Cygwin: FIFO: add support for the duplex case

If a FIFO is opened with O_RDWR access, create the pipe with
read/write access, and make the first client have the handle of that
pipe as its I/O handle.

Adjust fhandler_fifo::raw_read to account for the result of trying to
read from that client if there's no data.
This commit is contained in:
Ken Brown
2019-03-25 23:06:10 +00:00
committed by Corinna Vinschen
parent 40db74128a
commit a137da74ba
2 changed files with 73 additions and 11 deletions

View File

@ -1253,6 +1253,10 @@ struct fifo_client_handler
HANDLE dummy_evt; /* Never signaled. */
fifo_client_handler () : fh (NULL), state (fc_unknown), connect_evt (NULL),
dummy_evt (NULL) {}
fifo_client_handler (fhandler_base *_fh, fifo_client_connect_state _state,
HANDLE _connect_evt, HANDLE _dummy_evt)
: fh (_fh), state (_state), connect_evt (_connect_evt),
dummy_evt (_dummy_evt) {}
int connect ();
int close ();
};
@ -1268,6 +1272,7 @@ class fhandler_fifo: public fhandler_base
fifo_client_handler client[MAX_CLIENTS];
int nclients, nconnected;
af_unix_spinlock_t _fifo_client_lock;
bool _duplexer;
bool __reg2 wait (HANDLE);
NTSTATUS npfs_handle (HANDLE &);
HANDLE create_pipe_instance (bool);