While the actual process data segment size maintained by the kernel will only grow or shrink in page sizes, these functions allow setting the break to unaligned values (i.e., it may point to any address inside the last page of the data segment).
The current value of the program break may be determined by calling sbrk 0. See also end(3).
The getrlimit(2) system call may be used to determine the maximum permissible size of the data segment. It will not be possible to set the break beyond "etext + rlim.rlim_max" where the rlim.rlim_max value is returned from a call to getrlimit RLIMIT_DATA &rlim. (See end(3) for the definition of etext).
.Rv -std brk
The sbrk function returns the prior break value if successful; otherwise the value (Vt "void *"-1) is returned and the global variable errno is set to indicate the error.
The brk and sbrk functions will fail if: