Merge branch 'fcntl' into 'master'

feat: Add fcntl

See merge request redox-os/libredox!27
This commit is contained in:
Jeremy Soller
2026-07-01 08:01:38 -06:00
2 changed files with 18 additions and 2 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
[package]
name = "libredox"
authors = ["4lDO2 <4lDO2@protonmail.com>"]
version = "0.1.17"
version = "0.1.18"
edition = "2021"
license = "MIT"
description = "Redox stable ABI"
@@ -21,6 +21,6 @@ mkns = ["ioslice"]
[dependencies]
bitflags = { version = "2", optional = true }
libc = { version = "0.2", optional = true }
redox_syscall = { version = "0.8", optional = true }
redox_syscall = { version = "0.9", optional = true }
ioslice = { version = "0.6", optional = true }
plain = { version = "0.2", optional = true }
+16
View File
@@ -321,6 +321,8 @@ extern "C" {
name_len: usize,
cap_fd: usize,
) -> RawResult;
fn redox_fcntl_v0(fd: usize, cmd: usize, arg: usize) -> RawResult;
}
#[cfg(feature = "call")]
@@ -451,6 +453,11 @@ impl Fd {
) -> Result<usize> {
call::call_rw(self.raw(), payload, flags, metadata)
}
#[inline]
pub fn fcntl(&self, cmd: usize, arg: usize) -> Result<usize> {
call::fcntl(self.raw(), cmd, arg)
}
}
#[cfg(feature = "call")]
impl Drop for Fd {
@@ -793,6 +800,11 @@ pub mod call {
})
.map(|_| ())
}
#[inline]
pub fn fcntl(fd: usize, cmd: usize, arg: usize) -> Result<usize> {
Error::demux(unsafe { redox_fcntl_v0(fd, cmd, arg) })
}
}
#[cfg(feature = "protocol")]
@@ -1086,4 +1098,8 @@ pub mod protocol {
})
}
}
// CLOEXEC flags
pub const O_CLOEXEC: usize = 0x0100_0000;
pub const F_DUPFD_CLOEXEC: usize = 1030;
}