mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
Kernel: Use Userspace<T> for the fstat syscall
This commit is contained in:
parent
8dd78201a4
commit
431145148e
2 changed files with 3 additions and 4 deletions
|
@ -224,7 +224,7 @@ public:
|
||||||
ssize_t sys$read(int fd, Userspace<u8*>, ssize_t);
|
ssize_t sys$read(int fd, Userspace<u8*>, ssize_t);
|
||||||
ssize_t sys$write(int fd, const u8*, ssize_t);
|
ssize_t sys$write(int fd, const u8*, ssize_t);
|
||||||
ssize_t sys$writev(int fd, const struct iovec* iov, int iov_count);
|
ssize_t sys$writev(int fd, const struct iovec* iov, int iov_count);
|
||||||
int sys$fstat(int fd, stat*);
|
int sys$fstat(int fd, Userspace<stat*>);
|
||||||
int sys$stat(Userspace<const Syscall::SC_stat_params*>);
|
int sys$stat(Userspace<const Syscall::SC_stat_params*>);
|
||||||
int sys$lseek(int fd, off_t, int whence);
|
int sys$lseek(int fd, off_t, int whence);
|
||||||
int sys$kill(pid_t pid_or_pgid, int sig);
|
int sys$kill(pid_t pid_or_pgid, int sig);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
int Process::sys$fstat(int fd, stat* user_statbuf)
|
int Process::sys$fstat(int fd, Userspace<stat*> user_statbuf)
|
||||||
{
|
{
|
||||||
REQUIRE_PROMISE(stdio);
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_write_typed(user_statbuf))
|
if (!validate_write_typed(user_statbuf))
|
||||||
|
@ -39,8 +39,7 @@ int Process::sys$fstat(int fd, stat* user_statbuf)
|
||||||
auto description = file_description(fd);
|
auto description = file_description(fd);
|
||||||
if (!description)
|
if (!description)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
stat buffer;
|
stat buffer = {};
|
||||||
memset(&buffer, 0, sizeof(buffer));
|
|
||||||
int rc = description->fstat(buffer);
|
int rc = description->fstat(buffer);
|
||||||
copy_to_user(user_statbuf, &buffer);
|
copy_to_user(user_statbuf, &buffer);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue