1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-17 00:23:25 +00:00

POSIXMQ-RECV takes option o-nonblock

This commit is contained in:
Gerhard Rieger 2025-01-24 17:01:55 +01:00
parent 68f0143f7b
commit 9bf5fc625c
3 changed files with 18 additions and 8 deletions

View file

@ -45,6 +45,7 @@ static int xioopen_posixmq(
int dirs = addrdesc->arg1;
int oneshot = addrdesc->arg2;
bool opt_unlink_early = false;
bool nonblock;
int oflag;
bool opt_o_excl = false;
mode_t opt_mode = 0666;
@ -113,6 +114,8 @@ static int xioopen_posixmq(
case XIO_RDONLY: oflag |= O_RDONLY; break;
case XIO_WRONLY: oflag |= O_WRONLY; break;
}
if (retropt_bool(opts, OPT_O_NONBLOCK, &nonblock) >= 0 && nonblock)
oflag |= O_NONBLOCK;
/* Now open the message queue */
Debug3("mq_open(\"%s\", %d, "F_mode", NULL)", name, oflag, opt_mode);
@ -155,6 +158,8 @@ static int xioopen_posixmq(
do {
struct pollfd pollfd;
if (oflag & O_NONBLOCK)
break;
pollfd.fd = sfd->fd;
pollfd.events = (dirs==XIO_RDONLY?POLLIN:POLLOUT);
if (xiopoll(&pollfd, 1, NULL) > 0) {