From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/110 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: errno (was: Weekly reports - B) Date: Wed, 6 Jul 2011 14:57:38 +0200 Message-ID: <20110706125738.GN27634@port70.net> References: <4DF12B1D.7050106@gmail.com> <20110613021130.GA21268@openwall.com> <20110613022221.GO191@brightrain.aerifal.cx> <20110613025655.GA21653@openwall.com> <20110613045418.GQ191@brightrain.aerifal.cx> <20110706113508.GA21773@openwall.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1309957088 23874 80.91.229.12 (6 Jul 2011 12:58:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 6 Jul 2011 12:58:08 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-194-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jul 06 14:57:56 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QeRfr-0001Th-Ds for gllmg-musl@lo.gmane.org; Wed, 06 Jul 2011 14:57:51 +0200 Original-Received: (qmail 19817 invoked by uid 550); 6 Jul 2011 12:57:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19809 invoked from network); 6 Jul 2011 12:57:50 -0000 Content-Disposition: inline In-Reply-To: <20110706113508.GA21773@openwall.com> User-Agent: Mutt/1.5.20 (2009-06-14) Xref: news.gmane.org gmane.linux.lib.musl.general:110 Archived-At: * Solar Designer [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 * sysdeps/generic/bits/errno.h: Remove __set_errno definition. * ... and then 2002-11-25 Jakub Jelinek * 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 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 */