open函数中O_CLOEXEC标志的开关
来源:互联网 发布:不学c语言直接学java 编辑:程序博客网 时间:2024/04/30 18:17
虽然新版本支持在open时设置CLOEXEC,但是在编译的时候还是会提示错误 - error: ‘O_CLOEXEC’ undeclared (first use in this function)。原来这个新功能要求我们手动去打开,需要设置一个宏(_GNU_SOURCE)。可通过以下两种方法来设置这个宏以打开新功能:
1. 在源代码中加入 #define _GNU_SOURCE
2. 在编译参数中加入 -D_GNU_SOURCE
gcc 还有很多其他的开关,具体可以参考
--------------------------- /usr/include/features.h -----------------------------------------------
These are defined by the user (or the compiler) to specify the desired environment:
__STRICT_ANSI__ ISO Standard C.
_ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
_POSIX_SOURCE IEEE Std 1003.1.
_POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
if >=199309L, add IEEE Std 1003.1b-1993;
if >=199506L, add IEEE Std 1003.1c-1995;
if >=200112L, all of IEEE 1003.1-2004
_XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
Single Unix conformance is wanted, to 600 for the
upcoming sixth revision.
_XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
_LARGEFILE_SOURCE Some more functions for correct standard I/O.
_LARGEFILE64_SOURCE Additional functionality from LFS for large files.
_FILE_OFFSET_BITS=N Select default filesystem interface.
_BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
_SVID_SOURCE ISO C, POSIX, and SVID things.
_ATFILE_SOURCE Additional *at interfaces.
_GNU_SOURCE All of the above, plus GNU extensions.
_REENTRANT Select additionally reentrant object.
_THREAD_SAFE Same as _REENTRANT, often used by other systems.
_FORTIFY_SOURCE If set to numeric value > 0 additional security
measures are defined, according to level.
------------------------------------------------------------------------------------------
- open函数中O_CLOEXEC标志的开关
- open函数中O_CLOEXEC标志的开关
- open函数中O_CLOEXEC标志的开关
- open函数中O_CLOEXEC标志的开关
- open函数中O_CLOEXEC标志的开关
- open中的 O_CLOEXEC 标志
- open O_CLOEXEC标志
- open函数O_CLOEXEC作用
- [Linux]O_CLOEXEC 标志
- 浅析open函数O_CLOEXEC模式和fcntl函数FD_CLOEXEC选项
- 浅析open函数O_CLOEXEC模式和fcntl函数FD_CLOEXEC选项
- 浅析open函数O_CLOEXEC模式和fcntl函数FD_CLOEXEC选项
- open函数的标志的意思
- 浅析linux下open函数O_CLOEXEC模式和fcntl函数FD_CLOEXEC选项
- (MSSQL)在数据表中设置标志开关,进行触发器的有选择工作
- linux open 函数O_DIRECT标志位使用说明
- linux open 函数O_DIRECT标志位使用说明
- open() 标志位的设置与清除
- restful框架接收含有图片类型处理
- TCL照明电器
- LoadRunner 11 安装及破解
- Android拓展系列(2)--Git使用
- Python实例讲解 -- 定时播放 (闹钟+音乐)
- open函数中O_CLOEXEC标志的开关
- Linux awk 使用用例
- 开始记录汉化足迹
- WebBrowser嵌入对话框中,回车键不响应
- C#实现图标按钮
- ajax请求返回Json字符串运用highcharts数据图表展现数据
- git中的后悔方法:rebase,revert,reset
- c/c++内存泄露
- Hibernate中悲观锁和乐观锁