This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Non-volatile errno


Chapter Error Reporting, section Checking for Errors defines errno as:

@deftypevr {Variable} {volatile int} errno

and continues on to say:

Since @code{errno} is declared @code{volatile}, it might be changed
asynchronously by a signal handler; see @ref{Defining Handlers}.

but errno is not declared volatile.  On a system built with 2.19:

$ find /usr/include -name errno.h | xargs grep 'volatile.*errno'
$ find /usr/include -name errno.h | xargs grep 'int errno'
/usr/include/errno.h:extern int errno;

In the current git:
$ find . -name errno.h | xargs grep 'volatile.*errno'
$ find . -name errno.h | xargs grep 'int errno'
...
./stdlib/errno.h:extern int errno;

I assume extern is taken for granted since I don't see any other
variables declared extern in the manual.

Also, I'm not sure about the correctness of the subsequent description.
 Is it true that a signal handler can asynchronously change errno
*because* it is declared volatile?  If so, does removing the volatile
declaration warrant removing the comment about signal handlers, or
should that be reworded to say something else?

Thank you,
Rical Jasan

diff --git a/manual/errno.texi b/manual/errno.texi
index eb9617e..bf65015 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -38,7 +38,7 @@ variable @code{errno}.  This variable is declared in the header file
 
 @comment errno.h
 @comment ISO
-@deftypevr {Variable} {volatile int} errno
+@deftypevr {Variable} int errno
 The variable @code{errno} contains the system error number.  You can
 change the value of @code{errno}.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]