fcntl.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * fcntl.h
  3. *
  4. * Access constants for _open. Note that the permissions constants are
  5. * in sys/stat.h (ick).
  6. *
  7. * This code is part of the Mingw32 package.
  8. *
  9. * Contributors:
  10. * Created by Colin Peters <[email protected]>
  11. *
  12. * THIS SOFTWARE IS NOT COPYRIGHTED
  13. *
  14. * This source code is offered for use in the public domain. You may
  15. * use, modify or distribute it freely.
  16. *
  17. * This code is distributed in the hope that it will be useful but
  18. * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  19. * DISCLAIMED. This includes but is not limited to warranties of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. *
  22. * $Revision: 1.2 $
  23. * $Author: bellard $
  24. * $Date: 2005/04/17 13:14:29 $
  25. *
  26. */
  27. #ifndef __STRICT_ANSI__
  28. #ifndef _FCNTL_H_
  29. #define _FCNTL_H_
  30. /* All the headers include this file. */
  31. #include <_mingw.h>
  32. /*
  33. * It appears that fcntl.h should include io.h for compatibility...
  34. */
  35. #include <io.h>
  36. /* Specifiy one of these flags to define the access mode. */
  37. #define _O_RDONLY 0
  38. #define _O_WRONLY 1
  39. #define _O_RDWR 2
  40. /* Mask for access mode bits in the _open flags. */
  41. #define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR)
  42. #define _O_APPEND 0x0008 /* Writes will add to the end of the file. */
  43. #define _O_RANDOM 0x0010
  44. #define _O_SEQUENTIAL 0x0020
  45. #define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing.
  46. * WARNING: Even if not created by _open! */
  47. #define _O_NOINHERIT 0x0080
  48. #define _O_CREAT 0x0100 /* Create the file if it does not exist. */
  49. #define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */
  50. #define _O_EXCL 0x0400 /* Open only if the file does not exist. */
  51. /* NOTE: Text is the default even if the given _O_TEXT bit is not on. */
  52. #define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */
  53. #define _O_BINARY 0x8000 /* Input and output is not translated. */
  54. #define _O_RAW _O_BINARY
  55. #ifndef _NO_OLDNAMES
  56. /* POSIX/Non-ANSI names for increased portability */
  57. #define O_RDONLY _O_RDONLY
  58. #define O_WRONLY _O_WRONLY
  59. #define O_RDWR _O_RDWR
  60. #define O_ACCMODE _O_ACCMODE
  61. #define O_APPEND _O_APPEND
  62. #define O_CREAT _O_CREAT
  63. #define O_TRUNC _O_TRUNC
  64. #define O_EXCL _O_EXCL
  65. #define O_TEXT _O_TEXT
  66. #define O_BINARY _O_BINARY
  67. #define O_TEMPORARY _O_TEMPORARY
  68. #define O_NOINHERIT _O_NOINHERIT
  69. #define O_SEQENTIAL _O_SEQUENTIAL
  70. #define O_RANDOM _O_RANDOM
  71. #endif /* Not _NO_OLDNAMES */
  72. #ifndef RC_INVOKED
  73. /*
  74. * This variable determines the default file mode.
  75. * TODO: Which flags work?
  76. */
  77. #ifndef __DECLSPEC_SUPPORTED
  78. #ifdef __MSVCRT__
  79. extern unsigned int* __imp__fmode;
  80. #define _fmode (*__imp__fmode)
  81. #else
  82. /* CRTDLL */
  83. extern unsigned int* __imp__fmode_dll;
  84. #define _fmode (*__imp__fmode_dll)
  85. #endif
  86. #else /* __DECLSPEC_SUPPORTED */
  87. #ifdef __MSVCRT__
  88. __MINGW_IMPORT unsigned int _fmode;
  89. #else /* ! __MSVCRT__ */
  90. __MINGW_IMPORT unsigned int _fmode_dll;
  91. #define _fmode _fmode_dll
  92. #endif /* ! __MSVCRT__ */
  93. #endif /* __DECLSPEC_SUPPORTED */
  94. #ifdef __cplusplus
  95. extern "C" {
  96. #endif
  97. int _setmode (int, int);
  98. #ifndef _NO_OLDNAMES
  99. int setmode (int, int);
  100. #endif /* Not _NO_OLDNAMES */
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* Not RC_INVOKED */
  105. #endif /* Not _FCNTL_H_ */
  106. #endif /* Not __STRICT_ANSI__ */