update for HEAD-2003021201
[reactos.git] / include / msvcrt / 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  *  DISCLAIMED. This includes but is not limited to warranties of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  * $Revision$
23  * $Author$
24  * $Date$
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 <msvcrt/io.h>
38
39 /*
40  * This variable determines the default file mode.
41  * TODO: Which flags work?
42  */
43 #if 0
44 #ifdef __MSVCRT__ // || _MSVCRT_LIB_
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_RANDOM   0x0010
72 #define _O_SEQUENTIAL   _O_RANDOM
73 #define _O_TEMPORARY    0x0040  /* Make the file dissappear after closing.
74                                  * WARNING: Even if not created by _open! */
75 #define _O_NOINHERIT    0x0080
76
77 #define _O_CREAT    0x0100  /* Create the file if it does not exist. */
78 #define _O_TRUNC    0x0200  /* Truncate the file if it does exist. */
79 #define _O_EXCL     0x0400  /* Open only if the file does not exist. */
80
81 #define _O_SHORT_LIVED  0x1000  
82
83 /* NOTE: Text is the default even if the given _O_TEXT bit is not on. */
84 #define _O_TEXT     0x4000  /* CR-LF in file becomes LF in memory. */
85 #define _O_BINARY   0x8000  /* Input and output is not translated. */
86 #define _O_RAW      _O_BINARY
87
88
89 #ifndef __STRICT_ANSI__
90 #ifndef _NO_OLDNAMES
91
92 /* POSIX/Non-ANSI names for increased portability */
93 #define O_RDONLY    _O_RDONLY
94 #define O_WRONLY    _O_WRONLY
95 #define O_RDWR      _O_RDWR
96 #define O_ACCMODE   _O_ACCMODE
97 #define O_APPEND    _O_APPEND
98 #define O_CREAT     _O_CREAT
99 #define O_TRUNC     _O_TRUNC
100 #define O_EXCL      _O_EXCL
101 #define O_TEXT      _O_TEXT
102 #define O_BINARY    _O_BINARY
103 #define O_TEMPORARY _O_TEMPORARY
104 #define O_NOINHERIT _O_NOINHERIT
105
106 #define O_RANDOM    _O_RANDOM
107 #define O_SEQUENTIAL    _O_RANDOM
108 #define O_SHORT_LIVED   _O_SHORT_LIVED
109
110 #endif  /* Not _NO_OLDNAMES */
111
112 #ifdef  __cplusplus
113 extern "C" {
114 #endif
115
116 int _setmode (int, int);
117
118 #ifndef _NO_OLDNAMES
119 int setmode (int, int);
120 #endif  /* Not _NO_OLDNAMES */
121
122 #ifdef  __cplusplus
123 }
124 #endif
125
126 #endif  /* Not __STRICT_ANSI__ */
127
128 #endif  /* Not _FCNTL_H_ */
129