Index | Thread | Search

From:
"Theo de Raadt" <deraadt@openbsd.org>
Subject:
Re: Missing errno # 71 in man errno
To:
Ingo Schwarze <schwarze@usta.de>
Cc:
Jonathan Gray <jsg@jsg.id.au>, Angelo Rossi <angelo.rossi.homelab@gmail.com>, tech@openbsd.org
Date:
Fri, 18 Jul 2025 09:18:40 -0600

Download raw body.

Thread
I wish this was seperate diffs

But good enough.  Each chunk says what needs to be said.

Ingo Schwarze <schwarze@usta.de> wrote:

> Hello,
> 
> Jonathan Gray wrote on Wed, Jul 16, 2025 at 09:38:43AM +1000:
> 
> > EREMOTE use in inteldrm comes from linux, not somthing I changed.
> > inteldrm is not a reason to document it, I don't think that codepath
> > is even reachable at the moment.
> 
> Thanks for the feedback, and to all the others who spoke up as well.
> 
> Here is a patch to improve errno(2) in a number of respects:
>  * Mention EWOULDBLOCK.
>    It is required by POSIX, both to be defined, and to be returned
>    by various functions.  POSIX explicitly allows it to resolve
>    to the same error number as EAGAIN.  We take advantage of that
>    permission.
>  * EPROCLIM has no description at all.
>    Mark it "Not used in OpenBSD" as we already do for a few others.
>  * Add EREMOTE and mark it "Not used in OpenBSD".
>    I think that's the right thing to do given this sentence in the
>    third paragraph of DIAGNOSTICS: "The following is a complete
>    list of the errors and their names as given in <sys/errno.h>."
>  * Add STANDARDS.
>  * Add BUGS, based on what was discussed in this thread.
> 
> OK?
>   Ingo
> 
> 
> Index: intro.2
> ===================================================================
> RCS file: /cvs/src/lib/libc/sys/intro.2,v
> diff -u -r1.75 intro.2
> --- intro.2	13 Jun 2025 13:56:43 -0000	1.75
> +++ intro.2	17 Jul 2025 13:19:36 -0000
> @@ -228,7 +228,7 @@
>  .It Er 34 ERANGE Em "Result too large" .
>  A result of the function was too large to fit in the
>  available space (perhaps exceeded precision).
> -.It Er 35 EAGAIN Em "Resource temporarily unavailable" .
> +.It Er 35 EAGAIN No = Er EWOULDBLOCK Em "Resource temporarily unavailable" .
>  This is a temporary condition and later calls to the
>  same routine may complete normally.
>  .It Er 36 EINPROGRESS Em "Operation now in progress" .
> @@ -352,6 +352,8 @@
>  .Ql \&..
>  was supplied to a remove directory or rename call.
>  .It Er 67 EPROCLIM Em "Too many processes" .
> +Not used in
> +.Ox .
>  .It Er 68 EUSERS Em "Too many users" .
>  The quota system ran out of table entries.
>  .It Er 69 EDQUOT Em "Disk quota exceeded" .
> @@ -366,6 +368,9 @@
>  is now unavailable as referenced by the file descriptor.
>  This may indicate the file was deleted on the NFS server or some other
>  catastrophic event occurred.
> +.It Er 71 EREMOTE Em "Too many levels of remote in path" .
> +Not used in
> +.Ox .
>  .It Er 72 EBADRPC Em "RPC struct is bad" .
>  Exchange of
>  .Xr rpc 3
> @@ -740,8 +745,49 @@
>  .Xr pledge 2 ,
>  .Xr intro 3 ,
>  .Xr perror 3
> +.Sh STANDARDS
> +Most of the macro names that resolve to error numbers
> +are required to be defined by
> +.St -p1003.1-2024 .
> +In some cases, the standard requires certain kinds of failures
> +to be reported with certain error numbers.
> +It some cases, it allows certain kinds of failures
> +to optionally be reported with certain error numbers.
> +In some cases, it is entirely silent about whether and how
> +the system should report problems.
> +.Pp
> +The following defined constants are extensions to the standard:
> +.Er EAUTH ,
> +.Er EBADRPC ,
> +.Er EFTYPE ,
> +.Er EHOSTDOWN ,
> +.Er EIPSEC ,
> +.Er EMEDIUMTYPE ,
> +.Er ENEEDAUTH ,
> +.Er ENOATTR ,
> +.Er ENOMEDIUM ,
> +.Er ENOTBLK ,
> +.Er EPFNOSUPPORT ,
> +.Er EPROCLIM ,
> +.Er EPROCUNAVAIL ,
> +.Er EPROGMISMATCH ,
> +.Er EPROGUNAVAIL ,
> +.Er EREMOTE ,
> +.Er ERPCMISMATCH ,
> +.Er ESHUTDOWN ,
> +.Er ETOOMANYREFS ,
> +and
> +.Er EUSERS .
>  .Sh HISTORY
>  An
>  .Nm
>  manual for section 2 first appeared in
>  .At v5 .
> +.Sh BUGS
> +Since some error numbers are only loosely defined, and since which error
> +numbers any given function can set often varies from system to system,
> +programs usually need to make a fallback decision when receiving an
> +unexpected error number, typically treating it as a hard failure,
> +or less commonly just ignoring it.
> +Making portable decisions based on error numbers is only possible
> +for some specific error numbers being set by some specific functions.
>