Cygwin: FIFO: stop using overlapped I/O

Make fhandler_fifo a derived class of fhandler_base instead of
fhandler_base_overlapped.

Replace the create_pipe macro, which is based on
fhandler_pipe::create, by new create_pipe and open_pipe methods.
These use NT functions instead of Win32 functions.  Replace fifo_name
by get_pipe_name, which returns a pointer to a UNICODE_STRING.

Remove the fnevent macro, which would now be needed only once.

Add a raw_write method, adapted from fhandler_base::raw_write.

Adapt all functions to the changes above.
This commit is contained in:
Ken Brown
2019-03-22 19:30:36 +00:00
committed by Corinna Vinschen
parent 9fd429e6a7
commit 5955da96e2
2 changed files with 237 additions and 115 deletions

View File

@ -1234,14 +1234,21 @@ public:
}
};
class fhandler_fifo: public fhandler_base_overlapped
#define CYGWIN_FIFO_PIPE_NAME_LEN 47
class fhandler_fifo: public fhandler_base
{
HANDLE read_ready;
HANDLE write_ready;
UNICODE_STRING pipe_name;
WCHAR pipe_name_buf[CYGWIN_FIFO_PIPE_NAME_LEN + 1];
bool __reg2 wait (HANDLE);
char __reg2 *fifo_name (char *, const char *);
NTSTATUS npfs_handle (HANDLE &);
HANDLE create_pipe ();
NTSTATUS open_pipe ();
public:
fhandler_fifo ();
PUNICODE_STRING get_pipe_name ();
int open (int, mode_t);
off_t lseek (off_t offset, int whence);
int close ();
@ -1249,6 +1256,7 @@ public:
bool isfifo () const { return true; }
void set_close_on_exec (bool val);
void __reg3 raw_read (void *ptr, size_t& ulen);
ssize_t __reg3 raw_write (const void *ptr, size_t ulen);
bool arm (HANDLE h);
void fixup_after_fork (HANDLE);
int __reg2 fstatvfs (struct statvfs *buf);
@ -1262,7 +1270,6 @@ public:
{
x->pc.free_strings ();
*reinterpret_cast<fhandler_fifo *> (x) = *this;
reinterpret_cast<fhandler_fifo *> (x)->atomic_write_buf = NULL;
x->reset (this);
}