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]
  
<http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/getloadavg.c;hb=HEAD>
  line 63, the function can fail without setting errno.

- The OpenSolaris implementation [2] indeed sets errno.

- The BSD implementations [3][4][5][6] also set errno.

Bruno

[1] glibc source, files sysdeps/unix/sysv/linux/getloadavg.c, 
sysdeps/mach/getloadavg.c
[2] OpenSolaris source 
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/>,
    files usr/src/lib/libc/port/gen/getloadavg.c,
    usr/src/lib/libc/common/sys/__getloadavg.s,
    usr/src/uts/common/syscall/getloadavg.c
[3] FreeBSD source, file lib/libc/gen/getloadavg.c
[4] NetBSD source, file lib/libc/gen/getloadavg.c
[5] OpenBSD source, file lib/libc/gen/getloadavg.c
[6] MacOS X source, file Libc-*/gen/getloadavg.c
-- 
In memoriam Mildred Fish-Harnack <http://en.wikipedia.org/wiki/Mildred_Harnack>

Reply via email to