1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
26 .\" Translated 2006-07-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
27 .\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
28 .\" Updated 2007-09-08, Akihiro MOTOKI, LDP v2.64
29 .\" Updated 2009-04-23, Akihiro MOTOKI, LDP v3.21
31 .\"WORD: feature test macro 機能検査マクロ
32 .\"WORD: feature test macro requirements 機能検査マクロの要件
34 .TH FEATURE_TEST_MACROS 7 2010-09-10 "Linux" "Linux Programmer's Manual"
37 .\"O feature_test_macros \- feature test macros
38 feature_test_macros \- 機能検査マクロ
42 .B #include <features.h>
46 .\"O Feature test macros allow the programmer to control the definitions that
47 .\"O are exposed by system header files when a program is compiled.
48 機能検査マクロ (feature test macro) により、プログラマは
49 プログラムがコンパイルされる際にシステムのヘッダファイルにより
54 .\"O In order to be effective, a feature test macro
55 .\"O .IR "must be defined before including any header files" .
56 .\"O This can be done either in the compilation command
57 .\"O .RI ( "cc \-DMACRO=value" )
58 .\"O or by defining the macro within the source code before
59 .\"O including any headers.
60 機能検査マクロを機能させるには、機能検査マクロの定義を
61 「どのヘッダファイルのインクルードよりも前で」行わなければならない。
64 .RI ( "cc \-DMACRO=value" )
66 どのヘッダのインクルードよりも前で行う方法がある。
68 .\"O Some feature test macros are useful for creating portable applications,
69 .\"O by preventing nonstandard definitions from being exposed.
70 .\"O Other macros can be used to expose nonstandard definitions that
71 .\"O are not exposed by default.
72 .\"O The precise effects of each of the feature test macros described below
73 .\"O can be ascertained by inspecting the
76 機能検査マクロを使うと、非標準の定義が公開されないようにでき、
77 移植性のあるアプリケーションを作成するのに役立つ。
78 他のマクロを使うと、デフォルトでは公開されない非標準の定義を
80 以下で説明する機能検査マクロのそれぞれの正確な影響を確認するには、
85 .\"O .SS Specification of feature test macro requirements in manual pages
86 .SS マニュアルページでの機能検査マクロの要件の規定
87 .\"O When a function requires that a feature test macro is defined,
88 .\"O the manual page SYNOPSIS typically includes a note of the following form
89 .\"O (this example from the
92 関数が機能検査マクロの定義を必要とする場合、
93 マニュアルページの書式 (SYNOPSIS) の節に
100 .B #include <unistd.h>
102 .BI "int acct(const char *" filename );
106 .\"O Feature Test Macro Requirements for glibc (see
107 .\"O .BR feature_test_macros (7)):
109 .RB ( feature_test_macros (7)
115 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
118 .\"O The \fB||\fP means that in order to obtain the declaration of
121 .\"O .IR <unistd.h> ,
122 .\"O \fIeither\fP of the following macro
123 .\"O definitions must be made before including any header files:
128 から得るには、以下のマクロの定義のいずれかを、どのヘッダファイルの
129 インクルードよりも前で行わなければならないことを意味する。
134 #define _XOPEN_SOURCE /* or any value < 500 */
138 .\"O Alternatively, equivalent definitions can be included in the
139 .\"O compilation command:
140 別の方法としては、等価な定義をコンパイル用のコマンドで
146 cc \-D_XOPEN_SOURCE # Or any value < 500
150 .\"O Note that, as described below,
151 .\"O .BR "some feature test macros are defined by default" ,
152 .\"O so that it may not always be necessary to
153 .\"O explicitly specify the feature test macro(s) shown in the
156 .B 「いくつかの機能検査マクロはデフォルトで定義される」
158 このため、「書式」に記載された機能検査マクロを常に
161 .\"O In a few cases, manual pages use a shorthand for expressing the
162 .\"O feature test macro requirements (this example from
163 .\"O .BR readahead (2)):
164 あまり多くないが、マニュアルページによっては、
165 機能検査マクロの要件を以下のように簡単な表現で記載する場合がある。
172 .B #define _GNU_SOURCE
173 .B #include <fcntl.h>
175 .BI "ssize_t readahead(int " fd ", off64_t *" offset ", size_t " count );
179 .\"O This format is employed in cases where only a single
180 .\"O feature test macro can be used to expose the function
181 .\"O declaration, and that macro is not defined by default.
182 関数定義の公開に使える機能検査マクロが一つだけで、
183 デフォルトではそのマクロが定義されない場合に、
185 .\"O .SS Feature test macros understood by glibc
186 .SS glibc が解釈する機能検査マクロ
187 .\"O The following paragraphs explain how feature test macros are handled
188 .\"O in Linux glibc 2.\fIx\fP, \fIx\fP > 0.
189 以下では、Linux glibc 2.\fIx\fP (\fIx\fP > 0) において、
190 機能検査マクロがどのように扱われるかを説明する。
191 .\" The details in glibc 2.0 are simpler, but combining a
192 .\" a description of them with the details in later glibc versions
193 .\" would make for a complicated description.
195 .\"O Linux glibc understands the following feature test macros:
196 Linux/glibc は以下の機能検査マクロを解釈する:
200 .\"O This macro is implicitly defined by
202 .\"O when invoked with, for example, the
217 .\"O Defining this macro causes header files to expose definitions as follows:
222 .\"O The value 1 exposes definitions conforming to POSIX.1-1990 and
224 値が 1 の場合、POSIX.1-1990 と ISO C (1990) に準拠する定義が公開される。
226 .\"O The value 2 or greater additionally exposes
227 .\"O definitions for POSIX.2-1992.
229 POSIX.2-1992 関連の定義も追加で公開される。
231 .\"O The value 199309L or greater additionally exposes
232 .\"O definitions for POSIX.1b (real-time extensions).
234 POSIX.1b (リアルタイム拡張) 関連の定義が追加で公開される。
235 .\" 199506L functionality is only available since glibc 2.1
237 .\"O The value 199506L or greater additionally exposes
238 .\"O definitions for POSIX.1c (threads).
240 POSIX.1c (スレッド) 関連の定義が追加で公開される。
242 .\"O (Since glibc 2.3.3)
243 .\"O The value 200112L or greater exposes definitions corresponding
244 .\"O to the POSIX.1-2001 base specification (excluding the XSI extension).
247 (XSI 拡張を除く) POSIX.1-2001 基本仕様に対応する定義が公開される。
249 .\"O (Since glibc 2.10)
250 .\"O The value 200809L or greater exposes definitions corresponding
251 .\"O to the POSIX.1-2008 base specification (excluding the XSI extension).
254 (XSI 拡張を除く) POSIX.1-2008 基本仕様に対応する定義が公開される。
258 .\"O Defining this obsolete macro with any value is equivalent to defining
259 .\"O .B _POSIX_C_SOURCE
260 .\"O with the value 1.
267 .\"O Defining this macro causes header files to expose definitions as follows:
268 このマクロを定義すると、ヘッダファイルで以下の定義が公開される。
271 .\"O Defining with any value exposes
272 .\"O definitions conforming to POSIX.1, POSIX.2, and XPG4.
274 POSIX.1, POSIX.2, XPG4 に準拠する定義が公開される。
276 .\"O The value 500 or greater additionally exposes
277 .\"O definitions for SUSv2 (UNIX 98).
279 SUSv2 (UNIX 98) 関連の定義が追加で公開される。
281 .\"O (Since glibc 2.2) The value 600 or greater additionally exposes
282 .\"O definitions for SUSv3 (UNIX 03; i.e., the POSIX.1-2001 base specification
283 .\"O plus the XSI extension) and C99 definitions.
286 SUSv3 (UNIX 03; POSIX.1-2001 基本仕様 + XSI 拡張と同じ)
287 関連の定義と C99 での定義が追加で公開される。
289 .\"O (Since glibc 2.10) The value 700 or greater additionally exposes
290 .\"O definitions for SUSv4 (i.e., the POSIX.1-2008 base specification
291 .\"O plus the XSI extension).
294 SUSv4 (POSIX.1-2008 基本仕様 + XSI 拡張と同じ)
298 .B _XOPEN_SOURCE_EXTENDED
299 .\"O If this macro is defined, and
300 .\"O .B _XOPEN_SOURCE
301 .\"O is defined, then expose definitions corresponding to the XPG4v2
302 .\"O (SUSv1) UNIX extensions (UNIX 95).
303 .\"O This macro is also implicitly defined if
304 .\"O .B _XOPEN_SOURCE
305 .\"O is defined with a value of 500 or more.
308 が定義されていると、XPG4v2 (SUSv1) UNIX 拡張 (UNIX 95)
311 が 500 以上の値で定義された場合、このマクロは暗黙のうちに定義される。
314 .\"O Exposes C99 extensions to ISO C (1990).
315 ISO C (1990) の C99 拡張を公開する。
316 .\"O This macro is recognized since glibc 2.1.3;
317 このマクロは glibc 2.1.3 以降で認識される。
318 .\"O earlier glibc 2.1.x versions recognized an equivalent macro named
319 .\"O .B _ISOC9X_SOURCE
320 .\"O (because the C99 standard had not then been finalized).
321 .\"O Although the use of the latter macro is obsolete, glibc continues
322 .\"O to recognize it for backward compatibility.
323 初期のバージョン 2.1.x の glibc では、これと等価な
326 (なぜなら、C99 標準はまだ確定していなかったからである)。
329 glibc は過去との互換性のため今でもこのマクロを認識する。
331 .B _LARGEFILE64_SOURCE
332 .\"O Expose definitions for the alternative API specified by the
333 .\"O LFS (Large File Summit) as a "transitional extension" to the
334 .\"O Single UNIX Specification.
335 .\"O (See http://opengroup.org/platform/lfs.html.)
336 LFS (Large File Summit) により
337 "暫定拡張 (transitional extension)" Single UNIX Specification
338 として規定された代替 API (alternative API) に関する定義を公開する
339 (http://opengroup.org/platform/lfs.html 参照)。
340 .\"O The alternative API consists of a set of new objects
341 .\"O (i.e., functions and types) whose names are suffixed with "64"
350 代替 API は新規オブジェクト (関数と型) の集合で構成され、
351 その名前は "64" で終わる (例えば、
359 .\"O New programs should not employ this interface; instead
360 .\"O .I _FILE_OFFSET_BITS=64
361 .\"O should be employed.
362 新しいプログラムではこのインタフェースを利用しないこと。
364 .I _FILE_OFFSET_BITS=64
368 .\"O Defining this macro with the value 64
369 .\"O automatically converts references to 32-bit functions and data types
370 .\"O related to file I/O and file system operations into references to
371 .\"O their 64-bit counterparts.
372 .\"O This is useful for performing I/O on large files (> 2 Gigabytes)
373 .\"O on 32-bit systems.
374 .\"O (Defining this macro permits correctly written programs to use
375 .\"O large files with only a recompilation being required.)
376 .\"O 64-bit systems naturally permit file sizes greater than 2 Gigabytes,
377 .\"O and on those systems this macro has no effect.
378 このマクロを値 64 で定義すると、ファイル I/O とファイルシステム操作に
379 関連する 32 ビット版の関数とデータタイプは自動的に 64 ビット版に
381 これは、32 ビットシステムで大きなファイル (> 2 ギガバイト) の I/O
383 (このマクロを定義すると、コンパイルし直すだけで大きなファイルを
385 64 ビットシステムは、もともと 2 ギガバイトより大きなファイルを
386 扱えるので、64 ビットシステムではこのマクロは効果を持たない。
389 .\"O Defining this macro with any value causes header files to expose
390 .\"O BSD-derived definitions.
391 .\"O Defining this macro also causes BSD definitions to be preferred in
392 .\"O some situations where standards conflict, unless one or more of
393 .\"O .BR _SVID_SOURCE ,
394 .\"O .BR _POSIX_SOURCE ,
395 .\"O .BR _POSIX_C_SOURCE ,
396 .\"O .BR _XOPEN_SOURCE ,
397 .\"O .BR _XOPEN_SOURCE_EXTENDED ,
400 .\"O is defined, in which case BSD definitions are disfavored.
401 このマクロを定義すると (値に関わらず) ヘッダファイルで
403 また、このマクロを定義すると、相容れない標準が存在する状況において
408 .BR _POSIX_C_SOURCE ,
410 .BR _XOPEN_SOURCE_EXTENDED ,
412 が一つでも定義された場合には、BSD 由来の定義は優先されなくなる。
415 .\"O Defining this macro with any value causes header files to expose
416 .\"O System V-derived definitions.
417 .\"O (SVID == System V Interface Definition; see
418 .\"O .BR standards (7).)
419 このマクロを定義すると (値に関わらず) ヘッダファイルで
421 (SVID == System V Interface Definition;
425 .\"O .BR _ATFILE_SOURCE " (since glibc 2.4)"
426 .BR _ATFILE_SOURCE " (glibc 2.4 以降)"
427 .\"O Defining this macro with any value causes header files to expose
428 .\"O declarations of a range of functions with the suffix "at";
431 .\"O Since glibc 2.10, this macro is also implicitly defined if
432 .\"O .BR _POSIX_C_SOURCE
433 .\"O is defined with a value greater than or equal to 200809L.
434 このマクロを定義すると (値に関わらず) ヘッダファイルで
435 名前の末尾が "at" の各種の関数の定義が公開される。
440 が 200809L 以上の値で定義された場合には、
444 .\"O Defining this macro (with any value) is equivalent to defining
445 .\"O .BR _BSD_SOURCE ,
446 .\"O .BR _SVID_SOURCE ,
447 .\"O .BR _ATFILE_SOURCE ,
448 .\"O .BR _LARGEFILE64_SOURCE ,
449 .\"O .BR _ISOC99_SOURCE ,
450 .\"O .BR _XOPEN_SOURCE_EXTENDED ,
451 .\"O .BR _POSIX_SOURCE ,
452 .\"O .B _POSIX_C_SOURCE
453 .\"O with the value 200809L
454 .\"O (200112L in glibc versions before 2.10;
455 .\"O 199506L in glibc versions before 2.5;
456 .\"O 199309L in glibc versions before 2.1)
458 .\"O .B _XOPEN_SOURCE
459 .\"O with the value 700
460 .\"O (600 in glibc versions before 2.10;
461 .\"O 500 in glibc versions before 2.2).
462 .\"O In addition, various GNU-specific extensions are also exposed.
463 .\"O Where standards conflict, BSD definitions are disfavored.
464 このマクロを定義すると (値に関わらず) 以下のマクロを定義するのと
469 .BR _LARGEFILE64_SOURCE ,
471 .BR _XOPEN_SOURCE_EXTENDED ,
475 (バージョン 2.10 より前の glibc では値は 200112L、
476 バージョン 2.5 より前の glibc では値は 199506L、
477 バージョン 2.1 より前の glibc では値は 199309L),
480 (バージョン 2.10 より前の glibc では値は 600、
481 バージョン 2.2 より前の glibc では値は 500)。
482 さらに、各種の GNU 固有の拡張も公開される。
487 .\"O Defining this macro exposes definitions of certain reentrant functions.
488 .\"O For multithreaded programs, use
489 .\"O .I "cc\ \-pthread"
491 このマクロを定義すると、いくつかのリエントラント (再入可能) な関数
492 定義が公開される。マルチスレッド・プログラムでは、この代わりに
498 .\"O .BR _REENTRANT ,
499 .\"O provided for compatibility with some other implementations.
502 他のいくつかの実装との互換性を提供するためのもの。
504 .\"O .BR _FORTIFY_SOURCE " (since glibc 2.3.4)"
505 .BR _FORTIFY_SOURCE " (glibc 2.3.4 以降)"
506 .\" For more detail, see:
507 .\" http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
508 .\" [PATCH] Object size checking to prevent (some) buffer overflows
509 .\" * From: Jakub Jelinek <jakub at redhat dot com>
510 .\" * To: gcc-patches at gcc dot gnu dot org
511 .\" * Date: Tue, 21 Sep 2004 04:16:40 -0400
512 .\"O Defining this macro causes some lightweight checks to be performed
513 .\"O to detect some buffer overflow errors when employing
514 .\"O various string and memory manipulation functions.
515 .\"O Not all buffer overflows are detected, just some common cases.
516 このマクロを定義すると、文字列やメモリの操作を行う様々な関数を
517 使用する際にバッファオーバーフローを検出するための軽めのチェックが
518 実行されるようになる。すべてのバッファオーバーフローが検出される
519 わけではなく、あくまでよくある例についてだけである。
520 .\"O In the current implementation checks are added for
522 現在の実装では、以下の関数にチェックが追加されている:
539 .\"O .B _FORTIFY_SOURCE
540 .\"O is set to 1, with compiler optimization level 1
541 .\"O .RI ( "gcc\ \-O1" )
542 .\"O and above, checks that shouldn't change the behavior of
543 .\"O conforming programs are performed.
545 .\"O .B _FORTIFY_SOURCE
546 .\"O set to 2 some more checking is added, but
547 .\"O some conforming programs might fail.
549 が 1 に設定された場合、コンパイラの最適化レベルが 1
551 かそれ以上であれば、規格に準拠するプログラムの振る舞いを
554 が 2 に設定された場合、さらなるチェックが追加されるが、
555 規格に準拠するプログラムのいくつかが失敗する可能性がある。
556 .\"O Some of the checks can be performed at compile time,
557 .\"O and result in compiler warnings;
558 .\"O other checks take place at run time,
559 .\"O and result in a run-time error if the check fails.
560 いくつかのチェックはコンパイル時に実行でき、コンパイラの警告として
561 表示される。他のチェックは実行時に行われ、チェックに失敗した場合
563 .\"O Use of this macro requires compiler support, available with
565 .\"O since version 4.0.
566 このマクロを使用するにはコンパイラの対応が必要であり、
570 .\"O .SS Default definitions, implicit definitions, and combining definitions
571 .SS デフォルトの定義、暗黙の定義、組み合わせ定義
573 .\"O If no feature test macros are explicitly defined,
574 .\"O then the following feature test macros are defined by default:
575 .\"O .BR _BSD_SOURCE ,
576 .\"O .BR _SVID_SOURCE ,
577 .\"O .BR _POSIX_SOURCE ,
579 .\"O .BR _POSIX_C_SOURCE =200809L
580 .\"O (200112L in glibc versions before 2.10;
581 .\"O 199506L in glibc versions before 2.4;
582 .\"O 199309L in glibc versions before 2.1).
583 機能検査マクロが一つも明示的に定義されなかった場合、
588 .BR _POSIX_C_SOURCE =200809L
590 (バージョン 2.10 より前の glibc では値は 200112L、
591 バージョン 2.4 より前の glibc では値は 199506L、
592 バージョン 2.1 より前の glibc では値は 199309L)。
595 .\"O .BR __STRICT_ANSI__ ,
596 .\"O .BR _ISOC99_SOURCE ,
597 .\"O .BR _POSIX_SOURCE ,
598 .\"O .BR _POSIX_C_SOURCE ,
599 .\"O .BR _XOPEN_SOURCE ,
600 .\"O .BR _XOPEN_SOURCE_EXTENDED ,
601 .\"O .BR _BSD_SOURCE ,
604 .\"O is explicitly defined, then
605 .\"O .BR _BSD_SOURCE ,
608 .\"O are not defined by default.
609 .BR __STRICT_ANSI__ ,
612 .BR _POSIX_C_SOURCE ,
614 .BR _XOPEN_SOURCE_EXTENDED ,
624 .\"O .B _POSIX_SOURCE
626 .\"O .B _POSIX_C_SOURCE
627 .\"O are not explicitly defined,
629 .\"O .B __STRICT_ANSI__
630 .\"O is not defined or
631 .\"O .B _XOPEN_SOURCE
632 .\"O is defined with a value of 500 or more, then
640 が 500 以上の値で定義されたときには、
643 .\"O .B _POSIX_SOURCE
644 .\"O is defined with the value 1; and
648 .\"O .B _POSIX_C_SOURCE
649 .\"O is defined with one of the following values:
657 .\"O is defined with a value less than 500;
665 .\"O is defined with a value greater than or equal to 500 and less than 600;
669 が 500 以上 600 未満の値で定義された場合)
671 .\"O (since glibc 2.4) 200112L,
674 .\"O is defined with a value greater than or equal to 600 and less than 700.
678 が 600 以上 700 未満の値で定義された場合)
680 .\"O (Since glibc 2.10)
684 .\"O is defined with a value greater than or equal to 700.
690 .\"O Older versions of glibc do not know about the values
691 .\"O 200112L and 200809L for
692 .\"O .BR _POSIX_C_SOURCE ,
693 .\"O and the setting of this macro will depend on the glibc version.
696 の値として 200112L や 200809L は存在せず、
698 の値がどうなるかは glibc のバージョンにより異なる。
701 .\"O .B _XOPEN_SOURCE
702 .\"O is undefined, then the setting of
703 .\"O .B _POSIX_C_SOURCE
704 .\"O depends on the glibc version:
705 .\"O 199506L, in glibc versions before 2.4;
706 .\"O 200112L, in glibc 2.4 to 2.9; and
707 .\"O 200809L, since glibc 2.10.
711 の値は glibc のバージョンにより異なる。
712 バージョン 2.4 より前の glibc では 199506L、
713 バージョン 2.4 以降 2.9 未満では 200112L、
714 glibc 2.10 以降では 200809L となる。
718 .\"O Multiple macros can be defined; the results are additive.
719 また、複数のマクロを定義することもできる。
720 この場合、定義したマクロはすべて有効になる。
721 .\"O .SH CONFORMING TO
723 .\"O POSIX.1 specifies
724 .\"O .BR _POSIX_C_SOURCE ,
725 .\"O .BR _POSIX_SOURCE ,
727 .\"O .BR _XOPEN_SOURCE .
728 .\"O .B _XOPEN_SOURCE_EXTENDED
729 .\"O was specified by XPG4v2 (aka SUSv1).
731 .BR _POSIX_C_SOURCE ,
735 .B _XOPEN_SOURCE_EXTENDED
736 は XPG4v2 (別名 SUSv1) で規定されていた。
738 .\"O .B _FILE_OFFSET_BITS
739 .\"O is not specified by any standard,
740 .\"O but is employed on some other implementations.
745 .\"O .BR _BSD_SOURCE ,
746 .\"O .BR _SVID_SOURCE ,
747 .\"O .BR _ATFILE_SOURCE ,
748 .\"O .BR _GNU_SOURCE ,
749 .\"O .BR _FORTIFY_SOURCE ,
750 .\"O .BR _REENTRANT ,
753 .\"O are specific to Linux (glibc).
758 .BR _FORTIFY_SOURCE ,
761 は Linux (glibc) 固有である。
765 .\"O is a Linux/glibc-specific header file.
766 .\"O Other systems have an analogous file, but typically with a different name.
767 .\"O This header file is automatically included by other header files as
768 .\"O required: it is not necessary to explicitly include it in order to
769 .\"O employ feature test macros.
771 は Linux/glibc 固有のヘッダファイルである。
772 他のシステムにも同様の目的のファイルがあるが、普通は違う名前である。
773 このヘッダファイルは、他のヘッダファイルにより必要に応じて
774 自動的にインクルードされる。機能検査マクロを利用するために
777 .\"O According to which of the above feature test macros are defined,
779 .\"O internally defines various other macros that are checked by
780 .\"O other glibc header files.
781 .\"O These macros have names prefixed by two underscores (e.g.,
782 .\"O .BR __USE_MISC ).
783 .\"O Programs should \fInever\fP define these macros directly:
784 .\"O instead, the appropriate feature test macro(s) from the
785 .\"O list above should be employed.
786 上記の機能検査マクロのうちどれが定義されたかにしたがって、
788 は、他の glibc ヘッダファイルでチェックされる各種の他のマクロを、
789 内部で定義する。これらのマクロの名前はアンダースコア 2つで始まる
792 ユーザプログラムはこれらのマクロを \fI決して\fP 直接定義すべきではない。
793 代わりに、上記のリストにある適切な機能検査マクロを利用すべきである。
796 .\"O The program below can be used to explore how the various
797 .\"O feature test macros are set depending on the glibc version
798 .\"O and what feature test macros are explicitly set.
799 .\"O The following shell session, on a system with glibc 2.10,
800 .\"O shows some examples of what we would see:
801 下記のプログラムを使うと、各種の機能検査マクロが glibc のバージョン
802 に応じてどのように設定されるかや、どの機能検査マクロが明示的に
805 glibc 2.10 のシステムでの実行結果の例である。
811 _POSIX_SOURCE defined
812 _POSIX_C_SOURCE defined: 200809L
815 _ATFILE_SOURCE defined
816 $ \fBcc -D_XOPEN_SOURCE=500 ftm.c\fP
818 _POSIX_SOURCE defined
819 _POSIX_C_SOURCE defined: 199506L
820 _XOPEN_SOURCE defined: 500
821 $ \fBcc -D_GNU_SOURCE ftm.c\fP
823 _POSIX_SOURCE defined
824 _POSIX_C_SOURCE defined: 200809L
825 _ISOC99_SOURCE defined
826 _XOPEN_SOURCE defined: 700
827 _XOPEN_SOURCE_EXTENDED defined
828 _LARGEFILE64_SOURCE defined
831 _ATFILE_SOURCE defined
845 main(int argc, char *argv[])
848 printf("_POSIX_SOURCE defined\\n");
851 #ifdef _POSIX_C_SOURCE
852 printf("_POSIX_C_SOURCE defined: %ldL\\n", (long) _POSIX_C_SOURCE);
855 #ifdef _ISOC99_SOURCE
856 printf("_ISOC99_SOURCE defined\\n");
860 printf("_XOPEN_SOURCE defined: %d\\n", _XOPEN_SOURCE);
863 #ifdef _XOPEN_SOURCE_EXTENDED
864 printf("_XOPEN_SOURCE_EXTENDED defined\\n");
867 #ifdef _LARGEFILE64_SOURCE
868 printf("_LARGEFILE64_SOURCE defined\\n");
871 #ifdef _FILE_OFFSET_BITS
872 printf("_FILE_OFFSET_BITS defined: %d\\n", _FILE_OFFSET_BITS);
876 printf("_BSD_SOURCE defined\\n");
880 printf("_SVID_SOURCE defined\\n");
883 #ifdef _ATFILE_SOURCE
884 printf("_ATFILE_SOURCE defined\\n");
888 printf("_GNU_SOURCE defined\\n");
892 printf("_REENTRANT defined\\n");
896 printf("_THREAD_SAFE defined\\n");
899 #ifdef _FORTIFY_SOURCE
900 printf("_FORTIFY_SOURCE defined\\n");
911 .\"O The section "Feature Test Macros" under
912 .\"O .IR "info libc" .
914 の "Feature Test Macros" の節。
915 .\" But beware: the info libc document is out of date (Jul 07, mtk)
917 .I /usr/include/features.h