diff options
| author | Adrian Budau <budau.adi@gmail.com> | 2018-12-21 15:53:37 +0200 |
|---|---|---|
| committer | Adrian Budau <budau.adi@gmail.com> | 2018-12-21 15:53:37 +0200 |
| commit | bf172c532af44628e3c3323a5f8a8c1726ffbd30 (patch) | |
| tree | ee41284ce00f1a315d81d16a0b0de57887b20981 /src/libstd/sys/unix/os.rs | |
| parent | da47bd3ae01f9a651b652bb141685b128c5058b0 (diff) | |
| download | rust-bf172c532af44628e3c3323a5f8a8c1726ffbd30.tar.gz rust-bf172c532af44628e3c3323a5f8a8c1726ffbd30.zip | |
Properly report ENOSYS by modifying errno
Diffstat (limited to 'src/libstd/sys/unix/os.rs')
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 03e81a720dc..6e8ee445994 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -67,7 +67,8 @@ pub fn errno() -> i32 { } /// Sets the platform-specific value of errno -#[cfg(any(target_os = "solaris", target_os = "fuchsia"))] // only needed for readdir so far +#[cfg(all(not(target_os = "linux"), + not(target_os = "dragonfly")))] // needed for readdir and syscall! pub fn set_errno(e: i32) { unsafe { *errno_location() = e as c_int @@ -84,6 +85,18 @@ pub fn errno() -> i32 { unsafe { errno as i32 } } +#[cfg(target_os = "dragonfly")] +pub fn set_errno(e: i32) { + extern { + #[thread_local] + static mut errno: c_int; + } + + unsafe { + errno = e; + } +} + /// Gets a detailed string description for the given error number. pub fn error_string(errno: i32) -> String { extern { |
