fcntl.h (1010B)
1 #ifndef _FCNTL_H 2 #define _FCNTL_H 3 4 #include <sys/types.h> 5 6 7 // File access modes 8 #define O_ACCMODE 0x03 // Mask for file access modes. 9 #define O_RDONLY 0x00 // Open for reading only. 10 #define O_WRONLY 0x01 // Open for writing only. 11 #define O_RDWR 0x02 // Open for reading and writing. 12 13 // File creation flags 14 #define O_CREAT 0x10 // Create file if it does not exist. 15 #define O_EXCL 0x20 // Exclusive use flag. 16 #define O_NOCTTY 0x40 // Do not assign controlling terminal. 17 #define O_TRUNC 0x80 // Truncate flag. 18 19 // File access flags 20 #define O_APPEND 0x100 // Set append mode. 21 #define O_NONBLOCK 0x200 // Non-blocking mode. 22 #define O_SYNC 0x400 // Synchronous I/O. 23 24 // Fcntl args 25 #define F_DUPFD 0 26 #define F_GETFD 1 27 #define F_SETFD 2 28 #define F_GETFL 3 29 #define F_SETFL 4 30 // #define F_GETLK 7 31 // #define F_SETLK 8 32 // #define F_SETLKW 9 33 34 #define FD_CLOEXEC 1 35 36 37 38 int creat(const char *path, mode_t mode); 39 int fcntl(int fd, int cmd, ...); 40 int open(const char *path, int flags, ...); 41 42 43 #endif // _FCNTL_H