Re: getloadavg and errno

2011-02-16 Thread Bruno Haible
Paul Eggert wrote: > I'd prefer a getloadavg that always sets errno when it > fails; that's simpler and regular, and it's what getloadavg > does on GNU/Linux and on Solaris. Really? Let's look at the source code: - In the glibc implementation [1]

Re: getloadavg and errno

2011-02-15 Thread Paul Eggert
On 02/15/2011 03:25 AM, Jim Meyering wrote: Specifying that errno may be changed sounds better, even though coreutils' sole use in uptime.c does not use that. I think I'd prefer a getloadavg that always sets errno when it fails; that's simpler and regular, and it's what getloadavg does on GNU/L

Re: getloadavg and errno

2011-02-15 Thread Jim Meyering
Bruno Haible wrote: > Hi Paul, Jim, > >> + errno = 0;/* Don't be misled if it doesn't set errno. >> */ >> + loads = getloadavg (avg, 3); >> + if (loads == -1) >> +{ >> + perror ("Skipping test; load average not supported"); >> + return 77;

Re: getloadavg and errno

2011-02-15 Thread Bruno Haible
Hi Paul, Jim, > + errno = 0;/* Don't be misled if it doesn't set errno. > */ > + loads = getloadavg (avg, 3); > + if (loads == -1) > +{ > + perror ("Skipping test; load average not supported"); > + return 77; > +} This assignment