summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/socket.2
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-03-19 20:58:17 +0000
committerjilles <jilles@FreeBSD.org>2013-03-19 20:58:17 +0000
commitc9066bd014b20089911abc91a8c87ef738498a28 (patch)
tree71ad20dc1a5c91d4fc411e2e04d96225b53fd904 /lib/libc/sys/socket.2
parent30ce276eca66462aa7b3385fa4f6daac2634fbcc (diff)
downloadFreeBSD-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/socket.2')
-rw-r--r--lib/libc/sys/socket.211
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2
index 24e4293..74730be 100644
--- a/lib/libc/sys/socket.2
+++ b/lib/libc/sys/socket.2
@@ -28,7 +28,7 @@
.\" From: @(#)socket.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd December 7, 2012
+.Dd March 19, 2013
.Dt SOCKET 2
.Os
.Sh NAME
@@ -115,6 +115,15 @@ which is available only to the super-user, and
which is planned,
but not yet implemented, are not described here.
.Pp
+Additionally, the following flags are allowed in the
+.Fa type
+argument:
+.Pp
+.Bd -literal -offset indent -compact
+SOCK_CLOEXEC Set close-on-exec on the new descriptor,
+SOCK_NONBLOCK Set non-blocking mode on the new socket
+.Ed
+.Pp
The
.Fa protocol
argument
OpenPOWER on IntegriCloud