add utimensat

This addition removes duplicated code and also passes an os-test.

The `AT_EMPTY_PATH` duplicated code will be taken care of in the future.
This commit is contained in:
Connor-GH
2026-05-05 10:42:32 -05:00
parent ad4fa52f96
commit 03103893ef
4 changed files with 47 additions and 17 deletions
+7 -6
View File
@@ -304,12 +304,13 @@ impl Pal for Sys {
.map(|n| n as u32)
}
unsafe fn futimens(fd: c_int, times: *const timespec) -> Result<()> {
e_raw(unsafe { syscall!(UTIMENSAT, fd, ptr::null::<c_char>(), times, 0) }).map(|_| ())
}
unsafe fn utimens(path: CStr, times: *const timespec) -> Result<()> {
e_raw(unsafe { syscall!(UTIMENSAT, AT_FDCWD, path.as_ptr(), times, 0) }).map(|_| ())
unsafe fn utimensat(
dirfd: c_int,
path: CStr,
times: *const timespec,
flag: c_int,
) -> Result<()> {
e_raw(unsafe { syscall!(UTIMENSAT, dirfd, path.as_ptr(), times, flag) }).map(|_| ())
}
fn getcwd(mut buf: Out<[u8]>) -> Result<()> {