diff options
author | Christopher Faylor <me@cgf.cx> | 2011-10-26 23:42:39 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-10-26 23:42:39 +0400 |
commit | b79b15e9e3160ef31b8ace8f167a8e9647670647 (patch) | |
tree | d688fb10d662cdb5248c4c1c6966db9218084186 /winsup/cygwin/child_info.h | |
parent | be2280986de5339bca3d648ec0e7538541dcd674 (diff) |
* child_info.h (cchildren): New struct.
(child_info_spawn::nchildren): Rename from nprocs.
(child_info_spawn::children): Change type to cchildren for more bookkeeping
possibilities.
(child_info_spawn::child_info_spawn): Clear nchildren.
(child_info_spawn::record_children): Declare new function.
(child_info_spawn::reattach_children): Ditto.
* dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to gather
list of processes we are potentially waiting for.
* pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
(pinfo::reattach): New function.
* sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
(get_proc_lock): Don't bother with a lock during DLL initialization.
(proc_subproc): Handle PROC_REATTACH_CHILD.
(proc_terminate): Orphan children only when we are not an execed process or
when the pid is about to be occupied by a non-cygwin process.
(child_info_spawn::record_children): Define new function.
(child_info_spawn::reattach_children): Ditto.
* sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
elements.
* spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if about to
exec a cygwin process.
* sigproc.cc (sig_send): Fix harmless transposition of fifth and six arguments
to DuplicateHandle().
(child_info::child_info): Ditto.
* globals.cc (hExeced): Make NO_COPY.
Diffstat (limited to 'winsup/cygwin/child_info.h')
-rw-r--r-- | winsup/cygwin/child_info.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h index ef7166f2d..95cb4d6eb 100644 --- a/winsup/cygwin/child_info.h +++ b/winsup/cygwin/child_info.h @@ -38,10 +38,16 @@ enum child_status #define EXEC_MAGIC_SIZE sizeof(child_info) /* Change this value if you get a message indicating that it is out-of-sync. */ -#define CURR_CHILD_INFO_MAGIC 0x29afd207U +#define CURR_CHILD_INFO_MAGIC 0xa049a83aU #define NPROCS 256 +struct cchildren +{ + pid_t pid; + HANDLE rd_proc_pipe; +}; + /* NOTE: Do not make gratuitous changes to the names or organization of the below class. The layout is checksummed to determine compatibility between different cygwin versions. */ @@ -56,8 +62,6 @@ public: HANDLE subproc_ready; // used for synchronization with parent HANDLE user_h; HANDLE parent; - int nprocs; - pid_t children[NPROCS]; init_cygheap *cygheap; void *cygheap_max; DWORD cygheap_reserve_sz; @@ -119,6 +123,8 @@ public: int __stdin; int __stdout; char filler[4]; + int nchildren; + cchildren children[NPROCS]; ~child_info_spawn () { @@ -135,8 +141,10 @@ public: cfree (moreinfo); } } - child_info_spawn (): moreinfo (NULL) {}; + child_info_spawn (): moreinfo (NULL), nchildren (0) {}; child_info_spawn (child_info_types, bool); + void record_children (); + void reattach_children (); void *operator new (size_t, void *p) __attribute__ ((nothrow)) {return p;} void set (child_info_types ci, bool b) { new (this) child_info_spawn (ci, b);} void handle_spawn () __attribute__ ((regparm (1))); |