Type of brk(2) return value

Roger Southwick rogers at dadla.UUCP
Mon May 21 14:21:50 AEST 1984


	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.

	If you read the DIAGNOSTICS portion, it gives a 0
when the break was granted, and a -1 when not granted.  This
is consistant with all other system calls.

	I believe that this is an error in the documentation
in the page for brk, sbrk, break.  I think it should read:

	brk(addr)
	char *addr;

	sbrk(incr)
	char *incr;


	I think you'll find that this is the way it should be, 
although I really didn't dig into how brk() and sbrk() work all
that much.  I am real positive as to the return values though.


		-Roger Southwick

		...!tektronix!dadla!rogers



More information about the Comp.unix.wizards mailing list