mirror of
https://repo.or.cz/socat.git
synced 2025-06-11 03:56:51 +00:00
POSIXMQ-RECV takes option o-nonblock
This commit is contained in:
parent
68f0143f7b
commit
9bf5fc625c
3 changed files with 18 additions and 8 deletions
4
CHANGES
4
CHANGES
|
@ -41,6 +41,10 @@ Corrections:
|
|||
input lines. Changed Socat to explicitly print the newline in this
|
||||
case.
|
||||
|
||||
Features:
|
||||
POSIXMQ-RECV now takes option o-nonblock; this, in combination with -T,
|
||||
makes it possible to terminate Socat in case the queue is empty.
|
||||
|
||||
Building:
|
||||
Disabling certain features during configure could break build process.
|
||||
|
||||
|
|
17
doc/socat.yo
17
doc/socat.yo
|
@ -332,7 +332,7 @@ label(ADDRESS_DCCP_CONNECT)dit(bf(tt(DCCP-CONNECT:<host>:<port>)) (bf(tt(DCCP:<h
|
|||
link(connect-timeout)(OPTION_CONNECT_TIMEOUT),
|
||||
link(tos)(OPTION_TOS),
|
||||
link(dccp-set-ccid)(OPTION_DCCP_SET_CCID),
|
||||
link(nonblock)(OPTION_NONBLOCK),
|
||||
link(nonblock)(OPTION_O_NONBLOCK),
|
||||
link(sourceport)(OPTION_SOURCEPORT),
|
||||
link(retry)(OPTION_RETRY),
|
||||
link(readbytes)(OPTION_READBYTES)nl()
|
||||
|
@ -747,7 +747,7 @@ label(ADDRESS_NAMED_PIPE)dit(bf(tt(PIPE:<filename>)))
|
|||
Option groups: link(FD)(GROUP_FD),link(NAMED)(GROUP_NAMED),link(OPEN)(GROUP_OPEN) nl()
|
||||
Useful options:
|
||||
link(rdonly)(OPTION_RDONLY),
|
||||
link(nonblock)(OPTION_NONBLOCK),
|
||||
link(nonblock)(OPTION_O_NONBLOCK),
|
||||
link(group)(OPTION_GROUP),
|
||||
link(user)(OPTION_USER),
|
||||
link(mode)(OPTION_MODE),
|
||||
|
@ -784,7 +784,8 @@ label(ADDRESS_POSIXMQ_READ)dit(bf(tt(POSIXMQ-READ:/<mqueue>)))
|
|||
Useful options:
|
||||
link(posixmq-priority)(OPTION_POSIXMQ_PRIORITY),
|
||||
link(unlink-early)(OPTION_UNLINK_EARLY),
|
||||
link(unlink-close)(OPTION_UNLINK_CLOSE)
|
||||
link(unlink-close)(OPTION_UNLINK_CLOSE),
|
||||
link(o-nonblock)(OPTION_O_NONBLOCK)
|
||||
|
||||
label(ADDRESS_POSIXMQ_RECEIVE)dit(bf(tt(POSIXMQ-RECEIVE:/<mqueue>)))
|
||||
dit(bf(tt(POSIXMQ-RECV:/<mqueue>)))
|
||||
|
@ -882,7 +883,7 @@ label(ADDRESS_SCTP_CONNECT)dit(bf(tt(SCTP-CONNECT:<host>:<port>)))
|
|||
link(mtudiscover)(OPTION_MTUDISCOVER),
|
||||
link(sctp-maxseg)(OPTION_SCTP_MAXSEG),
|
||||
link(sctp-nodelay)(OPTION_SCTP_NODELAY),
|
||||
link(nonblock)(OPTION_NONBLOCK),
|
||||
link(nonblock)(OPTION_O_NONBLOCK),
|
||||
link(sourceport)(OPTION_SOURCEPORT),
|
||||
link(retry)(OPTION_RETRY),
|
||||
link(readbytes)(OPTION_READBYTES)nl()
|
||||
|
@ -1234,7 +1235,7 @@ label(ADDRESS_TCP_CONNECT)dit(bf(tt(TCP:<host>:<port>)))
|
|||
link(mtudiscover)(OPTION_MTUDISCOVER),
|
||||
link(mss)(OPTION_MSS),
|
||||
link(nodelay)(OPTION_TCP_NODELAY),
|
||||
link(nonblock)(OPTION_NONBLOCK),
|
||||
link(nonblock)(OPTION_O_NONBLOCK),
|
||||
link(readbytes)(OPTION_READBYTES)nl()
|
||||
See also:
|
||||
link(TCP4)(ADDRESS_TCP4_CONNECT),
|
||||
|
@ -1853,7 +1854,7 @@ label(OPTION_APPEND)dit(bf(tt(append[=<bool>])))
|
|||
socat() uses the code(O_APPEND) flag with the code(open()) system call
|
||||
(link(example)(EXAMPLE_OPTION_APPEND)).
|
||||
Otherwise, socat() applies the code(fcntl(fd, F_SETFL, O_APPEND)) call.
|
||||
label(OPTION_NONBLOCK)dit(bf(tt(nonblock[=<bool>])))
|
||||
label(OPTION_O_NONBLOCK)dit(bf(tt(nonblock[=<bool>])))
|
||||
Tries to open or use file in nonblocking mode. Its only effects are that the
|
||||
code(connect()) call of TCP addresses does not block, and that opening a
|
||||
named pipe for reading does not block.
|
||||
|
@ -1988,7 +1989,7 @@ E.g., option `creat' sets the code(O_CREAT) flag. When the used address does
|
|||
not use code(open()) (e.g.STDIO), the code(fcntl(..., F_SETFL, ...)) call is
|
||||
used instead.nl()
|
||||
See also options link(append)(OPTION_APPEND) and
|
||||
link(nonblock)(OPTION_NONBLOCK).
|
||||
link(nonblock)(OPTION_O_NONBLOCK).
|
||||
startdit()
|
||||
label(OPTION_O_CREAT)dit(bf(tt(creat[=<bool>])))
|
||||
Creates the file if it does not exist (link(example)(EXAMPLE_OPTION_CREAT)).
|
||||
|
@ -3973,7 +3974,7 @@ prompts.
|
|||
label(EXAMPLE_ADDRESS_PTY)
|
||||
label(EXAMPLE_OPTION_SYMBOLIC_LINK)
|
||||
label(EXAMPLE_OPTION_WAIT_SLAVE)
|
||||
label(EXAMPLE_OPTION_NONBLOCK)
|
||||
label(EXAMPLE_OPTION_O_NONBLOCK)
|
||||
mancommand(\.LP)
|
||||
mancommand(\.nf)
|
||||
mancommand(\fBsocat \\)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue