|
|
1.1 root 1: .TH BRK 2
2: .CT 2 mem_man
3: .SH NAME
4: brk, sbrk \(mi change core allocation
5: .SH SYNOPSIS
6: .nf
7: .B int brk(addr)
8: .B char *addr;
9: .PP
10: .B char *sbrk(incr)
11: .fi
12: .SH DESCRIPTION
13: .I Brk
14: sets the system's idea of the lowest location not used by the program
15: (called the break)
16: to
17: .I addr
18: rounded up to the next multiple of 1024 bytes.
19: Locations not less than
20: .I addr
21: and below the stack pointer
22: may cause a memory violation if accessed.
23: .PP
24: In the alternate function
25: .I sbrk,
26: .I incr
27: more bytes are added to the
28: program's data space and a pointer to the
29: start of the new area is returned.
30: Rounding occurs as with
31: .I brk,
32: but a nominal break is remembered, so rounding does not accumulate.
33: .PP
34: When a program begins execution via
35: .I exec
36: the break is set at the
37: highest location defined by the program
38: and data storage areas.
39: Ordinarily, therefore, only programs with growing
40: data areas need to use
41: .IR brk .
42: .PP
43: The error return from
44: .I sbrk
45: is
46: .BR "(char *)-1" .
47: .SH "SEE ALSO"
48: .IR exec (2),
49: .IR end (3),
50: .IR malloc (3)
51: .SH DIAGNOSTICS
52: .B ENOMEM
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.