File: posix_memalign.3

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (233 lines) | stat: -rw-r--r-- 6,057 bytes parent folder | download
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
.\" (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 2001-11-05, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2003-09-05, Akihiro MOTOKI, catch up to v1.60
.\" Updated 2005-11-19, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.\"WORD:	obsolete	ѻߤ줿
.\"WORD:	a multiple of	ܿ
.\"WORD:	a power of two	2 Τ٤
.\"
.TH POSIX_MEMALIGN 3  2007-07-26 "GNU" "Linux Programmer's Manual"
.SH ̾
posix_memalign, memalign, valloc \- 饤Ȥ줿γƤԤ
.SH 
.nf
.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 );
.fi
.sp
.in -4n
glibc εǽޥ׷
.RB ( feature_test_macros (7)
):
.in
.sp
.ad l
.BR posix_memalign ():
_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
.ad b
.SH 
ؿ
.BR posix_memalign ()

.I size
ХȤΥơƤ줿Υɥ쥹
.I "*memptr"
ꤹ롣
Ƥ줿Υɥ쥹
.I "alignment"
ܿˤʤäƤϤǤ롣
.I "alignment"
 2 Τ٤ǡ
.IR "sizeof(void *)"
ܿǤʤФʤʤ

ѻߤ줿ؿǤ
.BR memalign ()
ϡ
.I size
ХȤΥơƤ줿ؤΥݥ󥿤֤
Υɥ쥹
.I "boundary"
ܿˤʤäƤϤǤ롣
.I "boundary"
 2 Τ٤ǤʤФʤʤ

ѻߤ줿ؿǤ
.BR valloc ()

.I size
ХȤΥơƤ줿ؤΥݥ󥿤֤
Υɥ쥹ϥڡܿˤʤäƤϤǤ롣

.I "memalign(sysconf(_SC_PAGESIZE),size)"
Ǥ롣

.\" motoki: be not zeroed äƤɤ̣
3 ĤδؿϤΥꥢԤʤ
.SH ֤
.BR memalign ()

.BR valloc ()
ϳƤ줿ؤΥݥ󥿤֤
Ƥ˼Ԥ NULL ֤

.BR posix_memalign ()
 0 ֤
ԤϼΥ˵ܤ줿顼ͤΤ줫֤
.I errno
ϥåȤʤȤդ뤳ȡ
.SH 顼
.TP
.B EINVAL
.I alignment
ѥ᡼ 2 Τ٤Ǥʤä
.IR "sizeof(void *)"
ܿǤʤä
.TP
.B ENOMEM
׵Τ˽ʬʥ꤬ʤä
.SH С
.BR memalign ()

.BR valloc ()
Ϥ٤Ƥ Linux libc 饤֥ǻѲǽǤ롣
.BR posix_memalign ()
 glibc 2.1.91 ʹߤǻѲǽǤ롣
.SH 
ؿ
.BR valloc ()
 3.0BSD о줷4.3BSD Ǥѻߤ줿ȵܤƤꡢ
SUSv2 ǤϲΤΤȵܤƤ롣
POSIX.1-2001 ˤϤϤ¸ߤʤ
ؿ
.BR memalign ()
 SunOS 4.1.3 о줷4.4BSD ˤϤʤ
ؿ
.BR posix_memalign ()
 POSIX.1d ͳ褹롣
.SS إå
.BR posix_memalign ()
 \fI<stdlib.h>\fP ǹԤȤ˴ؤƤϡ
ΰոפƤ롣

ĤΥƥǤϡ
.BR memalign ()
 \fI<malloc.h>\fP ǤϤʤ \fI<stdlib.h>\fP Ƥ롣

SUSv2 ˤȡ
.BR valloc ()

.I <stdlib.h>
libc4,5  glibc Ǥ
.I <malloc.h>
Ƥꡢ

.I <stdlib.h>
Ǥ뤳Ȥ⤢
(ŪˤϰʲΤ줫ξ:
.B _GNU_SOURCE
Ƥ롢
.B _BSD_SOURCE
Ƥ롢
glibc 
.B _XOPEN_SOURCE_EXTENDED
Ƥ롢
glibc 
.B _XOPEN_SOURCE
 500 꾮ʤͤƤ)
.SH 
¿ΥƥǤϡ饤Ȥ˴ؤ¤롣㤨С
֥åǥХФ쥯 I/O ˻ѤХåեˤ
饤Ȥ˴ؤ¤롣
POSIX Ǥϡɤʥ饤ȤɬפΤ뤿
.I "pathconf(path,_PC_REC_XFER_ALIGN)"
ꤷƤ롣
.BR posix_memalign ()
Ȥȡɬ׾ȤǤ롣

.BR posix_memalign ()

.I alignment
Ǿܺ٤˽Ҥ٤ɬ׾ɤΤ롣
.BR memalign ()

.I boundary
ѥ᡼ɤγǧԤʤ⤷ʤ

POSIX Ǥ
.BR posix_memalign ()
ˤäƳ
.BR free (3)
ȤäƲ뤳ȤǤɬפ롣
ĤΥƥǤ
.BR memalign ()

.BR valloc ()
dzƤ줿Ѥʤ󶡤Ƥʤ
.\" motoki: while ΤĤʤϤǤ
(ʤʤ
.BR free (3)
ϤȤǤΤ
.BR malloc (3)
äݥ󥿤
.BR memalign ()

.BR malloc (3)
ƤӽФͤ򥢥饤ȤƤޤǤ)
.\" Other systems allow passing the result of
.\" .BR valloc ()
.\" to
.\" .BR free (3),
.\" but not to
.\" .BR realloc (3).
glibc μǤϡ
˽Ҥ٤ 3 ĤδؿΤdz
.BR free (3)
ǺѤ뤳ȤǤ롣

glibc 
.BR malloc (3)
Ͼ 8 ХȤ˥饤Ȥ줿ꥢɥ쥹֤Τǡ
ǽҤ٤ؿɬפˤʤΤ
8 ХȤ礭ʥ饤ȤɬפʾǤ롣
.SH Ϣ
.BR brk (2),
.BR getpagesize (2),
.BR free (3),
.BR malloc (3)