查了下O_RDWR, O_CREAT等定义,终于找到了。
我的系统是Fedora12, 其定义在文件:/usr/include/asm-generic/fcntl.h,部分定义如下:
#include
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
#define O_ACCMODE00000003
#define O_RDONLY00000000
#define O_WRONLY00000001
#define O_RDWR00000002
#ifndef O_CREAT
#define O_CREAT00000100/* not fcntl */
#endif
#ifndef O_EXCL
#define O_EXCL00000200/* not fcntl */
#endif
#ifndef O_NOCTTY
#define O_NOCTTY00000400/* not fcntl */
#endif
#ifndef O_TRUNC
#define O_TRUNC00001000/* not fcntl */
#endif
#ifndef O_APPEND
#define O_APPEND00002000
#endif
#ifndef O_NONBLOCK
#define O_NONBLOCK00004000
#endif
#ifndef O_SYNC
#define O_S