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.
This commit is contained in:
parent
5281699926
commit
1643789517
|
@ -1272,7 +1272,7 @@ class fhandler_fifo: public fhandler_base
|
||||||
fifo_client_handler fc_handler[MAX_CLIENTS];
|
fifo_client_handler fc_handler[MAX_CLIENTS];
|
||||||
int nhandlers, nconnected;
|
int nhandlers, nconnected;
|
||||||
af_unix_spinlock_t _fifo_client_lock;
|
af_unix_spinlock_t _fifo_client_lock;
|
||||||
bool _duplexer;
|
bool reader, writer, duplexer;
|
||||||
bool __reg2 wait (HANDLE);
|
bool __reg2 wait (HANDLE);
|
||||||
NTSTATUS npfs_handle (HANDLE &);
|
NTSTATUS npfs_handle (HANDLE &);
|
||||||
HANDLE create_pipe_instance (bool);
|
HANDLE create_pipe_instance (bool);
|
||||||
|
|
|
@ -33,7 +33,7 @@ STATUS_PIPE_EMPTY simply means there's no data to be read. */
|
||||||
fhandler_fifo::fhandler_fifo ():
|
fhandler_fifo::fhandler_fifo ():
|
||||||
fhandler_base (), read_ready (NULL), write_ready (NULL),
|
fhandler_base (), read_ready (NULL), write_ready (NULL),
|
||||||
listen_client_thr (NULL), lct_termination_evt (NULL), nhandlers (0),
|
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';
|
pipe_name_buf[0] = L'\0';
|
||||||
need_fork_fixup (true);
|
need_fork_fixup (true);
|
||||||
|
@ -224,7 +224,7 @@ fhandler_fifo::create_pipe_instance (bool first)
|
||||||
}
|
}
|
||||||
access = GENERIC_READ | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES
|
access = GENERIC_READ | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES
|
||||||
| SYNCHRONIZE;
|
| SYNCHRONIZE;
|
||||||
if (first && _duplexer)
|
if (first && duplexer)
|
||||||
access |= GENERIC_WRITE;
|
access |= GENERIC_WRITE;
|
||||||
sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
hattr = OBJ_INHERIT;
|
hattr = OBJ_INHERIT;
|
||||||
|
@ -421,25 +421,19 @@ fhandler_fifo::open (int flags, mode_t)
|
||||||
error_errno_set,
|
error_errno_set,
|
||||||
error_set_errno
|
error_set_errno
|
||||||
} res;
|
} res;
|
||||||
bool reader, writer, duplexer;
|
|
||||||
|
|
||||||
/* Determine what we're doing with this fhandler: reading, writing, both */
|
/* Determine what we're doing with this fhandler: reading, writing, both */
|
||||||
switch (flags & O_ACCMODE)
|
switch (flags & O_ACCMODE)
|
||||||
{
|
{
|
||||||
case O_RDONLY:
|
case O_RDONLY:
|
||||||
reader = true;
|
reader = true;
|
||||||
writer = false;
|
|
||||||
duplexer = false;
|
|
||||||
break;
|
break;
|
||||||
case O_WRONLY:
|
case O_WRONLY:
|
||||||
writer = true;
|
writer = true;
|
||||||
reader = false;
|
|
||||||
duplexer = false;
|
|
||||||
break;
|
break;
|
||||||
case O_RDWR:
|
case O_RDWR:
|
||||||
reader = true;
|
reader = true;
|
||||||
writer = false;
|
duplexer = true;
|
||||||
duplexer = _duplexer = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
|
@ -769,7 +763,7 @@ fhandler_fifo::raw_read (void *in_ptr, size_t& len)
|
||||||
fifo_client_unlock ();
|
fifo_client_unlock ();
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
else if (nread == 0 && (!_duplexer || i > 0))
|
else if (nread == 0 && (!duplexer || i > 0))
|
||||||
/* Client has disconnected. */
|
/* Client has disconnected. */
|
||||||
{
|
{
|
||||||
fc_handler[i].state = fc_invalid;
|
fc_handler[i].state = fc_invalid;
|
||||||
|
|
Loading…
Reference in New Issue