Copyright (c) 1980 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)brk.2 4.1 (Berkeley) 05/09/85
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)brk.2 4.1 (Berkeley) 05/09/85
BRK 2
C 4 NAME
brk, sbrk, break - change core allocation
SYNOPSIS
char *brk(addr) char *sbrk(incr)
DESCRIPTION
Brk sets the system's idea of the lowest location not used by the program
(called the break)
to
addr (rounded up to the next multiple of 64 bytes
on the PDP11, 256 bytes on the Interdata 8/32,
and 1024 bytes on a VAX-11).
Locations not less than
addr and below the stack pointer
are not in the address space and will thus
cause a memory violation if accessed.
In the alternate function sbrk, incr more bytes are added to the program's data space and a pointer to the start of the new area is returned.
When a program begins execution via exec the break is set at the highest location defined by the program and data storage areas. Ordinarily, therefore, only programs with growing data areas need to use break .
The vlimit (2) system call may be used to determine the maximum permissible size of the data region; it will not be possible to set the break beyond \*(lqetext + vlimit(LIM_DATA, -1).\*(rq (See end (3) for the definition of etext .)
"SEE ALSO"
exec(2),
vlimit(2),
malloc(3),
end(3)
DIAGNOSTICS
Zero is returned if the
brk could be set;
-1 if the program requests more
memory than the system limit
or if too many segmentation
registers would be required to implement the break.
Sbrk returns -1 if the break could not be set.
BUGS
Setting the break in the range
0177701 to 0177777 (on the PDP11) is the same as setting it to zero.
"ASSEMBLER (PDP-11)"
(break = 17.)
sys break; addr
Break performs the function of brk . The name of the routine differs from that in C for historical reasons.