Revert 2005-05-30 close_all_files changes.

* spawn.cc (spawn_guts): When execing, close all files after the child has
synced with us.
This commit is contained in:
Christopher Faylor 2005-06-02 02:36:50 +00:00
parent 5ac6edefaf
commit f9fb1149d5
9 changed files with 18 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2005-06-01 Christopher Faylor <cgf@timesys.com>
Revert 2005-05-30 close_all_files changes.
* spawn.cc (spawn_guts): When execing, close all files after the child
has synced with us.
2005-06-01 Christopher Faylor <cgf@timesys.com>
* fhandler_disk_file.cc (fhandler_disk_file::fchown): Make sure that

View File

@ -61,7 +61,10 @@ cygheap_fixup_in_child (bool execed)
_csbrk ((char *) child_proc_info->cygheap_max - (char *) cygheap);
child_copy (child_proc_info->parent, child_proc_info->dwProcessId, "cygheap", cygheap, cygheap_max);
if (execed)
CloseHandle (child_proc_info->parent);
{
CloseHandle (child_proc_info->parent);
child_proc_info->parent = NULL;
}
cygheap_init ();
debug_fixup_after_fork_exec ();

View File

@ -1030,7 +1030,7 @@ do_exit (int status)
if (exit_state < ES_CLOSEALL)
{
exit_state = ES_CLOSEALL;
close_all_files (false);
close_all_files ();
}
if (exit_state < ES_SIGPROCTERMINATE)

View File

@ -766,7 +766,7 @@ dtable::vfork_parent_restore ()
lock ();
fhandler_tty_slave *ctty_on_hold = cygheap->ctty_on_hold;
close_all_files (false);
close_all_files ();
fhandler_base **deleteme = fds;
fds = fds_on_hold;
fds_on_hold = NULL;

View File

@ -84,7 +84,7 @@ public:
fhandler_base **add_archetype ();
void delete_archetype (fhandler_base *);
friend void dtable_init ();
friend void __stdcall close_all_files (bool);
friend void __stdcall close_all_files ();
friend class cygheap_fdmanip;
friend class cygheap_fdget;
friend class cygheap_fdnew;

View File

@ -82,7 +82,7 @@ enum query_state {
class fhandler_base
{
friend class dtable;
friend void close_all_files (bool);
friend void close_all_files ();
struct status_flags
{

View File

@ -796,7 +796,6 @@ spawn_guts (const char * prog_arg, const char *const *argv,
myself.hProcess = hExeced = pi.hProcess;
strcpy (myself->progname, real_path); // FIXME: race?
sigproc_printf ("new process name %s", myself->progname);
close_all_files (true);
/* If wr_proc_pipe doesn't exist then this process was not started by a cygwin
process. So, we need to wait around until the process we've just "execed"
dies. Use our own wait facility to wait for our own pid to exit (there
@ -865,6 +864,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
switch (mode)
{
case _P_OVERLAY:
close_all_files ();
if (!synced)
/* let myself.exit handle this */;
else if (myself->wr_proc_pipe)

View File

@ -94,7 +94,7 @@ static int __stdcall stat_worker (const char *name, struct __stat64 *buf,
ensure we don't leave any such files lying around. */
void __stdcall
close_all_files (bool keep_table)
close_all_files ()
{
cygheap->fdtab.lock ();
@ -106,8 +106,7 @@ close_all_files (bool keep_table)
debug_printf ("closing fd %d", i);
#endif
fh->close ();
if (!keep_table)
cygheap->fdtab.release (i);
cygheap->fdtab.release (i);
}
if (cygheap->ctty)

View File

@ -221,7 +221,7 @@ void uinfo_init (void);
void events_init (void);
void events_terminate (void);
void __stdcall close_all_files (bool);
void __stdcall close_all_files ();
/* Globals that handle initialization of winsock in a child process. */
extern HANDLE wsock32_handle;