Add NOTES paragraph noting that <sys/types.h> isn't required by

POSIX.1-2001 or Linux, but was required on some implementations.
This commit is contained in:
Michael Kerrisk 2007-06-10 18:08:27 +00:00
parent 240c349b48
commit 53a6b01dee
8 changed files with 65 additions and 6 deletions

View File

@ -39,7 +39,7 @@
.SH NAME
accept \- accept a connection on a socket
.SH SYNOPSIS
.B #include <sys/types.h>
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.sp
@ -255,6 +255,12 @@ of file status flags and always explicitly set all required flags on
the socket returned from
.BR accept ().
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
There may not always be a connection waiting after a
.B SIGIO
is delivered or

View File

@ -68,7 +68,7 @@
bind \- bind a name to a socket
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.sp
.BI "int bind(int " sockfd ", const struct sockaddr *" my_addr \
@ -230,6 +230,12 @@ function first appeared in 4.2BSD).
.\" .B EISDIR
.\" Unix-domain error conditions.
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
The third argument of
.BR bind ()
is in reality an

View File

@ -67,7 +67,7 @@
connect \- initiate a connection on a socket
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.sp
@ -236,6 +236,12 @@ function first appeared in 4.2BSD), POSIX.1-2001.
.\" It also
.\" documents many additional error conditions not described here.
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
The third argument of
.BR connect ()
is in reality an

View File

@ -68,6 +68,19 @@ POSIX.1-2001 specifies
.BR gethostid ()
but not
.BR sethostid ().
.SH NOTES
In the glibc implementation, if
.BR gethostid ()
cannot open
.IR /etc/hostid ,
then it obtains the host name using
.BR gethostname (2),
passes that host name to
.BR gethostbyaddr (3)
in order to obtain the host's IPv4 address,
and returns a value obtained by bit-twiddling the IPv4 address.
(This value may not be unique.)
.SH "SEE ALSO"
.BR hostid (1),
.BR gethostbyname (3)

View File

@ -44,7 +44,7 @@
getsockopt, setsockopt \- get and set options on sockets
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.sp
@ -171,6 +171,12 @@ POSIX.1-2001.
.\" .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO
.\" options
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
The
.I optlen
argument of

View File

@ -42,9 +42,13 @@
.SH NAME
listen \- listen for connections on a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.sp
.BI "int listen(int " sockfd ", int " backlog );
.fi
.SH DESCRIPTION
To accept connections, a socket is first created with
.BR socket (2),
@ -100,6 +104,12 @@ The
.BR listen ()
function call first appeared in 4.2BSD.
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
The behavior of the
.I backlog
parameter on TCP sockets changed with Linux 2.2.

View File

@ -42,7 +42,7 @@
.SH NAME
socket \- create an endpoint for communication
.SH SYNOPSIS
.B #include <sys/types.h>
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.sp
@ -324,6 +324,12 @@ It is generally portable to/from
non-BSD systems supporting clones of the BSD socket layer (including
System V variants).
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
The manifest constants used under 4.x BSD for protocol families
are PF_UNIX, PF_INET, etc., while AF_UNIX etc. are used for address
families.

View File

@ -40,7 +40,7 @@
.SH NAME
socketpair \- create a pair of connected sockets
.SH SYNOPSIS
.B #include <sys/types.h>
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.sp
@ -100,6 +100,12 @@ On Linux, the only supported domain for this call is
(or synonymously,
.BR AF_LOCAL ).
(Most implementations have the same restriction.)
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.SH "SEE ALSO"
.BR pipe (2),
.BR read (2),