Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!husc6!necntc!ames!amdcad!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c,comp.unix.questions Subject: Re: Weird syscall returns Message-ID: <23659@sun.uucp> Date: Thu, 16-Jul-87 15:19:47 EDT Article-I.D.: sun.23659 Posted: Thu Jul 16 15:19:47 1987 Date-Received: Sat, 18-Jul-87 08:44:08 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <430@sds.SciCom.MN.ORG> Sender: news@sun.uucp Followup-To: comp.unix.questions Lines: 31 Xref: mnetor comp.lang.c:3101 comp.unix.questions:3219 (This is now a UNIX discussion rather than a C discussion, so I'm moving it to comp.unix.questions.) > > Other versions of "nice" may just return 0 on success, but they all > > return -1 on error. > > How about "all reasonable versions return -1 on error"? Here in the > backwaters of UNIX work-a-likes (aka XENIX), the manual says > > Note that 'nice' is unusual in the way return codes are > handled. It differs from most other system calls in two ways: the > value -1 is a valid return code (in the case where the new nice > value is 19), and the system call either works or ignores the > request; THERE IS NEVER AN ERROR. [my emphasis] Well, if this is really the case (i.e., they didn't just botch the manual page), I'd be curious to know why they changed the AT&T code. (Yes, Xenix *IS* derived from AT&T code; it's not a "rewritten from scratch" "work-alike".) My suspicion is that the documentation writers just got confused. Try writing a program that attempts to reduce your "nice", and run that program when not the super-user. Have the program set "errno" to zero before making the call, and check both the return code from "nice" and the value of "errno" after making the call. If the return code isn't -1, and the value of "errno" isn't EPERM, somebody doing the software screwed up. If the return code is -1, and the value of "errno" is EPERM, somebody doing the documentation screwed up. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com