intro.2 as errno.2: Use the name macro for errno

Reviewed by: imp
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1192
This commit is contained in:
Alexander Ziaee 2024-05-04 08:54:21 -06:00 committed by Warner Losh
parent 69ff2d754c
commit 9a62cdc013

View File

@ -32,8 +32,9 @@
.Dt INTRO 2 .Dt INTRO 2
.Os .Os
.Sh NAME .Sh NAME
.Nm intro .Nm intro ,
.Nd introduction to system calls and error numbers .Nm errno
.Nd introduction to system calls and their error numbers
.Sh LIBRARY .Sh LIBRARY
.Lb libc .Lb libc
.Sh SYNOPSIS .Sh SYNOPSIS
@ -333,7 +334,7 @@ Table of currently available system calls.
.Sh ERRORS .Sh ERRORS
Nearly all of the system calls provide an error number referenced via Nearly all of the system calls provide an error number referenced via
the external identifier the external identifier
.Va errno . .Nm errno .
This identifier is defined in This identifier is defined in
.In sys/errno.h .In sys/errno.h
as: as:
@ -349,7 +350,7 @@ For the initial thread and
non-threaded processes, non-threaded processes,
.Va __error() .Va __error()
returns a pointer to a global returns a pointer to a global
.Va errno .Nm errno
variable that is compatible with the previous definition. variable that is compatible with the previous definition.
.Pp .Pp
When a system call detects an error, When a system call detects an error,
@ -357,12 +358,12 @@ it returns an integer value
indicating failure indicating failure
.Pq usually -1 .Pq usually -1
and sets the variable and sets the variable
.Va errno .Nm errno
accordingly. accordingly.
This allows interpretation of the failure on receiving This allows interpretation of the failure on receiving
-1 and to take action accordingly. -1 and to take action accordingly.
Successful calls never set Successful calls never set
.Va errno ; .Nm errno ;
once set, it remains until another error occurs. once set, it remains until another error occurs.
It should only be examined after an error. It should only be examined after an error.
Note that a number of system calls overload the meanings of these Note that a number of system calls overload the meanings of these