diff options
Diffstat (limited to 'man2')
| -rw-r--r-- | man2/socket.2 | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/man2/socket.2 b/man2/socket.2 index 567cd80b1e..1e0bc1ed0e 100644 --- a/man2/socket.2 +++ b/man2/socket.2 @@ -38,7 +38,7 @@ .\" Modified 2002-07-17 by Michael Kerrisk <mtk.manpages@gmail.com> .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com> .\" -.TH SOCKET 2 2008-08-08 "Linux" "Linux Programmer's Manual" +.TH SOCKET 2 2008-10-11 "Linux" "Linux Programmer's Manual" .SH NAME socket \- create an endpoint for communication .SH SYNOPSIS @@ -152,6 +152,32 @@ for example, is not implemented for .BR AF_INET . .PP +Since Linux 2.6.27, the +.I type +argument serves a second purpose: +in addition to specifying a socket type, +it may include the bitwise OR of any of the following values, +to modify the behavior of +.BR socket (): +.TP 16 +.B SOCK_NONBLOCK +Set the +.BR O_NONBLOCK +file status flag on the new open file description. +Using this flag saves extra calls to +.BR fcntl (2) +to achieve the same result. +.TP +.B SOCK_CLOEXEC +Set the close-on-exec +.RB ( FD_CLOEXEC ) +flag on the new file descriptor. +See the description of the +.B O_CLOEXEC +flag in +.BR open (2) +for reasons why this may be useful. +.PP The .I protocol specifies a particular protocol to be used with the socket. @@ -300,6 +326,11 @@ The implementation does not support the specified address family. .B EINVAL Unknown protocol, or protocol family not available. .TP +.B EINVAL +.\" Since Linux 2.6.27 +Invalid flags in +.IR type . +.TP .B EMFILE Process file table overflow. .TP @@ -318,6 +349,13 @@ supported within this domain. Other errors may be generated by the underlying protocol modules. .SH "CONFORMING TO" 4.4BSD, POSIX.1-2001. + +The +.B SOCK_NONBLOCK +and +.B SOCK_CLOEXEC +flags are Linux-specific. + .BR socket () appeared in 4.2BSD. It is generally portable to/from |
