From fb4b5424835170d1437ac187038e07b4ed6f0199 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 6 Jan 1995 00:02:36 +0000 Subject: [PATCH] Set the NOINHERIT bit in all channels, so that the handles associated with those channels will not be inherited by subprocesses. The subprocess support will disable the bit in those channels that want to be inherited. --- v7/src/microcode/os2io.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/v7/src/microcode/os2io.c b/v7/src/microcode/os2io.c index 25ab024be..946623ea4 100644 --- a/v7/src/microcode/os2io.c +++ b/v7/src/microcode/os2io.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: os2io.c,v 1.2 1994/12/19 22:31:30 cph Exp $ +$Id: os2io.c,v 1.3 1995/01/06 00:02:36 cph Exp $ -Copyright (c) 1994 Massachusetts Institute of Technology +Copyright (c) 1994-95 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -39,6 +39,7 @@ extern void OS2_initialize_console_channel (Tchannel); extern void OS2_initialize_pipe_channel (Tchannel); static enum channel_type handle_channel_type (LHANDLE); +static void handle_noinherit (LHANDLE); size_t OS_channel_table_size; struct channel * OS2_channel_table; @@ -97,6 +98,7 @@ OS2_make_channel (LHANDLE handle, unsigned int mode) channel += 1; } type = (handle_channel_type (handle)); + handle_noinherit (handle); (CHANNEL_HANDLE (channel)) = handle; (CHANNEL_TYPE (channel)) = type; (CHANNEL_OPEN (channel)) = 1; @@ -158,6 +160,20 @@ handle_channel_type (LHANDLE handle) OS2_error_anonymous (); return (channel_type_unknown); } + +static void +handle_noinherit (LHANDLE handle) +{ + ULONG state; + STD_API_CALL (dos_query_fh_state, (handle, (& state))); + /* Magic mask 0xFF88 zeroes out high bits and two fields + required to be zero by the spec. When testing, the high + bits were not zero, and this caused the system call to + complain. */ + state &= 0xFF88; + STD_API_CALL + (dos_set_fh_state, (handle, (state | OPEN_FLAGS_NOINHERIT))); +} void OS_channel_close (Tchannel channel) -- 2.25.1