]> git.saurik.com Git - apple/libc.git/blame - stdlib/FreeBSD/memory.3.patch
Libc-498.tar.gz
[apple/libc.git] / stdlib / FreeBSD / memory.3.patch
CommitLineData
224c7076
A
1--- memory.3 2003-05-20 15:23:25.000000000 -0700
2+++ memory.3.edit 2006-07-13 09:26:29.000000000 -0700
3@@ -36,42 +36,101 @@
4 .Dt MEMORY 3
5 .Os
6 .Sh NAME
7-.Nm malloc ,
8-.Nm free ,
9-.Nm realloc ,
10-.Nm calloc ,
11 .Nm alloca ,
12-.Nm mmap
13+.Nm calloc ,
14+.Nm free ,
15+.Nm malloc ,
16+.Nm mmap ,
17+.Nm realloc
18 .Nd general memory allocation operations
19 .Sh LIBRARY
20 .Lb libc
21 .Sh SYNOPSIS
22 .In stdlib.h
23 .Ft void *
24-.Fn malloc "size_t size"
25-.Ft void
26-.Fn free "void *ptr"
27+.Fo alloca
28+.Fa "size_t size"
29+.Fc
30 .Ft void *
31-.Fn realloc "void *ptr" "size_t size"
32+.Fo calloc
33+.Fa "size_t nelem"
34+.Fa "size_t elsize"
35+.Fc
36+.Ft void
37+.Fo free
38+.Fa "void *ptr"
39+.Fc
40 .Ft void *
41-.Fn calloc "size_t nelem" "size_t elsize"
42+.Fo malloc
43+.Fa "size_t size"
44+.Fc
45 .Ft void *
46-.Fn alloca "size_t size"
47-.In sys/types.h
48+.Fo realloc
49+.Fa "void *ptr"
50+.Fa "size_t size"
51+.Fc
52 .In sys/mman.h
53 .Ft void *
54-.Fn mmap "void * addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
55+.Fo mmap
56+.Fa "void * addr"
57+.Fa "size_t len"
58+.Fa "int prot"
59+.Fa "int flags"
60+.Fa "int fildes"
61+.Fa "off_t off"
62+.Fc
63 .Sh DESCRIPTION
64 These functions allocate and free memory for the calling process.
65 They are described in the
66 individual manual pages.
67+.Sh LEGACY SYNOPSIS
68+.Fd #include <sys/types.h>
69+.Fd #include <sys/mman.h>
70+.Pp
71+.Ft void *
72+.br
73+.Fo mmap
74+.Fa "void * addr"
75+.Fa "size_t len"
76+.Fa "int prot"
77+.Fa "int flags"
78+.Fa "int fildes"
79+.Fa "off_t off"
80+.Fc ;
81+.Pp
82+The include file
83+.In sys/types.h
84+is needed for this function.
85+.Sh COMPATIBILITY
86+.Fn mmap
87+now returns with
88+.Va errno
89+set to EINVAL in places that historically succeeded.
90+The rules have changed as follows:
91+.Bl -bullet
92+.It
93+The
94+.Fa flags
95+parameter must specify either MAP_PRIVATE or MAP_SHARED.
96+.It
97+The
98+.Fa size
99+parameter must not be 0.
100+.It
101+The
102+.Fa off
103+parameter must be a multiple of pagesize,
104+as returned by
105+.Fn sysconf .
106+.El
107 .Sh SEE ALSO
108 .Xr mmap 2 ,
109 .Xr alloca 3 ,
110 .Xr calloc 3 ,
111 .Xr free 3 ,
112 .Xr malloc 3 ,
113-.Xr realloc 3
114+.Xr realloc 3 ,
115+.Xr compat 5
116 .Sh STANDARDS
117 These functions, with the exception of
118 .Fn alloca