socket.2: Document SOCK_NONBLOCK and SOCK_CLOEXEC flags

These flags, specified in the 'type' argument, are supported
since Linux 2.6.27.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2008-10-11 07:42:23 +02:00
parent 51d61866ba
commit af14d9f842
1 changed files with 39 additions and 1 deletions

View File

@ -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