fcntl.h 1.2 KB

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