System Interface Guide

brk(2) and sbrk(2)

brk(2) and sbrk(2) are called to add storage to the data segment of a process.

A process can manipulate this area by calling brk(2) and sbrk(2):


caddr_t
 brk(caddr_t addr);

 caddr_t
 sbrk(intptr_t incr); 

brk(2) identifies the lowest data segment location not used by the caller as addr (rounded up to the next multiple of the system page size).

sbrk(2), the alternate function, adds incr bytes to the caller data space and returns a pointer to the start of the new data area.