summaryrefslogtreecommitdiff
path: root/vendor/rustix/src/process/fcntl_getlk.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/process/fcntl_getlk.rs')
-rw-r--r--vendor/rustix/src/process/fcntl_getlk.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/rustix/src/process/fcntl_getlk.rs b/vendor/rustix/src/process/fcntl_getlk.rs
new file mode 100644
index 00000000..0dbdb945
--- /dev/null
+++ b/vendor/rustix/src/process/fcntl_getlk.rs
@@ -0,0 +1,23 @@
+use super::Flock;
+use crate::fd::AsFd;
+use crate::{backend, io};
+
+/// `fcntl(fd, F_GETLK)`—Get the first lock that blocks the lock description
+/// pointed to by the argument `lock`. If no such lock is found, then `None` is
+/// returned.
+///
+/// If `lock.typ` is set to `FlockType::Unlocked`, the returned value/error is
+/// not explicitly defined, as per POSIX, and will depend on the underlying
+/// platform implementation.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fcntl.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+#[inline]
+#[doc(alias = "F_GETLK")]
+pub fn fcntl_getlk<Fd: AsFd>(fd: Fd, lock: &Flock) -> io::Result<Option<Flock>> {
+ backend::process::syscalls::fcntl_getlk(fd.as_fd(), lock)
+}