acd91674b4d45731c540cce855b0eb62707712bc
[reactos.git] / reactos / include / crtdll / fcntl.h
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 <colin@bird.fu.is.saga-u.ac.jp>
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 * DISCLAMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 * $Revision: 1.4 $
23 * $Author: ekohl $
24 * $Date: 2001/06/15 18:32:25 $
25 *
26 */
27 /* Appropriated for Reactos Crtdll by Ariadne */
28 /* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/
29 /* changed fmode_dll */
30
31 #ifndef _FCNTL_H_
32 #define _FCNTL_H_
33
34 /*
35 * It appears that fcntl.h should include io.h for compatibility...
36 */
37 #include <crtdll/io.h>
38
39 /*
40 * This variable determines the default file mode.
41 * TODO: Which flags work?
42 */
43 #if 0
44 #if __MSVCRT__
45 extern unsigned int* __imp__fmode;
46 #define _fmode (*__imp__fmode)
47 #else
48 /* CRTDLL */
49 extern unsigned int* _fmode_dll;
50 #define _fmode (*_fmode_dll)
51 #endif
52 #endif /* 0 */
53
54 /*
55 * NOTE: This is the correct definition to build crtdll.
56 * It is NOT valid outside of crtdll.
57 */
58 extern unsigned int* _fmode_dll;
59 extern unsigned int _fmode;
60
61
62 /* Specifiy one of these flags to define the access mode. */
63 #define _O_RDONLY 0
64 #define _O_WRONLY 1
65 #define _O_RDWR 2
66
67 /* Mask for access mode bits in the _open flags. */
68 #define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
69
70 #define _O_APPEND 0x0008 /* Writes will add to the end of the file. */
71 #define _O_CREAT 0x0100 /* Create the file if it does not exist. */
72 #define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */
73 #define _O_EXCL 0x0400 /* Open only if the file does not exist. */
74
75 /* NOTE: Text is the default even if the given _O_TEXT bit is not on. */
76 #define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */
77 #define _O_BINARY 0x8000 /* Input and output is not translated. */
78 #define _O_RAW _O_BINARY
79
80 #define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing.
81 * WARNING: Even if not created by _open! */
82
83
84 #define _O_RANDOM 0x0010
85 #define _O_SEQUENTIAL _O_RANDOM
86 #define _O_SHORT_LIVED 0x1000
87
88 #ifndef __STRICT_ANSI__
89 #ifndef _NO_OLDNAMES
90
91 /* POSIX/Non-ANSI names for increased portability */
92 #define O_RDONLY _O_RDONLY
93 #define O_WRONLY _O_WRONLY
94 #define O_RDWR _O_RDWR
95 #define O_ACCMODE _O_ACCMODE
96 #define O_APPEND _O_APPEND
97 #define O_CREAT _O_CREAT
98 #define O_TRUNC _O_TRUNC
99 #define O_EXCL _O_EXCL
100 #define O_TEXT _O_TEXT
101 #define O_BINARY _O_BINARY
102 #define O_TEMPORARY _O_TEMPORARY
103
104 #define O_RANDOM _O_RANDOM
105 #define O_SEQUENTIAL _O_RANDOM
106 #define O_SHORT_LIVED _O_SHORT_LIVED
107
108 #endif /* Not _NO_OLDNAMES */
109
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113
114 int _setmode (int nHandle, int nAccessMode);
115
116 #ifndef _NO_OLDNAMES
117 int setmode (int nHandle, int nAccessMode);
118 #endif /* Not _NO_OLDNAMES */
119
120 #ifdef __cplusplus
121 }
122 #endif
123
124 #endif /* Not __STRICT_ANSI__ */
125 #endif /* Not _FCNTL_H_ */