[PATCH] Cygwin: FIFO: use FILE_PIPE_REJECT_REMOTE_CLIENTS flag

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Cygwin: FIFO: use FILE_PIPE_REJECT_REMOTE_CLIENTS flag

Ken Brown-6
Add that flag to the pipe type argument when creating the Windows
named pipe.  And add a definition of that flag to ntdll.h (copied from
/usr/include/w32api/ddk/ntifs.h).
---
 winsup/cygwin/fhandler_fifo.cc | 3 ++-
 winsup/cygwin/ntdll.h          | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index 92797ce60..fd8223000 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -184,7 +184,8 @@ fhandler_fifo::create_pipe_instance (bool first)
   timeout.QuadPart = -500000;
   status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing,
   first ? FILE_CREATE : FILE_OPEN, 0,
-  FILE_PIPE_MESSAGE_TYPE,
+  FILE_PIPE_MESSAGE_TYPE
+    | FILE_PIPE_REJECT_REMOTE_CLIENTS,
   FILE_PIPE_MESSAGE_MODE,
   nonblocking, max_instances,
   DEFAULT_PIPEBUFSIZE, DEFAULT_PIPEBUFSIZE,
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index e19cc8ab5..1c07d0255 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -557,7 +557,8 @@ enum
 enum
 {
   FILE_PIPE_BYTE_STREAM_TYPE = 0,
-  FILE_PIPE_MESSAGE_TYPE = 1
+  FILE_PIPE_MESSAGE_TYPE = 1,
+  FILE_PIPE_REJECT_REMOTE_CLIENTS = 2
 };
 
 typedef struct _FILE_PIPE_PEEK_BUFFER {
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Cygwin: FIFO: use FILE_PIPE_REJECT_REMOTE_CLIENTS flag

Corinna Vinschen-2
On Dec 21 23:01, Ken Brown wrote:

> Add that flag to the pipe type argument when creating the Windows
> named pipe.  And add a definition of that flag to ntdll.h (copied from
> /usr/include/w32api/ddk/ntifs.h).
> ---
>  winsup/cygwin/fhandler_fifo.cc | 3 ++-
>  winsup/cygwin/ntdll.h          | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
> index 92797ce60..fd8223000 100644
> --- a/winsup/cygwin/fhandler_fifo.cc
> +++ b/winsup/cygwin/fhandler_fifo.cc
> @@ -184,7 +184,8 @@ fhandler_fifo::create_pipe_instance (bool first)
>    timeout.QuadPart = -500000;
>    status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing,
>    first ? FILE_CREATE : FILE_OPEN, 0,
> -  FILE_PIPE_MESSAGE_TYPE,
> +  FILE_PIPE_MESSAGE_TYPE
> +    | FILE_PIPE_REJECT_REMOTE_CLIENTS,
>    FILE_PIPE_MESSAGE_MODE,
>    nonblocking, max_instances,
>    DEFAULT_PIPEBUFSIZE, DEFAULT_PIPEBUFSIZE,
> diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
> index e19cc8ab5..1c07d0255 100644
> --- a/winsup/cygwin/ntdll.h
> +++ b/winsup/cygwin/ntdll.h
> @@ -557,7 +557,8 @@ enum
>  enum
>  {
>    FILE_PIPE_BYTE_STREAM_TYPE = 0,
> -  FILE_PIPE_MESSAGE_TYPE = 1
> +  FILE_PIPE_MESSAGE_TYPE = 1,
> +  FILE_PIPE_REJECT_REMOTE_CLIENTS = 2
>  };
>  
>  typedef struct _FILE_PIPE_PEEK_BUFFER {
> --
> 2.21.0
Thanks, please push.


Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment