This is the mail archive of the libc-alpha@sources.redhat.com 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]

errno assignment problems (was Re: ECANCELED, errlist.c (was Re: FreeBSD port (11): a new errno))


On Tue, Aug 27, 2002 at 11:07:47PM -0400, Roland McGrath wrote:
> This is not a "limit".  It is the number of entries (i.e. sys_nerr value)
> that the symbols in that version set need to have for binary compatibility.
> It has to be exact for it to mean anything useful.
> 
> It hadn't occurred to me that the errno values would be inconsistent across
> Linux platforms (which I frankly find to be obviously insane).  The old
> sys_errlist binary compatibility code for Linux was not machine-specific.
> It defined the GLIBC_2.0 version of sys_errlist/sys_nerr with 123 entries
> on all platforms, and the GLIBC_2.1 default version with however many
> entries errlist.c defined.  If other platforms with different values did
> not have exactly 123 entries before, then the GLIBC_2.0 compatibility
> symbol has always been wrong for them.
> 
> It would be straightforward enough to add a configuration tuple pattern to
> the magic comments so that different ones apply to different configurations.

Things are way more complicated it seems.
@GLIBC_2.1 sys_errlist should have 125 entries on IA-32, 131
on Alpha and 127 on SPARC.
What should @GLIBC_2.0 have is very unclear, e.g. in glibc Red Hat shipped
in 5.0 (glibc-2.0.5c-9) had 123 entries on IA-32 and 129 on Alpha,
glibc Red Hat shipped in 5.1 (glibc-2.0.7-13) already has 125 entries on
IA-32, 131 on Alpha and 127 on Sparc (there was no Sparc port of 5.0)
and the same numbers were in 5.2 glibc too.
Reading kernel source reveals that most of the arches use the same errno
values as IA-32 (ie. asm-generic/errno.h), with the exceptions:
platform	biggest errno + 1	has ECANCELED				errno 125
generic		125			no					unasigned
alpha		131			no					ELIBMAX
mips{,64}	1134			yes					doesnt define ECANCELED to 125 in bits/errno.h
parisc		254			yes (though spelled as ECANCELLED)	unasigned
sparc{,64}	127			no					ENOMEDIUM
Furthermore, EDOM, EILSEQ and ERANGE values are bogus on the non-"generic" platforms
if only __need_Emath was requested, fortunately I cannot find any header which is
defining this macro.
All in all, we are in quite a big trouble everywhere, especially so on sparc* and alpha.

So, IMHO the solution must be stop using <asm/errno.h> immediately, instead
put all the defines into linux/bits/errno.h (the generic definitions) and
linux/alpha/bits/errno.h, linux/alpha/mips/bits/errno.h,
linux/alpha/hppa/bits/errno.h and linux/alpha/sparc/bits/errno.h.

Get in touch with kernel folks and #define ECANCELED in asm-generic/errno.h.

As neither the kernel nor glibc ever generates ELIBMAX, IMHO it is
possible to simply use a different value for it on Alpha and use 125 for
ECANCELED (again, should be changed in the kernel too), so that aio is
binary compatible. What to do on SPARC is really unclear, as ENOMEDIUM
is generated by the kernel a lot - either we use a different value for
ECANCELED, or live with it being the same value as ENOMEDIUM.

The errlist script should look all the Version files for errlist counts
and they should match the platform counts.

	Jakub


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