1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
.\" (c) 2001 by John Levon <moz@compsoc.man.ac.uk>
.\" Based in part on GNU libc documentation.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" License.
.\"
.\" 2001-10-11, 2003-08-22, aeb, added some details
.\"
.\" Japanese Version Copyright (c) 2001 Akihiro MOTOKI
.\" all rights reserved.
.\" Translated Mon Nov 5 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated Sun Sep 5 2003 JST by Akihiro MOTOKI, catch up to v1.60
.\"
.\"WORD: obsolete ѻߤ줿
.\"WORD: a multiple of ܿ
.\"WORD: a power of two 2 Τ٤
.\"
.TH POSIX_MEMALIGN 3 2003-08-22 "GNU" "Linux Programmer's Manual"
.SH ̾
posix_memalign, memalign, valloc \- 饤Ȥ줿γƤԤ
.SH
.nf
.B #define _XOPEN_SOURCE 600
.B #include <stdlib.h>
.sp
.BI "int posix_memalign(void **" memptr ", size_t " alignment ", size_t " size );
.sp
.B #include <malloc.h>
.sp
.BI "void *valloc(size_t " size );
.BI "void *memalign(size_t " boundary ", size_t " size );
.nl
.fi
.SH
ؿ
.B posix_memalign()
.I size
ХȤΥơƤ줿Υɥ쥹
.IR "*memptr"
ꤹ롣
Ƥ줿Υɥ쥹
.IR "alignment"
ܿˤʤäƤϤǤ롣
.IR "alignment"
2 Τ٤ǡ
.IR "sizeof(void *)"
ܿǤʤФʤʤ
ѻߤ줿ؿǤ
.B memalign()
ϡ
.I size
ХȤΥơƤ줿ؤΥݥ֤
Υɥ쥹
.IR "boundary"
ܿˤʤäƤϤǤ롣
.IR "boundary"
2 Τ٤ǤʤФʤʤ
ѻߤ줿ؿǤ
.B valloc()
.I size
ХȤΥơƤ줿ؤΥݥ֤
Υɥ쥹ϥڡܿˤʤäƤϤǤ롣
.IR "memalign(sysconf(_SC_PAGESIZE),size)"
Ǥ롣
.\" motoki: be not zeroed äƤɤ̣
3 ĤδؿϤΥꥢԤʤ
.SH ֤
.BR memalign()
.BR valloc()
ϳƤ줿ؤΥݥ֤
Ƥ˼Ԥ
.B NULL
֤
.BR posix_memalign()
0 ֤
ԤϼΥ˵ܤ줿顼ͤΤ줫֤
.IR errno
ϥåȤʤȤդ뤳ȡ
.SH 顼
.TP
.B EINVAL
.IR alignment
ѥ 2 Τ٤Ǥʤä
.IR "sizeof(void *)"
ܿǤʤä
.TP
.B ENOMEM
Τ˽ʬʥ꤬ʤä
.SH
¿ΥƥǤϡ饤Ȥ˴ؤ¤롣㤨С
֥åǥХФ쥯 I/O ˻ѤХåեˤ
饤Ȥ˴ؤ¤롣
POSIX Ǥϡɤʥ饤ȤɬפΤ뤿
.I "pathconf(path,_PC_REC_XFER_ALIGN)"
ꤷƤ롣
.BR posix_memalign ()
ȤȡɬȤǤ롣
.BR posix_memalign()
.IR alignment
Ǿܺ٤˽Ҥ٤ɬɤΤ롣
.BR memalign()
.IR boundary
ѥɤγǧԤʤ⤷ʤ
POSIX Ǥ
.BR posix_memalign()
ˤäƳ
.IR free ()
ȤäƲ뤳ȤǤɬפ롣
ĤΥƥǤ
.IR memalign ()
.IR valloc ()
dzƤ줿ѤʤƤʤ
.\" motoki: while ΤĤʤϤǤ
(ʤʤ
.IR free ()
ϤȤǤΤ
.IR malloc ()
äݥ
㤨
.IR memalign ()
.IR malloc ()
ƤӽФͤ饤ȤƤޤǤ)
GNU libc Ǥ
˽Ҥ٤ 3 ĤδؿΤdz
.IR free ()
ǺѤ뤳ȤǤ롣
GNU libc
.BR "malloc()"
Ͼ 8 ХȤ˥饤Ȥ줿ꥢɥ쥹֤Τǡ
ǽҤ٤ؿɬפˤʤΤ
8 ХȤ礭ʥ饤ȤɬפʾǤ롣
.SH
.IR memalign ()
.IR valloc ()
Ϥ٤Ƥ Linux libc 饤֥ǻѲǽǤ롣
.IR posix_memalign ()
glibc 2.1.91 ʹߤǻѲǽǤ롣
.SH
ؿ
.IR valloc ()
3.0 BSD о줷BSD 4.3 Ǥѻߤ줿ȵܤƤꡢ
SUSv2 ǤϲΤΤȵܤƤ롣
SUSv3 ǤϤϤϢ뵭ҤϤʤ
ؿ
.IR memalign ()
SunOS 4.1.3 о줷BSD 4.4 ˤϤʤ
ؿ
.IR posix_memalign ()
POSIX 1003.1d ͳ褹롣
.SH إå
.IR posix_memalign ()
<stdlib.h> ǹԤȤ˴ؤƤϡΰոפƤ롣
δؿˤϡ glibc Ǥ _GNU_SOURCE 롢ޤ
_XOPEN_SOURCE 600 꾮ʤͤ롢Τ줫Ԥ
ɬפ롣
.IR memalign ()
<malloc.h> ǹԤȤ˴ؤƤϡΰոפƤ롣
SUSv2 ˤȡ
.IR valloc ()
<stdlib.h> 롣
libc4,5 glibc Ǥ <malloc.h> Ƥꡢ
<stdlib.h> Ǥ뤳Ȥ⤢
(ŪˤϰʲΤ줫ξ:
_GNU_SOURCE Ƥ롢_BSD_SOURCE Ƥ롢
glibc _XOPEN_SOURCE_EXTENDED Ƥ롢
glibc _XOPEN_SOURCE 500 꾮ʤͤƤ)
.SH Ϣ
.BR brk (2),
.BR getpagesize (2),
.BR free (3),
.BR malloc (3)
|