Commit Graph

48 Commits

Author SHA1 Message Date
Christopher Faylor 6b7cd251c7 Remove unneeded sigproc.h includes throughout.
* fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument.
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search for
given pid.
(fhandler_proc::readdir): Assume that pid exists if it shows up in the winpid
list.
* fhandler_process.cc (fhandler_process::open): Simplify search for given pid.
Call fill_filebuf with pinfo argument.
(fhandler_process::fill_filebuf): Pass pinfo here and assume that it exists.
* pinfo.h (pinfo::remember): Define differently if sigproc.h is not included.
* dll_init.cc (dll_list::detach): Don't run destructor on exit.
2002-06-02 06:07:01 +00:00
Christopher Faylor 33ad2bf9d1 Add copyright stuff 2002-01-13 20:03:03 +00:00
Christopher Faylor 06486d9e55 * exceptions.cc (sig_handle): Accept a second argument indicating whether the
signal came from this process or not.
* sigproc.h: Reflect sig_handle arg change.
* signal.cc (kill_pgrp): Add sigframe info.
(abort): New function.  Eliminates newlib function of same name.
* sigproc.cc (wait_sig): Pass "signal from this process" value as arg 2.
2002-01-11 02:24:06 +00:00
Christopher Faylor 243a041bd0 * dll_init.h (class dll_list): Reorder functions to avoid compiler "can't
inline" warnings.
* security.h (class cygsid): Ditto.
* sigproc.cc (get_proc_lock): Ditto.
* sigproc.h (class sigframe): Ditto.
* sync.h (class muto): Ditto.
* fhandler.h (fhandler_base::get_guard): Actually MAKE virtual as previously
indicated.
* pipe.cc (make_pipe): Remove extraneous set_errno.
* syscalls.cc (_open): Ditto.
* select.cc (peek_pipe): Need to check that there is still something to read
from the pipe after acquiring the mutex since another process/thread could have
eaten the input before we got to acquiring the lock.  (Thanks to Nick Duffek
for this inspiration.)
2001-11-03 03:32:27 +00:00
Christopher Faylor 774cd790fc * sigproc.cc (sigproc_terminate): Don't signal main thread when exiting.
* sigproc.h (sigframe): Decorate some methods with `inline'.
(new_muto): Coerce pointer to new to void *.
2001-10-31 02:58:38 +00:00
Christopher Faylor 9661a0c8b7 * dcrt0.cc (dll_crt0_1): Create vfork main storage here so that it can be
queried in waitsig later.
* sigproc.cc (wait_sig): Don't deliver a signal if in a vfork.
* fork.cc (vfork): Deliver all signals on parent return from vfork.
2001-09-15 00:47:44 +00:00
Christopher Faylor 101f820da2 * sigproc.h (sigframe::unregister): Return true/false whether this frame is
capable of responding to signals.
* exceptions.cc (sigframe::call_signal_handler): Don't call signal handler if
it is not armed for this thread.
2001-09-12 01:56:32 +00:00
Christopher Faylor 1ff9f4b937 * cygheap.h (init_cygheap): Move heap pointers here.
* include/sys/cygwin.h (perprocess): Remove heap pointers.
* dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff.
(_dll_crt0): Don't initialize heap pointers.
(cygwin_dll_init): Ditto.
(release_upto): Use heap pointers from cygheap.
* heap.h: Ditto.
* fork.cc (fork_parent): Ditto.  Don't set heap pointers in ch.
(fork_child): Remove obsolete sigproc_fixup_after_fork.
* shared.cc (memory_init): Reorganize so that cygheap initialization is called
prior to regular heap since regular heap uses cygheap now.
* sigproc.cc (proc_subproc): Eliminate zombies allocation.
(sigproc_init): Move zombies alloation here.  Don't free up array on fork, just
reuse it.
(sigproc_fixup_after_fork): Eliminate.
* sigproc.h: Ditto.
* include/cygwin/version.h: Reflect change to perprocess structure.
2001-09-07 21:32:07 +00:00
Christopher Faylor 4ce15a4980 * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc.
* cygheap.cc: Throughout use bucket array from cygheap.
* sigproc.cc (proc_subproc): Dynamically allocate zombie buffer to save DLL
space.
(sigproc_fixup_after_fork): Free zombie array after a fork.
* sigproc.h (sigproc_fixup_after_fork): Declare.
* dir.cc (mkdir): Expand buffer for security descriptor to 4K to avoid stack
corruption.
* fhandler.cc (fhandler_base::open): Ditto.
* path.cc (symlink): Ditto.
2001-09-06 03:39:18 +00:00
Christopher Faylor 125205875b * exceptions.cc (interrupt_setup): Move actions from setup_handler to here.
(setup_handler): Move actions after a successful interrupt to interrupt_setup.
* fork.cc (vfork): Augment debugging output.
* sigproc.cc (proc_subproc): Ditto.
* spawn.cc (spawn_guts): Ditto.  Correctly fill out progname when spawn
NO_WAIT.  Call signal handler when a signal arrives.
* sigproc.h: Declare a function.
2001-06-24 21:57:50 +00:00
Christopher Faylor cba63823f8 * thread.cc (thread_init_wrapper): Use _REENT_INIT to initialize the reent
structure of newlib.
* sigproc.h (sig_send): Add exception parameter to sig_send.
* sigproc.cc (sig_send): Ditto.  Use it when setting frame info.
* exceptions.cc (handle_exceptions): Use exception flag when calling sig_send.
2001-04-27 18:50:59 +00:00
Christopher Faylor 968d91b2e6 * sigproc.h [sigthread]: Add exception field.
[sigframe::~sigframe]: Clear exception field.
[sigframe::set]: Set exception field from caller.
* sigproc.cc (sig_send): Set exception field when frame pointer is passed in.
* exceptions.cc (interrupt_on_return): Always treat exception as interruptible.
2001-04-25 19:11:37 +00:00
Christopher Faylor aa970c616c * Makefile.in: Put -lgcc last in list of libraries, since stdc++ library needs
it.
* cygwin.din: Remove obsolete "__empty" export.
* exceptions.cc (call_signal_handler_now): Force inclusion of function even
when -finline-functions is specified.
* sigproc.h: Remove obsolete call_signal_handler declaration.
* fhandler_console.cc (cp_get_internal): New function.
(cp_convert): New function.
(con_to_str): New function.
(str_to_con): New function.
(fhandler_console::read): Replace OemToCharBuff with con_to_str.
(fhandler_console::write_normal): Replace CharToOemBuff with str_to_con.
2001-04-09 00:44:25 +00:00
Christopher Faylor 1ba3935dfb * exceptions.cc (sigframe::call_signal_handler): Return value of
call_signal_handler_now.
* sigproc.h (sigframe): Use constructor.
* syscalls.cc (_read): Correct errno test prior to calling signal handler.
2001-04-02 00:18:29 +00:00
Christopher Faylor f611148366 * sigproc.h (class sigframe): Implement 'unregister()' method.
(sigframe::~sigframe): Use unregister method.
(sigframe::call_signal_handler): Declare new method.
* exceptions.cc (sigframe::call_signal_handler): New method.  Unregisters
current sigframe before calling signal handler.
(setup_handler): Clear waiting threads prior to arming signal_arrived.
* syscalls.cc (_read): Change goto to loop.  Recalculate sigframe inside of
loop so that constructor is called when appropriate.
* wait.cc (wait4): Ditto.
* signal.cc: Change "sig" to "signal" in debugging messages throughout.
* sigproc.cc: Ditto.
2001-04-01 00:06:17 +00:00
Christopher Faylor 7cf3b655ec * shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler warning.
* exceptions.cc (setup_handler): Clarify debugging message.
* sigproc.cc (proc_subproc): Remove PROC_CHILDSTOPPED test.  It is handled by
normal PROC_CLEARWAIT case.
(wait_sig): Eliminate "dispatched" tracking.  Remove __SIGCHILDSTOPPED test.
Decrement counter again before jumping out of InterlockedDecrement loop so that
subsequent InterlockedIncrement will keep the counter at the correctly
decremented value and also detect when there are pending signals.
* sigproc.h: Remove __SIGCHILDSTOPPED element.
(procstuff): Remove PROC_CHILDSTOPPED element.
2001-03-10 23:37:50 +00:00
Christopher Faylor efd76e4140 * sigproc.h (sigthread): Declare new methods. Create new winapi_lock field.
(sigframe:;set): Call get_winapi_lock after frame is set so that signal handler
thread knows not to call SuspendThread.
(sigframe::~sigframe): Release winapi_lock.
* exceptions.cc (sigthread::get_winapi_lock): New method.
(sigthread::release_winapi_lock): New method.
(setup_handler): Use get_winapi_lock to ensure that signalled thread is not
blocked in a Windows API.
* path.h (path_types): Avoid broken GCC warning.
2001-03-07 06:19:34 +00:00
Christopher Faylor c3d62298ba * debug.h: Add regparm attributes to some functions.
* signal.cc (sigaction): Don't treat SIGCONT specially.
* exceptions.cc (interrupt_setup): Save sa_flags of interrupted signal for
later use.
(sig_handler): Default any stopping signal to SIGSTOP.
(call_signal_handler): New function.
(sigdelayed0): New function.
* sigproc.cc (sigproc_init): Initialize SIGSTOP sigaction for special behavior.
* sigproc.h: Define call_signal_handler.
* syscalls.cc (_read): Allow restartable signal behavior.
2001-01-12 05:38:25 +00:00
Christopher Faylor 077ec4cb37 * pinfo.cc (codepage_init): Move function.
* environ.cc (codepage_init): To here.
* exceptoins.cc (SIG_NONMASKABLE): Remove SIGCONT from consideration since it
is supposed to be maskable.
* signal.cc (sigaction): Ditto.
* sigproc.cc (wait_sig): Ditto.
* winsup.h: Eliminate global declaration of codepage_init.
2001-01-08 04:02:02 +00:00
Christopher Faylor 84aeff4126 Throughout use myself->ppid_handle rather than parent_alive.
* child_info.h (child_info): Eliminate parent_alive.
* dcrt0.cc (dll_crt0_1): Call fork_init for debugging pid creation.
* fork.cc (fork_child): Reflect change to fixup_mmaps_after_fork arguments.
(slow_pid_reuse): New function to grab last 'n' pids to prevent pid reuse.
(fork_parent): Move last_fork_proc into slow_pid_reuse.  Handle fork_pids
debugging.  Eliminate unnecessary call to set_child_mmap_ptr.
(fork_init): New debugging function.
* mmap.cc (fixup_mmaps_after_fork): Renamed from recreate_mmaps_after_fork.
Rely on copied data after a fork.
(set_child_mmap_ptr): Eliminate.
* pinfo.h (_pinfo): Eliminate parent_alive, mmap_ptr and reflect above changes.
* spawn.cc (spawn_guts): Eliminate vestiges of "old way" of sending new hProc
to parent process.
2000-11-15 06:27:48 +00:00
Christopher Faylor 49421cd9c5 * path.h: Add __attribute__ ((regparm(x))) to commonly used functions.
* pinfo.h: Ditto.
* sigproc.h: Ditto.
* sync.h: Ditto.
2000-11-12 04:57:41 +00:00
Christopher Faylor c0188ae7cb * dcrt0.cc (sigthread::init): Reinstitute sigthread lock as a critical section.
(dll_crt0_1): Move sigthread lock initialization to earlier in startup.
* exceptions.cc (interrupt_on_return): Remove previous kludgy attempt to detect
an invalid frame.
(call_handler): Eliminate inner for loop.  Grab signal critical section lock
where appropriate.
* sigproc.cc (proc_subproc): Restore uid setting.
* sigproc.h (sigthread): Reinstitute sigthread lock as a critical section.
(sigframe): Grab the sigthread lock before clearing frame to avoid having the
signal thread use an invalid frame.
2000-11-06 23:12:05 +00:00
Christopher Faylor e46db834d9 * pinfo.cc (EnumProcessesNT): Avoid 0 pids.
(EnumProcesses9x): Ditto.
* sigproc.cc (remove_childe): Eliminate.
(proc_subproc): Move remove_child stuff here.
(wait_subproc): Synchronize with proc_subproc when error occurs.  Add more
debugging info.
* sigproc.h (procstuff): Add an entry.
* spawn.cc (spawn_guts): Add sigframe here.
2000-11-04 05:54:57 +00:00
Christopher Faylor 75a57bf04a Whitespace cleanup.
* configure.in: Eliminate subdir stuff.
* configure: Regenerate.
* include/getopt.h (option): Make name field 'const'.
2000-10-28 05:41:44 +00:00
Christopher Faylor 167095f6c0 * dcrt0.cc (sigthread::init): Correct overzealous ifdef.
* exceptions.cc (call_handler): Avoid calling sigthread acquire lock.
* sigproc.h (sigthread): Comment out lock for now.
* sync.cc (muto::acquire): Add a minor optimization.
2000-10-19 17:57:28 +00:00
Christopher Faylor 4b70969a08 * sigproc.h (sigthread): Eliminate locking for now since per thread signalling
is not available.
* dcrt0.cc (sigthread::init): Ditto.
(dll_crt0_1): Move set_process_privileges call (temporarily?) to pinfo_init.
(pinfo_init): Only call set_process_privileges when allow_ntsec.
2000-10-19 00:53:25 +00:00
Christopher Faylor 166b2571ce * Makefile.in: Remove some obsolete stuff.
* dcrt0.cc (dll_crt0_1): Call signal_fixup_after_exec where appropriate.  Set
myself->uid from parent version.  Just use ThreadItem Init method.  Close or
store hexec_proc as appropriate.
(_dll_crt0): Store user_data->forkee here so that proper tests can be made
subsequently.
(do_exit): Remove hExeced stuff.
* environ.cc (environ_init): Accept environ count as well as environ pointer.
* environ.h: Reflect above change.
* pinfo.cc (pinfo_init): Ditto.  Accept environ count.
(fixup_in_spawned_child): Remove.
* spawn.cc (spawn_guts): Move signal code to dll_crt0_1.  Don't suspend execing
process since it is no longer necessary.  Store envc.
* exceptions.cc (signal_fixup_after_exec): New function.
(call_handler): Remove hExeced test.
* child_info.h (cygheap_exec_info): Store envc as well as envp.
(child_info_spawn): Store hexec_proc so that it can be closed in child.
* path.cc (normalize_posix_path): Avoid intermediate use of temporary cwd buf.
(normalize_win32_path): Ditto.
(cwdstuff::get_initial): Always set lock.
* sigproc.h: Remove hExeced.
* strace.cc (strace::vsprntf): Modify to accomodate for lack of hExeced.
* thread.cc (MTinterface::Init): Merge Init1 and ClearReent into this method.
(MTinterface::Init1): Eliminate.
(MTinterface::ClearReent): Eliminate.
* thread.h: Reflect above changes.
* include/sys/strace.h (strace): Make microseconds() public.  Make various
functions 'regparm', throughout.
* pinfo.h (_pinfo): Inline simple signal manipulation functions.  Requires
inclusion of thread.h which was removed from .cc files, where appropriate.
throughout.
* pinfo.cc: Eliminate signal manipulation functions.
(_pinfo::exit): Calculate total rusage for exiting process here.
* cygheap.cc (size2bucket): Eliminate.
(init_buckets): Ditto.
(_cmalloc): Calculate size and bits in a loop rather than going through a
function call.
(_crealloc): Use stored array index to calculate allocated size.
* spawn.cc (spawn_guts): Use _pinfo exit method to exit, calculating cpu usage.
2000-10-16 23:55:58 +00:00
Christopher Faylor 1dc16fc74b * exceptions.cc (set_console_handler): Don't allocate
console_handler_thread_waiter.  It is obsolete.
(ctrl_c_handler): Don't use console_handler_thread_waiter.
* path.cc (hash_path_name): Fix handling of relative names.  Make case
insensitive.
* path.h (suffix_info): Use initializers.
* pinfo.h (_pinfo): Avoid initializers for null case.
* resource.cc (fill_rusage): Zero rest of rusage structure.
* security.cc (set_process_privileges): Don't reopen parent process.  Just use
hMainProc.
* signal.cc (signal): Track when a signal handler has been used.
(sigaction): Ditto.
* sigproc.cc (pchildren): Use default initializer.
(zombies): Ditto.
(sigproc_terminate): Avoid closing handles that will be closed on exit anyway.
(wait_sig): Send signal to "parent" on EXECing, not FORKing.
(wait_subproc): Send SIGCHLD here rather than in proc_wait to avoid potential
muto conflicts.
* sigproc.h (sigthread): Don't initialize to zero.  It's the default.
* spawn.cc (spawn_guts): Fill in resources from exec parent prior to
termination.
* sync.h (muto): Don't initialize to zero.
* syscalls.cc (close_all_files): Use one lock around entire loop and call
fhandler close/release stuff directly.
(_read): Don't use ready_for_read if there are not signal handlers active.
* dcrt0.cc (dll_crt0_1): Fix display of "title".
(do_exit): Use pinfo exit method to exit.
(__api_fatal): Ditto.
* exceptions.cc (signal_exit): Ditto.
* fork.cc (fork_child): Remove debugging stuff.  Use pinfo_fixup_after fork in
place of exec_fixup_after_fork.
* pinfo.cc (pinfo_fixup_after_fork): New method.
(pinfo_fixup_in_spawned_child): Ditto.
(_pinfo::exit): New method.
(_pinfo::init): Remove recursion.  Detect pathological case where pinfo
structure already exists for new pid.
* pinfo.h (_pinfo): Reorganize slightly.  Add new method and new function
declarations.
* sigproc.cc (proc_exists): Previous simplification was a little to simple.
Try harder to detect if a process exists.
(proc_terminate): Use PID_EXITED setting to determine if process is still
around.
(WFSO): Remove debugging statement.
(WFMO): Ditto.
* spawn.cc (exec_fixup_after_fork): Eliminate.
(spawn_guts): Always set old_title to NULL.  Is it really needed?  Move
hexec_proc to pinfo.cc.  Call pinfo_fixup_in_spawned_child to eliminate handle
link after a spawn.
* include/sys/cygwin.h: Remove PID_NOT_IN_USE.  Add PID_EXITED.
2000-10-15 01:37:07 +00:00
Christopher Faylor ec300c9979 * errno.cc (seterrno_from_win_error): Fix debugging output.
* fhandler.cc (fhandler_base::fstat): Move to inline method in fhandler.h.
(fhandler_base::set_io_handle): Ditto.
* fhandler.h (fhandler_base): Make some methods inline.
* fhandler_console.cc (fhandler_console::write_normal): Make buffer larger.
* sigproc.h (sigframe::sigframe): Actually use set ebp parameter correctly.
* spawn.cc (spawn_guts): Set dwProcessId when exec'ing.  Just exit immediately
after reparenting.
* syscalls.cc: Sprinkle sigframe stuff throughout.
* wait.cc (wait4): Set signal frame here.
* dcrt0.cc (__api_fatal): Don't rely on small_printf to display errors.  Always
display problems to the console, if possible.
2000-10-12 04:38:29 +00:00
Christopher Faylor a5855dc341 * exceptions.cc (interruptible): Add extra debugging.
* sigproc.h (wait_sig): Fill in frame pointer, by default, prior to calling or
suffer confusion due to September 7 change below.
2000-10-05 04:53:17 +00:00
Christopher Faylor f9f2ed0e2b * exceptions.cc (handle_exceptions): Just "core dump" if SIGSEGV in signal
thread.
* external.cc (fillout_pinfo): Fix compiler warning.
* sigproc.h: Eliminate special asm naming for sig_dispatch_pending.
* sigproc.cc (sig_send): Remove debugging statements.
2000-09-16 02:36:11 +00:00
Christopher Faylor 3b0d65eab9 * sigproc.h (sigframe::set): Eliminate second argument. Default bp to current
frame pointer rather than using this within the function, which is unstable
when this method is not inlined.
* net.cc: Eliminate use of second argument to sigframe.set throughout.
* select.cc (cygwin_select): Ditto.
* sigproc.cc (sig_send): Ditto.
2000-09-08 03:12:13 +00:00
Christopher Faylor f0338f545d Break out more header info into separate files. Use appropriate header files
throughout.
* shared.h: Remove.
* cygwin_version.h: New file.
* delqueue.h: New file.
* environ.h: New file.
* host_dependent.h: New file.
* perprocess.h: New file.
* registry.h: New file.
* security.h: New file.
2000-09-08 02:56:55 +00:00
Christopher Faylor 488c7683e3 * sigproc.cc (proc_info): Rename proc_exists which takes a pid to "pid_exists".
* shared.h: Split out "child_info" stuff into a new header file and use where
necessary.  Declare pid_exists.
* child_info.h: New file.
2000-09-01 20:54:22 +00:00
Christopher Faylor d824bcf985 * signal.cc (_raise): New function.
* exceptions.cc (unused_sig_wrapper): Remove _raise.
* sigproc.h (class sigframe): Default frames to skip to zero or suffer from
exuberant optimization.
* fhandler_tty.cc (fhandler_tty::write): Set appropriate errno when WriteFile
to pipe fails.
2000-08-29 02:06:49 +00:00
Christopher Faylor bccd5e0d85 * winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h files
only in sources which require them.
* Makefile.in: Generate dependencies with -MD option.
2000-08-22 05:10:20 +00:00
Christopher Faylor e2ebe11776 * winsup.h: Split out dtable definitions into separate header file.
* dtable.h: New file.
* sigproc.h: Eliminate pinfo.h usage here.  Use it in source files that need
it.
2000-08-12 05:35:42 +00:00
Christopher Faylor 84c7d40932 * include/cygwin/version.h: Bump DLL minor version number to 5 due to all of
the changes below.  Redefine process structure to avoid a fixed size table.
Redefine pinfo/_pinfo classes.  Use these throughout.
* dcrt0.cc (dll_crt0_1): Accomodate set_myself argument change.
(__api_fatal): Accomodate _pinfo::record_death argument change.
* exceptions.cc (really_exit): Ditto.
(sig_handle_tty_stop): Use pinfo constructor to access process info.
(events_init): Don't create pinfo_mutex since it is no longer required.
* external.cc (fillout_pinfo): Use winpids class to iterate over all system
pids.
(cygwin_internal): lock_pinfo_for_update and unlock_pinfo are now noops.
* fhandler_termios.cc (fhandler_termios::set_ctty): Use pinfo constructor to
access process info.
* fork.cc (fork): Reorganize to initialize child info after the child has
started since that is when we know the child's winpid, which is necessary to
allocate the pinfo shared memory.
* mmap.cc (recreate_mmaps_after_fork): Change arg type to _pinfo.
* pinfo.cc: Rename pinfo methods to _pinfo throughout.  Eliminate pinfo_list
stuff.
(set_myself): Accept a pid argument now.  Call pinfo initializer to initialize
myself.  Detect when this is an "execed" process and create an "indirect" pid
block.
(pinfo_init): Accomodate set_myself arg change.
(procinfo): Remove.
(pinfo::lock_pinfo): Remove.
(pinfo::unlock_pinfo): Remove.
(pinfo::init): New method.  Allocates shared memory space for process pinfo
structure.
(pinfo::record_death): Don't call locking functions.
(cygwin_winpid_to_pid): Simplify by using new pinfo constructor.
(EnumProcessesW95): New function for iterating over processes on Windows 95.
(winpids::winpids): New constructor for winpids class.  Sets up a list of
process ids.
(enum_init): Initialize w95/wnt pid enumerators.
* shared.cc (shared-info::initialize): Remove pid initialization.
* shared.h: Move pinfo stuff into pinfo.h.
(class shared_info): Remove pinfo_list element.
* signal.cc (kill_worker): Use pinfo constructor to access process info.
(kill_pgrp): Ditto.  Use winpids methods to access list of processes.
* sigproc.cc: Throughout, modify to use _pinfo where appropriate.
(proc_exists (pid_t)): New function.  Determines if a process exists based on
the pid.
(proc_exists (_pinfo *p): Use new proc_exists function above.
(proc_subproc): Copy pinfo stuff around rather than _pinfo pointers.  Try to be
careful about releasing shared memory when we don't need it anymore.  Remove
pinfo locks.
(remove_zombies): Remove pinfo memory when zombie is going away.
* sigproc.h: Reflect _pinfo/pinfo changes in sigproc.cc.
* spawn.cc (spawn_guts): Eliminate pinfo *child argument.  Reorganize to only
initialize child pinfo after process has been started and we know the windows
pid.
(_spawnve): Reflect spawn_guts changes.
* syscalls.cc (setpgid): Use pinfo constructor to access process info.
(getpgid): Ditto.
(internal_getlogin): Use _pinfo.
* winsup.h: Eliminate pinfo_mutex.  Eliminate spawn_guts declaration since it
is static now.  Reflect set_myself argument change.
* include/sys/cygwin.h: Add some PID_* enums to accomodate new pinfo stuff.
* include/cygwin/version.h: Update minor version for cygdrive changes below.
2000-07-29 16:24:59 +00:00
Christopher Faylor e1e61b9ae5 * sigproc.h (sigframe::set): Accept a default frame pointer.
* sigproc.cc (sig_send): Use passed in frame pointer, if appropriate.
2000-05-26 06:24:58 +00:00
Christopher Faylor f343a326d3 * Makefile.in: Remove external.h dependency.
* dcrt0.cc (sigthread::init): Move here from sigproc.h.
* sigproc.h (sigthread): Move init to dcrt0.cc.
2000-05-18 21:30:30 +00:00
Christopher Faylor 77303e2d83 * sigproc.h (sigframe): Don't set frame info unless tid matches this thread id. 2000-05-18 05:05:58 +00:00
Christopher Faylor 12e659efa8 * dcrt0.cc (dll_crt0_1): Initialize mainthread stuff here before anything needs
it.
* sigproc.cc (sigproc_init): Move mainthread initialization out of here.
* sigproc.h (sigthread): Add init() method.
(sigframe): Don't try to initialize muto.
* sync.cc: Undef WaitForSingleObject to avoid recursion.
2000-05-18 03:20:01 +00:00
Christopher Faylor 6201d15e3c * path.cc (mount_info::cygdrive_posix_path): Don't add trailing slash if
referring to something like c:\.
* dcrt0.cc (dll_crt0_1): Move uinfo initialization prior to sig_send
initialization to give signal thread a chance to finish.
* debug.cc (WFSO): Move to sigproc.cc
(WFMO): Ditto.
* exceptions.cc (interruptible): Allocate slightly more space for directory
just for paranoia's sake.
(call_handler): Eliminate nonmain argument.  Determine if main thread has set a
frame pointer and use it if so.
(sig_handle): Eliminate nonmain argument.
* net.cc: Record frame information in appropriate routines throughout.
* select.cc (select): Ditto.
* sigproc.cc: Use sigthread structure to record mainthread id throughout.
(sig_send): Record frame information for signal handler.
(wait_sig): Reflect argument change in sig_handle.
(WFSO): Move here and record frame information for signal handler.
(WFMO): Ditto.
* sigproc.h: Implement new "sigthread" class.  Implement "sigframe" class for
manipulating signal frame info.
* thread.cc (__pthread_kill): Use standard _kill() function rather than calling
sig_send directly.
* winsup.h: Eliminate ebp element from signal_dispatch class.
2000-05-17 05:49:51 +00:00
Christopher Faylor 0cda2f4609 * exceptions.cc (sigsave): Copy on fork so that we can restore correct behavior
in forked process.
(interruptible): Flag as interruptible when running in main process module.
(interrupt_setup): Save return address and address of return address.
(signal_fixup_after_fork): New function.  Uses above two values to restore
proper behavior to forked process.
(interrupt_on_return): Pass return address address to interupt_setup.
(interrupt_now): Pass NULL for return address address to interrupt_setup.
* fork.cc (fork): Call signal_fixup_after_fork.
* shared.h: Lint cleanups.
* winsup.h: Ditto.
2000-04-08 04:13:12 +00:00
Christopher Faylor af1dc7ccea * environ.cc: Eliminate oldstack CYGWIN option.
* exceptions.cc (sfta): Eliminate obsolete function.
(sgmb): Eliminate obsolete function.
(class stack_info): Remove MS method for walking the stack.
(stack_info::init): Just initialize required fields.
(stack_info::brute_force): Rename to stack_info::walk.
(handle_exceptions): Pass derived frame pointer to sig_send.
(interrupt_setup): Clear saved frame pointer here.
(interrupt_on_return): thestack is no longer a pointer.
(call_handler): Accept a flag to indicate when a signal was sent from other
than the main thread.  Use saved frame pointer for determining where to place
signal handler call.
(sig_handle): Accept "nonmain" argument.  Pass it to call_handler.
* fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Change
debugging output slightly.
* (fhandler_tty_common::__release_output_mutex): Ditto.
(fhandler_tty_slave::read): Fix a comment, remove a goto.
* sigproc.cc (sig_send): Accept an optional frame pointer argument for use when
suspending the main process.  sigcomplete_main is an autoreset event now.  Save
frame pointer for non-main operation.
(wait_sig): Make sigcomplete_main an autoreset event.  Eliminate NOSIGQUEUE.
Pass rc to sig_handle to signify if this was a nonmain process.
* sigproc.h: Reflect change to sig_send argument.
* syscalls.cc (swab): Eliminate swab function since it is now available in
newlib.
* winsup.h (signal_dispatch): Change CONTEXT cx to DWORD ebp.
2000-03-09 21:04:05 +00:00
Christopher Faylor 9aa07a8f60 Fix final round of gcc warnings relating to unused parameters.
* debug.cc (iscygthread): New function.
* debug.h: Declare it.
* exceptions.cc (set_process_mask): Flush pending signals.
(handle_sigsuspend): No need to flush pending signals.
(call_handler): Refine previous tests of muto ownership.  Only clear wait()'s
when we have definitely responded to a signal.
* fhandler_console.cc (fhandler_console::read): Don't set EINTR if executing in
a "cygwin" thread.
* sigproc.cc (proc_subproc): Use second argument to control whether CLEARWAIT
actually sets "signalled" flag.
* sync.h (muto): Add 'unstable' method.
2000-02-24 06:45:32 +00:00
Christopher Faylor f02f1f1444 * exceptions.cc (interruptible): Change method for determining if something is
interruptible.
(call_handler): Avoid suspending a thread if it owns a mutex.  Only set
signal_arrived if the thread was actually interrupted.
(events_init): Initialize module information needed by interruptible().
(sigdelayed): Don't call sig_dispatch_pending since it could screw up
* init.cc (dll_entry): Record module handle of main for use by interruptible().
(proc_subproc): Reorganize handling of terminated child so that the bulk of the
processing comes from the signal thread.
(wait_sig): Force processing of waiting threads if SIGCHLD is not processed.
* sync.cc (muto::release): Set tid == 0 after lock is released or signal
processor will be confused.
2000-02-24 02:49:44 +00:00
Christopher Faylor 1fd5e000ac import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00