-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-illumosthe other shiny OSthe other shiny OST-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Rust supports flock
on a number of OSes, but Illumos is not on the list:
rust/library/std/src/sys/fs/unix.rs
Lines 1336 to 1356 in 2371802
#[cfg(any( | |
target_os = "freebsd", | |
target_os = "fuchsia", | |
target_os = "linux", | |
target_os = "netbsd", | |
target_os = "openbsd", | |
target_os = "cygwin", | |
target_vendor = "apple", | |
))] | |
pub fn try_lock(&self) -> Result<(), TryLockError> { | |
let result = cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) }); | |
if let Err(err) = result { | |
if err.kind() == io::ErrorKind::WouldBlock { | |
Err(TryLockError::WouldBlock) | |
} else { | |
Err(TryLockError::Error(err)) | |
} | |
} else { | |
Ok(()) | |
} | |
} |
This is despite the fact that Illumos does seem to support flock:
flock support for Illumos was present before #132977. That PR talks only about Solaris in its title but actually removed flock support for a wide range of Unixes -- supposedly because they don't support it, which was claimed without giving any sources and which was apparently incorrect at least for Illumos, Fuchsia, and OpenBSD.
Judging from libc, solaris is the only cfg(unix)
OS that should be excluded here:
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-illumosthe other shiny OSthe other shiny OST-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.