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

This commit is contained in:
Andreas Kling 2018-10-27 00:29:31 +02:00
parent 509e5f9952
commit 3db8d7ae1a
5 changed files with 9 additions and 22 deletions

View file

@ -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()

View file

@ -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:

View file

@ -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;
}

View file

@ -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; }

View file

@ -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 };