* debug.cc (mark_closed): Rename from debug_mark_closed and make static.

(setclexec_pid): New function for marking saved handle as close-on-exec.
(delete_handle): New function.
(debug_fixup_after_fork): New function.
* debug.h: Declare new functions, remove obsolete ones.
* fork.cc (debug_fixup_after_fork): Call to cleanup close-on-exec handles.
* fhandler.cc (fhandler_disk_file::close): Minor reorg.
(fhandler_base::set_inheritance): Set flag appropriately for debugging when
close-on-exec so forked process can delete closed handles.
* tty.h (open_output_mutex): Eliminate unneeded argument.
(open_input_mutex): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): reflect open_*_mutex argument
changes.
* fhandler.h (fhandler_socket): Make saw_shutdown_* functions type bool.
* tty.cc (tty::get_event): Eliminate unneeded argument.
(tty::common_init): Reflect change to get_event.  Events should always be
inherited.
This commit is contained in:
Christopher Faylor
2001-09-01 05:17:34 +00:00
parent a26a4cdbe0
commit e62ac9e869
9 changed files with 95 additions and 44 deletions

View File

@@ -327,13 +327,13 @@ tty::init (void)
}
HANDLE
tty::get_event (const char *fmt, BOOL inherit, BOOL manual_reset)
tty::get_event (const char *fmt, BOOL manual_reset)
{
HANDLE hev;
char buf[40];
__small_sprintf (buf, fmt, ntty);
if (!(hev = CreateEvent (inherit ? &sec_all : &sec_all_nih, manual_reset, FALSE, buf)))
if (!(hev = CreateEvent (&sec_all, manual_reset, FALSE, buf)))
{
termios_printf ("couldn't create %s", buf);
set_errno (ENOENT); /* FIXME this can't be the right errno */
@@ -406,15 +406,15 @@ tty::common_init (fhandler_pty_master *ptym)
}
else
{
if (!(ptym->output_done_event = get_event (OUTPUT_DONE_EVENT, FALSE)))
if (!(ptym->output_done_event = get_event (OUTPUT_DONE_EVENT)))
return FALSE;
if (!(ptym->ioctl_done_event = get_event (IOCTL_DONE_EVENT, FALSE)))
if (!(ptym->ioctl_done_event = get_event (IOCTL_DONE_EVENT)))
return FALSE;
if (!(ptym->ioctl_request_event = get_event (IOCTL_REQUEST_EVENT, FALSE)))
if (!(ptym->ioctl_request_event = get_event (IOCTL_REQUEST_EVENT)))
return FALSE;
}
if (!(ptym->input_available_event = get_event (INPUT_AVAILABLE_EVENT, FALSE, TRUE)))
if (!(ptym->input_available_event = get_event (INPUT_AVAILABLE_EVENT, TRUE)))
return FALSE;
char buf[40];