summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotto <>2017-04-17 18:07:15 +0000
committerotto <>2017-04-17 18:07:15 +0000
commit0cb12ace14f001cd3e42cd8bfffe9903ffc74412 (patch)
treed34ef275653a42e7b3e073455297ba2ea03d06c9
parent66ef14d938bdcb68c0aedb0d37f86ffa3366a7e0 (diff)
downloadopenbsd-0cb12ace14f001cd3e42cd8bfffe9903ffc74412.tar.gz
openbsd-0cb12ace14f001cd3e42cd8bfffe9903ffc74412.tar.bz2
openbsd-0cb12ace14f001cd3e42cd8bfffe9903ffc74412.zip
consictently use .Dv NULL and a few other tweaks; ok schwarze@
-rw-r--r--src/lib/libc/stdlib/malloc.337
1 files changed, 17 insertions, 20 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index 602787532e..a943d1baf5 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.112 2017/04/13 18:32:55 otto Exp $ 33.\" $OpenBSD: malloc.3,v 1.113 2017/04/17 18:07:15 otto Exp $
34.\" 34.\"
35.Dd $Mdocdate: April 13 2017 $ 35.Dd $Mdocdate: April 17 2017 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -76,8 +76,8 @@ function allocates uninitialized space for an object of
76the specified 76the specified
77.Fa size . 77.Fa size .
78.Fn malloc 78.Fn malloc
79maintains multiple lists of free blocks according to size, allocating 79maintains multiple lists of free objects according to size, allocating
80space from the appropriate list. 80from the appropriate list or requesting memory from the kernel.
81The allocated space is suitably aligned (after possible pointer coercion) for 81The allocated space is suitably aligned (after possible pointer coercion) for
82storage of any type of object. 82storage of any type of object.
83.Pp 83.Pp
@@ -128,9 +128,9 @@ allocation or, when appropriate, to be returned to the kernel using
128.Xr munmap 2 . 128.Xr munmap 2 .
129If 129If
130.Fa ptr 130.Fa ptr
131is a 131is
132.Dv NULL 132.Dv NULL ,
133pointer, no action occurs. 133no action occurs.
134If 134If
135.Fa ptr 135.Fa ptr
136was previously freed by 136was previously freed by
@@ -158,7 +158,7 @@ the
158function is similar to 158function is similar to
159.Fn reallocarray 159.Fn reallocarray
160except it ensures newly allocated memory is cleared similar to 160except it ensures newly allocated memory is cleared similar to
161.Xr calloc 3 . 161.Fn calloc .
162Memory that becomes unallocated while shrinking or moving existing 162Memory that becomes unallocated while shrinking or moving existing
163allocations is explicitly discarded (meaning, pages of memory 163allocations is explicitly discarded (meaning, pages of memory
164are disposed via 164are disposed via
@@ -167,17 +167,15 @@ and smaller allocations are cleared with
167.Xr explicit_bzero 3 ) . 167.Xr explicit_bzero 3 ) .
168If 168If
169.Fa ptr 169.Fa ptr
170is a 170is
171.Dv NULL 171.Dv NULL ,
172pointer,
173.Fa oldnmemb 172.Fa oldnmemb
174is ignored and the call is equivalent to 173is ignored and the call is equivalent to
175.Fn calloc . 174.Fn calloc .
176If 175If
177.Fa ptr 176.Fa ptr
178is not a 177is not
179.Dv NULL 178.Dv NULL ,
180pointer,
181.Fa oldnmemb 179.Fa oldnmemb
182must be a value such that 180must be a value such that
183.Fa oldnmemb 181.Fa oldnmemb
@@ -214,9 +212,9 @@ with length
214is discarded while deallocating the whole object originally allocated. 212is discarded while deallocating the whole object originally allocated.
215.Sh RETURN VALUES 213.Sh RETURN VALUES
216Upon successful completion, the allocation functions 214Upon successful completion, the allocation functions
217return a pointer to the allocated space; otherwise, a 215return a pointer to the allocated space; otherwise,
218.Dv NULL 216.Dv NULL
219pointer is returned and 217is returned and
220.Va errno 218.Va errno
221is set to 219is set to
222.Er ENOMEM . 220.Er ENOMEM .
@@ -249,7 +247,9 @@ to
249.Pp 247.Pp
250If 248If
251.Fa ptr 249.Fa ptr
252is not NULL and multiplying 250is not
251.Dv NULL
252and multiplying
253.Fa oldnmemb 253.Fa oldnmemb
254and 254and
255.Fa size 255.Fa size
@@ -444,9 +444,6 @@ If the
444option is specified it is an error for the allocation functions 444option is specified it is an error for the allocation functions
445to return 445to return
446.Dv NULL . 446.Dv NULL .
447.It Dq malloc init mmap failed
448This is a rather weird condition that is most likely to indicate a
449seriously overloaded system or a ulimit restriction.
450.It Dq bogus pointer (double free?) 447.It Dq bogus pointer (double free?)
451An attempt to 448An attempt to
452.Fn free 449.Fn free