|
@@ -383,13 +383,14 @@ fn writev(fd: FD, iov_user: *const IoVec, iovcnt: u32) -> KResult<usize> {
|
|
|
Ok(tot)
|
|
Ok(tot)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#[cfg(target_arch = "x86_64")]
|
|
|
|
|
-#[eonix_macros::define_syscall(SYS_ACCESS)]
|
|
|
|
|
-fn access(pathname: *const u8, _mode: u32) -> KResult<()> {
|
|
|
|
|
- let path = UserString::new(pathname)?;
|
|
|
|
|
- let path = Path::new(path.as_cstr().to_bytes())?;
|
|
|
|
|
-
|
|
|
|
|
- let dentry = Dentry::open(&thread.fs_context, path, true)?;
|
|
|
|
|
|
|
+#[eonix_macros::define_syscall(SYS_FACCESSAT)]
|
|
|
|
|
+fn faccessat(dirfd: FD, pathname: *const u8, _mode: u32, flags: AtFlags) -> KResult<()> {
|
|
|
|
|
+ let dentry = if flags.at_empty_path() {
|
|
|
|
|
+ let file = thread.files.get(dirfd).ok_or(EBADF)?;
|
|
|
|
|
+ file.as_path().ok_or(EBADF)?.clone()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ dentry_from(thread, dirfd, pathname, !flags.no_follow())?
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
if !dentry.is_valid() {
|
|
if !dentry.is_valid() {
|
|
|
return Err(ENOENT);
|
|
return Err(ENOENT);
|
|
@@ -403,9 +404,16 @@ fn access(pathname: *const u8, _mode: u32) -> KResult<()> {
|
|
|
// X_OK => todo!(),
|
|
// X_OK => todo!(),
|
|
|
// _ => Err(EINVAL),
|
|
// _ => Err(EINVAL),
|
|
|
// }
|
|
// }
|
|
|
|
|
+
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#[cfg(target_arch = "x86_64")]
|
|
|
|
|
+#[eonix_macros::define_syscall(SYS_ACCESS)]
|
|
|
|
|
+fn access(pathname: *const u8, mode: u32) -> KResult<()> {
|
|
|
|
|
+ sys_faccessat(thread, FD::AT_FDCWD, pathname, mode, AtFlags::empty())
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#[eonix_macros::define_syscall(SYS_SENDFILE64)]
|
|
#[eonix_macros::define_syscall(SYS_SENDFILE64)]
|
|
|
fn sendfile64(out_fd: FD, in_fd: FD, offset: *mut u8, count: usize) -> KResult<usize> {
|
|
fn sendfile64(out_fd: FD, in_fd: FD, offset: *mut u8, count: usize) -> KResult<usize> {
|
|
|
let in_file = thread.files.get(in_fd).ok_or(EBADF)?;
|
|
let in_file = thread.files.get(in_fd).ok_or(EBADF)?;
|