]> git.lizzy.rs Git - plan9front.git/blob - sys/man/2/segbrk
kernel: use uintptr for ibrk() return value (for base >2GB) and clarify segbrk(2)
[plan9front.git] / sys / man / 2 / segbrk
1 .TH SEGBRK 2
2 .SH NAME
3 segbrk \- change memory allocation
4 .SH SYNOPSIS
5 .B #include <u.h>
6 .br
7 .B #include <libc.h>
8 .PP
9 .ta \w'\fLvoid* 'u
10 .B
11 void*   segbrk(void *saddr, void *addr)
12 .PP
13 .SH DESCRIPTION
14 .I Segbrk
15 sets the system's idea of the lowest unused location of a segment
16 to
17 .I addr
18 rounded up to the next multiple of a page size, typically 4096 bytes.
19 The segment is identified by
20 .I saddr
21 which may be any valid address within the segment.
22 .PP
23 A call to
24 .I segbrk
25 with a zero
26 .I addr
27 argument returns the base address of the segment without
28 altering its size.
29 .PP
30 The system will prevent segments from overlapping and will not allow the
31 length of the
32 text, data, or stack segment to be altered.
33 .SH SOURCE
34 .B /sys/src/libc/9syscall
35 .SH SEE ALSO
36 .IR brk (2),
37 .IR segattach (2),
38 .IR segflush (2)
39 .br
40 .BR /proc/*/segment
41 .SH DIAGNOSTICS
42 Sets
43 .IR errstr .
44 .I Segbrk
45 returns
46 .B (void*)-1
47 on error.
48 .SH BUGS
49 The
50 .I segbrk
51 system call may go away or be re-implemented
52 to give more general segment control,
53 subsuming the functions of
54 .IR brk (2),
55 .IR segflush (2)
56 and
57 .I segfree
58 in
59 .IR segattach (2).