From 54dd79bb44d2180ab769558deab274c70391cca7 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 5 Dec 2004 19:41:26 +0000 Subject: * sigproc.cc (mychild): Reimplement as list scan. (proc_subproc): Don't mess with pinfo if it's myself. * child_info.h (child_info_types): Label enum for _PROC constants. (child_info::child_info): New constructor. (child_info::~child_info): New destructor. (child_info::sync): Declare new function. (child_info_fork::child_info_fork): New constructor. (child_info_spawn::child_info_spawn): Remove old constructor. (child_info_spawn::child_info_spawn): New constructor. * dcrt0.cc (dll_crt0_0): Use correct sizeof when doing sanity check on passed in child_info. Signal readiness to parent when not forking (and not spawning). * fork.cc (sync_with_child): Delete. (resume_child): Remove extra argument. (sync_with_parent): Use child_info method to sync with parent. (fork_child): Don't close fork_info->subproc_ready since that is now handled by the destructor. (fork_parent): Remove subproc_ready stuff. Use child_info sync method for waiting.. Set start time here for child. Rename "forked" to "child". (fork): Check ch.subproc_ready for validity here. * pinfo.h (_pinfo::exec_sendsig): Temp storage for exec stub which may be staying around to handle non-cygwin captive process. (_pinfo::exec_dwProcessId): Ditto. (_pinfo::_lock): Renamed from lock. (_pinfo::lock): New method. (_pinfo::unlock): Ditto. (_pinfo::initialize_lock): Ditto. * pinfo.cc (set_myself): Use initialize_lock method to initialize myself lock. Set "exec" fields in _pinfo to zero to indicate that we've started successfully. Set start time here when appropriate. (_pinfo::commune_send): Use pinfo lock/unlock methods. (proc_waiter): Remove special case for non-cywin processes. Reinstitute handling for PID_NOCLDSTOP. * sigproc.cc (proc_subproc): Set proper EAGAIN errno when process table is filled. (sig_send): Use exec_* fields from _pinfo for sending signals if the the _pinfo sendsig never materializes. (child_info::child_info): New constructor, renamed from init_child_info. Zeroes child_info structure and sets appropriate fields in structure based on chtype. (child_info::~child_info): New destructor. Closes subproc_ready if it exists. (child_info_fork::child_info_fork): New constructor. (child_info_spawn::child_info_spawn): New constructor. (child_info::ready): New function. Signals parent when child is ready. (child_info::sync): New function. Wait for child to signal us or process to die. (remove_proc): Remove closing of hProcess since this should now be handled shortly after process creation. * spawn.cc (spawn_guts): Use child_info_spawn constructor rather than init_child_info. Save exec_sendsig and exec_dwProcessId in execing _pinfo. Rely on child_info constructor to properly set parent_wr_proc_pipe in ciresrv. Revert to previous determination on whether to start a process in suspended mode. Remove reparenting stuff. Just keep a stub around if starting a non-cygwin process. --- winsup/cygwin/include/sys/cygwin.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'winsup/cygwin/include/sys/cygwin.h') diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index b8c99738e..172de6e12 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -87,24 +87,24 @@ unsigned long cygwin_internal (cygwin_getinfo_types, ...); /* Flags associated with process_state */ enum { - PID_IN_USE = 0x0001, /* Entry in use. */ - PID_ZOMBIE = 0x0002, /* Child exited: no parent wait. */ - PID_STOPPED = 0x0004, /* Waiting for SIGCONT. */ - PID_TTYIN = 0x0008, /* Waiting for terminal input. */ - PID_TTYOU = 0x0010, /* Waiting for terminal output. */ - PID_ORPHANED = 0x0020, /* Member of an orphaned process group. */ - PID_ACTIVE = 0x0040, /* Pid accepts signals. */ - PID_CYGPARENT = 0x0080, /* Set if parent was a cygwin app. */ - PID_MAP_RW = 0x0100, /* Flag to open map rw. */ - PID_MYSELF = 0x0200, /* Flag that pid is me. */ - PID_NOCLDSTOP = 0x0400, /* Set if no SIGCHLD signal on stop. */ - PID_INITIALIZING = 0x0800, /* Set until ready to receive signals. */ - PID_USETTY = 0x1000, /* Setting this enables or disables cygwin's */ - /* tty support. This is inherited by */ - /* all execed or forked processes. */ - PID_ALLPIDS = 0x2000, /* child has execed */ - PID_EXECED = 0x4000, /* redirect to original pid info block */ - PID_NOREDIR = 0x8000, /* don't redirect if execed */ + PID_IN_USE = 0x00001, /* Entry in use. */ + PID_ZOMBIE = 0x00002, /* Child exited: no parent wait. */ + PID_STOPPED = 0x00004, /* Waiting for SIGCONT. */ + PID_TTYIN = 0x00008, /* Waiting for terminal input. */ + PID_TTYOU = 0x00010, /* Waiting for terminal output. */ + PID_ORPHANED = 0x00020, /* Member of an orphaned process group. */ + PID_ACTIVE = 0x00040, /* Pid accepts signals. */ + PID_CYGPARENT = 0x00080, /* Set if parent was a cygwin app. */ + PID_MAP_RW = 0x00100, /* Flag to open map rw. */ + PID_MYSELF = 0x00200, /* Flag that pid is me. */ + PID_NOCLDSTOP = 0x00400, /* Set if no SIGCHLD signal on stop. */ + PID_INITIALIZING = 0x00800, /* Set until ready to receive signals. */ + PID_USETTY = 0x01000, /* Setting this enables or disables cygwin's + tty support. This is inherited by + all execed or forked processes. */ + PID_ALLPIDS = 0x02000, /* used by pinfo scanner */ + PID_EXECED = 0x04000, /* redirect to original pid info block */ + PID_NOREDIR = 0x08000, /* don't redirect if execed */ PID_EXITED = 0x80000000 /* Free entry. */ }; -- cgit v1.2.3