Commit Graph

2550 Commits

Author SHA1 Message Date
Christopher Faylor 0e061ecf96 * fork.cc (fork_child): Invert sense of test which defeated correct handling in
a fork from a non-main thread.
* dcrt0.cc (initial_env): Eliminate parameter and just send DebugBreak when
appropriate.
(dll_crt0_0): Reflect parameter change to initial_env.
(dll_crt0_1): Don't call initial_env.
2004-02-18 22:32:15 +00:00
Christopher Faylor 2d6c4a1a65 * gendef (stabilize_sig_stack): New function.
(setjmp): Import, add sig stack handling.  Store sig stack info.
(longjmp): Call stabilize_sig_stack.  Restore sig stack info.
* config/i386/setjmp.c: Remove.
2004-02-18 20:48:38 +00:00
Corinna Vinschen a682de34be * fork.cc (fork_child): Move fixup_shms_after_fork so that
signal_arrived is initialized when calling it.
2004-02-17 21:17:25 +00:00
Christopher Faylor 720c33ae4c * Makefile.in (clean): Clean libserver, too.
* fhandler.cc (fhandler_base::~fhandler_base): Remove path_conv cleanup.
* syscalls.cc (chroot): Ditto.
* path.cc (path_conv::~path_conv): Define new destructor.
(conv_path_list_buf_size): Remove explicit path_conv cleanup.
* path.h (path_conv::~path_conv): Declare new destructor.
2004-02-17 20:03:01 +00:00
Christopher Faylor 88e584bf43 * Makefile.in: Compile flock.o with -fomit-frame-pointer. 2004-02-17 15:23:29 +00:00
Christopher Faylor f6cd9c3555 * Makefile.in: Compile dlfcn.o with -fomit-frame-pointer. 2004-02-16 21:25:10 +00:00
Christopher Faylor 2c29523ece * Makefile.in: Compile delqueue.o with -fomit-frame-pointer. 2004-02-16 20:30:46 +00:00
Corinna Vinschen 212592dcc9 * syscalls.cc (rename): Do not test the MoveFile error code
where MoveFileEx exists.
2004-02-16 11:45:04 +00:00
Christopher Faylor 04dbc76ea5 correct changelog 2004-02-16 02:34:36 +00:00
Christopher Faylor b4f0009fe3 * cygheap.cc (_csbrk): Report failing condition to stderr rather than strace. 2004-02-16 02:03:54 +00:00
Christopher Faylor 955bf2ee96 * Makefile.in: Compile syscalls.o with -fomit-frame-pointer.
* sigproc.cc: Eliminate unused variable.
2004-02-15 02:44:16 +00:00
Corinna Vinschen 968bdf96b1 * getopt.c: Replace with latest NetBSD version 1.16. Keep Cygwin
specific changes as minimal as possible.
2004-02-14 19:43:52 +00:00
Christopher Faylor cf2b4018b0 * sigproc.cc (proc_subproc): Change warning back to silent debug output. 2004-02-14 04:58:31 +00:00
Christopher Faylor c21e74cce8 * dcrt0.cc (alloc_stack_hard_way): Revert to previous implementation.
(alloc_stack): Ditto.
* exceptions.cc (ctrl_c_handler): Add debugging output.
2004-02-14 04:38:37 +00:00
Christopher Faylor edc4f86ad2 * Makefile.in (clean): Remove sigfe.s.
(sigfe.s): Ensure that sigfe.s will be regenerated if it does not exist.
* dll_init.cc (dll_dllcrt0): Simplify initializing tests.
* exceptions.cc (setup_handler): Detect when stub caller is either spinning or
has acquired the lock after being suspended to avoid windows problems with
suspending a win32 API call.
* cygtls.h (_cygtls::spinning): Declare new element.
* gendef: Remove unused _siglist_index and _siglist declaration.
(_sigfe): Set spinning element when potentially looping, waiting for lock.
(_sigbe): Ditto.
(_cygtls::lock): Ditto.
(_longjmp): Ditto.
* tlsoffsets.h: Regenerate.
* pinfo.cc (_pinfo::exit): Set final exit state here.  Call sigproc_terminate
if invoked with 'norecord'.  Clear any residual _cygtls stuff.
* winsup.h (exit_states): Define ES_FINAL.
* spawn.cc (spawn_guts): Don't call proc_terminate specifically when execing.
Let _pinfo::exit handle that case.
* sigproc.cc (wait_subproc): Always exit loop early when proc_loop_wait.
* init.cc (munge_threadfunc): Eliminate unused argument.
(dll_entry): Reflect above change in call to munge_threadfunc.
2004-02-13 19:34:32 +00:00
Christopher Faylor b3535c2730 * gendef (_sigbe): Zero location on pop.
(_cygtls::pop): Ditto.
2004-02-12 04:55:29 +00:00
Christopher Faylor b91faaabea * dcrt0.cc (alloc_stack_hard_way): Eliminate second argument.
(alloc_stack): Remove use of 'b' throughout.
2004-02-12 03:07:35 +00:00
Christopher Faylor e431827c7c Rename _threadinfo to _cygtls, throughout.
* cygtls.h (_cygtls::call_signal_handler): Rename from call_signal_handler_now.
(_cygtls::push): Make second argument mandatory.
(_cygtls::fixup_after_fork): Declare new function.
(_cygtls::lock): Ditto.
* cygtls.cc (_cygtls::fixup_after_fork): Define new function.
* dcrt0.cc (cygwin_finished_initializing): Define as bool.
(alloc_stack): Use _tlstop rather than arbitrary variable in probably vain
attempt to avoid strange fork problem on CTRL-C.
(dll_crt0_0): Remove obsolete winpids::init call.
* dll_init.cc (dll_dllcrt0): Detect forkee condition as equivalent to
initializing.
* winsup.h (cygwin_finished_initializing): Declare as bool.
* exceptions.cc (handle_exceptions): Rely on cygwin_finished_initializing to
determine how to handle exception during process startup.
(_cygtls::call_signal_handler): Rename from call_signal_handler_now.
(_cygtls::interrupt_now): Fill in second argument to push.
(signal_fixup_after_fork): Eliminate.
(setup_handler): Initialize locked to avoid potential inappropriate unlock.
Resume thread if it has acquired the stack lock.
(ctrl_c_handler): Just exit if ctrl-c is hit before cygiwn has finished
initializing.
* fork.cc (sync_with_child): Don't call abort since it can cause exit
deadlocks.
(sync_with_child): Change debugging output slightly.
(fork_child): Set cygwin_finished_initializing here.  Call _cygtls fork fixup
and explicitly call sigproc_init.
(fork_parent): Release malloc lock on fork failure.
(vfork): Call signal handler via _my_tls.
* sigproc.cc (sig_send): Ditto.
* syscalls.cc (readv): Ditto.
* termios.cc (tcsetattr): Ditto.
* wait.cc (wait4): Ditto.
* signal.cc (nanosleep): Ditto.
(abort): Ditto.
(kill_pgrp): Avoid killing self if exiting.
* sync.cc (muto::acquire): Remove (temporarily?) ill-advised exiting_thread
check.
* gendef (_sigfe): Be more agressive in protecting stack pointer from other
access by signal thread.
(_cygtls::locked): Define new function.
(_sigbe): Ditto.
(_cygtls::pop): Protect edx.
(_cygtls::lock): Use guaranteed method to set eax to 1.
(longjmp): Aggressively protect signal stack.
* miscfuncs.cc (low_priority_sleep): Reduce "sleep time" for secs == 0.
* pinfo.cc (winpids::set): Counterintuitively use malloc's lock to protect
simultaneous access to the pids list since there are pathological conditions
which can cause malloc to call winpid.
(winpids::init): Eliminate.
* pinfo.h (winpids::cs): Eliminate declaration.
* pinfo.h (winpids::init): Eliminate definition.
2004-02-12 03:01:58 +00:00
Corinna Vinschen 897c785600 * security.cc (get_nt_object_attribute): Fix error handling. 2004-02-11 17:54:34 +00:00
Corinna Vinschen 9ec70d2019 * fhandler_socket.cc (fhandler_socket::ioctl): Add FIONREAD handling. 2004-02-09 11:30:57 +00:00
Christopher Faylor cec4879206 * debug.h (console_printf): Define for non-debugging condition.
* cygtls.h (_threadinfo::lock): Remove wait argument.
(_threadinfo::interrupt_setup): Remove retaddr argument.
* exceptions.cc (_threadinfo::interrupt_setup): Ditto.
(_threadinfo::interrupt_now): Accommodate change to interrupt_setup argument.
(setup_handler): Ditto.  Always lock sig stack prior to determining interrupt
method.
* gendef (_sigfe): Correct thinko regarding cmpxchg.
(_sigbe): Ditto.
(_threadinfo::lock): Ditto.
(_threadinfo::pop): Eliminate left-over stack unlock.
* sigproc.cc (proc_subproc): Chnage debugging output to printed warning.
2004-02-09 04:04:24 +00:00
Christopher Faylor 6946073e78 * localtime.cc (localtime_r): Call tzset.
* Makefile.in: Make version.h/cygwin.din version check a warning since it is
not foolproof.
* cygheap.h (CYGHEAPSIZE): Bump size down.
* cygtls.h (_threadinfo::stacklock): New element.
(_threadinfo::pop): Make regparm.
(_threadinfo::lock): New function.
(_threadinfo::unlock): New function.
* cygtls.cc (_threadinfo::push): Wait for a lock on the stack before performing
the operation.
(_threadinfo::pop): Move to another file.
* cygwin.din: More SIGFE changes.
* exceptions.cc (try_to_debug): Always display messages on console.
(handle_exceptions): Unwind stack only when actually about to call sig_send.
(setup_handler): Lock stack prior to performing any operations.
* gendef (_sigfe): Ditto.
(_sigbe): Ditto.
(_threadinfo::pop): Ditto.  Move here.
* gen_tlsoffsets: Generate positive offsets.
* tlsoffsets.h: Regenerate.
2004-02-08 19:59:27 +00:00
Corinna Vinschen 2a566ac3ef * cygserver.h (CYGWIN_SERVER_VERSION_API): Bump.
* cygserver_ipc.h (struct proc): Add signal_arrived member.
        (ipc_set_proc_info): Inititalize blk.signal_arrived.
2004-02-06 16:18:59 +00:00
Corinna Vinschen 043878df18 * uinfo.cc (cygheap_user::init): Use sec_user_nih to build a
security descriptor. Set both the process and the default DACLs.
	* fork.cc (fork_parent): Use sec_none_nih security attributes.
	* spawn.cc (spawn_guts): Ditto.
2004-02-06 10:37:37 +00:00
Christopher Faylor 656a999a33 * cygwin.din: Make many more functions SIGFE.
* include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
2004-02-05 19:57:03 +00:00
Corinna Vinschen d82c6f474d * security.h (SID): New macro.
(well_known_*_sid): Change type to cygpsid.
	(cygsid::init): Delete declaration.
	* sec_helper.cc (well_known_*_sid): Define using above SID macro.
	(cygsid::init): Delete.
	* dcrt0.cc (dll_crt0_0): Do not call cygsid::init.
	* security.cc (get_user_local_groups): Change the second argument type
	to cygpsid.
2004-02-05 17:23:19 +00:00
Christopher Faylor 120023b090 update copyright 2004-02-04 22:40:50 +00:00
Christopher Faylor 9e8c2fadf7 * tlsoffsets.h: Regenerate. 2004-02-03 22:05:02 +00:00
Christopher Faylor 06615351b1 * cygtls.h (_local_storage::signamebuf): Increase size to prevent overflow on
really odd values.
2004-02-03 22:04:27 +00:00
Christopher Faylor c571716c64 * Makefile.in (DLL_OFILES): Add strsig.o.
* cygtls.h (_local_storage::signamebuf) New element.
* sysconf.cc (sysconf): Implement _SC_RTSIG_MAX.
* tlsoffset.h: Regenerate.
* include/limits.h (_POSIX_RTSIG_MAX): New define.
(RTSIG_MAX): Ditto.
* include/cygwin/signal.h (SIGRTMIN): New define.
(SIGRTMAX): Ditto.
(NSIG): Bump.
* strsig.cc: New file.
2004-02-03 21:59:27 +00:00
Christopher Faylor 50be1d78d9 * window.cc (Winmain): Show windows error code in error output when
RegisterClass fails.
2004-02-03 19:41:28 +00:00
Christopher Faylor 528060195c * fhandler.h (*::fixup_after_exec): Eliminate unused handle argument.
* fhandler.h (dtable::fixup_after_exec): Eliminate unused handle argument.
* dcrt0.cc (dll_crt0_1): Reflect elimination of unused handle argument to
fixup_after_exec.
* dtable.cc (dtable::fixup_after_exec): Ditto.
* fhandler_console.cc (fhandler_console::fixup_after_exec): Ditto.
* fhandler_dsp.cc (fhandler_dsp::fixup_after_exec): Ditto.
* fhandler_raw.cc (fhandler_raw::fixup_after_exec): Ditto.
* fhandler_socket.cc (fhandler_socket::fixup_after_exec): Ditto.
* fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Ditto.
* pipe.cc (fhandler_pipe::fixup_after_exec): Ditto.
* spawn.cc (spawn_guts): Do not set ciresrv.parent.
* child_info.h (child_info_spawn::~child_info_spawn): Do not close parent.
Update CURR_CHILD_INFO_MAGIC.
* dcrt0.cc (dll_crt0_0): Do not close spawn_info->parent.  Pass NULL to
cygheap->fdtab.fixup_after_exec().
2004-02-02 21:00:07 +00:00
Christopher Faylor 6027d26d8b Throughout, change name from set_inheritance to set_no_inheritance to better
reflect input arguments of this function.
* cygheap.h (CYGHEAPSIZE): Increase size of cygheap to something closer to the
21st century.
2004-02-02 20:33:09 +00:00
Corinna Vinschen 8d9bbb5092 * cygerrno.h (set_errno): Replace semicolon with comma in non-DEBUGGING
version to avoid compile time error.
2004-02-02 10:47:29 +00:00
Christopher Faylor 9e1ad59de6 * cygerrno.h (set_errno): Set global errno whenever setting thread specific
version.
* debug.cc (__set_errno): Ditto.
* exceptions.cc (handle_sigsuspend): Remove spurious sig_dispatch_pending call.
(set_signal_mask): When there seem to be pending signals to dispatch, tell
signal_dispatch_pending/sig_send not to specifically call any handlers.
* sigproc.h (sig_dispatch_pending): Change declaration to void.
* sigproc.cc (sig_dispatch_pending): Change definition to void.  Take an
argument to determine whether to tell sig_send to wait for handler to be
called.
* sigproc.cc (sig_send): Don't call signal handler when sig == __SIGFLUSHFAST.
(wait_sig): Honor __SIGFLUSHFAST.  Guard against sigpacket::process nuking
si_signo.
* sigproc.h (__SIGFLUSHFAST): Define new special signal.
(sig_dispatch_pending): Change declaration to void.  Take optional boolean
argument.
* fork.cc (vfork): Add debugging output.
2004-02-01 18:29:12 +00:00
Christopher Faylor ef33379be8 * exceptions.cc (sig_handle_tty_stop): Avoid races by waiting for both
signal_arrived and for sigCONT.
(sigpacket::process): Enforce sending of both signal_arrived and sigCONT, where
appropriate.
* gendef (sigreturn): Save tls pointer in ebx so that it can jump into
sigdelayed and use the same register.
2004-01-26 22:25:57 +00:00
Christopher Faylor 5e0f482f2c * cygtls.cc (_threadinfo::init_thread): Add more local reent stdio
initialization.
* dcrt0.cc (initial_env): Can it really be true that XP doesn't allow attaching
a debugger during DLL attach?  Add temporary workaround.
(dll_crt0_0): Ensure that _impure_ptr stdio is initialized before any threads.
(dll_crt0_1): Move _impure_ptr initialization to dll_crt0_0.
* exceptions.cc (try_to_debug): Reinstate old method for looping while
debugging.
* syscalls.cc (_cygwin_istext_for_stdio): Regularize debugging output.  Remove
hopefully extraneous check.
(setmode_helper): Add debugging output for improbable case.  Use "binary"
rather "raw" for consistency.
2004-01-26 18:52:02 +00:00
Christopher Faylor d7231d7224 * fhandler.cc (fhandler_base::fhaccess): Avoid always setting errno to EACCESS
when return value is < 0.  Rely on errno being set properly.
2004-01-25 23:39:26 +00:00
Christopher Faylor 6bc774fc6b * sigproc.cc (proc_subproc): Don't protect *child's* handle. 2004-01-25 05:17:21 +00:00
Christopher Faylor 9157f0f3ec * fhandler.h (fhandler_base::fhaccess): Return int for compatibility with
access.
* fhandler.cc (fhandler_base::fhaccess): Return int.  Use consistent variable
name for exit value.  Exit at bottom, printing debugging information, like
other cygwin functions.
2004-01-24 20:34:27 +00:00
Christopher Faylor f4e815bc30 * cygheap.cc (init_cygheap::close_ctty): Protect YA vforkism.
* fhandler.h (fhandler_base::has_acls): Make pass through for path_conv method.
(fhandler_base::isremote): Ditto.
(fhandler_base::is_fs_special): Ditto.
(fhandler_base::has_attribute): Ditto.  Define new function.
(fhandler_base::fhaccess): Declare new function based on access_worker.
(fhandler_base::set_has_acls): Eliminate obsolete function.
(fhandler_base::set_isremote): Ditto.
* fhandler.cc (fhandler_base::fhaccess): Move from syscalls.cc and into
fhandler_base class.  Use fhandler methods to access data rather than path_conv
stuff.
(fhandler_base::device_access_denied): Use fhaccess method.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto.
(fhandler_base::open_fs): Remove calls to obsolete functions.
* fhandler_virtual.cc (fhandler_virtual::open): Ditto.
* winsup.h (access_worker): Remove obsolete access_worker declaration.
*syscalls.cc (access_worker): Move function to fhandler.cc.
(access): Use fhaccess method.
* pinfo.cc (_pinfo::set_ctty): Clarify debugging output.
* sigproc.cc (sig_dispatch_pending): Ditto.
* syscalls.cc (setsid): Perform minor rearrangement.
2004-01-24 03:40:33 +00:00
Pierre Humblet b9a766427b 2004-01-23 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler_socket.cc (fhandler_socket::create_secret_event): Avoid
        creating multiple handles. Always allow event inheritance but set the
        handle inheritance appropriately. Improve error handling.
        (fhandler_socket::check_peer_secret_event): Improve error handling.
        (fhandler_socket::close_secret_event): Simply call CloseHandle.
        (fhandler_socket::set_close_on_exec): Set secret event inheritance.
2004-01-24 00:14:27 +00:00
Christopher Faylor f723909038 * configure.in: Remove NEWVFORK default.
* configure: Regenerate.
* dcrt0.cc: Conditionalize vfork stuff throughout.
* dtable.cc: Ditto.
* perthread.h: Ditto.
* pipe.cc (fhandler_pipe::close): Ditto.
* spawn.cc (spawnve): Ditto.
* syscalls.cc (setsid): Ditto.
* exceptions.cc (sigpacket::process): Use macro to refer to vfork pid.
* debug.cc (verify_handle): Define new function.
* debug.h (VerifyHandle): Define new macro.
(verify_handle): Declare new function
* fhandler.cc (fhandler_base::dup): Verify that dup'ed handle is not supposed
to be in use.
(fhandler_base::set_inheritance): Ditto.
(fhandler_base::fork_fixup): Ditto.
* fhandler_socket.cc (fhandler_socket::dup): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* net.cc (set_socket_inheritance): Ditto.
* pinfo.cc (pinfo_fixup_after_exec): Ditto.
* sigproc.cc (proc_subproc): Ditto.
(sig_send): Ditto.
* spawn.cc (spawn_guts): Ditto.
* thread.cc (pthread::init_mainthread): Ditto.
* pipe.cc (fhandler_pipe::close): Close read_state with ForceCloseHandle since
it was protected.
(fhandler_pipe::fixup_after_exec): Protect read_state handle.
(fhandler_pipe::dup): Correctly close open handles on error condition.  Verify
that dup'ed handle is not supposed to be in use.
(fhandler_pipe::create): Protect read_state.
2004-01-23 23:05:33 +00:00
Christopher Faylor 35b7fc6c00 * exceptions.cc (sig_handle_tty_stop): Fix boneheaded mistake by using correct
check for parent state rather than inverted check mistakenly introduced on
2003-09-15.
2004-01-23 15:44:15 +00:00
Christopher Faylor a33df42223 * fhandler_serial.cc (fhandler_serial::raw_write): Prevent a deadlock when the
input buffer overflows.
(fhandler_serial::raw_read): Correct to print the actual error and only call
PurgeComm when necessary.
2004-01-23 15:22:48 +00:00
Christopher Faylor fba870ac94 change comment. 2004-01-22 19:16:17 +00:00
Christopher Faylor 35711de753 * dcrt0.cc (reent_data): Make global.
* cygwin.din: Reexport reent_data.
2004-01-22 19:14:07 +00:00
Christopher Faylor 39d06d71ff * cygtls.cc (_threadinfo::remove): Don't assume that we are removing _my_tls.
* exceptions.cc (setup_handler): Improve debugging output.
(call_signal_handler_now): Remove ill-advised debugger call.
* sigproc.cc (sigcomplete_main): Delete.
(sig_send): Honor FIXME and avoid using main thread's completion event for
everything or suffer races.
(pending_signals::add): Default stored mask to current process mask rather than
mask at time of signal send.
(wait_sig): Add debugging output.
* sigproc.h (sigpacket::mask_storage): Delete.
2004-01-22 19:03:19 +00:00
Christopher Faylor 537ca63f8e * fhandler.cc (fhandler_base::open): Revert isfs change. 2004-01-22 15:08:08 +00:00
Christopher Faylor a1dcf5d848 * devices.in: Change raw com device to more correct form. 2004-01-21 19:14:19 +00:00