소스 검색

feat(syscall): add newfstat syscall

greatbridf 7 달 전
부모
커밋
8f42972027
1개의 변경된 파일16개의 추가작업 그리고 2개의 파일을 삭제
  1. 16 2
      src/kernel/syscall/file_rw.rs

+ 16 - 2
src/kernel/syscall/file_rw.rs

@@ -150,8 +150,11 @@ fn getdents64(fd: FD, buffer: *mut u8, bufsize: usize) -> KResult<usize> {
     Ok(buffer.wrote())
 }
 
-#[cfg(not(target_arch = "x86_64"))]
-#[eonix_macros::define_syscall(SYS_NEWFSTATAT)]
+#[cfg_attr(target_arch = "x86_64", eonix_macros::define_syscall(SYS_FSTATAT64))]
+#[cfg_attr(
+    not(target_arch = "x86_64"),
+    eonix_macros::define_syscall(SYS_NEWFSTATAT)
+)]
 fn newfstatat(dirfd: FD, pathname: *const u8, statbuf: *mut Stat, flags: AtFlags) -> KResult<()> {
     let dentry = if flags.at_empty_path() {
         let file = thread.files.get(dirfd).ok_or(EBADF)?;
@@ -170,6 +173,17 @@ fn newfstatat(dirfd: FD, pathname: *const u8, statbuf: *mut Stat, flags: AtFlags
     Ok(())
 }
 
+#[eonix_macros::define_syscall(SYS_NEWFSTAT)]
+fn newfstat(fd: FD, statbuf: *mut Stat) -> KResult<()> {
+    sys_newfstatat(
+        thread,
+        fd,
+        core::ptr::null(),
+        statbuf,
+        AtFlags::AT_EMPTY_PATH,
+    )
+}
+
 #[eonix_macros::define_syscall(SYS_STATX)]
 fn statx(
     dirfd: FD,