diff options
author | tedu <> | 2010-05-18 22:24:55 +0000 |
---|---|---|
committer | tedu <> | 2010-05-18 22:24:55 +0000 |
commit | 84e56ad2cf3f4b33089396bba6483888d54d99a3 (patch) | |
tree | a6c0f4a1cf1cb7596fb9279f0a7ff14d13a1317e /src/lib/libc/stdlib/posix_memalign.3 | |
parent | 5a36fcc1c46490330487900d818ea64d85ac1f1a (diff) | |
download | openbsd-84e56ad2cf3f4b33089396bba6483888d54d99a3.tar.gz openbsd-84e56ad2cf3f4b33089396bba6483888d54d99a3.tar.bz2 openbsd-84e56ad2cf3f4b33089396bba6483888d54d99a3.zip |
add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.
Diffstat (limited to 'src/lib/libc/stdlib/posix_memalign.3')
-rw-r--r-- | src/lib/libc/stdlib/posix_memalign.3 | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/lib/libc/stdlib/posix_memalign.3 b/src/lib/libc/stdlib/posix_memalign.3 new file mode 100644 index 0000000000..7bd39933dc --- /dev/null +++ b/src/lib/libc/stdlib/posix_memalign.3 | |||
@@ -0,0 +1,94 @@ | |||
1 | .\" $OpenBSD | ||
2 | .\" Copyright (C) 2006 Jason Evans <jasone@FreeBSD.org>. | ||
3 | .\" All rights reserved. | ||
4 | .\" | ||
5 | .\" Redistribution and use in source and binary forms, with or without | ||
6 | .\" modification, are permitted provided that the following conditions | ||
7 | .\" are met: | ||
8 | .\" 1. Redistributions of source code must retain the above copyright | ||
9 | .\" notice(s), this list of conditions and the following disclaimer as | ||
10 | .\" the first lines of this file unmodified other than the possible | ||
11 | .\" addition of one or more copyright notices. | ||
12 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
13 | .\" notice(s), this list of conditions and the following disclaimer in | ||
14 | .\" the documentation and/or other materials provided with the | ||
15 | .\" distribution. | ||
16 | .\" | ||
17 | .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY | ||
18 | .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
20 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE | ||
21 | .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
22 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
23 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
24 | .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
25 | .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
26 | .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
27 | .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | .\" | ||
29 | .\" $FreeBSD: src/lib/libc/stdlib/posix_memalign.3,v 1.3 2007/03/28 04:32:51 jasone Exp $ | ||
30 | .\" | ||
31 | .Dd $Mdocdate: May 18 2010 $ | ||
32 | .Dt POSIX_MEMALIGN 3 | ||
33 | .Os | ||
34 | .Sh NAME | ||
35 | .Nm posix_memalign | ||
36 | .Nd aligned memory allocation | ||
37 | .Sh SYNOPSIS | ||
38 | .In stdlib.h | ||
39 | .Ft int | ||
40 | .Fn posix_memalign "void **ptr" "size_t alignment" "size_t size" | ||
41 | .Sh DESCRIPTION | ||
42 | The | ||
43 | .Fn posix_memalign | ||
44 | function allocates | ||
45 | .Fa size | ||
46 | bytes of memory such that the allocation's base address is a multiple of | ||
47 | .Fa alignment , | ||
48 | and returns the allocation in the value pointed to by | ||
49 | .Fa ptr . | ||
50 | .Pp | ||
51 | The requested | ||
52 | .Fa alignment | ||
53 | must be a power of 2 at least as large as | ||
54 | .Fn sizeof "void *" . | ||
55 | .Pp | ||
56 | Memory that is allocated via | ||
57 | .Fn posix_memalign | ||
58 | can be used as an argument in subsequent calls to | ||
59 | .Xr realloc 3 | ||
60 | and | ||
61 | .Xr free 3 . | ||
62 | .Sh RETURN VALUES | ||
63 | The | ||
64 | .Fn posix_memalign | ||
65 | function returns the value 0 if successful; otherwise it returns an error value. | ||
66 | .Sh ERRORS | ||
67 | The | ||
68 | .Fn posix_memalign | ||
69 | function will fail if: | ||
70 | .Bl -tag -width Er | ||
71 | .It Bq Er EINVAL | ||
72 | The | ||
73 | .Fa alignment | ||
74 | parameter is not a power of 2 at least as large as | ||
75 | .Fn sizeof "void *" . | ||
76 | .It Bq Er ENOMEM | ||
77 | Memory allocation error. | ||
78 | .El | ||
79 | .Sh SEE ALSO | ||
80 | .Xr free 3 , | ||
81 | .Xr malloc 3 , | ||
82 | .Xr realloc 3 | ||
83 | .Sh STANDARDS | ||
84 | The | ||
85 | .Fn posix_memalign | ||
86 | function conforms to | ||
87 | .St -p1003.1-2001 . | ||
88 | .Sh HISTORY | ||
89 | The | ||
90 | .Fn posix_memalign | ||
91 | function first appeared in | ||
92 | .Ox 4.8 . | ||
93 | .Sh BUGS | ||
94 | Only alignments up to the page size can be specified. | ||