* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(cygheap_exec_info::nchildren): Move from child_info_spawn. (cygheap_exec_info::cchildren): Ditto. (cygheap_exec_info::record_children): Declare new function. (cygheap_exec_info::reattach_children): Ditto. (cygheap_exec_info::alloc): Ditto. (child_info_spawn::nchildren): Move to cygheap_exec_info. (child_info_spawn::cchildren): Ditto. * sigproc.cc (cygheap_exec_info::alloc): Define new function. (child_info_spawn::cleanup): Accommodate move of children info to cygheap_exec_info. (cygheap_exec_info::record_children): Define new function. (cygheap_exec_info::reattach_children): Ditto. (child_info_spawn::record_children): Use cygheap_exec_info function to accomplish this task. (child_info_spawn::reattach_children): Ditto. * spawn.cc (child_info_spawn::worker): Allocate moreinfo using cygheap_exec_info::alloc. * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Use abort for the error to avoid a retry.
This commit is contained in:
parent
f32d96ff99
commit
7b2740dda3
@ -1,3 +1,27 @@
|
|||||||
|
2011-11-15 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
|
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
|
||||||
|
(cygheap_exec_info::nchildren): Move from child_info_spawn.
|
||||||
|
(cygheap_exec_info::cchildren): Ditto.
|
||||||
|
(cygheap_exec_info::record_children): Declare new function.
|
||||||
|
(cygheap_exec_info::reattach_children): Ditto.
|
||||||
|
(cygheap_exec_info::alloc): Ditto.
|
||||||
|
(child_info_spawn::nchildren): Move to cygheap_exec_info.
|
||||||
|
(child_info_spawn::cchildren): Ditto.
|
||||||
|
* sigproc.cc (cygheap_exec_info::alloc): Define new function.
|
||||||
|
(child_info_spawn::cleanup): Accommodate move of children info to
|
||||||
|
cygheap_exec_info.
|
||||||
|
(cygheap_exec_info::record_children): Define new function.
|
||||||
|
(cygheap_exec_info::reattach_children): Ditto.
|
||||||
|
(child_info_spawn::record_children): Use
|
||||||
|
cygheap_exec_info function to accomplish this task.
|
||||||
|
(child_info_spawn::reattach_children): Ditto.
|
||||||
|
* spawn.cc (child_info_spawn::worker): Allocate moreinfo using
|
||||||
|
cygheap_exec_info::alloc.
|
||||||
|
|
||||||
|
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Use abort for the
|
||||||
|
error to avoid a retry.
|
||||||
|
|
||||||
2011-11-14 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-11-14 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* pinfo.cc (_pinfo::dup_proc_pipe): Fatalize a warning when debugging.
|
* pinfo.cc (_pinfo::dup_proc_pipe): Fatalize a warning when debugging.
|
||||||
|
@ -35,7 +35,7 @@ enum child_status
|
|||||||
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
||||||
|
|
||||||
/* Change this value if you get a message indicating that it is out-of-sync. */
|
/* Change this value if you get a message indicating that it is out-of-sync. */
|
||||||
#define CURR_CHILD_INFO_MAGIC 0x941e0a4aU
|
#define CURR_CHILD_INFO_MAGIC 0x24f4be4bU
|
||||||
|
|
||||||
#define NPROCS 256
|
#define NPROCS 256
|
||||||
|
|
||||||
@ -111,6 +111,11 @@ public:
|
|||||||
int envc;
|
int envc;
|
||||||
char **envp;
|
char **envp;
|
||||||
HANDLE myself_pinfo;
|
HANDLE myself_pinfo;
|
||||||
|
int nchildren;
|
||||||
|
cchildren children[0];
|
||||||
|
static cygheap_exec_info *alloc ();
|
||||||
|
void record_children ();
|
||||||
|
void reattach_children (HANDLE);
|
||||||
};
|
};
|
||||||
|
|
||||||
class child_info_spawn: public child_info
|
class child_info_spawn: public child_info
|
||||||
@ -123,8 +128,6 @@ public:
|
|||||||
int __stdin;
|
int __stdin;
|
||||||
int __stdout;
|
int __stdout;
|
||||||
char filler[4];
|
char filler[4];
|
||||||
int nchildren;
|
|
||||||
cchildren children[NPROCS];
|
|
||||||
|
|
||||||
void cleanup ();
|
void cleanup ();
|
||||||
child_info_spawn () {};
|
child_info_spawn () {};
|
||||||
|
@ -411,8 +411,7 @@ child_info_fork::alloc_stack_hard_way (volatile char *b)
|
|||||||
stack_ptr = VirtualAlloc (stacktop, stacksize, MEM_COMMIT,
|
stack_ptr = VirtualAlloc (stacktop, stacksize, MEM_COMMIT,
|
||||||
PAGE_EXECUTE_READWRITE);
|
PAGE_EXECUTE_READWRITE);
|
||||||
if (!stack_ptr)
|
if (!stack_ptr)
|
||||||
api_fatal ("fork: can't commit memory for stack %p(%d), %E",
|
abort ("can't commit memory for stack %p(%d), %E", stacktop, stacksize);
|
||||||
stacktop, stacksize);
|
|
||||||
if (guardsize != (size_t) -1)
|
if (guardsize != (size_t) -1)
|
||||||
{
|
{
|
||||||
/* Allocate PAGE_GUARD page if it still fits. */
|
/* Allocate PAGE_GUARD page if it still fits. */
|
||||||
|
@ -843,6 +843,14 @@ child_info_spawn::child_info_spawn (child_info_types chtype, bool need_subproc_r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cygheap_exec_info *
|
||||||
|
cygheap_exec_info::alloc ()
|
||||||
|
{
|
||||||
|
return (cygheap_exec_info *) ccalloc_abort (HEAP_1_EXEC, 1,
|
||||||
|
sizeof (cygheap_exec_info)
|
||||||
|
+ (nprocs * sizeof (children[0])));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
child_info_spawn::cleanup ()
|
child_info_spawn::cleanup ()
|
||||||
{
|
{
|
||||||
@ -859,7 +867,6 @@ child_info_spawn::cleanup ()
|
|||||||
cfree (moreinfo);
|
cfree (moreinfo);
|
||||||
}
|
}
|
||||||
moreinfo = NULL;
|
moreinfo = NULL;
|
||||||
nchildren = 0;
|
|
||||||
if (ev)
|
if (ev)
|
||||||
{
|
{
|
||||||
CloseHandle (ev);
|
CloseHandle (ev);
|
||||||
@ -877,22 +884,28 @@ child_info_spawn::cleanup ()
|
|||||||
/* Record any non-reaped subprocesses to be passed to about-to-be-execed
|
/* Record any non-reaped subprocesses to be passed to about-to-be-execed
|
||||||
process. FIXME: There is a race here if the process exits while we
|
process. FIXME: There is a race here if the process exits while we
|
||||||
are recording it. */
|
are recording it. */
|
||||||
|
inline void
|
||||||
|
cygheap_exec_info::record_children ()
|
||||||
|
{
|
||||||
|
for (nchildren = 0; nchildren < nprocs; nchildren++)
|
||||||
|
{
|
||||||
|
children[nchildren].pid = procs[nchildren]->pid;
|
||||||
|
children[nchildren].p = procs[nchildren];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
child_info_spawn::record_children ()
|
child_info_spawn::record_children ()
|
||||||
{
|
{
|
||||||
if (type == _CH_EXEC && iscygwin ())
|
if (type == _CH_EXEC && iscygwin ())
|
||||||
for (nchildren = 0; nchildren < nprocs; nchildren++)
|
moreinfo->record_children ();
|
||||||
{
|
|
||||||
children[nchildren].pid = procs[nchildren]->pid;
|
|
||||||
children[nchildren].p = procs[nchildren];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reattach non-reaped subprocesses passed in from the cygwin process
|
/* Reattach non-reaped subprocesses passed in from the cygwin process
|
||||||
which previously operated under this pid. FIXME: Is there a race here
|
which previously operated under this pid. FIXME: Is there a race here
|
||||||
if the process exits during cygwin's exec handoff? */
|
if the process exits during cygwin's exec handoff? */
|
||||||
void
|
inline void
|
||||||
child_info_spawn::reattach_children ()
|
cygheap_exec_info::reattach_children (HANDLE parent)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nchildren; i++)
|
for (int i = 0; i < nchildren; i++)
|
||||||
{
|
{
|
||||||
@ -908,6 +921,12 @@ child_info_spawn::reattach_children ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
child_info_spawn::reattach_children ()
|
||||||
|
{
|
||||||
|
moreinfo->reattach_children (parent);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
child_info::ready (bool execed)
|
child_info::ready (bool execed)
|
||||||
{
|
{
|
||||||
|
@ -354,8 +354,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
|||||||
else
|
else
|
||||||
chtype = _CH_EXEC;
|
chtype = _CH_EXEC;
|
||||||
|
|
||||||
moreinfo = (cygheap_exec_info *) ccalloc_abort (HEAP_1_EXEC, 1,
|
moreinfo = cygheap_exec_info::alloc ();
|
||||||
sizeof (cygheap_exec_info));
|
|
||||||
|
|
||||||
/* CreateProcess takes one long string that is the command line (sigh).
|
/* CreateProcess takes one long string that is the command line (sigh).
|
||||||
We need to quote any argument that has whitespace or embedded "'s. */
|
We need to quote any argument that has whitespace or embedded "'s. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user