[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getloadavg and errno
From: |
Bruno Haible |
Subject: |
Re: getloadavg and errno |
Date: |
Wed, 16 Feb 2011 13:20:30 +0100 |
User-agent: |
KMail/1.9.9 |
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>
Re: getloadavg and errno, Bruno Haible, 2011/02/15
Re: getloadavg on Solaris 2.6, Bruno Haible, 2011/02/17
Re: getloadavg on IRIX, Bruno Haible, 2011/02/17
Re: getloadavg and platforms, Bruno Haible, 2011/02/17