BRK(2) DOMAIN/IX Reference Manual (SYS5) BRK(2)
NAME
brk, sbrk - change amount of memory available
USAGE
int brk (endds)
char *endds;
char *sbrk (incr)
int incr;
DESCRIPTION
These calls extend the amount of memory available to a pro-
gram, beyond what was allocated when the program was com-
piled. The break value is the address of the first location
beyond the end of available memory; the amount of allocated
space increases as the break value increases. Brk and sbrk
are used to change the break value while the process is run-
ning. The address of the newly allocated space is set to
zero.
Brk sets the break value to endds.
Sbrk adds incr bytes to the break value. Incr can be nega-
tive, in which case the amount of allocated space is
decreased.
RETURN VALUE
Brk returns zero if the break was set; sbrk returns the old
break value, if the call was successful. Otherwise, the
calls return -1 and set errno to indicate the error.
ERRORS
Brk and sbrk will fail without making any changes if one or
more of the following is true:
[ENOMEM] The change would result in more space being
allocated than a system-imposed maximum
allows (see set_sbrk_size(2)).
The change would result in the break value
being greater than or equal to the start
address of any attached shared memory segment
(see shmop(2)).
RELATED INFORMATION
exec(2), shmop(2), ulimit(2), set_sbrk_size(2)
Printed 5/10/85 BRK-1