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 18:35:02 +0300
committerKen Brown <kbrown@cornell.edu>2021-06-04 19:36:45 +0300
commitd9b2b638306369a2398eb3341f001418de335e8a (patch)
tree1dbfa13c0065e71d3517219ccab161a1d6d5b4f3
parent9e3a04efb616b6e10019e27ff68245e20857a61a (diff)
Cygwin: AF_UNIX: new helper function set_mqueue_non_blocking
This will replace set_pipe_non_blocking.
-rw-r--r--winsup/cygwin/fhandler_socket_unix.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 4d5026605..875ad98fb 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -594,6 +594,23 @@ fhandler_socket_unix::get_type_char ()
}
}
+/* Returns error code, but callers don't check it. */
+static int
+set_mqueue_non_blocking (mqd_t mqd, bool nonblocking)
+{
+ struct mq_attr attr;
+
+ if (mq_getattr (mqd, &attr) < 0)
+ return get_errno ();
+ if (nonblocking)
+ attr.mq_flags |= O_NONBLOCK;
+ else
+ attr.mq_flags &= ~O_NONBLOCK;
+ if (mq_setattr (mqd, &attr, NULL) < 0)
+ return get_errno ();
+ return 0;
+}
+
/* This also sets the pipe to message mode unconditionally. */
void
fhandler_socket_unix::set_pipe_non_blocking (bool nonblocking)