Commit Graph

5430 Commits

Author SHA1 Message Date
Corinna Vinschen 6c22c79f73 * errno.cc (errmap): Map ERROR_SEEK and ERROR_SECTOR_NOT_FOUND. 2005-09-26 15:27:15 +00:00
Christopher Faylor a3d5219c5f * exceptions.cc (_cygtls::call_signal_handler): Minor cleanup. 2005-09-26 14:58:16 +00:00
Corinna Vinschen b470a0e81f * fhandler.h (class fhandler_dev_raw): Add drive information members
drive_size, current_position and bytes_per_sector.
	(fhandler_dev_floppy::get_drive_info): Declare.
	* fhandler_floppy.cc (fhandler_dev_floppy::is_eom): Define ERROR_SEEK
	and ERROR_SECTOR_NOT_FOUND as end-of-medium conditions.
	(fhandler_dev_floppy::get_drive_info): New method to have one function
	retrieving drive info.
	(fhandler_dev_floppy::open): Call get_drive_info to get drive
	information right from the start.
	(fhandler_dev_floppy::lseek): Use and set drive information members.
	Especially keep track of current_position.
	(fhandler_dev_floppy::ioctl): Ditto.
	* fhandler_raw.cc (fhandler_dev_raw::write_file): Keep track of
	current_position.
	(fhandler_dev_raw::read_file): Ditto.
	(fhandler_dev_raw::raw_read): Never try to read beyond end-of-medium.
	(fhandler_dev_raw::dup): Handle new drive information members.
2005-09-26 14:55:40 +00:00
Christopher Faylor d5f4ee62b7 * exceptions.cc (handle_exceptions): Just si_code to SI_KERNEL first and let it
be overridden.
* exceptions.cc (_cygtls::call_signal_handler): Call signal handler with extra
siginfo_t * and void * parameters when SA_SIGINFO flag is set.
* signal.cc (signal): Clear SA_SIGINFO flag.
(sigqueue): Fix incorrect setting of si_code.
* sigproc.cc (signal_fixup_after_exec): Clear SA_SIGINFO flag when setting
handler to SIG_DFL.
2005-09-26 14:51:48 +00:00
Christopher Faylor 683cc8189c * pinfo.cc (proc_waiter): Properly fill out si_code as according to SUSv3.
* exceptions.cc (handle_exceptions): Properly fill out si_code as according to
SUSv3.
2005-09-26 13:47:27 +00:00
Christopher Faylor f086715060 * exceptions.cc (handle_exceptions): Properly fill out si_code. 2005-09-26 13:23:47 +00:00
Christopher Faylor 529649f983 * sigproc.cc (wait_sig): Cosmetic change.
* pinfo.cc (pinfo::exit): Don't explicitly remove myself since some other
thread may still be using it.
2005-09-26 01:27:36 +00:00
Joshua Daniel Franklin 7b96339c80 2005-09-25 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* faq.xml: Remove copyright section, link to license.html
	* faq-sections.xml: Remove copyright section, link to license.html
	* faq-programming.xml: Remove confusing reference to Red Hat.
	* faq-what.xml: Reword "supported" FAQ.
2005-09-26 00:29:51 +00:00
Christopher Faylor 6f96c53642 * sigproc.cc (sigproc_terminate): More reversion of always-exit-from-sigthread
change.
2005-09-24 19:17:49 +00:00
Danny Smith e6e55ca6a2 * include/math.h (HUGE_VALF, HUGE_VALL, INFINITY, NAN)
Avoid raising FP exceptions.
2005-09-24 01:26:24 +00:00
Christopher Faylor 5cbcdfa9dd * shared.cc (open_shared): Add crucial bit of debugging info. 2005-09-23 23:56:17 +00:00
Christopher Faylor 5e477e9a9b Semi-reversion of always-exit-from-sigthread change of 2005-09-15.
* exceptions.cc (sigpacket::process): Eliminate return after call to reinstated
noreturn function.
(signal_exit): Allow function to exit when a captive process has been
terminated.
* pinfo.cc (pinfo::exit): Enter exit_lock here.  Once again exit here under
control of exit_lock.
* sigproc.cc (sig_send): Don't wait for completion if process is exiting.
Remove special __SIGEXIT accommodations.
(wait_sig): Just exit the thread when a __SIGEXIT has been detected.  Don't
exit the process.
2005-09-23 23:37:52 +00:00
Christopher Faylor 1b19d74296 * net.cc (cygwin_gethostbyname): Remove debugging cruft. 2005-09-23 23:25:25 +00:00
Chris Sutcliffe 2b4f76269d 2005-09-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* lib/ddk/newdev.def: Added.
        Thanks to: Stephan Meyer <ste_meyer at users dot sourceforge dot net>
2005-09-23 22:41:24 +00:00
Christopher Faylor 0017e72675 * pinfo.cc (pinfo::exit): Call ExitProcess if called from signal thread. 2005-09-23 20:05:50 +00:00
Chris Sutcliffe e68bd70ab4 2005-09-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/commdlg.h (OPENFILENAME): Added WINNT >= 0x0500
        component.
        Thanks to: Gennady Feldman <gena01 at users dot sourceforge dot net>
2005-09-23 19:59:33 +00:00
Christopher Faylor 0c75486267 * tlsoffsets.h: Regenerate. 2005-09-23 19:24:03 +00:00
Christopher Faylor 08c7ea264b * pinfo.cc (pinfo::exit): Eliminate use of _my_tls.thread_handle. 2005-09-23 19:23:26 +00:00
Christopher Faylor 255e7e559e * cygtls.h (struct _cygtls::thread_handle): Remove/revert.
* sigproc.h (struct sipacket::thread_handle): Put thread_handle here.
* sigproc.cc (sigproc_terminate): Move setting of thread_handle...
(sig_send): ...to here.  Put it in packet being sent.  Only close pack.wakeup
when we're waiting for completion.
(wait_sig): Use thread_handle directly from received packet.
2005-09-23 15:18:22 +00:00
Chris Sutcliffe e7a76793ad 2005-09-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* lib/shell32.def (SHILCreateFromPath): Add stub.
        Thanks to: Michael Jung <mjung at iss dot tu-darmstadt dot de>
2005-09-23 10:50:15 +00:00
Christopher Faylor 85b0face89 * tlsoffsets.h: Regenerate. 2005-09-23 03:40:57 +00:00
Christopher Faylor 936e4018b6 * cygheap.cc (cygheap_fixup_in_child): It's not just for exec.
* cygtls.h (struct _cygtls::thread_handle): New field.
* dcrt0.cc (exit_lock): Remove declaration.
* winsup.h (exit_lock): Add declaration.
* exceptions.cc (sigpacket::process): Properly return after signal_exit.
* pinfo.cc (pinfo::exit): Only exit the process if _my_tls.thread_handle has
not been filled out -- which should be an impossible event.
* sigproc.cc (sigproc_terminate): Fillout _my_tls.thread_handle to provide
something for wait_sig to wait for.  Use the siginfo_t version of sig_send and
fill out the tls argument with _my_tls.
(wait_sig): Wait for the thread specified in pack.tls or (for now) complain
bitterly if it doesn't exit.
2005-09-23 03:35:41 +00:00
Christopher Faylor 4340c43955 * pinfo.cc (set_myself): Call strace.hello unconditionally when DEBUGGING.
(pinfo::init): Sleep and issue debugging output before looping when a
PID_EXITED is found.
2005-09-22 21:10:07 +00:00
Corinna Vinschen b30dbbe2c3 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix copy/paste
bug.
2005-09-22 17:53:38 +00:00
Christopher Faylor 378017d7c2 * strace.cc (strace::vsprntf): Avoid accessing myself->pid if !myself. 2005-09-22 17:06:48 +00:00
Christopher Faylor 7e7a719a8e * include/sys/strace.h (_STRACE_ON): Remove semicolon from definition.
(_STRACE_OFF): Remove semicolon from definition.
2005-09-22 16:41:36 +00:00
Corinna Vinschen f3810c7281 * fhandler.h (fhandler_base::fstat_helper): Declare with additional
file attributes argument.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Use
	file attributes evaluated from NtQueryFileInformation or
	FileInformationByHandle in call to fstat_helper.
	Set pc.fileattr from just evaluated file attributes here.
	(fhandler_base::fstat_by_name): Use file attributes evaluated from
	FindFileFirst or default attribute in call to fstat_helper.
	Set pc.fileattr from just evaluated file attributes here.
	(fhandler_base::fstat_helper): Use file attributes given as argument,
	not file attributes stored in this fhandler, since this information
	is potentially wrong.  Add comment to explain this.
	* path.h (has_attribute): New global inline function.
	(path_conv::set_attributes): New method to change fileattr.
2005-09-22 15:52:02 +00:00
Corinna Vinschen f3a61fc4aa Fix typo. 2005-09-21 22:27:38 +00:00
Corinna Vinschen d829da1423 Align error message handling to mkpasswd's error messages throughout.
* mkgroup.c (print_win_error): Create macro calling ...
	(_print_win_error): ... this function created from former
	print_win_error.  Move up in source.
	(PDOMAIN_CONTROLLER_INFOW): Define return type of DcGetDcNameW.
	(dsgetdcname): New function pointer for DcGetDcNameW.
	(load_netapi): Get DcGetDcNameW address.
	(main): If DcGetDcNameW is available, use it.
	* mkpasswd.c (PDOMAIN_CONTROLLER_INFOW): Define return type of
	DcGetDcNameW.
	(dsgetdcname): New function pointer for DcGetDcNameW.
	(load_netapi): Get DcGetDcNameW address.
	(main): If DcGetDcNameW is available, use it.  Rename local variable
	domain_name_specified to domain_specified as in mkgroup.c.
2005-09-21 22:26:08 +00:00
Christopher Faylor faf4210542 * cygthread.cc (cygthread::operator new): Just use getenv() to look for
CYGWIN_FREERANGE_NOCHECK since the Windows environment may be truncated by
being previously execed.
2005-09-21 19:29:50 +00:00
Chris Sutcliffe 574c2ba2a3 2005-09-21 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/winbase.h (RegisterWaitForSingleObject,
	RegisterWaitForSingleObjectEx): Define.
	* lib/kernel32.def (RegisterWaitForSingleObjectEx@20): Define.
	(RegisterWaitForSingleObject@16): Changed to
	RegisterWaitForSingleObject@24.
	Thanks to: Brandon Sneed <nivenh at users dot sourceforge dot net>
2005-09-21 19:20:46 +00:00
Christopher Faylor e15e9fc9a7 * spawn.cc (av::fixup): Just blindly run any file if it has a .bat or .cmd
extension.
2005-09-20 18:32:23 +00:00
Christopher Faylor c529909f45 * dcrt0.cc (do_exit): Only call sigproc_terminate from one location --
pinfo::exit.
* pinfo.cc (pinfo::exit): Move sigproc_terminate later so that signals can be
processed while waiting for hExeced child.
(pinfo::maybe_set_exit_code_from_windows): Set exit code from sigExeced if it
is non-zero.  Set exit_state to ES_EXEC_EXIT prior to waiting for captive
process exit code.
* exceptions.cc (sigExeced): New global variable.
(signal_exit): Remove noreturn attribute from declaration.
(signal_exit): Just terminate captive process and return if hExeced on the
theory that the exit will be subsequently handled in the main thread.
* sigproc.cc (sigproc_terminate): Eliminate test for ES_SIGPROCTERMINATE and
use ES_FINAL instead.
(sig_send): Use no_signals_available instead of duplicate test.
* winsup.h (ES_EXEC_EXIT): New enum.
(ES_SIGPROCTERMINATE): Delete.
2005-09-20 02:06:57 +00:00
Christopher Faylor e60ec8bf96 white space changes to force new snapshot 2005-09-19 15:50:56 +00:00
Christopher Faylor 1bde6e09a6 * sigproc.cc (talktome): Take siginfo_t argument. Don't scan all pids trying
to find one that's talking to me.  Just use the pid from siginfo_t.
(wait_pid): Pass siginfo_t argument to talktome.
2005-09-19 14:15:06 +00:00
Danny Smith 64cf26a0e9 * include/winsock2.h (SO_EXCLUSIVEADDRUSE): Define.
Thanks to Gisle Vanem  <giva at bgnett dot no>
2005-09-19 10:32:51 +00:00
Danny Smith c1c5de21a9 * include/stdlib.h (strtof): Add prototype. Uglify
parameter names in inline definition.
	(wcstof): Likewise.
	(_Exit): Uglify	parameter names in inline definition.
	(llabs): Add prototype.
	(_set_error_mode): Add prototype and input defines.
2005-09-19 09:48:08 +00:00
Christopher Faylor 0d8efc429f * pipe.cc (fhandler_pipe::open): Use 'cfree' to free buffer since it is now
allocated by cmalloc.
2005-09-17 20:36:34 +00:00
Corinna Vinschen 5da8b1281b * net.cc (cygwin_inet_ntop): Change len argument to socklen_t to
follow SUSv3.
	* include/arpa/inet.h (inet_ntop): Ditto.
	* include/cygwin/in.h: Include cygwin/socket.h to get socklen_t.
2005-09-17 08:55:30 +00:00
Christopher Faylor b3ecdcf438 * environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return immediately
on error.
* spawn.cc (spawn_guts): Set return value to -1 on error from build_env.
2005-09-16 20:12:12 +00:00
Christopher Faylor e4d981b957 * environ.cc (build_env): Clear envblock and return NULL on attempt to use env
var > 32K.
* spawn.cc (spawn_guts): Set E2BIG if build_env detects an error.
2005-09-16 19:58:12 +00:00
Christopher Faylor 541ea31352 * environ.cc (environ_init): Protect with a 'myfault' in case
GetEnvironmentStrings misbehaves.
* environ.cc (environ_init): Add debugging output with value returned from
GetEnvironmentStrings.
2005-09-16 15:56:06 +00:00
Christopher Faylor 4dc2cfe588 * environ.cc (environ_init): Issue an error if GetEnvironmentStrings fails and
return.
2005-09-16 14:52:32 +00:00
Christopher Faylor 882dfbf776 * pinfo.h (EXITCODE_SET): Move out of range of Windows error.
(EXITCODE_NOSET): Ditto.
* sigproc.cc (no_signals_available): Remove check for hwait_sig.  Just rely on
my_sendsig.  Pass in an argument controlling when it is appropriate to test
EXITCODE_SET.
(proc_can_be_signalled): Remove checks for myself since this function is never
called in that context.
(sigproc_init): Pre-initialize my_sendsig to non-zero so that
proc_can_be_signalled will know that we expect to be signalable soon.
(sig_send): Change debugging output.
2005-09-16 03:16:17 +00:00
Christopher Faylor 150f3bd168 * sigproc.cc (no_signals_available): Return true if sending to self from the
signal thread.
(wait_sig): Correct so that WaitForSingleObject is called when hMainThread is
!= 0, rather than the reverse.
* cygheap.cc (cygheap_fixup_in_child): Clarify potential error message.
* fork.cc (fork_copy): Cosmetic change.
2005-09-16 01:47:09 +00:00
Christopher Faylor a3a9aac72d * sigproc.cc (wait_sig): Reorganize exit case so that ExitProcess is always
called, since that is the intent of sending a __SIGEXIT.  Wait forever for main
thread to go away since, presumably, the main thread told us it was going away.
2005-09-15 16:06:18 +00:00
Corinna Vinschen c4ec3e76b9 * cygwinenv.sgml (ntea): Add some wording to scare people away
from using this option.
2005-09-15 08:24:46 +00:00
Christopher Faylor fef80fce55 * spawn.cc (av::fixup): Avoid breaking out of the wrong "loop". 2005-09-15 00:31:42 +00:00
Christopher Faylor 59960f651d * hookapi.cc (hook_or_detect_cygwin): Simplify very slightly.
* spawn.cc (av::fixup): Guard against problems reading an executable which does
not match Microsoft's documentation about PE format.
2005-09-15 00:02:57 +00:00
Christopher Faylor ae37cc1218 * spawn.cc (av::error): Eliminate.
(av::av): Remove reference to error.
(av::replace0_maybe): Ditto.
(av::dup_maybe): Ditto.
(av::dup_all): Ditto.
(av::unshift): Ditto.
(spawn_guts): On a fault, return E2BIG only if ENOMEM has been set.  Otherwise
return EFAULT.
2005-09-14 23:03:44 +00:00
Christopher Faylor c9629cefe9 * cygtls.h (san): New structure.
(cygtls::andreas): New element.  Replaces _myfault and _myfault_errno.
(cygtls::fault_guarded): Use andreas.
(cygtls::return_from_fault): Ditto.
(cygtls::setup_fault): Add a parameter denoting where to store old fault
handler, if any and use it to "stack" faults.
(cygtls::reset_fault): Restore fault from parameter.
(myfault::sebastian): New variable.
(myfault::~myfault): Pass sebastian to reset_fault.
(myfault::myfault): Store old fault values in sebastian.
2005-09-14 21:26:15 +00:00
Christopher Faylor 1f48d233eb * heap.cc (heap_init): Revert 2005-09-11 patch as it seems to inexplicably
cause problems with emacs.
2005-09-14 18:30:21 +00:00
Christopher Faylor 3aca3cb636 Remove some more unneeded 'return;'s throughout. 2005-09-14 14:27:56 +00:00
Christopher Faylor 18ea7328a7 * sigproc.h: Protect declaration so that it only happens when
__INSIDE_CYGWIN__.
2005-09-14 14:08:00 +00:00
Christopher Faylor 62fe0eacda . 2005-09-14 14:02:17 +00:00
Christopher Faylor a611ae50d5 * exceptions.cc (sigtid): Remove declaration.
(handle_exceptions): Use _sig_tls rather than sigtid to determine if this is
the signal thread.
(set_signal_mask): Ditto for conditionalized CGF code.
* pinfo.cc (pinfo::exit): Exit the thread if we forcefully terminated the main
thread
* sigproc.cc (sigtid): Delete.
(_sig_tls): Define.
(sig_clear): Use _sig_tls rather than sigtid to determine if this is the signal
thread.
(sig_dispatch_pending): Ditto.
(wait_sig): Set _sig_tls here.
* dcrt0.cc (do_exit): Move sigproc_terminate call later since signal handling
was still needed for subsequent stuff.  Call sigproc_terminate with new
exit_state value.
* pinfo.cc (pinfo::exit): Call sigproc_terminate with new exit_state value.
* sigproc.cc (proc_terminate): Remove unnecessary (void) parameter.
(sigproc_terminate): Ditto.  Add new argument to accept exit state to be set.
(wait_sig): Reorganize __SIGEXIT handling.  Add more debugging output.
* winsup.h (sigproc_terminate): Declare with new exit_state argument.
(exit_states): Reorganize to reflect new exit ordering of sigproc_terminate.
2005-09-14 14:00:07 +00:00
Christopher Faylor 67483cb2cd * dcrt0.cc (do_exit): Rely on sigproc_terminate to set exit_state
appropriately.
* pinfo.cc (pinfo::exit): Always call sigproc_terminate here.  Rely on
sigproc_terminate to signal signal thread to handle eventual process exit.
* sigproc.cc (no_signals_available): Change criteria for determining if this
process can handle signals to itself.
(my_sendsig): New variable.  Copy of my sendsig handle.
(proc_can_be_signalled): Don't send signals if exit code is set.
(sigproc_terminate): Use and set exit_state appropriately to determine when to
do anything.  Send __SIGEXIT to self to control process exit.
(sig_send): Use my_sendsig for sending signals.  Don't call
proc_can_be_signalled for myself since the criteria is now different for
sending signals to myself.
(wait_sig): Copy myself->sendsig to my_sendsig for future use.  Exit signal
loop when __SIGEXIT is received.  Wait for main thread to exit and use its exit
status to actually exit process.
* sigproc.h (__SIGEXIT): New enum.
* dcrt0.cc (alloc_stack): Eliminate superfluous "return;".
* debug.cc (add_handle): Ditto.
* devices.in (device::parse): Ditto.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
(dtable::vfork_child_fixup): Ditto.
* environ.cc (parse_options): Ditto.
* errno.cc (seterrno_from_win_error): Ditto.
* exceptions.cc (sig_handle_tty_stop): Ditto.
(set_signal_mask): Ditto.
* fhandler.cc (fhandler_base::read): Ditto.
(fhandler_base::operator delete): Ditto.
(fhandler_base::seekdir): Ditto.
(fhandler_base::rewinddir): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::fixup_after_exec): Ditto.
* sigproc.cc (sigproc_init): Ditto.
(sigproc_terminate): Ditto.

* devices.cc: Regenerate.
2005-09-13 17:08:54 +00:00
Christopher Faylor 00fb79f70e * sigproc.cc (wait_sig): Be more defensive about detecting when we're exiting. 2005-09-13 15:05:53 +00:00
Christopher Faylor 4e993dc7cc * cygthread.cc (cygthread::cygthread): Add more info to fatal error.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Temporarily remove
insertion of /dev into root directory.
* path.cc (path_conv::check): Ditto.
2005-09-12 21:19:07 +00:00
Christopher Faylor 6772e4c9e9 * heap.cc (heap_init): Allocate heap from top down as a hedge against
subsequent ERROR_INVALID_ADDRESS in forked processes when CTRL-C is pressed.
2005-09-12 03:55:16 +00:00
Christopher Faylor 70b4d870b5 . 2005-09-10 05:51:26 +00:00
Christopher Faylor 6336eba8f4 * heap.cc (heap_init): Be slightly more aggressive when trying to allocate
heap.  Change fatal error to avoid confusion with cygheap.
* spawn.cc (linebuf::finish): New function.
(linebuf::add): Cosmetic change.
(spawn_guts): Only avoid building windows command line if the program being
executed was actually mounted with -X.  Don't return E2BIG if we hit the 32K
size and we're executing a detected cygwin program.  Just silently truncate the
windows command line, instead.
2005-09-10 01:37:20 +00:00
Christopher Faylor 270bbd4e24 * fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag here
rather than clearing CBAUD after the fact.
2005-09-09 03:00:34 +00:00
Christopher Faylor c0df672fa0 * fhandler_serial.cc (fhandler_serial::ioctl): Always return 0 for window size.
* termios.cc (tcgetattr): Clear out baud part of c_cflag since it is always
ignored.
2005-09-09 02:53:40 +00:00
Corinna Vinschen bd84404b0f * exceptions.cc (ctrl_c_handler): Disable any special CTRL_LOGOFF_EVENT
handling and add longish comment about the reasons.
2005-09-08 14:58:15 +00:00
Dimitri Papadopoulos f4613fcd1d * include/reason.h [_WIN32_WINNT >= 0x0501]
(SHTDN_REASON_*): New file.
	* include/objbase.h: Avoid double header guard.
2005-09-08 13:55:46 +00:00
Corinna Vinschen b17b7644d5 * regtool.cc: Extend copyright-years.
(print_version): Ditto.
	(cmd_list): Don't depend on terminating '\0' being present on
	string-values.
	(cmd_get): Don't attempt to read more than present, but keep
	extra space for terminating '\0'. Really output REG_BINARY.
	Don't leak memory.
	(cmd_set): Include trailing '\0' in string's length.
2005-09-08 09:24:41 +00:00
Christopher Faylor 70d0243ce9 * hookapi.cc (rvadelta): Change argument to DWORD to eliminate a compiler
warning.
* path.h (path_conv::set_cygexec): New function.
* spawn.cc (av::iscygwin): Eliminate.
(av::av): Don't initialize iscygwin.
(spawn_guts): Just use real_path.iscygexec for all tests.
(av::fixup): Short circuit test if .exe extension and known cygexec.  Set
cygexec flag appropriately if we find that program uses cygwin1.dll.
2005-09-08 00:57:12 +00:00
Christopher Faylor 31fcc87ed9 add missing ChangeLog entry. 2005-09-07 16:01:06 +00:00
Christopher Faylor 41ff9d8c7d * dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.
(dll_crt0_0): Move console initialization earlier.
* init.cc (dll_entry): Move console initialization here.
* exceptions.cc (init_console_handler): Fully remove any old console handler.
* spawn.cc (spawn_guts): Don't fill out windows argv if we've deduced that this
is a cygwin-using program.
(av::fixup): Always check executables to see if they are using cygwin1.dll.
Don't consider .com files to be scripts.
* hookapi.cc (rvadelta): New function.
(PEHeaderFromHModule): Simplify slightly.
(hook_or_detect_cygwin): Use passed in name argument for "HMODULE" rather than
incorrectly reading current program.  Calculate delta needed to read image data
and file names if this isn't a real "HMODULE".
2005-09-07 03:10:17 +00:00
Corinna Vinschen 75833f08cd * thread.h: Revert patch from 2005-09-05.
* thread.cc (pthread_mutex::can_be_unlocked): Return true also if
	mutex is owned by MUTEX_OWNER_ANONYMOUS.
2005-09-06 19:22:54 +00:00
Christopher Faylor a743e3b940 * cygheap.cc (cygheap_init): Eliminate debugging #if.
* fork.cc (fork_parent): Don't issue errors if "somebody" has set the
PID_EXITED flag on a child.  Don't close process handle if it has potentially
already been closed.
* pinfo.cc (winpids::add): Eliminate PID_ALLPIDS handling which was obsoleted
by previous changes.
* spawn.cc (av::fixup): Do win16 detection for .com files.  Make sure that
buffer has been unmapped in all cases.
2005-09-05 17:30:04 +00:00
Corinna Vinschen bf58ec35b4 * thread.h (pthread_mutex::get_pthread_self): Remove.
(pthread_mutex::lock): Use ::pthread_self as self parameter.
	(pthread_mutex::trylock): Ditto.
	(pthread_mutex::unlock): Ditto.
	(pthread_mutex::destroy): Ditto.
2005-09-05 15:17:03 +00:00
Christopher Faylor be7d909395 Grr. REVERT erroneous checkin. AGAIN. 2005-09-02 17:35:22 +00:00
Christopher Faylor 414808f9e0 * Makefile.in (CXXFLAGS): Use 'override' to correctly set flags to generate
dependencies when invoked from top-level make.
2005-09-02 17:12:37 +00:00
Christopher Faylor b8a66ba2cd revert inexplicable previous checkin 2005-09-02 04:51:09 +00:00
Christopher Faylor 7a1bf10a84 bad_addresses 2005-09-02 04:46:51 +00:00
Christopher Faylor 6a53b21360 * exceptions.cc (set_process_mask_delta): Conditionalize debugging output.
* sigproc.cc (proc_subproc): Make strace output a little more verbose.
2005-08-29 03:12:39 +00:00
Christopher Faylor 74f5d7104b typo 2005-08-28 23:52:01 +00:00
Christopher Faylor c461fbf160 * cygtls.h (__ljfault): Declare.
(_cygtls::return_from_fault): Use __ljfault.
* exceptions.cc (set_signal_mask): Revert previous checkin.
* gendef (__sjfault): Split out into a separate function which doesn't bother
with any special signal locking.  routines.
(_ljfault): Return from a __sjfault without bothering with signals.
2005-08-28 23:26:23 +00:00
Christopher Faylor 2241d3fb53 Add missing ChangeLog for previous checkin.
Revert erroneous include/cygwin/version.h checkin.
2005-08-28 17:34:25 +00:00
Christopher Faylor 453185b136 * cygwin.din: Correct readdir_r typo. 2005-08-28 17:30:34 +00:00
Christopher Faylor a232350855 Fix typo. 2005-08-28 16:51:55 +00:00
Christopher Faylor b2068b401b Fix improper formatting. 2005-08-28 16:51:13 +00:00
Christopher Faylor 988e9165e9 *dir.cc (readdir_r): Invert sense on error-test. 2005-08-28 16:30:48 +00:00
Joshua Daniel Franklin 970fabec27 2005-08-26 Brian Dessent <brian@dessent.net>
* faq-using.xml: Add 'net use' hint to network shares FAQ.
2005-08-27 04:53:15 +00:00
Joshua Daniel Franklin 7a582da599 2005-08-26 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* Makefile.in: Remove extra anchor to make NN4 happy.
	* faq.xml: Link to cygwin.com/license.html
	* faq-resources.xml: Link instead of duplicating info.
	* faq-using.xml: Split out services and network shares FAQ.
	* faq-what.xml: Link to cygwin.com/license.html
2005-08-27 01:32:36 +00:00
Corinna Vinschen 63958f00d3 * path.cc (normalize_posix_path): Keep two leading slashes
intact throughout.
	(normalize_win32_path): Revert to only checking for slash.
	(realpath): Convert drive letters to cygdrive paths before
	doing anything else.
	* shared_info.h (mount_info::cygdrive_posix_path): Make public.
2005-08-26 15:11:06 +00:00
Corinna Vinschen 3716969169 * path.cc (realpath): Drop call to mount_info::conv_to_posix_path
in favor of calling path_conv with PC_POSIX flag.  Align error
	handling closer to POSIX.  As on Linux, return user space allocated
	memory if second parameter is NULL.
2005-08-25 21:18:26 +00:00
Corinna Vinschen 9d13e04523 * path.cc (normalize_win32_path): Honor network paths. Fold more
than two leading dir separators into one.  Check for dir separator
	instead of just slashes to handle incoming Win32 paths correctly.
2005-08-25 20:35:25 +00:00
Christopher Faylor b4b0980b9d * errno.cc (errmap): Translate ERROR_NO_MORE_ITEMS to ENMFILE. 2005-08-25 15:27:10 +00:00
Danny Smith 9e28e551f2 * mingwex/fe*.c: Revert previous changes.
* include/fenv.h: Revert previous changes.

	Add Changelog entry for the reverted change.
2005-08-25 08:39:54 +00:00
Christopher Faylor b9ebff640a * exceptions.cc (handle_sigsuspend): Just sleep forever if called from non-main
thread.
(sigpacket:process): Simplify logic which determines when and how a signal is
masked.  Don't trigger sigwait if there is a signal handler.
* sigproc.cc (wait_sig): Update comment.  Try to process a signal which is in
the queue if it isn't queued for the target thread (this is still not right).
2005-08-25 03:12:48 +00:00
Danny Smith 5092e4a714 * mingwex/feclearexcept.c (feclearexcept): Change declaration.
Do not return a value.
	* mingwex/fegetexceptflag.c (fegetexceptflag): Likewise.
	* mingwex/feraiseexcept.c (feraiseexcept): Likewise.
	* mingwex/fesetexceptflag.c (fesetexceptflag): Likewise.
	* mingwex/fegetenv.c (fegetenv): Likewise.
	* mingwex/fesetenv.c (fesetenv): Likewise.
	* mingwex/feupdateenv.c (feupdateenv): Likewise.
	* include/fenv.h (feclearexcept, fegetexceptflag, feraiseexcept,
	fesetexceptflag, fegetenv, fesetenv, feupdateenv): Correct
	prototypes.
2005-08-25 02:35:34 +00:00
Danny Smith 03ee0ba163 * mingwex/stdio/fseeko64.c (fseeko64): Flush stream before
getting filelength for SEEK_END.
2005-08-25 02:04:59 +00:00
Christopher Faylor 04dfd98dc6 * spawn.cc (perhaps_suffix): Record errno-type error value in third argument.
(find_exec): On error, set errno returned from perhaps_suffix.
(spawn_guts): Ditto.
2005-08-24 18:26:14 +00:00
Christopher Faylor b56c466b2c * fhandler_virtual.cc (fhandler_virtual::close): Don't free filebuf if it's
NULL.
* pinfo.cc (_pinfo::commune_send): Fix test for incorrect number of bytes read
from pipe.
2005-08-24 17:45:11 +00:00
Corinna Vinschen 986c841b21 * syscalls.cc (endusershell): Reset shell_fp to NULL to allow
subsequent getusershell calls.
2005-08-24 15:50:11 +00:00
Christopher Faylor 7871cd8c5d * path.cc (path_conv::check): Fill in fileattr for /dev, defaulting to
directory if /dev doesn't actually exist.
(win32_device_name): Don't consider FH_DEV to be a device since it's really a
directory which should go through mount processing.
2005-08-24 14:17:56 +00:00
Christopher Faylor 14c4d65ef1 * cygheap.h (cygheap_types): Add HEAP_COMMUNE.
* fhandler_proc.cc: Use cygheap rather than user heap for allocation of filebuf
throughout.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* fhandler_process.cc: Ditto.
(get_mem_values): Use malloc/realloc/free rather than new.
* pinfo.cc (_pinfo::commune_send): Allocate on cygwin heap rather than user
heap.  Avoid calling ReadFile when correct number of characters have been read
or suffer buffer corruption.
(_pinfo::fd): Allocate on cygwin heap rather than user heap.
(_pinfo::fds): Ditto.
(_pinfo::root): Ditto.
(_pinfo::cwd): Ditto.
(_pinfo::cmdline): Ditto.
* devices.h (FH_DEV): New define.
* devices.in: Detect lone /dev.
* devices.cc: Regenerate.
* path.cc (path_conv::check): Treat FH_DEV as a special case.
2005-08-24 04:38:39 +00:00
Christopher Faylor db7f135b03 * sigproc.h (set_signal_mask): Remove default on second parameter and make pass
by reference.
* signal.cc (abort): Accommodate change to set_signal_mask.
* select.cc (pselect): Ditto.
* exceptions.cc (handle_sigsuspend): Ditto.
(ctrl_c_handler): Ditto.
(sighold): Ditto.
(sigrelse): Ditto.
(set_process_mask_delta): Ditto.
(_cygtls::call_signal_handler): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE if
__handle is not set.  Set __handle to NULL when out of files.
(fhandler_disk_file::rewinddir): Don't close handle if it's NULL.
(fhandler_disk_file::closedir): Ditto.
2005-08-23 22:22:52 +00:00
Christopher Faylor 5f5c6f7fa9 * dir.cc (readdir_worker): Make static. Only add '.' and '..' when readdir
fails due to ENMFILE.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Only close handle on
error != ENMFILE.
2005-08-23 03:58:09 +00:00
Corinna Vinschen b575e059ac * mtinfo.h (mtinfo_drive::error): Fix argument bug in debug_printf call. 2005-08-22 16:12:01 +00:00
Christopher Faylor acc12b15a1 add missing entry 2005-08-20 06:21:20 +00:00
Christopher Faylor d9a2276435 * cygerrno.h (geterrno_from_win_error): Change declaration to default to using
GetLastError and EACCESS.
* cygwin.din: Export readdir_r.
* include/cygwin/version.h: Bump API version number to 138.
* syscalls.cc (readdir_worker): New function, renamed from old readdir()
function.
(readdir): Use readdir_worker.
(readdir_r): New function.
* fhandler.h (fhandler_base::readdir): Accommodate second argument indicating
dirent buffer.
(fhandler_disk_file::readdir): Ditto.
(fhandler_cygdrive::readdir): Ditto.
(fhandler_proc::readdir): Ditto.
(fhandler_netdrive::readdir): Ditto.
(fhandler_registry::readdir): Ditto.
(fhandler_process::readdir): Ditto.
* fhandler.cc (fhandler_base::readdir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Ditto.
* fhandler_cygdrive.cc (fhandler_cygdrive::readdir): Ditto.
* fhandler_proc.cc (fhandler_proc::readdir): Ditto.
* fhandler_netdrive.cc (fhandler_netdrive::readdir): Ditto.
* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
2005-08-20 06:19:55 +00:00
Christopher Faylor 683ef95392 * fhandler.h (dirent_states): Add dirent_saw_proc.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Fill in "proc" if it is
the root dir and it is missing.
2005-08-19 16:29:43 +00:00
Christopher Faylor 358063ace3 * fhandler.h (dirent_states): Add dirent_isroot, dirent_saw_cygdrive,
dirent_saw_dev.
* dir.cc (opendir): Don't zero __flags here.  Push that responsibility to
opendir methods.
(seekdir): Preserve dirent_isrrot in __flags.
(rewinddir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set dirent_isroot
appropriately.
(fhandler_disk_file::readdir): Fill in "cygdrive" and "dev" if it is the root
dir and they are missing.
* fhandler_process.cc (fhandler_process::opendir): Set __flags here.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set __flags here.
2005-08-19 16:18:42 +00:00
Christopher Faylor babc4e5424 * winsup.h (create_pipe): Declare new function.
(CreatePipe): New define.
* miscfuncs.cc (create_pipe): Define new function.
2005-08-19 14:56:48 +00:00
Corinna Vinschen 4fa0a39865 * passwd.c (longopts): Add --logonserver option.
(opts): Add -d option.
	(GetPW): Add server parameter which is given to Net functions.
	(ChangePW): Ditto.
	(PrintPW): Ditto.
	(SetModals): Ditto.
	(usage): Add description for -d/--logonserver option.
	(main): Add option handling for -d/--logonserver.  Use LOGONSERVER
	environment variable content for server to contact, unless
	-d/--logonserver option is given.  If both is missing, use NULL.
2005-08-18 20:25:43 +00:00
Christopher Faylor 4f3e6ff17b * fhandler.h (fhandler_tty_common::lseek): Declare new method.
(fhandler_tty_slave::lseek): Delete old method.
(fhandler_tty_master::lseek): Delete old method.
* fhandler_tty.cc (fhandler_tty_common::lseek): Define new method.
2005-08-18 20:17:10 +00:00
Corinna Vinschen abebe87c40 * fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize
ret to 0.
	(fhandler_socket::recvmsg): Ditto.
2005-08-18 13:14:15 +00:00
Corinna Vinschen d71805725f * errno.cc (strerror): Check errnum for underflow. 2005-08-18 08:35:19 +00:00
Christopher Faylor abed5965ca * textbinary.sgml: Correct incorrect information about ability to specify text
mode in fopen().
2005-08-17 18:23:39 +00:00
Christopher Faylor 0d339267ec * dcrt0.cc (dll_crt0_1): Tweak debugging stuff.
* fhandler_tty.cc (fhandler_tty_common::close): Rearrange the code so that the
master end of the input and output pipes is closed before signalling an EOF
event to the slave.
(fhandler_pty_master::close): Likewise.
2005-08-17 16:10:48 +00:00
Danny Smith ae6c01c069 2005-08-17 Michael Jung <mjung@iss.tu-darmstadt.de>
* lib/shell32.c (CLSID_RecycleBin, CLSID_ControlPanel,
	CLSID_MyComputer,CLSID_Internet, CLSID_NetworkPlaces,
	CLSID_MyDocuments, CLSID_FolderShortcut): Add GUIDs.
2005-08-17 10:57:17 +00:00
Danny Smith 38c9e858ac 2005-08-17 Martin Fuchs <martin-fuchs@gmx.net>
* include/shlobj.h (IContextMenu3): Define.
	* include/shlguid.h (IID_IContextMenu3): Declare.
	* lib/shell32.c (IID_IContextMenu3): Define.

2005-08-17  Martin Fuchs <martin-fuchs@gmx.net>

	* include/shlobj.h (SHFormatDrive): Declaration of function
	and associated constants.
2005-08-17 08:29:08 +00:00
Brian Dessent 9a99dcd39c * cygcheck.cc (dump_sysinfo_services): Properly null-terminate 'buf'.
Avoid extraneous cygrunsrv invocation if 'verbose' is true.
2005-08-17 00:52:43 +00:00
Corinna Vinschen 447419497d * init.cc (respawn_wow64_process): Make inline function. Remove
"noreturn" attribute.  Add additional check if parent process is
	actually a 64 bit process.
	(dll_entry): Only test WOW64 processes with a stack in the usual
	"dangerous" process space area.
2005-08-14 19:48:07 +00:00
Chris Sutcliffe 50f196b57f * Include/_mingw.h: Increment version to 3.8.
* Makefile.in: Ditto.
2005-08-13 12:52:43 +00:00
Danny Smith 1a2fe82e40 * include/ddk/hidsdi.h: New file.
* lib/ddk/hid.def: Uncomment symbols and add stdcall suffix for
	functions declared in hidsdi.h.
	Thanks to:  Alex J Lennon  <ajlennon at organixconsulting dot com>
2005-08-12 09:16:18 +00:00
Danny Smith b50ce80887 * lib/imm32.def (ImmDisableIME): Add stub.
Thanks to: "kidmin"  <kidmin at users dot sourceforge dot net>
2005-08-12 09:11:40 +00:00
Christopher Faylor 1cd065837c white space 2005-08-12 02:39:13 +00:00
Christopher Faylor b4ec184199 fix typo 2005-08-11 17:18:18 +00:00
Christopher Faylor 205a575188 * fhandler_serial.cc (fhandler_serial::tcgetattr): Return current baud rate
regardless of current DTR state.
2005-08-11 17:03:18 +00:00
Christopher Faylor b21413b304 * dcrt0.cc: Remove ld_preload declaration.
* winsup.h: Move ld_preload declaration here.
* fork.cc (fork_child): Call ld_preload() before returning.
2005-08-11 16:30:48 +00:00
Christopher Faylor ff7bdd11f5 * child_info. (CURR_CHILD_INFO_MAGIC): Refresh.
(child_info::child_info()): New constructor.
(child_info_spawn::child_info_spawn()): Ditto.
(child_info_spawn::operator new): New operator.
(child_info_spawn::set): New function.
* spawn.cc (av()): New constructor.
(av::operator new): New operator.
(av::set): New function.
(spawn_guts): Reorganize so that classes which allocates are defined early in
the function so that it can be properly cleaned up after an efault.  Set errno
to E2BIG in the event of a SEGV situation.
2005-08-11 16:13:30 +00:00
Dimitri Papadopoulos abec0aaae9 Attempting to add include/objsafe.h again... 2005-08-11 09:04:13 +00:00
Chris Sutcliffe 8cb66eee67 * include/w32api.h: Increment version to 3.3.
* Makefile.in: Ditto.
2005-08-11 02:13:36 +00:00
Danny Smith d154b707d0 * include/wctype.h (towupper, towlower): Change arg and return value
types to wint_t.
	* include/ctype.h (towupper, towlower): Likewise.
2005-08-10 10:10:32 +00:00
Danny Smith 5ce4d1685b * mthr_stub.c (__mingwthr_key_dtor): Replace assert(0) with
a diagnostic, guarded by #ifdef DEBUG.
	(__mingwthr_remove_key_dtor): Likewise.
2005-08-10 10:05:02 +00:00
Christopher Faylor c9508cb4ec * cygserver.cc (main): Call wincap.init() earlier to avoid a NULL dereference. 2005-08-08 19:46:48 +00:00
Christopher Faylor d4c8f095ba * include/sys/cdefs.h: Remove extra line. 2005-08-08 18:54:28 +00:00
Corinna Vinschen 2ab8ea6738 * security.cc (get_reg_security): New static function.
(get_nt_object_security): Call get_reg_security for registry keys
	to circumvent problems with predefined registry keys.
2005-08-08 16:30:15 +00:00
Corinna Vinschen af925fe4fa * fhandler_process.cc (fhandler_process::open): Allow opening of
/proc/<pid>/fd for reading.
	* fhandler_registry.cc (fhandler_registry::open): Ditto for registry
	keys.
2005-08-08 15:33:32 +00:00
Christopher Faylor 6e8cac2638 * include/sys/cdefs.h (__CONCAT): Define.
* include/elf.h: New file.
* include/sys/elf32.h: Ditto.
* include/sys/elf64.h: Ditto.
* include/sys/elf_common.h: Ditto.
* include/sys/elf_generic.h: Ditto.
2005-08-08 15:00:39 +00:00
Christopher Faylor 2e82c9355f * cygwin.sc: Use simpler method to align .cygheap.
* dllfixdbg: Just copy .stab and .stabstr sections when making cygwin1.dbg,
rather than relying on objcopy to keep only the debug sections since objcopy
seems to get it wrong.
* dtable.cc (build_fh_pc): Check setting fh to fhandler_nodevice for NULL, too.
2005-08-08 13:53:05 +00:00
Corinna Vinschen a8b939adc7 * ftw.c: Include winsup.h.
* nftw.c: Ditto.
	* include/ftw.h: Guard declarations appropriately.
2005-08-08 13:39:56 +00:00
Danny Smith 5b3ab258e5 * moldname.def.in (sleep, beep, seterrormode): Remove. 2005-08-08 10:22:20 +00:00
Corinna Vinschen e6ae6cd338 * Makefile.in (DLL_OFILES): Add fts.o, ftw.o, nftw.o.
* cygwin.din: Export fts_children, fts_close, fts_get_clientptr,
	fts_get_stream, fts_open, fts_read, fts_set, fts_set_clientptr,
	ftw, nftw.
	* fts.c: New file, imported from FreeBSD.
	* ftw.c: Ditto.
	* nftw.c: Ditto.
	* include/fts.h: Ditto.
	* include/ftw.h: Ditto.
	* include/cygwin/version.h: Bump API minor number.
2005-08-08 09:45:42 +00:00
Christopher Faylor 6a7bea70f0 * Makefile.in (dtable_CFLAGS): Use -fomit-frame-pointer and -fcheck-new.
* cygheap.cc (cmalloc): Only emit system_printf warnings on failure if
DEBUGGING.
(crealloc): Ditto.
(ccalloc): Ditto.
* dtable.cc (build_fh_name): Treat NULL return from cnew as indicative of
EMFILE condition.
(build_fh_dev): Ditto.
(dtable::dup_worker): Handle NULL return from build_fh_pc.
(dtable::vfork_child_dup): Trust dup_worker to set errno.
* fhandler.h (fhandler_base::new): Mark as nothrow.
2005-08-08 04:06:07 +00:00
Christopher Faylor cbda22eb63 * dllfixdbg: New perl script.
* configure.in: Detect objcopy, objdump, strip.
* configure: Regenerate.
* Makefile.in: Pass target objcopy/objdump to new dllfixdbg script.  Remove
previous perl check.
* cygwin.sc: Add .gnu_debuglink_overlay section for eventual replacement with
.gnu_debuglink section.  Revert move of cygheap to end of image.
2005-08-08 02:27:43 +00:00
Corinna Vinschen 1e0cb9ee0a * Makefile.in: Allow previous patch to work in a 64 bit environment. 2005-08-07 09:21:09 +00:00
Christopher Faylor 45a2f09e55 revert erroneous checkin 2005-08-07 02:38:46 +00:00
Christopher Faylor 82eaabf521 * Makefile.in: Warn when end of cygheap is not on 64k boundary.
* cygwin.sc: Try harder to ensure that cygheap is on a 64k boundary.  Move
cygheap to end of image to stop interference from unstripped debug regions.
2005-08-07 02:38:13 +00:00
Christopher Faylor 244f5a27a6 * include/endian.h: Move everything into this file and define things more like
linux.
* include/cygwin/types.h: Include endian.h.
* include/sys/dirent.h: Define DT_* types and conversion macros.
* pinfo.cc (pinfo::init): Remove special handling for PID_ALLPIDS and execed
code, even though it probably still isn't quite right.
2005-08-06 23:00:06 +00:00
Joshua Daniel Franklin 2041777dee Update to switch FAQ from texinfo to DocBook. 2005-08-06 05:14:41 +00:00
Corinna Vinschen 7d7e7a21b1 * thread.cc (pthread::create(3 args)): Make bool.
(pthread_null::create): Ditto.
	(pthread::create(4 args)): Check return of inner create rather than
	calling is_good_object().
	* thread.h: Ditto.
2005-08-05 16:14:41 +00:00
Corinna Vinschen c8f07ce787 * fhandler_tty.cc (fhandler_tty_slave::tcflush): Return either 0 or -1. 2005-08-05 16:11:21 +00:00
Corinna Vinschen 8cba692063 * thread.cc (pthread_cond_timedwait): Check abstime for validity
according to SUSv3.  Rewrite timeout check and waitlength calculation
	to avoid overflow problems.
2005-08-05 11:31:33 +00:00
Corinna Vinschen bb002a4968 * mount.cc (longopts): Fix typo which disallows --options option. 2005-08-03 09:23:39 +00:00