public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: FIFO: remember the type of the fhandler
@ 2019-04-16 11:15 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-04-16 11:15 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=164378951757bb4bd5554c9034fb97cf1649cbeb
commit 164378951757bb4bd5554c9034fb97cf1649cbeb
Author: Ken Brown <kbrown@cornell.edu>
Date: Sun Apr 14 19:15:57 2019 +0000
Cygwin: FIFO: remember the type of the fhandler
Add data members 'reader', 'writer', and 'duplexer' to the
fhandler_fifo class. Set them in fhandler_fifo::open. ('duplexer'
replaces the previous '_duplexer'.)
This will be useful in later commits.
Diff:
---
winsup/cygwin/fhandler.h | 2 +-
winsup/cygwin/fhandler_fifo.cc | 14 ++++----------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 2898db4..59d9dad 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1272,7 +1272,7 @@ class fhandler_fifo: public fhandler_base
fifo_client_handler fc_handler[MAX_CLIENTS];
int nhandlers, nconnected;
af_unix_spinlock_t _fifo_client_lock;
- bool _duplexer;
+ bool reader, writer, duplexer;
bool __reg2 wait (HANDLE);
NTSTATUS npfs_handle (HANDLE &);
HANDLE create_pipe_instance (bool);
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index 70551eb..258c3cf 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -33,7 +33,7 @@ STATUS_PIPE_EMPTY simply means there's no data to be read. */
fhandler_fifo::fhandler_fifo ():
fhandler_base (), read_ready (NULL), write_ready (NULL),
listen_client_thr (NULL), lct_termination_evt (NULL), nhandlers (0),
- nconnected (0), _duplexer (false)
+ nconnected (0), reader (false), writer (false), duplexer (false)
{
pipe_name_buf[0] = L'\0';
need_fork_fixup (true);
@@ -224,7 +224,7 @@ fhandler_fifo::create_pipe_instance (bool first)
}
access = GENERIC_READ | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES
| SYNCHRONIZE;
- if (first && _duplexer)
+ if (first && duplexer)
access |= GENERIC_WRITE;
sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
hattr = OBJ_INHERIT;
@@ -421,25 +421,19 @@ fhandler_fifo::open (int flags, mode_t)
error_errno_set,
error_set_errno
} res;
- bool reader, writer, duplexer;
/* Determine what we're doing with this fhandler: reading, writing, both */
switch (flags & O_ACCMODE)
{
case O_RDONLY:
reader = true;
- writer = false;
- duplexer = false;
break;
case O_WRONLY:
writer = true;
- reader = false;
- duplexer = false;
break;
case O_RDWR:
reader = true;
- writer = false;
- duplexer = _duplexer = true;
+ duplexer = true;
break;
default:
set_errno (EINVAL);
@@ -769,7 +763,7 @@ fhandler_fifo::raw_read (void *in_ptr, size_t& len)
fifo_client_unlock ();
goto errout;
}
- else if (nread == 0 && (!_duplexer || i > 0))
+ else if (nread == 0 && (!duplexer || i > 0))
/* Client has disconnected. */
{
fc_handler[i].state = fc_invalid;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-16 11:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 11:15 [newlib-cygwin] Cygwin: FIFO: remember the type of the fhandler Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).