mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
Kernel: Get rid of SmapDisabler in sys$fstat()
This commit is contained in:
parent
ddb5c995c6
commit
3803196edb
2 changed files with 7 additions and 4 deletions
|
@ -76,7 +76,6 @@ FileDescription::~FileDescription()
|
||||||
|
|
||||||
KResult FileDescription::fstat(stat& buffer)
|
KResult FileDescription::fstat(stat& buffer)
|
||||||
{
|
{
|
||||||
SmapDisabler disabler;
|
|
||||||
if (is_fifo()) {
|
if (is_fifo()) {
|
||||||
memset(&buffer, 0, sizeof(buffer));
|
memset(&buffer, 0, sizeof(buffer));
|
||||||
buffer.st_mode = 001000;
|
buffer.st_mode = 001000;
|
||||||
|
|
|
@ -1818,15 +1818,19 @@ int Process::sys$fcntl(int fd, int cmd, u32 arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Process::sys$fstat(int fd, stat* statbuf)
|
int Process::sys$fstat(int fd, stat* user_statbuf)
|
||||||
{
|
{
|
||||||
REQUIRE_PROMISE(stdio);
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_write_typed(statbuf))
|
if (!validate_write_typed(user_statbuf))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
auto description = file_description(fd);
|
auto description = file_description(fd);
|
||||||
if (!description)
|
if (!description)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
return description->fstat(*statbuf);
|
stat buffer;
|
||||||
|
memset(&buffer, 0, sizeof(buffer));
|
||||||
|
int rc = description->fstat(buffer);
|
||||||
|
copy_to_user(user_statbuf, &buffer);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Process::sys$stat(const Syscall::SC_stat_params* user_params)
|
int Process::sys$stat(const Syscall::SC_stat_params* user_params)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue