From 0cc642a5f1b2121b4a451dfcd25fd98384f694c9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 26 Jul 2001 00:10:52 +0000 Subject: * syscalls.cc (setsid): Detach process from its console if the current controlling tty is the console and already closed. * dtable.h (class dtable): Add members to count descriptors referring to the console. * dtable.cc (dtable::dec_console_fds): New function to detach process from its console. (dtable::release): Decrement the counter of console descriptors. (dtable::build_fhandler): Increment it. * exception.cc (ctrl_c_handler): Send SIGTERM to myself when catch CTRL_SHUTDOWN_EVENT. --- winsup/cygwin/dtable.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/dtable.h') diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h index f81d916b7..bfeffa36b 100644 --- a/winsup/cygwin/dtable.h +++ b/winsup/cygwin/dtable.h @@ -1,6 +1,6 @@ /* dtable.h: fd table definition. - Copyright 2000 Red Hat, Inc. + Copyright 2000, 2001 Red Hat, Inc. This file is part of Cygwin. @@ -19,19 +19,26 @@ class dtable fhandler_base **fds_on_hold; int first_fd_for_open; int cnt_need_fixup_before; + int console_fds; public: size_t size; - dtable () : first_fd_for_open(3), cnt_need_fixup_before(0) {} + dtable () : first_fd_for_open(3), cnt_need_fixup_before(0), console_fds(0) {} void init () {first_fd_for_open = 3;} void dec_need_fixup_before () { if (cnt_need_fixup_before > 0) --cnt_need_fixup_before; } void inc_need_fixup_before () - { ++cnt_need_fixup_before; } + { cnt_need_fixup_before++; } BOOL need_fixup_before () { return cnt_need_fixup_before > 0; } + void dec_console_fds (); + void inc_console_fds () + { console_fds++; } + BOOL has_console_fds () + { return console_fds > 0; } + int vfork_child_dup (); void vfork_parent_restore (); void vfork_child_fixup (); -- cgit v1.2.3