mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibC+Kernel: Switch off_t to 64 bits
This commit is contained in:
parent
b05b4d4b24
commit
7a079f7780
Notes:
sideshowbarker
2024-07-18 21:15:56 +09:00
Author: https://github.com/boricj
Commit: 7a079f7780
Pull-request: https://github.com/SerenityOS/serenity/pull/5766
Reviewed-by: https://github.com/supercomputer7
7 changed files with 23 additions and 13 deletions
|
@ -29,9 +29,12 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
KResultOr<int> Process::sys$ftruncate(int fd, off_t length)
|
||||
KResultOr<int> Process::sys$ftruncate(int fd, Userspace<off_t*> userspace_length)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
off_t length;
|
||||
if (!copy_from_user(&length, userspace_length))
|
||||
return EFAULT;
|
||||
if (length < 0)
|
||||
return EINVAL;
|
||||
auto description = file_description(fd);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue