Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!lcc.rich-wiz@ucla-locus.ARPA From: lcc.rich-wiz@ucla-locus.ARPA (Richard Mathews) Newsgroups: net.unix-wizards Subject: Re: Syscall Return Values Message-ID: <2612@brl-tgr.ARPA> Date: Wed, 30-Oct-85 12:14:23 EST Article-I.D.: brl-tgr.2612 Posted: Wed Oct 30 12:14:23 1985 Date-Received: Fri, 1-Nov-85 02:34:15 EST Sender: news@brl-tgr.ARPA Lines: 23 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@LOCUS.UCLA.EDU lcc.richard@UCLA-CS {ucivax,trwrb}!lcc!richard {ihnp4,randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!richard