Add ability to handle named pipes. This should be all that is
authorChris Hanson <org/chris-hanson/cph>
Sat, 25 Oct 1997 07:40:26 +0000 (07:40 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 25 Oct 1997 07:40:26 +0000 (07:40 +0000)
necessary to manage the client side of a named pipe.

v7/src/microcode/ntio.c
v7/src/microcode/ntio.h
v7/src/microcode/osio.h

index d69a23d33d8971912a368cccae2f1f67eaee56bc..bb0fe41be5b920627e6174a31961672c11c81359 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: ntio.c,v 1.18 1997/10/24 07:24:56 cph Exp $
+$Id: ntio.c,v 1.19 1997/10/25 07:40:21 cph Exp $
 
 Copyright (c) 1992-97 Massachusetts Institute of Technology
 
@@ -46,7 +46,8 @@ MIT in each case. */
 channel_class_t * NT_channel_class_generic;
 channel_class_t * NT_channel_class_file;
 channel_class_t * NT_channel_class_screen;
-channel_class_t * NT_channel_class_pipe;
+channel_class_t * NT_channel_class_anonymous_pipe;
+channel_class_t * NT_channel_class_named_pipe;
 
 static Tchannel channel_allocate (void);
 static long cooked_channel_write (Tchannel, const void *, unsigned long) ;
@@ -80,11 +81,14 @@ NT_handle_channel_class (HANDLE handle)
 {
   if (Screen_IsScreenHandle (handle))
     return (NT_channel_class_screen);
+  /* If GetFileType returns FILE_TYPE_PIPE, assume that it is a named
+     pipe.  This procedure won't be called with an anonymous-pipe
+     handle.  */
   switch (GetFileType (handle))
     {
     case FILE_TYPE_DISK: return (NT_channel_class_file);
-    case FILE_TYPE_PIPE: return (NT_channel_class_pipe);
     case FILE_TYPE_CHAR: return (NT_channel_class_generic);
+    case FILE_TYPE_PIPE: return (NT_channel_class_named_pipe);
     default: return (NT_channel_class_generic);
     }
 }
@@ -340,11 +344,11 @@ OS_make_pipe (Tchannel * readerp, Tchannel * writerp)
   STD_BOOL_API_CALL (CreatePipe, ((&hread), (&hwrite), 0, 0));
   transaction_begin ();
   NT_handle_close_on_abort (hwrite);
-  (*readerp) = (NT_make_channel (hread, NT_channel_class_pipe));
+  (*readerp) = (NT_make_channel (hread, NT_channel_class_anonymous_pipe));
   transaction_commit ();
   transaction_begin ();
   OS_channel_close_on_abort (*readerp);
-  (*writerp) = (NT_make_channel (hwrite, NT_channel_class_pipe));
+  (*writerp) = (NT_make_channel (hwrite, NT_channel_class_anonymous_pipe));
   transaction_commit ();
 }
 
@@ -378,15 +382,24 @@ pipe_channel_n_read (Tchannel channel)
 }
 
 static void
-initialize_channel_class_pipe (void)
+initialize_channel_class_anonymous_pipe (void)
 {
   channel_class_t * class = (OS_malloc (sizeof (channel_class_t)));
-  (CHANNEL_CLASS_TYPE (class)) = channel_type_win32_pipe;
+  (CHANNEL_CLASS_TYPE (class)) = channel_type_win32_anonymous_pipe;
   (CHANNEL_CLASS_OP_READ (class)) = pipe_channel_read;
   (CHANNEL_CLASS_OP_WRITE (class)) = generic_channel_write;
   (CHANNEL_CLASS_OP_CLOSE (class)) = generic_channel_close;
   (CHANNEL_CLASS_OP_N_READ (class)) = pipe_channel_n_read;
-  NT_channel_class_pipe = class;
+  NT_channel_class_anonymous_pipe = class;
+}
+
+static void
+initialize_channel_class_named_pipe (void)
+{
+  channel_class_t * class = (OS_malloc (sizeof (channel_class_t)));
+  (*class) = (*NT_channel_class_anonymous_pipe);
+  (CHANNEL_CLASS_TYPE (class)) = channel_type_win32_named_pipe;
+  NT_channel_class_named_pipe = class;
 }
 \f
 static long
@@ -647,5 +660,6 @@ NT_initialize_channels (void)
   initialize_channel_class_generic ();
   initialize_channel_class_file ();
   initialize_channel_class_screen ();
-  initialize_channel_class_pipe ();
+  initialize_channel_class_anonymous_pipe ();
+  initialize_channel_class_named_pipe ();
 }
index 52646ff13d90d9436e687fd2c189acbf169fb46a..d345563023c05bbaa8bebaaeacb70b88c2dc4edc 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: ntio.h,v 1.9 1997/10/24 07:25:01 cph Exp $
+$Id: ntio.h,v 1.10 1997/10/25 07:40:26 cph Exp $
 
 Copyright (c) 1992-97 Massachusetts Institute of Technology
 
@@ -87,7 +87,8 @@ extern channel_class_t * NT_channel_class_generic;
 extern channel_class_t * NT_channel_class_file;
 extern channel_class_t * NT_channel_class_screen;
 extern channel_class_t * NT_channel_class_console;
-extern channel_class_t * NT_channel_class_pipe;
+extern channel_class_t * NT_channel_class_anonymous_pipe;
+extern channel_class_t * NT_channel_class_named_pipe;
 extern struct channel * NT_channel_table;
 
 extern Tchannel NT_make_channel (HANDLE, channel_class_t *);
index 7a34a7532fc8156241dde76ca85901f9a81f0d90..6d505c53f457638d81ed5d8710e223156d20e9b9 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: osio.h,v 1.12 1997/01/01 22:57:34 cph Exp $
+$Id: osio.h,v 1.13 1997/10/25 07:40:15 cph Exp $
 
 Copyright (c) 1990-97 Massachusetts Institute of Technology
 
@@ -55,8 +55,8 @@ enum channel_type
   channel_type_os2_console,
   channel_type_os2_unnamed_pipe,
   channel_type_os2_named_pipe,
-  channel_type_win32_char,
-  channel_type_win32_pipe
+  channel_type_win32_anonymous_pipe,
+  channel_type_win32_named_pipe
 };
 
 extern size_t OS_channel_table_size;