fcntl.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __FCNTL_H
  10. #define __FCNTL_H
  11. #ifndef _POSIX_SOURCE
  12. This header file is not defined in pure ANSI
  13. #endif
  14. #pragma lib "/$M/lib/ape/libap.a"
  15. #include <sys/types.h>
  16. #define O_RDONLY 0
  17. #define O_WRONLY 1
  18. #define O_RDWR 2
  19. #define O_ACCMODE 0x003
  20. #define O_NONBLOCK 0x004
  21. #define O_APPEND 0x008
  22. #define O_CREAT 0x100
  23. #define O_TRUNC 0x200
  24. #define O_EXCL 0x400
  25. #define O_NOCTTY 0x800
  26. #define O_DSYNC 0x1000
  27. #define O_RSYNC 0x2000
  28. #define O_SYNC 0x4000
  29. #define F_DUPFD 0 /* Duplicate fildes */
  30. #define F_GETFD 1 /* Get fildes flags */
  31. #define F_SETFD 2 /* Set fildes flags */
  32. #define F_GETFL 3 /* Get file flags */
  33. #define F_SETFL 4 /* Set file flags */
  34. #define F_GETLK 5 /* Get file lock */
  35. #define F_SETLK 6 /* Set file lock */
  36. #define F_SETLKW 7 /* Set file lock and wait */
  37. #define FD_CLOEXEC 1
  38. struct flock {
  39. int16_t l_type;
  40. int16_t l_whence;
  41. off_t l_start;
  42. off_t l_len;
  43. pid_t l_pid;
  44. };
  45. #define F_RDLCK 1 /* shared or read lock */
  46. #define F_UNLCK 2 /* unlock */
  47. #define F_WRLCK 3 /* exclusive or write lock */
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. extern int fcntl(int, int, ...);
  52. extern int open(const char *, int, ...);
  53. extern int creat(const char *, mode_t);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif