diff --git a/Cargo.toml b/Cargo.toml index 8e60701898..8a52c4cfdb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libredox" authors = ["4lDO2 <4lDO2@protonmail.com>"] -version = "0.1.16" +version = "0.1.17" 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.7", optional = true } +redox_syscall = { version = "0.8", optional = true } ioslice = { version = "0.6", optional = true } plain = { version = "0.2", optional = true } diff --git a/src/lib.rs b/src/lib.rs index c9adcfa1c3..d95697ae97 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -115,7 +115,7 @@ pub mod flag { O_NONBLOCK, O_PATH, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, }; - pub use libc::{MSG_DONTROUTE, MSG_OOB, MSG_PEEK, MSG_DONTWAIT, MSG_EOR, }; + pub use libc::{MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR, MSG_OOB, MSG_PEEK}; pub use libc::{CLOCK_MONOTONIC, CLOCK_REALTIME}; @@ -257,6 +257,7 @@ extern "C" { fn redox_unlinkat_v0(fd: usize, buf: *const u8, path_len: usize, flags: u32) -> RawResult; */ fn redox_fpath_v1(fd: usize, dst_base: *mut u8, dst_len: usize) -> RawResult; + fn redox_relpathat_v0(dirfd: usize, fd: usize, dst_base: *mut u8, dst_len: usize) -> RawResult; fn redox_close_v1(fd: usize) -> RawResult; // NOTE: While the Redox kernel currently doesn't distinguish between threads and processes, @@ -412,6 +413,10 @@ impl Fd { call::fpath(self.raw(), path) } #[inline] + pub fn relpathat(&self, fd: usize, path: &mut [u8]) -> Result { + call::relpathat(self.raw(), fd, path) + } + #[inline] pub fn close(self) -> Result<()> { call::close(self.into_raw()) } @@ -564,6 +569,10 @@ pub mod call { Error::demux(unsafe { redox_fpath_v1(raw_fd, buf.as_mut_ptr(), buf.len()) }) } #[inline] + pub fn relpathat(raw_fd: usize, fd: usize, buf: &mut [u8]) -> Result { + Error::demux(unsafe { redox_relpathat_v0(raw_fd, fd, buf.as_mut_ptr(), buf.len()) }) + } + #[inline] pub fn close(raw_fd: usize) -> Result<()> { Error::demux(unsafe { redox_close_v1(raw_fd) })?; Ok(())