|
|
Message-ID: <20110706125738.GN27634@port70.net>
Date: Wed, 6 Jul 2011 14:57:38 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: errno (was: Weekly reports - B)
* Solar Designer <solar@...nwall.com> [2011-07-06 15:35:08 +0400]:
> On Mon, Jun 13, 2011 at 12:54:18AM -0400, Rich Felker wrote:
> > ... errno is a macro and has been for a
> > long time (ever since threads) on most systems. It's required by the
> > standard to be an lvalue macro.
>
> Any idea why glibc has __set_errno() internally instead of assigning to
> its errno directly, then? The implementation for __set_errno() does a
> direct assignment anyway. What did the glibc developers need
it seems there was a different definition under sysdeps until
2002-07-19 Ulrich Drepper <drepper@...hat.com>
* sysdeps/generic/bits/errno.h: Remove __set_errno definition.
* ...
and then
2002-11-25 Jakub Jelinek <jakub@...hat.com>
* include/errno.h (__set_errno): Define as errno = val
unconditionally.
in older glibc eg sysdeps/unix/sysv/linux/bits/errno.h had code like
#ifdef _ERRNO_H
# undef EDOM
# undef EILSEQ
# undef ERANGE
# include <linux/errno.h>
/* Linux has no ENOTSUP error code. */
# define ENOTSUP EOPNOTSUPP
/* Linux also has no ECANCELED error code. Since it is not used here
we define it to an invalid value. */
# define ECANCELED 125
# ifndef __ASSEMBLER__
/* We now need a declaration of the `errno' variable. */
extern int errno;
/* Function to get address of global `errno' variable. */
extern int *__errno_location __P ((void)) __attribute__ ((__const__));
# if defined _LIBC
/* We wouldn't need a special macro anymore but it is history. */
# define __set_errno(val) (*__errno_location ()) = (val)
# endif /* _LIBC */
# if !defined _LIBC || defined _LIBC_REENTRANT
/* When using threads, errno is a per-thread value. */
# define errno (*__errno_location ())
# endif
# endif /* !__ASSEMBLER__ */
#endif /* _ERRNO_H */
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.