1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:27:34 +00:00

More LibC portability work while trying to get figlet building.

This commit is contained in:
Andreas Kling 2018-10-31 10:14:56 +01:00
parent bb90c8ecab
commit 9160fd0d47
12 changed files with 128 additions and 2 deletions

View file

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

View file

@ -38,6 +38,7 @@ enum Function {
PosixReadlink = 0x2006,
PosixWrite = 0x2007,
PosixTtynameR = 0x2008,
PosixStat = 0x2009,
};
void initialize();

View file

@ -851,6 +851,17 @@ int Task::sys$lstat(const char* path, Unix::stat* statbuf)
return 0;
}
int Task::sys$stat(const char* path, Unix::stat* statbuf)
{
VALIDATE_USER_BUFFER(statbuf, sizeof(Unix::stat));
int error;
auto handle = VirtualFileSystem::the().open(move(path), error, 0, cwdInode());
if (!handle)
return error;
handle->stat(statbuf);
return 0;
}
int Task::sys$readlink(const char* path, char* buffer, size_t size)
{
VALIDATE_USER_BUFFER(path, strlen(path));

View file

@ -93,6 +93,7 @@ public:
ssize_t sys$read(int fd, void* outbuf, size_t nread);
ssize_t sys$write(int fd, const void*, size_t);
int sys$lstat(const char*, Unix::stat*);
int sys$stat(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; }