Return to BSD News archive
Xref: sserve comp.os.misc:3352 comp.unix.bsd:15042 comp.unix.internals:7795 comp.unix.programmer:20635 Newsgroups: comp.os.misc,comp.unix.bsd,comp.unix.internals,comp.unix.programmer,comp.unix.quest1ions Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!uunet!psinntp!relay1!unislc!rick From: rick@unislc.slc.unisys.com (Rick Cohen) Subject: Re: Question: What exactly does sbrk(0) do? References: <36n65p$blf@sal-sun2.usc.edu> Message-ID: <1994Oct5.165455.29421@unislc.slc.unisys.com> Reply-To: rick@unislc.UUCP (Rick Cohen,D1V03,6359,CC 5231) Organization: Unisys, Salt Lake City Date: Wed, 5 Oct 1994 16:54:55 GMT Keywords: Question: What exactly does sbrk(0) do? Lines: 27 In article <36n65p$blf@sal-sun2.usc.edu> fabbroci@sal-sun2.usc.edu (Frank Fabbrocino) writes: >From what I understand, calling sbrk(0) returns the size of the data segment >in the executable. However, I can't find this call in our system documentation >or my UNIX books (specifically, calling sbrk with 0). Since I can't look >at the code for sbrk() since our system is proprietary :( and I can't find >the code on BSD ftp sites :( does anyone know where I can get more info >on that specific call of sbrk() with 0 as an arg? Do I even have the right >info on what sbrk(0) does? > >Thanks in advance. > >Later, >Frank On my SVR4 system, the man page for sbrk(2) reads: . . . DIAGNOSTICS Upon successful completion, brk returns a value of 0 and sbrk returns the old break value. Otherwise, a value of -1 is returned and errno is set to indicate the error. So, calling sbrk(0) is not a special case since adding 0 bytes doesn't change anything.