tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strerror(0) POSIX compliance



On Thu, 24 Mar 2016 17:09:50 +0000 (UTC)
christos%astron.com@localhost (Christos Zoulas) wrote:

> >IMO it's incorrect to say 0 is an "undefined error".  It's defined as
> >success by nearly every syscall.  The emitted string should reflect
> >that, even if [sic] Posix says so.  Perhaps, 
> 
> Actually not; syscalls set errno on error, don't clear errno on
> success [1]. 

Thank you for the correction.  I know what I was "thinking", if you can
call it that: most syscalls *return* 0 on success.  Of course that says
nothing about errno.  Too quick to the keyboard.  

> [1] There is at least one syscall stub that clears errno before the
> syscall which I find bogus; can you guess which one?

As penance, I checked and found quite a few that set errno to 0, but
all in section 3.  Must be looking in the wrong place? 

# (file produced with cscope)
$ awk '/^lib\/libc.+0;$/ { print $1; }' /tmp/errno  | uniq
lib/libc/resolv/res_send.c
lib/libc/db/btree/bt_open.c
lib/libc/db/hash/hash.c
lib/libc/db/recno/rec_open.c
lib/libc/gdtoa/test/dt.c
lib/libc/gen/dehumanize_number.c
lib/libc/gen/fts.c
lib/libc/gen/getttyent.c
lib/libc/gen/glob.c
lib/libc/gen/nice.c
lib/libc/gen/readdir.c
lib/libc/gen/setmode.c
lib/libc/gen/sysctlgetmibinfo.c
lib/libc/locale/multibyte_amd1.c
lib/libc/locale/multibyte_c90.c
lib/libc/net/getaddrinfo.c
lib/libc/net/rcmd.c
lib/libc/resolv/res_debug.c
lib/libc/resolv/res_query.c
lib/libc/resolv/res_send.c
lib/libc/stdlib/strsuftoll.c
lib/libc/time/getdate.c

--jkl


Home | Main Index | Thread Index | Old Index