summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_tty.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-12-27 17:41:17 +0000
committerChristopher Faylor <me@cgf.cx>2003-12-27 17:41:17 +0000
commite97377932b06f0993df95c7c7877474ec20ff74d (patch)
treee06f5299ce91c509ac8a34d9aa13226e5206f5e3 /winsup/cygwin/fhandler_tty.cc
parentfe861ce9344d7577a909fc2878b2e61483bf6107 (diff)
downloadcygnal-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/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index ff1d48f24..69d03a9e3 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -601,9 +601,8 @@ fhandler_tty_slave::open (int flags, mode_t)
out:
usecount = 0;
archetype->usecount++;
+ report_tty_counts (this, "opened", "incremented ", "");
myself->set_ctty (get_ttyp (), flags, arch);
- termios_printf ("%s opened, incremented open_fhs %d, archetype usecount %d",
- pc.dev.name, fhandler_console::open_fhs, archetype->usecount);
return 1;
}
@@ -613,9 +612,11 @@ fhandler_tty_slave::close ()
{
if (!--fhandler_console::open_fhs && myself->ctty == -1)
FreeConsole ();
- termios_printf ("decremented open_fhs %d, archetype usecount %d",
- fhandler_console::open_fhs, archetype->usecount);
- if (--archetype->usecount)
+
+ archetype->usecount--;
+ report_tty_counts (this, "closed", "decremented ", "");
+
+ if (archetype->usecount)
{
#ifdef DEBUGGING
if (archetype->usecount < 0)
@@ -909,14 +910,13 @@ fhandler_tty_slave::read (void *ptr, size_t& len)
int
fhandler_tty_slave::dup (fhandler_base *child)
{
- fhandler_console::open_fhs++;
fhandler_tty_slave *arch = (fhandler_tty_slave *) archetype;
*(fhandler_tty_slave *) child = *arch;
- arch->usecount++;
child->usecount = 0;
+ arch->usecount++;
+ fhandler_console::open_fhs++;
+ report_tty_counts (child, "duped", "incremented ", "");
myself->set_ctty (get_ttyp (), openflags, arch);
- termios_printf ("incremented open_fhs %d, archetype usecount %d",
- fhandler_console::open_fhs, archetype->usecount);
return 0;
}