1 #ifndef __FCNTL_H 2 #define __FCNTL_H 3 #ifndef _POSIX_SOURCE 4 This header file is not defined in pure ANSI 5 #endif 6 #pragma lib "/$M/lib/ape/libap.a" 7 8 #include <sys/types.h> 9 10 #define O_RDONLY 0 11 #define O_WRONLY 1 12 #define O_RDWR 2 13 #define O_ACCMODE 0x003 14 #define O_NONBLOCK 0x004 15 #define O_APPEND 0x008 16 #define O_CREAT 0x100 17 #define O_TRUNC 0x200 18 #define O_EXCL 0x400 19 #define O_NOCTTY 0x800 20 #define O_DSYNC 0x1000 21 #define O_RSYNC 0x2000 22 #define O_SYNC 0x4000 23 24 #define F_DUPFD 0 /* Duplicate fildes */ 25 #define F_GETFD 1 /* Get fildes flags */ 26 #define F_SETFD 2 /* Set fildes flags */ 27 #define F_GETFL 3 /* Get file flags */ 28 #define F_SETFL 4 /* Set file flags */ 29 #define F_GETLK 5 /* Get file lock */ 30 #define F_SETLK 6 /* Set file lock */ 31 #define F_SETLKW 7 /* Set file lock and wait */ 32 33 #define FD_CLOEXEC 1 34 35 struct flock { 36 short l_type; 37 short l_whence; 38 off_t l_start; 39 off_t l_len; 40 pid_t l_pid; 41 }; 42 43 #define F_RDLCK 1 /* shared or read lock */ 44 #define F_UNLCK 2 /* unlock */ 45 #define F_WRLCK 3 /* exclusive or write lock */ 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 extern int fcntl(int, int, ...); 52 extern int open(const char *, int, ...); 53 extern int creat(const char *, mode_t); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif 60