]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
Document _FORTIFY_SOURCE, _REENTRANT, and _THREAD_SAFE.
authorMichael Kerrisk <mtk.manpages@gmail.com>
Sun, 28 Jan 2007 19:30:54 +0000 (19:30 +0000)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sun, 28 Jan 2007 19:30:54 +0000 (19:30 +0000)
man7/feature_test_macros.7

index e02f84cd6326c34c430bd5b93c51de3000822faf..46e1d315cc7c94f72288c8e503b613dd8a9b41bd 100644 (file)
@@ -121,6 +121,63 @@ and
 .BR _XOPEN_SOURCE
 with the value 600.
 In addition, various GNU-specific extensions are also exposed.
+.TP
+.B _REENTRANT
+Defining this macro exposes definitions of certain reentrant functions.
+Avoid direct use of this macro; use 
+.I "cc -pthread"
+instead.
+.TP
+.B _THREAD_SAFE
+Synonym for 
+.BR _REENTRANT ,
+provided for compatibility with some other implementations.
+.TP
+.B _FORTIFY_SOURCE
+.\" 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
+Defining this macro causes some lightweight checks to be performed
+to detect some buffer overflow errors when employing
+various string and memory manipulation functions.
+Not all buffer overflows are detected, just some common cases.
+In the current implementation checks are added for
+calls to 
+.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),
+and 
+.BR gets (3).
+If 
+.B _FORTIFY_SOURCE 
+is set to 1, with compiler optimization level 1 
+.RI ( "gcc -O1" )
+and above, checks that shouldn't change the behaviour of 
+conforming programs are performed.
+With 
+.B _FORTIFY_SOURCE 
+set to 2 some more checking is added, but
+some conforming programs might fail.
+Some of the checks can be performed at compile time, 
+and result in compiler warnings; 
+other checks take place at run time, 
+and result in a run-time error if the check fails.
+Use of this macro requires compiler support, available with
+.BR gcc (1)
+since version 4.0.
 .PP
 When
 .BR gcc (1)
@@ -154,8 +211,11 @@ is not specified by any standard,
 but is employed on some other implementations.
 .BR _BSD_SOURCE ,
 .BR _SVID_SOURCE ,
+.BR _GNU_SOURCE ,
+.BR _FORTIFY_SOURCE ,
+.BR _REENTRANT ,
 and
-.BR _GNU_SOURCE
+.BR _THREAD_SAFE
 are Linux (glibc) specific.
 .SH NOTES
 .I <features.h>