是在features.h中用于特性控制的一个功能测试宏 测试
/user/include/features.h spa
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */ di
#ifdef _GNU_SOURCE 时间
# undef _ISOC99_SOURCE co
# define _ISOC99_SOURCE 1 工作
# undef _POSIX_SOURCE 系统
# define _POSIX_SOURCE 1
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200809L
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE 700
# undef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
# undef _LARGEFILE64_SOURCE
# define _LARGEFILE64_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
# define _SVID_SOURCE 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1
#endif
其中_ISOC99_SOURCE, _POSIX_SOURCE, _XOPEN_SOURCE都是功能测试宏,
用于指示是否包含对应标准的特性,
而这些不一样的特性源于过去20多年来进行的各类标准化工做(ANSI, ISO, POSIX, FIPS等),
不一样的标准支持实现了不一样的特性,
如系统时间的获取,stat结构是在ANSI标准中是不支持的,
而定义了_GNU_SOURCE至关于开启了对全部特性的支持。