xref: /reactos/sdk/include/ucrt/fcntl.h (revision a6a07059)
1 //
2 // fcntl.h
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // File control options used by _open().
7 //
8 #pragma once
9 #ifndef _INC_FCNTL // include guard for 3rd party interop
10 #define _INC_FCNTL
11 
12 #include <corecrt.h>
13 
14 #pragma warning(push)
15 #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
16 _UCRT_DISABLE_CLANG_WARNINGS
17 
18 #define _O_RDONLY      0x0000  // open for reading only
19 #define _O_WRONLY      0x0001  // open for writing only
20 #define _O_RDWR        0x0002  // open for reading and writing
21 #define _O_APPEND      0x0008  // writes done at eof
22 
23 #define _O_CREAT       0x0100  // create and open file
24 #define _O_TRUNC       0x0200  // open and truncate
25 #define _O_EXCL        0x0400  // open only if file doesn't already exist
26 
27 // O_TEXT files have <cr><lf> sequences translated to <lf> on read()'s and <lf>
28 // sequences translated to <cr><lf> on write()'s
29 
30 #define _O_TEXT        0x4000  // file mode is text (translated)
31 #define _O_BINARY      0x8000  // file mode is binary (untranslated)
32 #define _O_WTEXT       0x10000 // file mode is UTF16 (translated)
33 #define _O_U16TEXT     0x20000 // file mode is UTF16 no BOM (translated)
34 #define _O_U8TEXT      0x40000 // file mode is UTF8  no BOM (translated)
35 
36 // macro to translate the C 2.0 name used to force binary mode for files
37 #define _O_RAW _O_BINARY
38 
39 #define _O_NOINHERIT   0x0080  // child process doesn't inherit file
40 #define _O_TEMPORARY   0x0040  // temporary file bit (file is deleted when last handle is closed)
41 #define _O_SHORT_LIVED 0x1000  // temporary storage file, try not to flush
42 #define _O_OBTAIN_DIR  0x2000  // get information about a directory
43 #define _O_SEQUENTIAL  0x0020  // file access is primarily sequential
44 #define _O_RANDOM      0x0010  // file access is primarily random
45 
46 
47 
48 #if (defined _CRT_DECLARE_NONSTDC_NAMES && _CRT_DECLARE_NONSTDC_NAMES) || (!defined _CRT_DECLARE_NONSTDC_NAMES && !__STDC__)
49     #define O_RDONLY     _O_RDONLY
50     #define O_WRONLY     _O_WRONLY
51     #define O_RDWR       _O_RDWR
52     #define O_APPEND     _O_APPEND
53     #define O_CREAT      _O_CREAT
54     #define O_TRUNC      _O_TRUNC
55     #define O_EXCL       _O_EXCL
56     #define O_TEXT       _O_TEXT
57     #define O_BINARY     _O_BINARY
58     #define O_RAW        _O_BINARY
59     #define O_TEMPORARY  _O_TEMPORARY
60     #define O_NOINHERIT  _O_NOINHERIT
61     #define O_SEQUENTIAL _O_SEQUENTIAL
62     #define O_RANDOM     _O_RANDOM
63 #endif
64 
65 _UCRT_RESTORE_CLANG_WARNINGS
66 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
67 
68 #endif // _INC_FCNTL
69