xref: /nrf52832-nimble/rt-thread/include/libc/libc_fcntl.h (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * File      : libc_fcntl.h
9  *
10  * Change Logs:
11  * Date           Author       Notes
12  * 2018-02-07     Bernard      Add O_DIRECTORY definition in NEWLIB mode.
13  * 2018-02-09     Bernard      Add O_BINARY definition
14  */
15 
16 #ifndef LIBC_FCNTL_H__
17 #define LIBC_FCNTL_H__
18 
19 #if defined(RT_USING_NEWLIB) || defined(_WIN32)
20 #include <fcntl.h>
21 
22 #ifndef O_NONBLOCK
23 #define O_NONBLOCK   0x4000
24 #endif
25 
26 #if defined(_WIN32)
27 #define O_ACCMODE   (_O_RDONLY | _O_WRONLY | _O_RDWR)
28 #endif
29 
30 #ifndef F_GETFL
31 #define F_GETFL  3
32 #endif
33 #ifndef F_SETFL
34 #define F_SETFL  4
35 #endif
36 
37 #ifndef O_DIRECTORY
38 #define O_DIRECTORY 0x200000
39 #endif
40 
41 #ifndef O_BINARY
42 #ifdef  _O_BINARY
43 #define O_BINARY _O_BINARY
44 #else
45 #define O_BINARY	     0
46 #endif
47 #endif
48 
49 #else
50 #define O_RDONLY         00
51 #define O_WRONLY         01
52 #define O_RDWR           02
53 
54 #define O_CREAT        0100
55 #define O_EXCL         0200
56 #define O_NOCTTY       0400
57 #define O_TRUNC       01000
58 #define O_APPEND      02000
59 #define O_NONBLOCK    04000
60 #define O_DSYNC      010000
61 #define O_SYNC     04010000
62 #define O_RSYNC    04010000
63 #define O_BINARY    0100000
64 #define O_DIRECTORY 0200000
65 #define O_NOFOLLOW  0400000
66 #define O_CLOEXEC  02000000
67 
68 #define O_ASYNC      020000
69 #define O_DIRECT     040000
70 #define O_LARGEFILE 0100000
71 #define O_NOATIME  01000000
72 #define O_PATH    010000000
73 #define O_TMPFILE 020200000
74 #define O_NDELAY O_NONBLOCK
75 
76 #define O_SEARCH  O_PATH
77 #define O_EXEC    O_PATH
78 
79 #define O_ACCMODE (03|O_SEARCH)
80 
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 
87 #define F_SETOWN 8
88 #define F_GETOWN 9
89 #define F_SETSIG 10
90 #define F_GETSIG 11
91 
92 #define F_GETLK 12
93 #define F_SETLK 13
94 #define F_SETLKW 14
95 
96 #define F_SETOWN_EX 15
97 #define F_GETOWN_EX 16
98 
99 #define F_GETOWNER_UIDS 17
100 #endif
101 
102 #endif
103