summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah <33094578+coolreader18@users.noreply.github.com>2021-05-23 14:59:25 -0500
committerNoah <33094578+coolreader18@users.noreply.github.com>2021-05-24 20:11:40 -0500
commit0bbbccf509e76bc4312532d0f69a330094bed244 (patch)
tree4aeb735f35fba0404a7023ab269d5e1b19e8dae4
parent2261e1a63bf1d7a2e457bea756693305aad820fd (diff)
downloadrust-libc-0bbbccf509e76bc4312532d0f69a330094bed244.tar.gz
Add all O_* codes from fcntl.h on windows
-rwxr-xr-xlibc-test/build.rs2
-rw-r--r--libc-test/semver/windows.txt21
-rw-r--r--src/windows/mod.rs31
3 files changed, 38 insertions, 16 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 070be64a8c..be642474eb 100755
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -579,6 +579,8 @@ fn test_windows(target: &str) {
// FIXME: API error:
// SIG_ERR type is "void (*)(int)", not "int"
"SIG_ERR" => true,
+ // FIXME: newer windows-gnu environment on CI?
+ "_O_OBTAIN_DIR" if gnu => true,
_ => false,
}
});
diff --git a/libc-test/semver/windows.txt b/libc-test/semver/windows.txt
index 6246edce65..eaa7790898 100644
--- a/libc-test/semver/windows.txt
+++ b/libc-test/semver/windows.txt
@@ -94,16 +94,25 @@ LC_NUMERIC
LC_TIME
L_tmpnam
NSIG
+O_RDONLY
+O_WRONLY
+O_RDWR
O_APPEND
-O_BINARY
O_CREAT
+O_TRUNC
O_EXCL
-O_NOINHERIT
-O_RDONLY
-O_RDWR
O_TEXT
-O_TRUNC
-O_WRONLY
+O_BINARY
+_O_WTEXT
+_O_U16TEXT
+_O_U8TEXT
+O_RAW
+O_NOINHERIT
+O_TEMPORARY
+_O_SHORT_LIVED
+_O_OBTAIN_DIR
+O_SEQUENTIAL
+O_RANDOM
RAND_MAX
SEEK_CUR
SEEK_END
diff --git a/src/windows/mod.rs b/src/windows/mod.rs
index f64aa2f971..377a6c75f9 100644
--- a/src/windows/mod.rs
+++ b/src/windows/mod.rs
@@ -117,16 +117,27 @@ pub const BUFSIZ: ::c_uint = 512;
pub const FOPEN_MAX: ::c_uint = 20;
pub const FILENAME_MAX: ::c_uint = 260;
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 256;
-pub const O_EXCL: ::c_int = 1024;
-pub const O_TEXT: ::c_int = 16384;
-pub const O_BINARY: ::c_int = 32768;
-pub const O_NOINHERIT: ::c_int = 128;
-pub const O_TRUNC: ::c_int = 512;
+// fcntl.h
+pub const O_RDONLY: ::c_int = 0x0000;
+pub const O_WRONLY: ::c_int = 0x0001;
+pub const O_RDWR: ::c_int = 0x0002;
+pub const O_APPEND: ::c_int = 0x0008;
+pub const O_CREAT: ::c_int = 0x0100;
+pub const O_TRUNC: ::c_int = 0x0200;
+pub const O_EXCL: ::c_int = 0x0400;
+pub const O_TEXT: ::c_int = 0x4000;
+pub const O_BINARY: ::c_int = 0x8000;
+pub const _O_WTEXT: ::c_int = 0x10000;
+pub const _O_U16TEXT: ::c_int = 0x20000;
+pub const _O_U8TEXT: ::c_int = 0x40000;
+pub const O_RAW: ::c_int = O_BINARY;
+pub const O_NOINHERIT: ::c_int = 0x0080;
+pub const O_TEMPORARY: ::c_int = 0x0040;
+pub const _O_SHORT_LIVED: ::c_int = 0x1000;
+pub const _O_OBTAIN_DIR: ::c_int = 0x2000;
+pub const O_SEQUENTIAL: ::c_int = 0x0020;
+pub const O_RANDOM: ::c_int = 0x0010;
+
pub const S_IFCHR: ::c_int = 8192;
pub const S_IFDIR: ::c_int = 16384;
pub const S_IFREG: ::c_int = 32768;