From 73ef851d59a52d3f2705ddf4c52891a53dbefcf7 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Tue, 24 Feb 2026 22:36:19 +1100 Subject: [PATCH] feat(redox): `F_OFD_SETLK` Signed-off-by: Anhad Singh --- src/platform/redox/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index ee064aeb0e..d1b2c85aaa 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -31,8 +31,8 @@ use crate::{ ENOMEM, ENOSYS, EOPNOTSUPP, EPERM, ERANGE, }, fcntl::{ - self, AT_EMPTY_PATH, AT_FDCWD, AT_SYMLINK_NOFOLLOW, F_GETLK, F_RDLCK, F_SETLK, - F_SETLKW, F_UNLCK, F_WRLCK, flock, + self, AT_EMPTY_PATH, AT_FDCWD, AT_SYMLINK_NOFOLLOW, F_GETLK, F_OFD_SETLK, F_RDLCK, + F_SETLK, F_SETLKW, F_UNLCK, F_WRLCK, flock, }, limits, pthread::{pthread_cancel, pthread_create}, @@ -297,7 +297,8 @@ impl Pal for Sys { fn fcntl(fd: c_int, cmd: c_int, args: c_ulonglong) -> Result { match cmd { - F_SETLK => { + F_SETLK | F_OFD_SETLK => { + let is_ofd = cmd == F_OFD_SETLK; let flock = unsafe { &mut *(args as *mut flock) }; // let file_off = Self::lseek(fd, 0, SEEK_SET)?; @@ -321,6 +322,7 @@ impl Pal for Sys { c => unreachable!("{c}"), }; + let start = start | if is_ofd { 1 << 63 } else { 0 }; match flock.l_type as i32 { F_UNLCK => { let meta = StdFsCallMeta::new(StdFsCallKind::Unlock, start, len);