]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
manual: Document error codes missing for 'socket'
authorMaciej W. Rozycki <macro@redhat.com>
Thu, 29 May 2025 21:11:38 +0000 (22:11 +0100)
committerMaciej W. Rozycki <macro@redhat.com>
Thu, 29 May 2025 21:11:38 +0000 (22:11 +0100)
Add missing EAFNOSUPPORT, ESOCKTNOSUPPORT, EPROTOTYPE, EINVAL, EPERM,
and ENOMEM error codes, and adjust existing descriptions accordingly.

On Linux either ENOBUFS or ENOMEM is returned in the case of a memory
allocation failure, depending on the namespace requested, e.g. AF_INET
returns ENOMEM while AF_INET6 returns ENOBUFS, so document these codes
as alternatives.

Similarly EPERM is returned rather than EACCES on Linux, so document
these codes as alternatives as well.  We might want to convert EPERM to
EACCES for POSIX compliance, but it is beyond the scope of this change,
and software has to expect either anyway, owing to the long-established
practice.

Finally ESOCKTNOSUPPORT is returned rather than EPROTONOSUPPORT for an
unsupported style except for the AF_QIPCRTR namespace where EPROTOTYPE
is used, so document these codes as alternatives too.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
manual/socket.texi

index 8708cbb07ca02b5c6b38f1bc68c714f13471e3f3..ed24cd5bd41ce8c072e813435b7ff3aea3e8b6b9 100644 (file)
@@ -2205,9 +2205,19 @@ socket, or @code{-1} in case of error.  The following @code{errno} error
 conditions are defined for this function:
 
 @table @code
+@item EAFNOSUPPORT
+The @var{namespace} requested is not supported.
+
+@item ESOCKTNOSUPPORT
+@itemx EPROTONOSUPPORT
+@itemx EPROTOTYPE
+The @var{style} is not supported by the @var{namespace} specified.
+
 @item EPROTONOSUPPORT
-The @var{protocol} or @var{style} is not supported by the
-@var{namespace} specified.
+The @var{protocol} is not supported by the @var{namespace} specified.
+
+@item EINVAL
+The @var{style} or @var{protocol} requested is not valid.
 
 @item EMFILE
 The process already has too many file descriptors open.
@@ -2216,11 +2226,13 @@ The process already has too many file descriptors open.
 The system already has too many file descriptors open.
 
 @item EACCES
+@itemx EPERM
 The process does not have the privilege to create a socket of the specified
 @var{style} or @var{protocol}.
 
 @item ENOBUFS
-The system ran out of internal buffer space.
+@itemx ENOMEM
+Insufficient memory was available.
 @end table
 
 The file descriptor returned by the @code{socket} function supports both