diff options
author | jilles <jilles@FreeBSD.org> | 2013-05-01 20:10:21 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-05-01 20:10:21 +0000 |
commit | 299afd25fd6dead39bf5c78572782db885579911 (patch) | |
tree | c530c7ecc418cacfa14b49c004393242e6613d6b /sys/compat | |
parent | 19e5409088a95e1f704e9a1b2e7737b3e76608e9 (diff) | |
download | FreeBSD-src-299afd25fd6dead39bf5c78572782db885579911.zip FreeBSD-src-299afd25fd6dead39bf5c78572782db885579911.tar.gz |
Add accept4() system call.
The accept4() function, compared to accept(), allows setting the new file
descriptor atomically close-on-exec and explicitly controlling the
non-blocking status on the new socket. (Note that the latter point means
that accept() is not equivalent to any form of accept4().)
The linuxulator's accept4 implementation leaves a race window where the new
file descriptor is not close-on-exec because it calls sys_accept(). This
implementation leaves no such race window (by using falloc() flags). The
linuxulator could be fixed and simplified by using the new code.
Like accept(), accept4() is async-signal-safe, a cancellation point and
permitted in capability mode.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/freebsd32/syscalls.master | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index 0a40ab2..2cbdf31 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -1022,3 +1022,7 @@ int namelen); } 540 AUE_CHFLAGSAT NOPROTO { int chflagsat(int fd, const char *path, \ u_long flags, int atflag); } +541 AUE_ACCEPT NOPROTO { int accept4(int s, \ + struct sockaddr * __restrict name, \ + __socklen_t * __restrict anamelen, \ + int flags); } |