home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pthrd004.zip / emx / include / sys / fcntl.h next >
C/C++ Source or Header  |  1998-09-17  |  3KB  |  116 lines

  1. /* sys/fcntl.h (emx+gcc) */
  2.  
  3. #ifndef _SYS_FCNTL_H
  4. #define _SYS_FCNTL_H
  5.  
  6. #if defined (__cplusplus)
  7. extern "C" {
  8. #endif
  9.  
  10. /* Don't forget to update /emx/src/dos/termio.inc when changing this! */
  11.  
  12. #if !defined (O_RDONLY)
  13. #define O_ACCMODE       0x03    /* mask */
  14. #define O_RDONLY        0x00
  15. #define O_WRONLY        0x01
  16. #define O_RDWR          0x02
  17. #define O_NONBLOCK      0x04
  18. #define O_APPEND        0x08
  19. #define O_TEXT          0x10
  20.  
  21. #define O_BINARY        0x0100
  22. #define O_CREAT         0x0200
  23. #define O_TRUNC         0x0400
  24. #define O_EXCL          0x0800
  25. #define O_SYNC          0x2000
  26. #define O_NOCTTY        0x4000
  27. #define O_SIZE          0x8000
  28.  
  29. #if !defined (_POSIX_SOURCE)
  30. #define O_NDELAY        O_NONBLOCK
  31. #define O_NOINHERIT     0x1000
  32. #endif
  33.  
  34. #endif
  35.  
  36. #if !defined (F_OK)
  37. #define F_OK 0
  38. #define X_OK 1
  39. #define W_OK 2
  40. #define R_OK 4
  41. #endif
  42.  
  43. #if !defined (F_GETFL)
  44. #define F_GETFL     1
  45. #define F_SETFL     2
  46. #define F_GETFD     3
  47. #define F_SETFD     4
  48. #define F_DUPFD     5
  49. #define F_GETLK     7           /* FreeBSD: get record locking information */
  50. #define F_SETLK     8           /* FreeBSD: set record locking information */
  51. #define F_SETLKW    9           /* FreeBSD: F_SETLK; wait if blocked */
  52. #endif
  53.  
  54. #if !defined (FD_CLOEXEC)
  55. /* file descriptor flags (F_GETFD, F_SETFD) */
  56. #define FD_CLOEXEC  0x01        /* close-on-exec flag */
  57. #endif
  58.  
  59. /* record loging flags (F_GETLK, F_SETLK, F_SETLKW) */
  60. #define F_RDLCK     1           /* FreeBSD: shared or read lock */
  61. #define F_UNLCK     2           /* FreeBSD: unlock */
  62. #define F_WRLCK     3           /* FreeBSD: exclusive or write lock */
  63. #ifdef KERNEL
  64. #define F_WAIT      0x010       /* FreeBSD: Wait until lock is granted */
  65. #define F_FLOCK     0x020       /* FreeBSD: Use flock(2) semantics for lock */
  66. #define F_POSIX     0x040       /* FreeBSD: Use POSIX semantics for lock */
  67. #endif
  68.  
  69. /*
  70.  * FreeBSD:
  71.  * Advisory file segment locking data type
  72.  * information passed to system by use
  73.  */
  74. struct flock {
  75.         off_t   l_start;        /* starting offset */
  76.         off_t   l_len;          /* len = 0 means until end of file */
  77.         pid_t   l_pid;          /* lock owner */
  78.         short   l_type;         /* lock type: read/write, etc. */
  79.         short   l_whence;       /* type of l_start */
  80. };
  81.  
  82.  
  83. int creat (__const__ char *, int);
  84. int fcntl (int, int, ...);
  85. int open (__const__ char *, int, ...);
  86.  
  87. #if !defined (_POSIX_SOURCE)
  88.  
  89. #if !defined (LOCK_SH)
  90. #define LOCK_SH     0x01
  91. #define LOCK_EX     0x02
  92. #define LOCK_NB     0x04
  93. #define LOCK_UN     0x08
  94. #endif
  95.  
  96. int flock (int, int);
  97.  
  98. #endif
  99.  
  100.  
  101. #if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE)
  102.  
  103. int _creat (__const__ char *, int);
  104. int _fcntl (int, int, ...);
  105. int _flock (int, int);
  106. int _open (__const__ char *, int, ...);
  107.  
  108. #endif
  109.  
  110.  
  111. #if defined (__cplusplus)
  112. }
  113. #endif
  114.  
  115. #endif /* not _SYS_FCNTL_H */
  116.