Skip to content

Commit 7477948

Browse files
committed
Auto merge of #2194 - coolreader18:windows-fcntl, r=JohnTitor
Add all O_* codes from fcntl.h on windows
2 parents 34ddde5 + 0bbbccf commit 7477948

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,8 @@ fn test_windows(target: &str) {
584584
// FIXME: API error:
585585
// SIG_ERR type is "void (*)(int)", not "int"
586586
"SIG_ERR" => true,
587+
// FIXME: newer windows-gnu environment on CI?
588+
"_O_OBTAIN_DIR" if gnu => true,
587589
_ => false,
588590
}
589591
});

libc-test/semver/windows.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,25 @@ LC_NUMERIC
9494
LC_TIME
9595
L_tmpnam
9696
NSIG
97+
O_RDONLY
98+
O_WRONLY
99+
O_RDWR
97100
O_APPEND
98-
O_BINARY
99101
O_CREAT
102+
O_TRUNC
100103
O_EXCL
101-
O_NOINHERIT
102-
O_RDONLY
103-
O_RDWR
104104
O_TEXT
105-
O_TRUNC
106-
O_WRONLY
105+
O_BINARY
106+
_O_WTEXT
107+
_O_U16TEXT
108+
_O_U8TEXT
109+
O_RAW
110+
O_NOINHERIT
111+
O_TEMPORARY
112+
_O_SHORT_LIVED
113+
_O_OBTAIN_DIR
114+
O_SEQUENTIAL
115+
O_RANDOM
107116
RAND_MAX
108117
SEEK_CUR
109118
SEEK_END

src/windows/mod.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,27 @@ pub const BUFSIZ: ::c_uint = 512;
117117
pub const FOPEN_MAX: ::c_uint = 20;
118118
pub const FILENAME_MAX: ::c_uint = 260;
119119

120-
pub const O_RDONLY: ::c_int = 0;
121-
pub const O_WRONLY: ::c_int = 1;
122-
pub const O_RDWR: ::c_int = 2;
123-
pub const O_APPEND: ::c_int = 8;
124-
pub const O_CREAT: ::c_int = 256;
125-
pub const O_EXCL: ::c_int = 1024;
126-
pub const O_TEXT: ::c_int = 16384;
127-
pub const O_BINARY: ::c_int = 32768;
128-
pub const O_NOINHERIT: ::c_int = 128;
129-
pub const O_TRUNC: ::c_int = 512;
120+
// fcntl.h
121+
pub const O_RDONLY: ::c_int = 0x0000;
122+
pub const O_WRONLY: ::c_int = 0x0001;
123+
pub const O_RDWR: ::c_int = 0x0002;
124+
pub const O_APPEND: ::c_int = 0x0008;
125+
pub const O_CREAT: ::c_int = 0x0100;
126+
pub const O_TRUNC: ::c_int = 0x0200;
127+
pub const O_EXCL: ::c_int = 0x0400;
128+
pub const O_TEXT: ::c_int = 0x4000;
129+
pub const O_BINARY: ::c_int = 0x8000;
130+
pub const _O_WTEXT: ::c_int = 0x10000;
131+
pub const _O_U16TEXT: ::c_int = 0x20000;
132+
pub const _O_U8TEXT: ::c_int = 0x40000;
133+
pub const O_RAW: ::c_int = O_BINARY;
134+
pub const O_NOINHERIT: ::c_int = 0x0080;
135+
pub const O_TEMPORARY: ::c_int = 0x0040;
136+
pub const _O_SHORT_LIVED: ::c_int = 0x1000;
137+
pub const _O_OBTAIN_DIR: ::c_int = 0x2000;
138+
pub const O_SEQUENTIAL: ::c_int = 0x0020;
139+
pub const O_RANDOM: ::c_int = 0x0010;
140+
130141
pub const S_IFCHR: ::c_int = 8192;
131142
pub const S_IFDIR: ::c_int = 16384;
132143
pub const S_IFREG: ::c_int = 32768;

0 commit comments

Comments
 (0)