diff options
author | otto <> | 2017-04-17 18:07:15 +0000 |
---|---|---|
committer | otto <> | 2017-04-17 18:07:15 +0000 |
commit | 0cb12ace14f001cd3e42cd8bfffe9903ffc74412 (patch) | |
tree | d34ef275653a42e7b3e073455297ba2ea03d06c9 | |
parent | 66ef14d938bdcb68c0aedb0d37f86ffa3366a7e0 (diff) | |
download | openbsd-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.3 | 37 |
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 | |||
76 | the specified | 76 | the specified |
77 | .Fa size . | 77 | .Fa size . |
78 | .Fn malloc | 78 | .Fn malloc |
79 | maintains multiple lists of free blocks according to size, allocating | 79 | maintains multiple lists of free objects according to size, allocating |
80 | space from the appropriate list. | 80 | from the appropriate list or requesting memory from the kernel. |
81 | The allocated space is suitably aligned (after possible pointer coercion) for | 81 | The allocated space is suitably aligned (after possible pointer coercion) for |
82 | storage of any type of object. | 82 | storage 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 . |
129 | If | 129 | If |
130 | .Fa ptr | 130 | .Fa ptr |
131 | is a | 131 | is |
132 | .Dv NULL | 132 | .Dv NULL , |
133 | pointer, no action occurs. | 133 | no action occurs. |
134 | If | 134 | If |
135 | .Fa ptr | 135 | .Fa ptr |
136 | was previously freed by | 136 | was previously freed by |
@@ -158,7 +158,7 @@ the | |||
158 | function is similar to | 158 | function is similar to |
159 | .Fn reallocarray | 159 | .Fn reallocarray |
160 | except it ensures newly allocated memory is cleared similar to | 160 | except it ensures newly allocated memory is cleared similar to |
161 | .Xr calloc 3 . | 161 | .Fn calloc . |
162 | Memory that becomes unallocated while shrinking or moving existing | 162 | Memory that becomes unallocated while shrinking or moving existing |
163 | allocations is explicitly discarded (meaning, pages of memory | 163 | allocations is explicitly discarded (meaning, pages of memory |
164 | are disposed via | 164 | are disposed via |
@@ -167,17 +167,15 @@ and smaller allocations are cleared with | |||
167 | .Xr explicit_bzero 3 ) . | 167 | .Xr explicit_bzero 3 ) . |
168 | If | 168 | If |
169 | .Fa ptr | 169 | .Fa ptr |
170 | is a | 170 | is |
171 | .Dv NULL | 171 | .Dv NULL , |
172 | pointer, | ||
173 | .Fa oldnmemb | 172 | .Fa oldnmemb |
174 | is ignored and the call is equivalent to | 173 | is ignored and the call is equivalent to |
175 | .Fn calloc . | 174 | .Fn calloc . |
176 | If | 175 | If |
177 | .Fa ptr | 176 | .Fa ptr |
178 | is not a | 177 | is not |
179 | .Dv NULL | 178 | .Dv NULL , |
180 | pointer, | ||
181 | .Fa oldnmemb | 179 | .Fa oldnmemb |
182 | must be a value such that | 180 | must be a value such that |
183 | .Fa oldnmemb | 181 | .Fa oldnmemb |
@@ -214,9 +212,9 @@ with length | |||
214 | is discarded while deallocating the whole object originally allocated. | 212 | is discarded while deallocating the whole object originally allocated. |
215 | .Sh RETURN VALUES | 213 | .Sh RETURN VALUES |
216 | Upon successful completion, the allocation functions | 214 | Upon successful completion, the allocation functions |
217 | return a pointer to the allocated space; otherwise, a | 215 | return a pointer to the allocated space; otherwise, |
218 | .Dv NULL | 216 | .Dv NULL |
219 | pointer is returned and | 217 | is returned and |
220 | .Va errno | 218 | .Va errno |
221 | is set to | 219 | is set to |
222 | .Er ENOMEM . | 220 | .Er ENOMEM . |
@@ -249,7 +247,9 @@ to | |||
249 | .Pp | 247 | .Pp |
250 | If | 248 | If |
251 | .Fa ptr | 249 | .Fa ptr |
252 | is not NULL and multiplying | 250 | is not |
251 | .Dv NULL | ||
252 | and multiplying | ||
253 | .Fa oldnmemb | 253 | .Fa oldnmemb |
254 | and | 254 | and |
255 | .Fa size | 255 | .Fa size |
@@ -444,9 +444,6 @@ If the | |||
444 | option is specified it is an error for the allocation functions | 444 | option is specified it is an error for the allocation functions |
445 | to return | 445 | to return |
446 | .Dv NULL . | 446 | .Dv NULL . |
447 | .It Dq malloc init mmap failed | ||
448 | This is a rather weird condition that is most likely to indicate a | ||
449 | seriously overloaded system or a ulimit restriction. | ||
450 | .It Dq bogus pointer (double free?) | 447 | .It Dq bogus pointer (double free?) |
451 | An attempt to | 448 | An attempt to |
452 | .Fn free | 449 | .Fn free |