From 2b158cefc22460afe2b278fc4b196ab332cef319 Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Fri, 16 Aug 2019 06:31:47 +0100 Subject: [PATCH 1/3] Adding UTIME_NOW and UTIME_OMIT to OSes which support utimensat --- src/unix/bsd/apple/mod.rs | 3 +++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 3 +++ src/unix/bsd/netbsdlike/netbsd/mod.rs | 3 +++ src/unix/haiku/mod.rs | 3 +++ src/unix/solarish/mod.rs | 3 +++ src/wasi.rs | 3 +++ 6 files changed, 18 insertions(+) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 24ad12bee5207..904bfe00b00f8 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -2823,6 +2823,9 @@ pub const P_ALL: idtype_t = 0; pub const P_PID: idtype_t = 1; pub const P_PGID: idtype_t = 2; +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; + pub const XATTR_NOFOLLOW: ::c_int = 0x0001; pub const XATTR_CREATE: ::c_int = 0x0002; pub const XATTR_REPLACE: ::c_int = 0x0004; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index fea680d2af40c..62d416406aa91 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1041,6 +1041,9 @@ pub const P_PID: idtype_t = 0; pub const P_PGID: idtype_t = 2; pub const P_ALL: idtype_t = 7; +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; + pub const B460800: ::speed_t = 460800; pub const B921600: ::speed_t = 921600; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 893b15752ad61..c4e03adea7e11 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1357,6 +1357,9 @@ pub const P_ALL: idtype_t = 0; pub const P_PID: idtype_t = 1; pub const P_PGID: idtype_t = 4; +pub const UTIME_OMIT: c_long = 1073741822; +pub const UTIME_NOW: c_long = 1073741823; + pub const B460800: ::speed_t = 460800; pub const B921600: ::speed_t = 921600; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index c8cf8ad25d9a6..fe1929f9bb1fc 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1039,6 +1039,9 @@ pub const P_ALL: idtype_t = 0; pub const P_PID: idtype_t = 1; pub const P_PGID: idtype_t = 2; +pub const UTIME_OMIT: c_long = 1000000001; +pub const UTIME_NOW: c_long = 1000000000; + pub const VINTR: usize = 0; pub const VQUIT: usize = 1; pub const VERASE: usize = 2; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 78956146adea6..f8a64547d4cb0 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -965,6 +965,9 @@ pub const P_CTID: idtype_t = 13; pub const P_CPUID: idtype_t = 14; pub const P_PSETID: idtype_t = 15; +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; + pub const PROT_NONE: ::c_int = 0; pub const PROT_READ: ::c_int = 1; pub const PROT_WRITE: ::c_int = 2; diff --git a/src/wasi.rs b/src/wasi.rs index e1ffeded9f6d6..551f8b96f18c0 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -334,6 +334,9 @@ pub const AT_EACCESS: c_int = 0x0; pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1; pub const AT_SYMLINK_FOLLOW: c_int = 0x2; pub const AT_REMOVEDIR: c_int = 0x4; +pub const UTIME_OMIT: c_long = 1073741822; +pub const UTIME_NOW: c_long = 1073741823; + pub const E2BIG: c_int = __WASI_E2BIG as c_int; pub const EACCES: c_int = __WASI_EACCES as c_int; From 2c839a3342ee08bb4875373497ce5a6571ca335d Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Sat, 17 Aug 2019 06:41:39 +0100 Subject: [PATCH 2/3] Adding OpenBSD as per request, verified here: https://github.com/openbsd/src/blob/master/sys/sys/stat.h#L188 --- src/unix/bsd/netbsdlike/openbsd/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 51b1bf14d759d..a8c5252efed80 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -748,6 +748,9 @@ pub const ELAST : ::c_int = 95; pub const F_DUPFD_CLOEXEC : ::c_int = 10; +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; + pub const AT_FDCWD: ::c_int = -100; pub const AT_EACCESS: ::c_int = 0x01; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02; From 6c995607ce202511c769eed41d3342459020ed06 Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Sun, 18 Aug 2019 14:35:33 +0100 Subject: [PATCH 3/3] Fix style error in wasi.rs --- src/wasi.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wasi.rs b/src/wasi.rs index 551f8b96f18c0..7100a99785945 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -337,7 +337,6 @@ pub const AT_REMOVEDIR: c_int = 0x4; pub const UTIME_OMIT: c_long = 1073741822; pub const UTIME_NOW: c_long = 1073741823; - pub const E2BIG: c_int = __WASI_E2BIG as c_int; pub const EACCES: c_int = __WASI_EACCES as c_int; pub const EADDRINUSE: c_int = __WASI_EADDRINUSE as c_int;