Syscall Return Values
Richard Mathews
lcc.rich-wiz at ucla-locus.ARPA
Thu Oct 31 03:14:23 AEST 1985
Key: >> Niket; > Cottrell
>/*
>> I thought that every SYSTEM CALL returned -1 on error.
>Make that MOST system calls. The idea is to return an out-of-band
>value of the same type.
For once, I agree with Niket. Can you name any system calls which will
return something other than -1 when they get an error?
It is not new for a system call to return -1 even though it normally
returns a pointer. Take a look at sbrk(2) and signal(2). It is, however,
very unfortunate. It is just as unfortunate that System V's nice(2) can
return -1 even when it is successful. The only real way to test for error
in these cases is to set errno to zero before the call and take advantage
of the fact that errno is modified iff the call is unsuccessful.
Richard M. Mathews
Locus Computing Corporation lcc.richard at LOCUS.UCLA.EDU
lcc.richard at UCLA-CS
{ucivax,trwrb}!lcc!richard
{ihnp4,randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!richard
More information about the Comp.unix.wizards
mailing list