Bell 32V development
[unix-history] / usr / man / man2 / brk.2
CommitLineData
cb67878b
TL
1.TH BRK 2
2.SH NAME
3brk, sbrk, break \- change core allocation
4.SH SYNOPSIS
5.B char *brk(addr)
6.PP
7.B char *sbrk(incr)
8.SH DESCRIPTION
9.I Brk
10sets the system's idea of the lowest location not used by the program
11(called the break)
12to
13.I addr
14(rounded up to the next multiple of 64 bytes
15on the PDP11, 256 bytes on the Interdata 8/32,
16and 512 bytes on a VAX-11).
17Locations not less than
18.I addr
19and below the stack pointer
20are not in the address space and will thus
21cause a memory violation if accessed.
22.PP
23In the alternate function
24.I sbrk,
25.I incr
26more bytes are added to the
27program's data space and a pointer to the
28start of the new area is returned.
29.PP
30When a program begins execution via
31.I exec
32the break is set at the
33highest location defined by the program
34and data storage areas.
35Ordinarily, therefore, only programs with growing
36data areas need to use
37.IR break .
38.SH "SEE ALSO"
39exec(2),
40malloc(3),
41end(3)
42.SH DIAGNOSTICS
43Zero is returned if the break could be set;
44\-1 if the program requests more
45memory than the system limit
46or if too many segmentation
47registers would be required to implement the break.
48.SH BUGS
49Setting the break in the range
500177701 to 0177777 (on the PDP11) is the same as setting it to zero.
51.SH "ASSEMBLER (PDP-11)"
52(break = 17.)
53.br
54.B sys break; addr
55.PP
56.I Break
57performs the function of
58.IR brk .
59The name of the routine differs from that in C
60for historical reasons.