manual: Use @code{errno} instead of @var{errno} [BZ #24063]

@var is intended for placeholders (such as function parameters).
Actual variables need to use @code because @var causes upper-case
output, resulting in a different C identifier.
This commit is contained in:
Florian Weimer 2019-01-07 11:42:04 +01:00
parent b79dc8d0fe
commit 010fe23177
12 changed files with 54 additions and 31 deletions

View File

@ -1,3 +1,26 @@
2019-01-07 Florian Weimer <fweimer@redhat.com>
[BZ #24063]
* manual/arith.texi (Math Error Reporting): Use @code{errno}
instead of @var{errno}.
(Parsing of Integers): Likewise.
(Parsing of Floats): Likewise.
* manual/filesys.texi (Working with Directory Trees): Likewise.
(Temporary Files): Likewise.
* manual/job.texi (Terminal Access Functions): Likewise.
* manual/llio.texi (Synchronizing I/O): Likewise.
* manual/math.texi (SVID Random): Likewise.
* manual/message.texi (The catgets Functions): Likewise.
(Translation with gettext): Likewise.
(Locating gettext catalog): Likewise.
(Charset conversion in gettext): Likewise.
* manual/nss.texi (NSS Module Function Internals): Likewise.
* manual/search.texi (Hash Search Function): Likewise.
* manual/setjmp.texi (System V contexts): Likewise.
* manual/time.texi (Sleeping): Likewise.
* manual/users.texi (Lookup User): Likewise.
(Lookup Group): Likewise.
2019-01-05 Adhemerval Zanella <adhemerval.zanella@linaro.org> 2019-01-05 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* posix/tst-spawn.c (do_test): Extend spargv to new required size and * posix/tst-spawn.c (do_test): Extend spargv to new required size and

View File

@ -875,20 +875,20 @@ complete response as @dfn{signalling} a domain error, overflow, or
underflow. underflow.
When a math function suffers a domain error, it raises the invalid When a math function suffers a domain error, it raises the invalid
exception and returns NaN. It also sets @var{errno} to @code{EDOM}; exception and returns NaN. It also sets @code{errno} to @code{EDOM};
this is for compatibility with old systems that do not support @w{IEEE this is for compatibility with old systems that do not support @w{IEEE
754} exception handling. Likewise, when overflow occurs, math 754} exception handling. Likewise, when overflow occurs, math
functions raise the overflow exception and, in the default rounding functions raise the overflow exception and, in the default rounding
mode, return @math{@infinity{}} or @math{-@infinity{}} as appropriate mode, return @math{@infinity{}} or @math{-@infinity{}} as appropriate
(in other rounding modes, the largest finite value of the appropriate (in other rounding modes, the largest finite value of the appropriate
sign is returned when appropriate for that rounding mode). They also sign is returned when appropriate for that rounding mode). They also
set @var{errno} to @code{ERANGE} if returning @math{@infinity{}} or set @code{errno} to @code{ERANGE} if returning @math{@infinity{}} or
@math{-@infinity{}}; @var{errno} may or may not be set to @math{-@infinity{}}; @code{errno} may or may not be set to
@code{ERANGE} when a finite value is returned on overflow. When @code{ERANGE} when a finite value is returned on overflow. When
underflow occurs, the underflow exception is raised, and zero underflow occurs, the underflow exception is raised, and zero
(appropriately signed) or a subnormal value, as appropriate for the (appropriately signed) or a subnormal value, as appropriate for the
mathematical result of the function and the rounding mode, is mathematical result of the function and the rounding mode, is
returned. @var{errno} may be set to @code{ERANGE}, but this is not returned. @code{errno} may be set to @code{ERANGE}, but this is not
guaranteed; it is intended that @theglibc{} should set it when the guaranteed; it is intended that @theglibc{} should set it when the
underflow is to an appropriately signed zero, but not necessarily for underflow is to an appropriately signed zero, but not necessarily for
other underflows. other underflows.
@ -2545,7 +2545,7 @@ You should not check for errors by examining the return value of
@code{0l}, @code{LONG_MAX}, or @code{LONG_MIN}. Instead, check whether @code{0l}, @code{LONG_MAX}, or @code{LONG_MIN}. Instead, check whether
@var{tailptr} points to what you expect after the number @var{tailptr} points to what you expect after the number
(e.g. @code{'\0'} if the string should end after the number). You also (e.g. @code{'\0'} if the string should end after the number). You also
need to clear @var{errno} before the call and check it afterward, in need to clear @code{errno} before the call and check it afterward, in
case there was overflow. case there was overflow.
There is an example at the end of this section. There is an example at the end of this section.
@ -2574,7 +2574,7 @@ for example that @code{strtoul} on @code{"-1"} returns @code{ULONG_MAX}
and an input more negative than @code{LONG_MIN} returns and an input more negative than @code{LONG_MIN} returns
(@code{ULONG_MAX} + 1) / 2. (@code{ULONG_MAX} + 1) / 2.
@code{strtoul} sets @var{errno} to @code{EINVAL} if @var{base} is out of @code{strtoul} sets @code{errno} to @code{EINVAL} if @var{base} is out of
range, or @code{ERANGE} on overflow. range, or @code{ERANGE} on overflow.
@end deftypefun @end deftypefun
@ -2892,7 +2892,7 @@ representation of NaN (there can be several).
Since zero is a valid result as well as the value returned on error, you Since zero is a valid result as well as the value returned on error, you
should check for errors in the same way as for @code{strtol}, by should check for errors in the same way as for @code{strtol}, by
examining @var{errno} and @var{tailptr}. examining @code{errno} and @var{tailptr}.
@end deftypefun @end deftypefun
@deftypefun float strtof (const char *@var{string}, char **@var{tailptr}) @deftypefun float strtof (const char *@var{string}, char **@var{tailptr})

View File

@ -1098,7 +1098,7 @@ this option is set. This option is a GNU extension.
The return value is computed in the same way as for @code{ftw}. The return value is computed in the same way as for @code{ftw}.
@code{nftw} returns @math{0} if no failures occurred and all callback @code{nftw} returns @math{0} if no failures occurred and all callback
functions returned @math{0}. In case of internal errors, such as memory functions returned @math{0}. In case of internal errors, such as memory
problems, the return value is @math{-1} and @var{errno} is set problems, the return value is @math{-1} and @code{errno} is set
accordingly. If the return value of a callback invocation was non-zero accordingly. If the return value of a callback invocation was non-zero
then that value is returned. then that value is returned.
@ -3524,9 +3524,9 @@ directory, and returns @var{template}. As with @code{mktemp} and
@samp{XXXXXX}. @samp{XXXXXX}.
If @code{mkdtemp} cannot create an uniquely named directory, it returns If @code{mkdtemp} cannot create an uniquely named directory, it returns
@code{NULL} and sets @var{errno} appropriately. If @var{template} does @code{NULL} and sets @code{errno} appropriately. If @var{template} does
not end with @samp{XXXXXX}, @code{mkdtemp} returns @code{NULL} and does not end with @samp{XXXXXX}, @code{mkdtemp} returns @code{NULL} and does
not modify @var{template}. @var{errno} will be set to @code{EINVAL} in not modify @var{template}. @code{errno} will be set to @code{EINVAL} in
this case. this case.
The directory is created using mode @code{0700}. The directory is created using mode @code{0700}.

View File

@ -1275,7 +1275,7 @@ process.
This function is used to obtain the process group ID of the session This function is used to obtain the process group ID of the session
for which the terminal specified by @var{fildes} is the controlling terminal. for which the terminal specified by @var{fildes} is the controlling terminal.
If the call is successful the group ID is returned. Otherwise the If the call is successful the group ID is returned. Otherwise the
return value is @code{(pid_t) -1} and the global variable @var{errno} return value is @code{(pid_t) -1} and the global variable @code{errno}
is set to the following value: is set to the following value:
@table @code @table @code
@item EBADF @item EBADF

View File

@ -2197,7 +2197,7 @@ protected using cancellation handlers.
@c ref pthread_cleanup_push / pthread_cleanup_pop @c ref pthread_cleanup_push / pthread_cleanup_pop
The return value of the function is zero if no error occurred. Otherwise The return value of the function is zero if no error occurred. Otherwise
it is @math{-1} and the global variable @var{errno} is set to the it is @math{-1} and the global variable @code{errno} is set to the
following values: following values:
@table @code @table @code
@item EBADF @item EBADF
@ -2230,7 +2230,7 @@ required by @code{fdatasync}.
The prototype for @code{fdatasync} is in @file{unistd.h}. The prototype for @code{fdatasync} is in @file{unistd.h}.
The return value of the function is zero if no error occurred. Otherwise The return value of the function is zero if no error occurred. Otherwise
it is @math{-1} and the global variable @var{errno} is set to the it is @math{-1} and the global variable @code{errno} is set to the
following values: following values:
@table @code @table @code
@item EBADF @item EBADF

View File

@ -1835,7 +1835,7 @@ pointer @var{buffer}. The random number is returned in the variable
pointed to by @var{result}. pointed to by @var{result}.
The return value of the function indicates whether the call succeeded. The return value of the function indicates whether the call succeeded.
If the value is less than @code{0} an error occurred and @var{errno} is If the value is less than @code{0} an error occurred and @code{errno} is
set to indicate the problem. set to indicate the problem.
This function is a GNU extension and should not be used in portable This function is a GNU extension and should not be used in portable

View File

@ -116,7 +116,7 @@ opaque type and can be used in calls to the other functions to refer to
this loaded catalog. this loaded catalog.
The return value is @code{(nl_catd) -1} in case the function failed and The return value is @code{(nl_catd) -1} in case the function failed and
no catalog was loaded. The global variable @var{errno} contains a code no catalog was loaded. The global variable @code{errno} contains a code
for the error causing the failure. But even if the function call for the error causing the failure. But even if the function call
succeeded this does not mean that all messages can be translated. succeeded this does not mean that all messages can be translated.
@ -242,7 +242,7 @@ translation actually happened must look like this:
@end smallexample @end smallexample
@noindent @noindent
When an error occurs the global variable @var{errno} is set to When an error occurs the global variable @code{errno} is set to
@table @var @table @var
@item EBADF @item EBADF
@ -315,8 +315,8 @@ The @code{catclose} function can be used to free the resources
associated with a message catalog which previously was opened by a call associated with a message catalog which previously was opened by a call
to @code{catopen}. If the resources can be successfully freed the to @code{catopen}. If the resources can be successfully freed the
function returns @code{0}. Otherwise it returns @code{@minus{}1} and the function returns @code{0}. Otherwise it returns @code{@minus{}1} and the
global variable @var{errno} is set. Errors can occur if the catalog global variable @code{errno} is set. Errors can occur if the catalog
descriptor @var{catalog_desc} is not valid in which case @var{errno} is descriptor @var{catalog_desc} is not valid in which case @code{errno} is
set to @code{EBADF}. set to @code{EBADF}.
@end deftypefun @end deftypefun
@ -849,14 +849,14 @@ say more about this when we talk about the ways message catalogs are
selected (@pxref{Locating gettext catalog}). selected (@pxref{Locating gettext catalog}).
The @code{gettext} function does not modify the value of the global The @code{gettext} function does not modify the value of the global
@var{errno} variable. This is necessary to make it possible to write @code{errno} variable. This is necessary to make it possible to write
something like something like
@smallexample @smallexample
printf (gettext ("Operation failed: %m\n")); printf (gettext ("Operation failed: %m\n"));
@end smallexample @end smallexample
Here the @var{errno} value is used in the @code{printf} function while Here the @code{errno} value is used in the @code{printf} function while
processing the @code{%m} format element and if the @code{gettext} processing the @code{%m} format element and if the @code{gettext}
function would change this value (it is called before @code{printf} is function would change this value (it is called before @code{printf} is
called) we would get a wrong message. called) we would get a wrong message.
@ -1133,7 +1133,7 @@ only lead to problems.
The function returns the value which is from now on taken as the default The function returns the value which is from now on taken as the default
domain. If the system went out of memory the returned value is domain. If the system went out of memory the returned value is
@code{NULL} and the global variable @var{errno} is set to @code{ENOMEM}. @code{NULL} and the global variable @code{errno} is set to @code{ENOMEM}.
Despite the return value type being @code{char *} the return string must Despite the return value type being @code{char *} the return string must
not be changed. It is allocated internally by the @code{textdomain} not be changed. It is allocated internally by the @code{textdomain}
function. function.
@ -1190,7 +1190,7 @@ containing the name of the selected directory name. The string is
allocated internally in the function and must not be changed by the allocated internally in the function and must not be changed by the
user. If the system went out of core during the execution of user. If the system went out of core during the execution of
@code{bindtextdomain} the return value is @code{NULL} and the global @code{bindtextdomain} the return value is @code{NULL} and the global
variable @var{errno} is set accordingly. variable @code{errno} is set accordingly.
@end deftypefun @end deftypefun
@ -1585,7 +1585,7 @@ string containing the name of the selected codeset. The string is
allocated internally in the function and must not be changed by the allocated internally in the function and must not be changed by the
user. If the system went out of core during the execution of user. If the system went out of core during the execution of
@code{bind_textdomain_codeset}, the return value is @code{NULL} and the @code{bind_textdomain_codeset}, the return value is @code{NULL} and the
global variable @var{errno} is set accordingly. global variable @code{errno} is set accordingly.
@end deftypefun @end deftypefun

View File

@ -691,7 +691,7 @@ function. Therefore one must not misuse this buffer to save some state
information from one call to another. information from one call to another.
Before the function returns with a failure code, the implementation Before the function returns with a failure code, the implementation
should store the value of the local @var{errno} variable in the variable should store the value of the local @code{errno} variable in the variable
pointed to be @var{errnop}. This is important to guarantee the module pointed to be @var{errnop}. This is important to guarantee the module
working in statically linked programs. The stored value must not be working in statically linked programs. The stored value must not be
zero. zero.
@ -725,7 +725,7 @@ The implementation of this function should honor the @var{stayopen}
flag set by the @code{set@var{DB}ent} function whenever this makes sense. flag set by the @code{set@var{DB}ent} function whenever this makes sense.
Before the function returns, the implementation should store the value of Before the function returns, the implementation should store the value of
the local @var{errno} variable in the variable pointed to by the local @code{errno} variable in the variable pointed to by
@var{errnop}. This is important to guarantee the module works in @var{errnop}. This is important to guarantee the module works in
statically linked programs. statically linked programs.

View File

@ -449,7 +449,7 @@ entry in the table is not the return value of the function. It is
returned by storing it in a pointer variable pointed to by the returned by storing it in a pointer variable pointed to by the
@var{retval} parameter. The return value of the function is an integer @var{retval} parameter. The return value of the function is an integer
value indicating success if it is non-zero and failure if it is zero. value indicating success if it is non-zero and failure if it is zero.
In the latter case the global variable @var{errno} signals the reason for In the latter case the global variable @code{errno} signals the reason for
the failure. the failure.
@table @code @table @code

View File

@ -300,7 +300,7 @@ information about the current context's stack may be in the
architecture-specific subfields of the @code{uc_mcontext} field. architecture-specific subfields of the @code{uc_mcontext} field.
The function returns @code{0} if successful. Otherwise it returns The function returns @code{0} if successful. Otherwise it returns
@code{-1} and sets @var{errno} accordingly. @code{-1} and sets @code{errno} accordingly.
@end deftypefun @end deftypefun
The @code{getcontext} function is similar to @code{setjmp} but it does The @code{getcontext} function is similar to @code{setjmp} but it does
@ -425,7 +425,7 @@ installed and execution continues as described in this context.
If @code{swapcontext} succeeds the function does not return unless the If @code{swapcontext} succeeds the function does not return unless the
context @var{oucp} is used without prior modification by context @var{oucp} is used without prior modification by
@code{makecontext}. The return value in this case is @code{0}. If the @code{makecontext}. The return value in this case is @code{0}. If the
function fails it returns @code{-1} and sets @var{errno} accordingly. function fails it returns @code{-1} and sets @code{errno} accordingly.
@end deftypefun @end deftypefun
@heading Example for SVID Context Handling @heading Example for SVID Context Handling

View File

@ -2864,7 +2864,7 @@ without getting interrupted by a signal, this is zero.
@code{struct timespec} is described in @xref{Elapsed Time}. @code{struct timespec} is described in @xref{Elapsed Time}.
If the function returns because the interval is over the return value is If the function returns because the interval is over the return value is
zero. If the function returns @math{-1} the global variable @var{errno} zero. If the function returns @math{-1} the global variable @code{errno}
is set to the following values: is set to the following values:
@table @code @table @code

View File

@ -2034,7 +2034,7 @@ If a user with ID @var{uid} is found, the pointer returned in
or if an error occurred, the pointer returned in @var{result} is a null or if an error occurred, the pointer returned in @var{result} is a null
pointer. The function returns zero or an error code. If the buffer pointer. The function returns zero or an error code. If the buffer
@var{buffer} is too small to contain all the needed information, the @var{buffer} is too small to contain all the needed information, the
error code @code{ERANGE} is returned and @var{errno} is set to error code @code{ERANGE} is returned and @code{errno} is set to
@code{ERANGE}. @code{ERANGE}.
@end deftypefun @end deftypefun
@ -2353,7 +2353,7 @@ If a group with ID @var{gid} is found, the pointer returned in
or if an error occurred, the pointer returned in @var{result} is a null or if an error occurred, the pointer returned in @var{result} is a null
pointer. The function returns zero or an error code. If the buffer pointer. The function returns zero or an error code. If the buffer
@var{buffer} is too small to contain all the needed information, the @var{buffer} is too small to contain all the needed information, the
error code @code{ERANGE} is returned and @var{errno} is set to error code @code{ERANGE} is returned and @code{errno} is set to
@code{ERANGE}. @code{ERANGE}.
@end deftypefun @end deftypefun