diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2015-08-23 20:10:22 +0200 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2015-08-24 20:02:09 +0200 |
| commit | 6de7f609ddc6027b4148b7a458f9f766b44cd09f (patch) | |
| tree | 821d3b0671a88cca79620466c3ec0de794851976 /src/liblibc | |
| parent | 63ba780fd7ab506bfd0f92d34a39172b412cfbe1 (diff) | |
| download | rust-6de7f609ddc6027b4148b7a458f9f766b44cd09f.tar.gz rust-6de7f609ddc6027b4148b7a458f9f766b44cd09f.zip | |
Atomically open files with O_CLOEXEC where possible
On Linux the flag is just ignored if it is not supported: https://lwn.net/Articles/588444/ Touches #24237.
Diffstat (limited to 'src/liblibc')
| -rw-r--r-- | src/liblibc/lib.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 5903cc055a7..a3950376fcb 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -102,6 +102,7 @@ pub use types::os::arch::extra::*; pub use consts::os::c95::*; pub use consts::os::posix88::*; pub use consts::os::posix01::*; +pub use consts::os::posix08::*; pub use consts::os::bsd44::*; pub use consts::os::extra::*; @@ -3608,6 +3609,8 @@ pub mod consts { pub const RUSAGE_THREAD: c_int = 1; } pub mod posix08 { + use types::os::arch::c95::c_int; + pub const O_CLOEXEC: c_int = 0x80000; } #[cfg(any(target_arch = "arm", target_arch = "aarch64", @@ -4267,7 +4270,15 @@ pub mod consts { pub const RUSAGE_CHILDREN: c_int = -1; pub const RUSAGE_THREAD: c_int = 1; } + #[cfg(target_os = "freebsd")] pub mod posix08 { + use types::os::arch::c95::c_int; + pub const O_CLOEXEC: c_int = 0x100000; + } + #[cfg(target_os = "dragonfly")] + pub mod posix08 { + use types::os::arch::c95::c_int; + pub const O_CLOEXEC: c_int = 0x20000; } pub mod bsd44 { use types::os::arch::c95::c_int; @@ -4710,7 +4721,15 @@ pub mod consts { pub const RUSAGE_CHILDREN: c_int = -1; pub const RUSAGE_THREAD: c_int = 1; } + #[cfg(any(target_os = "bitrig", target_os = "openbsd"))] pub mod posix08 { + use types::os::arch::c95::c_int; + pub const O_CLOEXEC: c_int = 0x10000; + } + #[cfg(target_os = "netbsd")] + pub mod posix08 { + use types::os::arch::c95::c_int; + pub const O_CLOEXEC: c_int = 0x400000; } pub mod bsd44 { use types::os::arch::c95::c_int; @@ -5148,6 +5167,8 @@ pub mod consts { pub const RUSAGE_THREAD: c_int = 1; } pub mod posix08 { + use types::os::arch::c95::c_int; + pub const O_CLOEXEC: c_int = 0x1000000; } pub mod bsd44 { use types::os::arch::c95::c_int; |
