1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibC+Kernel: Switch off_t to 64 bits

This commit is contained in:
Jean-Baptiste Boric 2021-03-13 22:02:54 +01:00 committed by Andreas Kling
parent b05b4d4b24
commit 7a079f7780
7 changed files with 23 additions and 13 deletions

View file

@ -29,13 +29,22 @@
namespace Kernel {
KResultOr<int> Process::sys$lseek(int fd, off_t offset, int whence)
KResultOr<int> Process::sys$lseek(int fd, Userspace<off_t*> userspace_offset, int whence)
{
REQUIRE_PROMISE(stdio);
auto description = file_description(fd);
if (!description)
return EBADF;
return description->seek(offset, whence);
off_t offset;
if (!copy_from_user(&offset, userspace_offset))
return EFAULT;
offset = description->seek(offset, whence);
if (!copy_to_user(userspace_offset, &offset))
return EFAULT;
if (offset < 0)
return offset;
else
return 0;
}
}