diff --git a/CHANGES b/CHANGES index fbedf85..ffaefe0 100644 --- a/CHANGES +++ b/CHANGES @@ -49,13 +49,16 @@ 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. - New option posixmq-flush (mq-flush) for POSIXMQ addresses empty the + New option posixmq-flush (mq-flush) for POSIXMQ addresses empties the queue before starting to transfer data. Test: LINUX_POSIXMQ_FLUSH New options posixmq-maxmsg, posixmq-msgsize. Tests: POSIXMQ_MAXMSG POSIXMQ_MSGSIZE + POSIXMQ is now an alias for POSIXMQ-BIDIRECTIONAL. It can also be used + in unidirectional context. + Building: Disabling certain features during configure could break build process. diff --git a/doc/socat.yo b/doc/socat.yo index 2e97524..6695d28 100644 --- a/doc/socat.yo +++ b/doc/socat.yo @@ -313,6 +313,7 @@ label(ADDRESS_CREAT)dit(bf(tt(CREATE:<filename>))) if <filename> refers to a socket, this is an error.nl() Option groups: link(FD)(GROUP_FD),link(REG)(GROUP_REG),link(NAMED)(GROUP_NAMED) nl() Useful options: + link(mode)(OPTION_UMASK), link(mode)(OPTION_MODE), link(user)(OPTION_USER), link(group)(OPTION_GROUP), @@ -583,7 +584,7 @@ label(ADDRESS_OPEN)dit(bf(tt(OPEN:<filename>))) Option groups: link(FD)(GROUP_FD),link(REG)(GROUP_REG),link(NAMED)(GROUP_NAMED),link(OPEN)(GROUP_OPEN) nl() Useful options: link(creat)(OPTION_O_CREAT), - link(excl)(OPTION_EXCL), + link(excl)(OPTION_O_EXCL), link(noatime)(OPTION_O_NOATIME), link(nofollow)(OPTION_NOFOLLOW), link(append)(OPTION_APPEND), @@ -783,7 +784,10 @@ label(ADDRESS_POSIXMQ_READ)dit(bf(tt(POSIXMQ-READ:/<mqueue>))) link(posixmq-priority)(OPTION_POSIXMQ_PRIORITY), link(unlink-early)(OPTION_UNLINK_EARLY), link(unlink-close)(OPTION_UNLINK_CLOSE), - link(o-nonblock)(OPTION_O_NONBLOCK) + link(o-nonblock)(OPTION_O_NONBLOCK), + link(o-creat)(OPTION_O_CREAT), + link(o-excl)(OPTION_O_EXCL), + link(umask)(OPTION_UMASK) label(ADDRESS_POSIXMQ_RECEIVE)dit(bf(tt(POSIXMQ-RECEIVE:/<mqueue>))) dit(bf(tt(POSIXMQ-RECV:/<mqueue>))) @@ -796,7 +800,10 @@ dit(bf(tt(POSIXMQ-RECV:/<mqueue>))) link(fork)(OPTION_FORK), link(max-children)(OPTION_MAX_CHILDREN), link(unlink-early)(OPTION_UNLINK_EARLY), - link(unlink-close)(OPTION_UNLINK_CLOSE) + link(unlink-close)(OPTION_UNLINK_CLOSE), + link(o-creat)(OPTION_O_CREAT), + link(o-excl)(OPTION_O_EXCL), + link(umask)(OPTION_UMASK) label(ADDRESS_POSIXMQ_SEND)dit(bf(tt(POSIXMQ-SEND:/<mqueue>))) Opens the specified POSIX message queue and writes messages (packets).nl() @@ -808,12 +815,18 @@ label(ADDRESS_POSIXMQ_SEND)dit(bf(tt(POSIXMQ-SEND:/<mqueue>))) link(fork)(OPTION_FORK), link(max-children)(OPTION_MAX_CHILDREN), link(unlink-early)(OPTION_UNLINK_EARLY), - link(unlink-close)(OPTION_UNLINK_CLOSE) + link(unlink-close)(OPTION_UNLINK_CLOSE), + link(o-creat)(OPTION_O_CREAT), + link(o-excl)(OPTION_O_EXCL), + link(umask)(OPTION_UMASK) label(ADDRESS_POSIXMQ_BIDIRECTIONAL)dit(bf(tt(POSIXMQ-BIDIRECTIONAL:/mqueue))) - Opens the specified POSIX message queue and writes and reads messages - (packet). This is probably rarely useful but has been implemented for - functional completeness. +dit(bf(tt(POSIXMQ:/mqueue))) + Opens the specified POSIX message queue in read and/or write mode depending + on context, then reads and/or writes messages (packets). + In bidirectional mode this is just another echo service.nl() + See link(POSIXMQ-READ)(ADDRESS_POSIXMQ_READ) and + link(POSIXMQ-SEND)(ADDRESS_POSIXMQ_SEND) for more info. label(ADDRESS_PROXY_CONNECT)dit(bf(tt(PROXY:<proxy>:<hostname>:<port>))) Connects to an HTTP proxy server on port 8080 using TCP/IP version 4 or 6 @@ -1837,8 +1850,10 @@ label(OPTION_MODE)dit(bf(tt(mode=<mode>))) system calls, socat() uses the code(chmod()) system call after opening the filesystem entry or binding to the unixdomain() socket (race condition!). Otherwise, socat() sets the mode of the stream - using code(fchmod()). - These calls might require ownership or root privilege. + using code(fchmod()) which, btw, might not have any effect.nl() + These calls might require ownership or root privilege.nl() + Note: this option can only tighten the permissions implied by processes + umask. See option link(umask)(OPTION_UMASK) to loosen permissions. label(OPTION_PERM_LATE)dit(bf(tt(perm-late=<mode>))) Sets the permissions of the fd to value <mode> [link(mode_t)(TYPE_MODE_T)] using the code(fchmod()) system call after @@ -1991,7 +2006,7 @@ label(OPTION_O_CREAT)dit(bf(tt(creat[=<bool>]))) Creates the file if it does not exist (link(example)(EXAMPLE_OPTION_CREAT)). label(OPTION_DSYNC)dit(bf(tt(dsync[=<bool>]))) Blocks code(write()) calls until metainfo is physically written to media. -label(OPTION_EXCL)dit(bf(tt(excl[=<bool>]))) +label(OPTION_O_EXCL)dit(bf(tt(excl[=<bool>]))) With option creat, if file exists this is an error. label(OPTION_LARGEFILE)dit(bf(tt(largefile[=<bool>]))) On 32 bit systems, allows a file larger than 2^31 bytes. @@ -2106,8 +2121,9 @@ label(OPTION_CHDIR)dit(bf(tt(chdir=<filename>))) dit(bf(tt(cd=<filename>))) label(OPTION_UMASK)dit(bf(tt(umask=<mode>))) Sets the umask of the process to <mode> [link(mode_t)(TYPE_MODE_T)] before opening the address. Useful when file system entries are created or a shell - or program is invoked. Usually the value is specified as octal number.nl() - The processes tt(umask) value is inherited by child processes. + or program is invoked. Usually the value is specified as octal number with + leading '0'.nl() + The processes tt(umask) value is inherited by child processes.nl() Note: umask is an inverted value: creating a file with umask=0026 results in permissions 0640. enddit() diff --git a/xioopen.c b/xioopen.c index 8a29f21..45fe9fa 100644 --- a/xioopen.c +++ b/xioopen.c @@ -177,6 +177,7 @@ const struct addrname addressnames[] = { { "PIPE", &xioaddr_pipe }, #endif #if WITH_POSIXMQ + { "POSIXMQ", &xioaddr_posixmq_bidir }, { "POSIXMQ-BIDIRECTIONAL", &xioaddr_posixmq_bidir }, { "POSIXMQ-READ", &xioaddr_posixmq_read }, { "POSIXMQ-RECEIVE", &xioaddr_posixmq_receive },