Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!grkermit!masscomp!clyde!burl!ulysses!mhuxl!ihnp4!zehntel!hplabs!hao!seismo!rlgvax!guy From: guy@rlgvax.UUCP Newsgroups: net.unix-wizards Subject: Re: Type of brk(2) return value Message-ID: <1943@rlgvax.UUCP> Date: Wed, 30-May-84 01:05:06 EDT Article-I.D.: rlgvax.1943 Posted: Wed May 30 01:05:06 1984 Date-Received: Mon, 28-May-84 05:40:15 EDT References: <488@sri-arpa.UUCP> <60@dadla.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 22 > I think you would find that brk() really returns an > int and not a char * (I've looked at the code for 4.1 BSD, > 2.8 BSD and Bell V7). This is because of the way the entries > are defined in the sysent[] table (as pointers to functions > which return int). Therefore all system calls return int. Look at the "time(2)" system call page. Then tell me all system calls return "int". The declaration of the routines in the sysent[] table is irrelevant; values are returned from a system call in the kernel to user-mode code by filling in the return value in the U page; this value is then stuffed into the appropriate register(s), so a system call can return whatever it pleases, except for a structure. Furthermore, the user-mode routine that issues the system call need not have the same behavior as the actual trap; check out the "signal" call for an example. However, "brk" does, indeed, return an "int" and "sbrk" does, indeed, return a "char *". The S5 manual (which is the one sitting in front of me at this instant) states it correctly, and probably other versions of the manual do so as well. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy