diff options
author | otto <> | 2019-05-10 15:03:24 +0000 |
---|---|---|
committer | otto <> | 2019-05-10 15:03:24 +0000 |
commit | db9d6bd84c976c2cbc8987b4f833c82c5657008e (patch) | |
tree | 351f341ee663baddfeb4c10cfa7273013fe52ddd /src/lib/libc/stdlib/malloc.3 | |
parent | dbcfb6b9d803c6373711f51c965f6a8f989c5157 (diff) | |
download | openbsd-db9d6bd84c976c2cbc8987b4f833c82c5657008e.tar.gz openbsd-db9d6bd84c976c2cbc8987b4f833c82c5657008e.tar.bz2 openbsd-db9d6bd84c976c2cbc8987b4f833c82c5657008e.zip |
Inroduce malloc_conceal() and calloc_conceal(). Similar to their
counterparts but return memory in pages marked MAP_CONCEAL and on
free() freezero() is actually called.
Diffstat (limited to 'src/lib/libc/stdlib/malloc.3')
-rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index a6edb2be00..ccb5d257a2 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.122 2018/12/05 17:11:59 schwarze Exp $ | 33 | .\" $OpenBSD: malloc.3,v 1.123 2019/05/10 15:03:24 otto Exp $ |
34 | .\" | 34 | .\" |
35 | .Dd $Mdocdate: December 5 2018 $ | 35 | .Dd $Mdocdate: May 10 2019 $ |
36 | .Dt MALLOC 3 | 36 | .Dt MALLOC 3 |
37 | .Os | 37 | .Os |
38 | .Sh NAME | 38 | .Sh NAME |
@@ -43,7 +43,9 @@ | |||
43 | .Nm reallocarray , | 43 | .Nm reallocarray , |
44 | .Nm recallocarray , | 44 | .Nm recallocarray , |
45 | .Nm freezero , | 45 | .Nm freezero , |
46 | .Nm aligned_alloc | 46 | .Nm aligned_alloc , |
47 | .Nm malloc_conceal , | ||
48 | .Nm calloc_conceal | ||
47 | .Nd memory allocation and deallocation | 49 | .Nd memory allocation and deallocation |
48 | .Sh SYNOPSIS | 50 | .Sh SYNOPSIS |
49 | .In stdlib.h | 51 | .In stdlib.h |
@@ -63,6 +65,10 @@ | |||
63 | .Fn freezero "void *ptr" "size_t size" | 65 | .Fn freezero "void *ptr" "size_t size" |
64 | .Ft void * | 66 | .Ft void * |
65 | .Fn aligned_alloc "size_t alignment" "size_t size" | 67 | .Fn aligned_alloc "size_t alignment" "size_t size" |
68 | .Ft void * | ||
69 | .Fn malloc_conceal "size_t size" | ||
70 | .Ft void * | ||
71 | .Fn calloc_conceal "size_t nmemb" "size_t size" | ||
66 | .Vt char *malloc_options ; | 72 | .Vt char *malloc_options ; |
67 | .Sh DESCRIPTION | 73 | .Sh DESCRIPTION |
68 | The standard functions | 74 | The standard functions |
@@ -233,6 +239,23 @@ If | |||
233 | is not a multiple of | 239 | is not a multiple of |
234 | .Fa alignment , | 240 | .Fa alignment , |
235 | behavior is undefined. | 241 | behavior is undefined. |
242 | .Pp | ||
243 | The | ||
244 | .Fn malloc_conceal | ||
245 | and | ||
246 | .Fn calloc_conceal | ||
247 | functions behave the same as | ||
248 | .Fn malloc | ||
249 | and | ||
250 | .Fn calloc | ||
251 | respectively, | ||
252 | with the exception that the allocation returned is marked with the | ||
253 | .Dv MAP_CONCEAL | ||
254 | .Xr mmap 2 | ||
255 | flag and calling | ||
256 | .Fn free | ||
257 | on the allocation will discard the contents explicitly. | ||
258 | A reallocation of a concealed allocation will leave these properties intact. | ||
236 | .Sh MALLOC OPTIONS | 259 | .Sh MALLOC OPTIONS |
237 | Upon the first call to the | 260 | Upon the first call to the |
238 | .Fn malloc | 261 | .Fn malloc |