summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
authorotto <>2019-05-10 15:03:24 +0000
committerotto <>2019-05-10 15:03:24 +0000
commitdb9d6bd84c976c2cbc8987b4f833c82c5657008e (patch)
tree351f341ee663baddfeb4c10cfa7273013fe52ddd /src/lib/libc/stdlib/malloc.3
parentdbcfb6b9d803c6373711f51c965f6a8f989c5157 (diff)
downloadopenbsd-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.329
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
68The standard functions 74The standard functions
@@ -233,6 +239,23 @@ If
233is not a multiple of 239is not a multiple of
234.Fa alignment , 240.Fa alignment ,
235behavior is undefined. 241behavior is undefined.
242.Pp
243The
244.Fn malloc_conceal
245and
246.Fn calloc_conceal
247functions behave the same as
248.Fn malloc
249and
250.Fn calloc
251respectively,
252with the exception that the allocation returned is marked with the
253.Dv MAP_CONCEAL
254.Xr mmap 2
255flag and calling
256.Fn free
257on the allocation will discard the contents explicitly.
258A reallocation of a concealed allocation will leave these properties intact.
236.Sh MALLOC OPTIONS 259.Sh MALLOC OPTIONS
237Upon the first call to the 260Upon the first call to the
238.Fn malloc 261.Fn malloc