Debian Codegraph @

debian/rust-vendor/rustix/src/process/fcntl_getlk.rs

raw
1 use super::Flock;
2 use crate::fd::AsFd;
3 use crate::{backend, io};
4
5 /// `fcntl(fd, F_GETLK)`—Get the first lock that blocks the lock description
6 /// pointed to by the argument `lock`. If no such lock is found, then `None` is
7 /// returned.
8 ///
9 /// If `lock.typ` is set to `FlockType::Unlocked`, the returned value/error is
10 /// not explicitly defined, as per POSIX, and will depend on the underlying
11 /// platform implementation.
12 ///
13 /// # References
14 /// - [POSIX]
15 /// - [Linux]
16 ///
17 /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fcntl.html
18 /// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
19 #[inline]
20 #[doc(alias = "F_GETLK")]
21 pub fn fcntl_getlk<Fd: AsFd>(fd: Fd, lock: &Flock) -> io::Result<Option<Flock>> {
22 backend::process::syscalls::fcntl_getlk(fd.as_fd(), lock)
23 }