This is the mail archive of the libc-alpha@sourceware.cygnus.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]

Re: [eric_backus@agilent.com] libc/1510: getc on /dev/null sets errno to 25


> Eric Backus <ericjb@labejb.lsid.hp.com> writes:
> 
> > If GNU libc never modified errno unless there truly is an error to
> > report, it would be easier to use errno on GNU systems, though of
> > course such usage would be non-portable.
> 
> Since it is unportable to rely on errno, why should we change it?
> Such a change only adds costs.  Assigning to errno is not cheap.
> There is a hidden function call involved.
> 
> Plus: there is a good reason why POSIX uses almost exclusively return
> values to signal errors.  This is how it should have been done in the
> first place.  errno is historic baggage we have to carry around but we
> don't want to make this even more expensive and also we don't want to
> encourage people using it.

These seem like reasonable reasons to leave the current behavior.
OK, thanks for considering this.


> > I note in the source code to GNU libc that there are other cases where
> > errno is saved and restored around certain operations.
> 
> This happens only is a standard requires it or an interface is
> designed this way (e.g., in NSS).

I'm pretty sure I saw it inside some stdio functions.  But it doesn't
really matter.

--
			Eric Backus <eric_backus@agilent.com>
			http://labejb.lsid.hp.com/
			(425) 335-2495

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