File: feature_test_macros.7

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 (450 lines) | stat: -rw-r--r-- 12,967 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" This manpage is Copyright (C) 2006, Michael Kerrisk
.\"
.\" 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.
.\"
.\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
.\" Translated 2006-07-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
.\" Updated 2007-09-08, Akihiro MOTOKI, LDP v2.64
.\"
.\"WORD:	feature test macro	ǽޥ
.\"WORD:	feature test macro requirements	ǽޥ׷
.\"
.TH FEATURE_TEST_MACROS 7 2008-01-02 "Linux" "Linux Programmer's Manual"
.SH ̾
feature_test_macros \- ǽޥ
.SH 
.nf
.B #include <features.h>
.fi
.SH 
ǽޥ (feature test macro) ˤꡢץޤ
ץबѥ뤵ݤ˥ƥΥإåեˤ
椹뤳ȤǤ롣
εǽȤȡɸʤ褦ˤǤ
ܿΤ륢ץꥱΤΩġ
¾ΥޥȤȡǥեȤǤϸʤɸ
뤳ȤǤ롣
ʲ뵡ǽޥΤ줾Τʱƶǧˤϡ
إåե
.I <features.h>
Ĵ٤Ф褤

ǽޥǽˤϡǽޥ
֤ɤΥإåեΥ󥯥롼ɤǡ׹ԤʤФʤʤ
¸ˤϡ
ѥ륳ޥɤǻꤹˡ
.RI ( "cc \-DMACRO=value" )
ȡɬפʥޥ
ɤΥإåΥ󥯥롼ɤǹԤˡ롣
.SS ޥ˥奢ڡǤεǽޥ׷ε
ؿǽޥɬפȤ硢
ޥ˥奢ڡν (SYNOPSIS) 
ʲη
.BR chmod (2)
Υޥ˥奢ڡΰѤǤ)
.RS
.sp
.B #include <sys/stat.h>
.sp
.BI "int chmod(const char *" path ", mode_t " mode );
.br
.BI "int fchmod(int " fd ", mode_t " mode );
.sp
.in -4n
glibc εǽޥ׷
.RB ( feature_test_macros (7)
):
.in
.sp
.BR fchmod ():
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.RE
.PP
\fB||\fP ϡ
.BR fchmod (2)

.I <sys/stat.h>
ˤϡʲΥޥΤ줫򡢤ɤΥإåե
󥯥롼ɤǹԤʤФʤʤȤ̣롣
.RS
.nf

#define _BSD_SOURCE
#define _XOPEN_SOURCE 500     /* or any value > 500 */
.fi
.RE
.PP
̤ˡȤƤϡ򥳥ѥѤΥޥɤ
ꤹ뤳ȤǤ롣
.RS
.nf

cc -D_BSD_SOURCE
cc -D_XOPEN_SOURCE=500        # Or any value > 500
.fi
.RE
.PP
ǽҤ٤뤬
.B ֤ĤεǽޥϥǥեȤ
դ뤳ȡ
Τᡢֽ񼰡פ˵ܤ줿ǽޥ
Ū˻ꤹɬפ櫓ǤϤʤ

ޤ¿ʤޥ˥奢ڡˤäƤϡ
ǽޥ׷ʲΤ褦˴ñɽǵܤ礬롣
.BR readahead (2)
Υޥ˥奢ڡΰѤǤ)
.RS
.nf

.B #define _GNU_SOURCE
.B #include <fcntl.h>
.sp
.BI "ssize_t readahead(int " fd ", off64_t *" offset ", size_t " count );
.fi
.RE
.PP
ؿθ˻Ȥ뵡ǽޥĤǡ
ǥեȤǤϤΥޥʤˡ
ηɽѤ롣
.SS glibc ᤹뵡ǽޥ
ʲǤϡLinux glibc 2.\fIx\fP (\fIx\fP > 0) ˤơ
ǽޥɤΤ褦˰뤫롣
.\" The details in glibc 2.0 are simpler, but combining a
.\" a description of them with the details in later glibc versions
.\" would make for a complicated description.

Linux/glibc ϰʲεǽޥ᤹:
.TP
.B __STRICT_ANSI__
ISO ɸ C
.BR gcc (1)

.I -std=c99

.I -ansi
ʤɤΥե饰դƵư硢
ΥޥϰۤΤ롣
.TP
.B _POSIX_C_SOURCE
Υޥȡإåե
ʲ롣
.RS
.IP \(bu 3
ͤ 1 ξ硢POSIX.1-1990  ISO C (1990) ˽򤹤롣
.IP \(bu
ͤ 2 ʾξ硢
POSIX.2-1992 ϢɲäǸ롣
.IP \(bu
ͤ 199309 ʾξ硢
POSIX.1b (ꥢ륿ĥ) ϢɲäǸ롣
.\" 199506L functionality is only available since glibc 2.1
.IP \(bu
ͤ 199506 ʾξ硢
POSIX.1c (å) ϢɲäǸ롣
.IP \(bu
(glibc 2.3.3 ʹ)
ͤ 200112 ξ硢
(XSI ĥ) POSIX.1-2001 ܻͤб롣
.RE
.TP
.B _POSIX_SOURCE
ΥޥѻͽǤ롣
Υޥȡͤ˴ؤ餺
.B _POSIX_C_SOURCE
 1 ΤȤʤ롣
.TP
.B _XOPEN_SOURCE
Υޥȡإåեǰʲ롣
.RS
.IP \(bu 3
ɤͤǤ⡢إåե
POSIX.1, POSIX.2, XPG4 ˽򤹤롣
.IP \(bu
ͤ 500 ʾξ硢
SUSv2 (UNIX 98) ϢɲäǸ롣
.IP \(bu
(glibc 2.2 ʹ)
ͤ 600 ʾξ硢
SUSv3 (UNIX 03; POSIX.1-2001 ܻ + XSI ĥƱ)
Ϣ C99 ǤɲäǸ롣
.RE
.TP
.B _XOPEN_SOURCE_EXTENDED
Υޥ졢
.B _XOPEN_SOURCE
ƤȡXPG4v2 (SUSv1) UNIX ĥ (UNIX 95)
б롣
.B _XOPEN_SOURCE
 500 ʾͤ줿硢ΥޥϰۤΤ롣
.TP
.B _ISOC99_SOURCE
ISO C (1990)  C99 ĥ롣
Υޥ glibc 2.1.3 ʹߤǧ롣
ΥС 2.1.x  glibc Ǥϡ
.B _ISOC9X_SOURCE
Ȥ̾ΥޥȤƤ
(ʤʤ顢C99 ɸϤޤꤷƤʤäǤ)
.B _ISOC9X_SOURCE
ޥλѤѻߤƤ뤬
glibc ϲȤθߴΤảǤ⤳Υޥǧ롣
.TP
.B _LARGEFILE64_SOURCE
LFS (Large File Summit) ˤ
"ĥ (transitional extension)" Single UNIX Specification
ȤƵꤵ줿 API (alternative API) ˴ؤ
(http://opengroup.org/platform/lfs.html )
 API Ͽ֥ (ؿȷ) νǹ졢
̾ "64" ǽ (㤨С
.I off_t
бΤ
.IR off64_t 
.BR lseek ()
бΤ
.BR lseek64 ()
Ǥ)
ץǤϤΥ󥿥եѤʤȡ

.I _FILE_OFFSET_BITS=64
Ѥ뤳ȡ
.TP
.B _FILE_OFFSET_BITS
Υޥ 64 ȡե I/O ȥե륷ƥ
Ϣ 32 ӥåǤδؿȥǡפϼưŪ 64 ӥåǤ
Ѵ롣
ϡ32 ӥåȥƥ礭ʥե (> 2 Х)  I/O
¹ԤݤΩ
(Υޥȡѥ뤷ľ礭ʥե
ץ񤯤ȤǤ)
64 ӥåȥƥϡȤ 2 ХȤ礭ʥե
Τǡ64 ӥåȥƥǤϤΥޥϸ̤ʤ
.TP
.B _BSD_SOURCE
Υޥ (ͤ˴ؤ餺) إåե
BSD ͳ롣
ޤΥޥȡƤʤɸब¸ߤˤ
BSD ͳͥ褹褦ˤʤ롣

.BR _SVID_SOURCE ,
.BR _POSIX_SOURCE ,
.BR _POSIX_C_SOURCE ,
.BR _XOPEN_SOURCE ,
.BR _XOPEN_SOURCE_EXTENDED ,
.B _GNU_SOURCE
ĤǤ줿ˤϡBSD ͳͥ褵ʤʤ롣
.TP
.B _SVID_SOURCE
Υޥ (ͤ˴ؤ餺) إåե
System V ͳ
(SVID == System V Interface Definition;
.BR standards (7)
)
.TP
.BR _ATFILE_SOURCE " (glibc 2.4 ʹ)"
Υޥ (ͤ˴ؤ餺) إåե
̾ "at" γƼδؿ롣
.BR openat (2)
ȡ
.TP
.B _GNU_SOURCE
Υޥ (ͤ˴ؤ餺) ʲΥޥΤ
ˤʤ:
.BR _BSD_SOURCE ,
.BR _SVID_SOURCE ,
.BR _ATFILE_SOURCE ,
.BR _LARGEFILE64_SOURCE ,
.BR _ISOC99_SOURCE ,
.BR _XOPEN_SOURCE_EXTENDED ,
.BR _POSIX_SOURCE ,
 200112L 
.B _POSIX_C_SOURCE
(С 2.5  glibc Ǥͤ 199506L),
.\" С 2.1  glibc Ǥ 199309L
 600 
.B _XOPEN_SOURCE
(С 2.2  glibc Ǥͤ 500)
ˡƼ GNU ͭγĥ롣
ꤵ줿ɸ̷⤬äϡ
BSD ͳͥ褵ʤʤ롣
.TP
.B _REENTRANT
ΥޥȡĤΥꥨȥ (ǽ) ʴؿ
롣ޥåɡץǤϡ
.I "cc -pthread"
Ѥ뤳ȡ
.TP
.B _THREAD_SAFE
.B _REENTRANT
Ʊ졣
¾ΤĤμȤθߴ󶡤뤿ΤΡ
.TP
.BR _FORTIFY_SOURCE " (glibc 2.3.4 ʹ)"
.\" For more detail, see:
.\" http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
.\" [PATCH] Object size checking to prevent (some) buffer overflows
.\" * From: Jakub Jelinek <jakub at redhat dot com>
.\" * To: gcc-patches at gcc dot gnu dot org
.\" * Date: Tue, 21 Sep 2004 04:16:40 -0400
ΥޥȡʸԤ͡ʴؿ
Ѥݤ˥ХåեСե򸡽Ф뤿ηڤΥå
¹Ԥ褦ˤʤ롣٤ƤΥХåեСեФ
櫓ǤϤʤޤǤ褯ˤĤƤǤ롣
ߤμǤϡʲδؿ˥åɲäƤ:
.BR memcpy (3),
.BR mempcpy (3),
.BR memmove (3),
.BR memset (3),
.BR stpcpy (3),
.BR strcpy (3),
.BR strncpy (3),
.BR strcat (3),
.BR strncat (3),
.BR sprintf (3),
.BR snprintf (3),
.BR vsprintf (3),
.BR vsnprintf (3),
.BR gets (3).
.B _FORTIFY_SOURCE
 1 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
.PP
ޤʣΥޥ뤳ȤǤ롣
ξ硢ޥϤ٤ͭˤʤ롣
.SH 
POSIX.1 Ǥ
.BR _POSIX_C_SOURCE ,
.BR _POSIX_SOURCE ,
.B _XOPEN_SOURCE
ꤵƤ롣
.B _XOPEN_SOURCE_EXTENDED
 XPG4v2 (̾ SUSv1) ǵꤵƤ

.B _FILE_OFFSET_BITS
ϤɤɸǤ⵬ꤵƤʤ
¾ΤĤμǺѤƤ롣

.BR _BSD_SOURCE ,
.BR _SVID_SOURCE ,
.BR _ATFILE_SOURCE ,
.BR _GNU_SOURCE ,
.BR _FORTIFY_SOURCE ,
.BR _REENTRANT ,
.B _THREAD_SAFE
 Linux (glibc) ͭǤ롣
.SH 
.I <features.h>
 Linux/glibc ͭΥإåեǤ롣
¾ΥƥˤƱͤŪΥե뤬뤬̤ϰ㤦̾Ǥ롣
Υإåեϡ¾Υإåեˤɬפ˱
ưŪ˥󥯥롼ɤ롣ǽޥѤ뤿
Ū˥󥯥롼ɤɬפϤʤ

嵭εǽޥΤɤ줬줿ˤäơ
.I <features.h>
ϡ¾ glibc إåեǥåƼ¾Υޥ
롣Υޥ̾ϥ 2ĤǻϤޤ
(㤨
.BR __USE_MISC )
桼ץϤΥޥ \fI褷\fP ľ٤ǤϤʤ
ˡ嵭ΥꥹȤˤŬڤʵǽޥѤ٤Ǥ롣
.SH Ϣ
.BR standards (7)
.sp
.I "info libc"
 "Feature Test Macros" ᡣ
.\" But beware: the info libc document is out of date (Jul 07, mtk)
.sp
.I /usr/include/features.h