ソースを参照

Use Unix::stat for sys$lstat().

Andreas Kling 6 年 前
コミット
3db8d7ae1a
5 ファイル変更9 行追加22 行削除
  1. 4 1
      ELFLoader/ExecSpace.cpp
  2. 1 1
      Kernel/Syscall.cpp
  3. 3 3
      Kernel/Task.cpp
  4. 1 1
      Kernel/Task.h
  5. 0 16
      Kernel/types.h

+ 4 - 1
ELFLoader/ExecSpace.cpp

@@ -1,8 +1,11 @@
 #include "ExecSpace.h"
 #include "ELFLoader.h"
-#include <AK/TemporaryFile.h>
 #include <AK/Types.h>
 
+#ifndef SERENITY
+#include <AK/TemporaryFile.h>
+#endif
+
 //#define EXECSPACE_DEBUG
 
 ExecSpace::ExecSpace()

+ 1 - 1
Kernel/Syscall.cpp

@@ -69,7 +69,7 @@ DWORD handle(DWORD function, DWORD arg1, DWORD arg2, DWORD arg3)
     case Syscall::GetDirEntries:
         return current->sys$get_dir_entries((int)arg1, (void*)arg2, (size_t)arg3);
     case Syscall::PosixLstat:
-        return current->sys$lstat((const char*)arg1, (void*)arg2);
+        return current->sys$lstat((const char*)arg1, (Unix::stat*)arg2);
     case Syscall::PosixGetcwd:
         return current->sys$getcwd((char*)arg1, (size_t)arg2);
     case Syscall::PosixOpen:

+ 3 - 3
Kernel/Task.cpp

@@ -733,13 +733,13 @@ int Task::sys$close(int fd)
     return 0;
 }
 
-int Task::sys$lstat(const char* path, void* statbuf)
+int Task::sys$lstat(const char* path, Unix::stat* statbuf)
 {
-    VALIDATE_USER_BUFFER(statbuf, sizeof(stat));
+    VALIDATE_USER_BUFFER(statbuf, sizeof(Unix::stat));
     auto handle = VirtualFileSystem::the().open(move(path), m_cwd.ptr());
     if (!handle)
         return -1;
-    handle->stat((Unix::stat*)statbuf);
+    handle->stat(statbuf);
     return 0;
 }
 

+ 1 - 1
Kernel/Task.h

@@ -89,7 +89,7 @@ public:
     int sys$open(const char* path, size_t pathLength);
     int sys$close(int fd);
     int sys$read(int fd, void* outbuf, size_t nread);
-    int sys$lstat(const char*, void* statbuf);
+    int sys$lstat(const char*, Unix::stat*);
     int sys$seek(int fd, int offset);
     int sys$kill(pid_t pid, int sig);
     int sys$geterror() { return m_error; }

+ 0 - 16
Kernel/types.h

@@ -52,22 +52,6 @@ typedef dword blkcnt_t;
 typedef dword time_t;
 typedef dword suseconds_t;
 
-struct stat {
-    dev_t     st_dev;     /* ID of device containing file */
-    ino_t     st_ino;     /* inode number */
-    mode_t    st_mode;    /* protection */
-    nlink_t   st_nlink;   /* number of hard links */
-    uid_t     st_uid;     /* user ID of owner */
-    gid_t     st_gid;     /* group ID of owner */
-    dev_t     st_rdev;    /* device ID (if special file) */
-    off_t     st_size;    /* total size, in bytes */
-    blksize_t st_blksize; /* blocksize for file system I/O */
-    blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
-    time_t    st_atime;   /* time of last access */
-    time_t    st_mtime;   /* time of last modification */
-    time_t    st_ctime;   /* time of last status change */
-};
-
 struct FarPtr {
     DWORD offset { 0 };
     WORD selector { 0 };