diff options
author | Ken Brown <kbrown@cornell.edu> | 2021-05-15 18:38:30 +0300 |
---|---|---|
committer | Ken Brown <kbrown@cornell.edu> | 2021-06-04 19:36:45 +0300 |
commit | e5b69b9018a0c73d14c48caaaa5b507a0f916050 (patch) | |
tree | 72eda7cf83cdb1c548fc2a25922f4b65158b25d7 | |
parent | 83b2ac199dc60a38b00776e29d6516cbf2a1f26c (diff) |
Cygwin: AF_UNIX: new method open_mqueue
This will replace open_pipe.
-rw-r--r-- | winsup/cygwin/fhandler.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket_unix.cc | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index da400704a..050c1ff19 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -14,6 +14,7 @@ details. */ #include <cygwin/_socketflags.h> #include <cygwin/_ucred.h> #include <sys/un.h> +#include <mqueue.h> /* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it properly defines both to be the same. Unfortunately, we have to @@ -1099,6 +1100,7 @@ class fhandler_socket_unix : public fhandler_socket HANDLE create_pipe (bool single_instance); HANDLE create_pipe_instance (); NTSTATUS open_pipe (PUNICODE_STRING pipe_name, bool xchg_sock_info); + mqd_t open_mqueue (const char *mqueue_name, bool nonblocking); int wait_pipe (PUNICODE_STRING pipe_name); int connect_mqueue (const char *mqueue_name); int connect_pipe (PUNICODE_STRING pipe_name); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index b7df31823..5d224befb 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -950,6 +950,15 @@ fhandler_socket_unix::open_pipe (PUNICODE_STRING pipe_name, bool xchg_sock_info) return status; } +mqd_t +fhandler_socket_unix::open_mqueue (const char *mqueue_name, bool nonblocking) +{ + int flags = O_WRONLY; + if (nonblocking) + flags |= O_NONBLOCK; + return mq_open (mqueue_name, flags); +} + struct conn_wait_info_t { fhandler_socket_unix *fh; |