From 84c7d4093270dc07de4531ab6648a12daaff77c3 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 29 Jul 2000 16:24:59 +0000 Subject: * 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. --- winsup/cygwin/exceptions.cc | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'winsup/cygwin/exceptions.cc') diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 22f262cc8..c6cad810c 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -315,7 +315,6 @@ try_to_debug () /* if any of these mutexes is owned, we will fail to start any cygwin app until trapped app exits */ - ReleaseMutex (pinfo_mutex); ReleaseMutex (title_mutex); /* prevent recursive exception handling */ @@ -877,7 +876,7 @@ sig_handle_tty_stop (int sig) */ if (my_parent_is_alive ()) { - pinfo *parent = procinfo (myself->ppid); + pinfo parent (myself->ppid); sig_send (parent, __SIGCHILDSTOPPED); } sigproc_printf ("process %d stopped by signal %d, parent_alive %p", @@ -1007,27 +1006,18 @@ signal_exit (int rc) if (exit_already++) { /* We are going down - reset our process_state without locking. */ - myself->record_death (FALSE); + myself->record_death (); ExitProcess (rc); } do_exit (rc); } -HANDLE NO_COPY pinfo_mutex = NULL; HANDLE NO_COPY title_mutex = NULL; void events_init (void) { - /* pinfo_mutex protects access to process table */ - - if (!(pinfo_mutex = CreateMutex (&sec_all_nih, FALSE, - shared_name ("pinfo_mutex", 0)))) - api_fatal ("catastrophic failure - unable to create pinfo_mutex, %E"); - - ProtectHandle (pinfo_mutex); - /* title_mutex protects modification of console title. It's neccessary while finding console window handle */ @@ -1056,12 +1046,11 @@ events_init (void) void events_terminate (void) { -//CloseHandle (pinfo_mutex); // Use implicit close on exit to avoid race ForceCloseHandle (title_mutex); exit_already = 1; } -#define pid_offset (unsigned)(((pinfo *)NULL)->pid) +#define pid_offset (unsigned)(((_pinfo *)NULL)->pid) extern "C" { static void __stdcall reset_signal_arrived () __attribute__ ((unused)); -- cgit v1.2.3