Move open_fhs from fhandler.h to cygheap.h for easier tracking. Accommodate
this change throughout. * dtable.cc (dtable::add_archetype): Use correct count when iterating through *active* archetypes. * dtable.cc (dtable::fixup_after_exec): Close handle if close_on_exec and archetype exists since archetype currently does not set windows close-on-exec flag (FIXME). * fhandler_tty.cc (fhandler_tty_slave::open): Change debugging output slightly. (fhandler_tty_slave::close): Ditto. (fhandler_tty_slave::fixup_after_fork): Just report on inherited use counts since since archetype currently does not set windows close-on-exec flag (FIXME). * pinfo.cc (_pinfo::set_ctty): Change debugging output slightly. * cygheap.cc (cygheap_init): Remove open_fhs accommodation and use count reporting. * perthread.h (vfork_save::fhctty): New element. * perthread.h (vfork_save::open_fhs): New element. * fork.cc (vfork): Muck around with ctty and open_fhs stuff, both of which are now saved in the vfork_save structure.
This commit is contained in:
@@ -186,10 +186,10 @@ dtable::add_archetype ()
|
||||
void
|
||||
dtable::delete_archetype (fhandler_base *fh)
|
||||
{
|
||||
for (unsigned i = 0; i < narchetypes; i++)
|
||||
for (unsigned i = 0; i < farchetype; i++)
|
||||
if (fh == archetypes[i])
|
||||
{
|
||||
debug_printf ("deleting archive element %d for %s", i, fh->get_name ());
|
||||
debug_printf ("deleting element %d for %s", i, fh->get_name ());
|
||||
if (i < --farchetype)
|
||||
archetypes[i] = archetypes[farchetype];
|
||||
break;
|
||||
@@ -660,7 +660,11 @@ dtable::fixup_after_exec (HANDLE parent)
|
||||
{
|
||||
fh->clear_readahead ();
|
||||
if (fh->get_close_on_exec ())
|
||||
release (i);
|
||||
{
|
||||
if (fh->archetype)
|
||||
fh->close ();
|
||||
release (i);
|
||||
}
|
||||
else
|
||||
{
|
||||
fh->fixup_after_exec (parent);
|
||||
@@ -704,7 +708,7 @@ dtable::vfork_child_dup ()
|
||||
if (cygheap->ctty)
|
||||
{
|
||||
cygheap->ctty->usecount++;
|
||||
fhandler_console::open_fhs++;
|
||||
cygheap->open_fhs++;
|
||||
report_tty_counts (cygheap->ctty, "vfork dup", "incremented ", "");
|
||||
}
|
||||
|
||||
@@ -742,9 +746,6 @@ dtable::vfork_parent_restore ()
|
||||
fds_on_hold = NULL;
|
||||
cfree (deleteme);
|
||||
|
||||
if (cygheap->ctty)
|
||||
cygheap->ctty->close ();
|
||||
|
||||
ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "restore");
|
||||
return;
|
||||
}
|
||||
@@ -758,7 +759,6 @@ dtable::vfork_child_fixup ()
|
||||
fhandler_base **saveme = fds;
|
||||
fds = fds_on_hold;
|
||||
|
||||
int old_open_fhs = fhandler_console::open_fhs;
|
||||
fhandler_base *fh;
|
||||
for (int i = 0; i < (int) size; i++)
|
||||
if ((fh = fds[i]) != NULL)
|
||||
@@ -773,10 +773,6 @@ dtable::vfork_child_fixup ()
|
||||
}
|
||||
}
|
||||
|
||||
fhandler_console::open_fhs = old_open_fhs;
|
||||
if (cygheap->ctty)
|
||||
cygheap->ctty->close ();
|
||||
|
||||
fds = saveme;
|
||||
cfree (fds_on_hold);
|
||||
fds_on_hold = NULL;
|
||||
|
Reference in New Issue
Block a user