Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2021-05-08 00:34:17 +0300
committerKen Brown <kbrown@cornell.edu>2021-06-04 19:36:45 +0300
commit92a7d6b53264aae4c43a390c0c608d1a4007ab06 (patch)
treec777d8f18f48e478fdb84cba93dcc64f875dde0f
parentcfed6351b0024415e54da342901df233c3a06e87 (diff)
Cygwin: AF_UNIX: new method peek_mqueue
This will replace peek_pipe.
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_socket_unix.cc11
2 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 6ec71b23b..5a98affce 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1106,6 +1106,7 @@ class fhandler_socket_unix : public fhandler_socket
int connect_mqueue (const char *mqueue_name);
int connect_pipe (PUNICODE_STRING pipe_name);
int listen_pipe ();
+ ssize_t peek_mqueue (char *buf, size_t buflen, bool nonblocking = true);
ULONG peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize, HANDLE evt);
int disconnect_pipe (HANDLE ph);
/* The NULL pointer check is required for FS methods like fstat. When
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 20fb3ab2f..bf81892ca 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -1105,6 +1105,17 @@ fhandler_socket_unix::listen_pipe ()
return ret;
}
+ssize_t
+fhandler_socket_unix::peek_mqueue (char *buf, size_t buflen, bool nonblocking)
+{
+ if (get_mqd_in () == (mqd_t) -1)
+ {
+ /* FIXME: Set appropriate errno. */
+ return -1;
+ }
+ return _mq_peek (get_mqd_in (), buf, buflen, nonblocking);
+}
+
ULONG
fhandler_socket_unix::peek_pipe (PFILE_PIPE_PEEK_BUFFER pbuf, ULONG psize,
HANDLE evt)