Subject: Re: tales of woe from the recent tools/compat_defs.h pullups on
To: None <jmc@netbsd.org>
From: None <cgd@broadcom.com>
List: tech-toolchain
Date: 06/23/2004 09:24:28
At Wed, 23 Jun 2004 16:16:17 +0000 (UTC), cgd@broadcom.com wrote:
> if people do that for function calls other than those that
> specifically need it (because they don't directly return an error
> indication), then they're broken.

BTW, the solaris intro(2) manual page indicates "[errno] should be
tested only after an error has been indicated," and the NetBSD errno
manual page says "[errno] should only be examined after an error."
One could interpret both as indicating that errno will **only** be set
in the case of an error -- but both manual pages really document errno
behaviour regarding syscalls, and don't really touch its use w/
library functions.

The linux manual page is explicit:

       The integer errno is set by system calls (and some library
       functions) to indicate what went wrong.  Its value is sig-
       nificant  only  when  the  call returned an error (usually
       -1), and a library function that does succeed  is  allowed
       to change errno.


(I don't know what the relevant standards say, but obviously if you
want to write practically-portable code, the documented linux
behaviour should be taken into account.)



chris