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]

Re: Non-volatile errno


On 24 Oct 2014 22:08, ricaljasan wrote:
> 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;

it isn't used though.  if you read the file:
#ifndef errno
extern int errno;
#endif

and Linux systems do:
extern int *__errno_location (void) __THROW __attribute__ ((__const__));
#define errno (*__errno_location ())
-mike

Attachment: signature.asc
Description: Digital signature


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