home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / win3 / patches / symantec / rtlinc.exe / FCNTL.H < prev    next >
C/C++ Source or Header  |  1993-05-19  |  3KB  |  137 lines

  1. /*_ fcntl.h   Tue Dec 19 1989    Modified by: Walter Bright */
  2. /* Copyright (C) 1985-1989 by Walter Bright    */
  3. /* All rights reserved                */
  4. /* Written by Walter Bright            */
  5.  
  6. #ifndef __FCNTL_H
  7. #define __FCNTL_H    1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. #ifdef __STDC__
  14. #define __CDECL
  15. #define __STDCALL
  16. #else
  17. #define __CDECL __cdecl
  18. #define __STDCALL __stdcall
  19. #endif
  20.  
  21. #if __OS2__ && __INTSIZE == 4
  22. #define __CLIB    __STDCALL
  23. #else
  24. #define __CLIB    __CDECL
  25. #endif
  26.  
  27. /*******************************
  28.  * File modes for open() and fcnt().
  29.  */
  30.  
  31. #define O_RDONLY    0
  32. #define O_WRONLY    1
  33. #define O_RDWR        2
  34. #define O_APPEND    8
  35. #define O_CREAT        0x100
  36. #define O_TRUNC        0x200
  37. #define O_EXCL        0x400
  38.  
  39. #define _O_RDONLY 0    /* open for reading only */
  40. #define _O_WRONLY    1    /* open for writing only */
  41. #define _O_RDWR     2    /* open for reading and writing */
  42. #define _O_APPEND    8    /* writes done at eof */
  43. #define _O_CREAT    0x100    /* create and open file */
  44. #define _O_TRUNC    0x200    /* open and truncate */
  45. #define _O_EXCL     0x400    /* open only if file doesn't already exist */
  46.  
  47. #if M_UNIX || M_XENIX
  48.  
  49. #if M_XOUT
  50.  
  51. #define CF_RDLCK    1
  52. #define CF_WRLCK    2
  53. #define CF_UNLCK    3
  54.  
  55. #define CMN_RDLCK    3
  56. #define CMN_WRLCK    1
  57. #define CMN_UNLCK    0
  58. #define F_RDLCK CMN_RDLCK
  59. #define F_WRLCK CMN_WRLCK
  60. #define F_UNLCK CMN_UNLCK
  61.  
  62. #define O_ACCMODE    3
  63. #define O_NDELAY    4
  64. #define O_NONBLOCK    4
  65.  
  66. #define O_SYNCW 0020
  67. #define O_SYNC    O_SYNCW
  68.  
  69. #else /* M_XOUT */
  70.  
  71. #define F_RDLCK 01
  72. #define F_WRLCK 02
  73. #define F_UNLCK 03
  74.  
  75. #endif    /* M_XOUT */
  76.  
  77. /* Values for open() */
  78. #define O_NOCTTY 0x800
  79.  
  80. /* Values for fcntl() */
  81. #define F_DUPFD      0
  82. #define F_GETFD      1
  83. #define F_SETFD      2
  84. #define F_GETFL      3
  85. #define F_SETFL      4
  86. #define F_GETLK      5
  87. #define F_SETLK      6
  88. #define F_SETLKW  7
  89. #define F_CHKFL      8
  90. #define F_ALLOCSP 10
  91. #define F_FREESP  11
  92. #define F_CHSIZE  0x6000
  93. #define F_RDCHK      0x6001
  94.  
  95. /*  Value for F_SETFD */
  96. #define FD_CLOEXEC    0x01
  97.  
  98. #define F_LK_NBRLCK    0x6100
  99. #define F_LK_NBLCK    0x6200
  100. #define F_LK_UNLCK    0x6300
  101. #define F_LK_RLCK    0x7100
  102. #define F_LK_LOCK    0x7200
  103.  
  104. #define LK_LCKTYPE(a)    ((a>>8)&7)
  105. #define LK_CMDTYPE(a)    ((a>>12)&7)
  106.  
  107. struct flock {
  108.     short    l_type;
  109.     short    l_whence;
  110.     long    l_start;
  111.     long    l_len;
  112.     short    l_sysid;
  113.     short    l_pid;
  114. };
  115.  
  116. int __CDECL rdchk(int filedes);
  117. int __CDECL fcntl(int filedes, int cmd, int arg);
  118.  
  119. #else    /* M_XENIX || M_UNIX */
  120. #define O_NOINHERIT    0x80
  121. #define O_BINARY 0 /* MSC compatible mode (files are ALWAYS O_BINARY anyway) */
  122. #define O_TEXT    0x4000
  123.  
  124. #define _O_TEXT     0x4000    /* file mode is text (translated) */
  125. #define _O_BINARY    0x8000    /* file mode is binary (untranslated) */
  126. #define _O_RAW    _O_BINARY
  127. #define _O_NOINHERIT    0x0080    /* child process doesn't inherit file */
  128.  
  129. #endif /* M_UNIX || M_XENIX */
  130.  
  131. #if __cplusplus
  132. }
  133. #endif
  134.  
  135. #endif /* __FCNTL_H */
  136.  
  137.