diff options
author | jilles <jilles@FreeBSD.org> | 2013-03-19 20:58:17 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-03-19 20:58:17 +0000 |
commit | c9066bd014b20089911abc91a8c87ef738498a28 (patch) | |
tree | 71ad20dc1a5c91d4fc411e2e04d96225b53fd904 /lib/libc/sys/socketpair.2 | |
parent | 30ce276eca66462aa7b3385fa4f6daac2634fbcc (diff) | |
download | FreeBSD-src-c9066bd014b20089911abc91a8c87ef738498a28.zip FreeBSD-src-c9066bd014b20089911abc91a8c87ef738498a28.tar.gz |
Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC.
This change allows creating file descriptors with close-on-exec set in some
situations. SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and
socketpair()'s type parameter, and MSG_CMSG_CLOEXEC to recvmsg() makes file
descriptors (SCM_RIGHTS) atomically close-on-exec.
The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD.
MSG_CMSG_CLOEXEC is the first free bit for MSG_*.
The SOCK_* flags are not passed to MAC because this may cause incorrect
failures and can be done later via fcntl() anyway. On the other hand, audit
is expected to cope with the new flags.
For MSG_CMSG_CLOEXEC, unp_externalize() is extended to take a flags
argument.
Reviewed by: kib
Diffstat (limited to 'lib/libc/sys/socketpair.2')
-rw-r--r-- | lib/libc/sys/socketpair.2 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libc/sys/socketpair.2 b/lib/libc/sys/socketpair.2 index c86db43..08d00d3 100644 --- a/lib/libc/sys/socketpair.2 +++ b/lib/libc/sys/socketpair.2 @@ -28,7 +28,7 @@ .\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd March 19, 2013 .Dt SOCKETPAIR 2 .Os .Sh NAME @@ -57,6 +57,14 @@ are returned in and .Fa sv Ns [1] . The two sockets are indistinguishable. +.Pp +The +.Dv SOCK_CLOEXEC +and +.Dv SOCK_NONBLOCK +flags in the +.Fa type +argument apply to both descriptors. .Sh RETURN VALUES .Rv -std socketpair .Sh ERRORS @@ -79,6 +87,7 @@ process address space. .Sh SEE ALSO .Xr pipe 2 , .Xr read 2 , +.Xr socket 2 , .Xr write 2 .Sh HISTORY The |