fd_lock/sys/unix/mod.rs
1mod read_guard;
2mod rw_lock;
3mod write_guard;
4
5pub use read_guard::RwLockReadGuard;
6pub use rw_lock::RwLock;
7pub use write_guard::RwLockWriteGuard;
8
9use rustix::{fd::AsFd, fs};
10
11pub(crate) fn compatible_unix_lock<Fd: AsFd>(
12 fd: Fd,
13 operation: fs::FlockOperation,
14) -> rustix::io::Result<()> {
15 #[cfg(not(target_os = "solaris"))]
16 return fs::flock(fd, operation);
17
18 #[cfg(target_os = "solaris")]
19 return fs::fcntl_lock(fd, operation);
20}