diff options
author | Christopher Faylor <me@cgf.cx> | 2003-12-27 17:41:17 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-12-27 17:41:17 +0000 |
commit | e97377932b06f0993df95c7c7877474ec20ff74d (patch) | |
tree | e06f5299ce91c509ac8a34d9aa13226e5206f5e3 /winsup/cygwin/dtable.cc | |
parent | fe861ce9344d7577a909fc2878b2e61483bf6107 (diff) | |
download | cygnal-e97377932b06f0993df95c7c7877474ec20ff74d.tar.gz cygnal-e97377932b06f0993df95c7c7877474ec20ff74d.tar.bz2 cygnal-e97377932b06f0993df95c7c7877474ec20ff74d.zip |
* fhandler.h (fhandler_tty_slave::archetype): Make public.
(report_tty_counts): New macro. Use throughout for reporting tty use counts.
* dtable.cc (dtable::vfork_child_dup): Add debugging output for usecount
increment. Increment open_fhs if appropriate.
(dtable::vfork_parent_restore): "Close" artificially bumped ctty.
(dtable::vfork_child_fixup): Close ctty since it was bumped prior to vfork.
Save open_fhs around close since the closing of these handles has no effect on
the console.
* fhandler_tty.cc (fhandler_tty_slave::open): Reorganize calls to allow for
easier tracking of usecount modification.
(fhandler_tty_slave::open): Ditto.
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r-- | winsup/cygwin/dtable.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index b4c5db0d7..a7095c597 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -31,6 +31,7 @@ details. */ #include "dtable.h" #include "cygheap.h" #include "ntdll.h" +#include "tty.h" static const NO_COPY DWORD std_consts[] = {STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE}; @@ -701,7 +702,11 @@ dtable::vfork_child_dup () /* Remove impersonation */ cygheap->user.deimpersonate (); if (cygheap->ctty) - cygheap->ctty->usecount++; + { + cygheap->ctty->usecount++; + fhandler_console::open_fhs++; + report_tty_counts (cygheap->ctty, "vfork dup", "incremented ", ""); + } for (size_t i = 0; i < size; i++) if (not_open (i)) @@ -737,6 +742,9 @@ 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; } @@ -750,6 +758,7 @@ 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) @@ -764,6 +773,10 @@ 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; |