mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Kernel: Make sys${ftruncate,pread} take off_t as const pointer
These syscalls don't write back to the off_t value (unlike sys$lseek) so let's take Userspace<off_t const*> instead of Userspace<off_t*>.
This commit is contained in:
parent
9c7659306a
commit
39d9337db5
3 changed files with 6 additions and 8 deletions
|
@ -86,7 +86,7 @@ ErrorOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size)
|
|||
return TRY(description->read(user_buffer, size));
|
||||
}
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size, Userspace<off_t*> userspace_offset)
|
||||
ErrorOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size, Userspace<off_t const*> userspace_offset)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||
REQUIRE_PROMISE(stdio);
|
||||
|
@ -94,8 +94,7 @@ ErrorOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size,
|
|||
return 0;
|
||||
if (size > NumericLimits<ssize_t>::max())
|
||||
return EINVAL;
|
||||
off_t offset;
|
||||
TRY(copy_from_user(&offset, userspace_offset));
|
||||
auto offset = TRY(copy_typed_from_user(userspace_offset));
|
||||
if (offset < 0)
|
||||
return EINVAL;
|
||||
dbgln_if(IO_DEBUG, "sys$pread({}, {}, {}, {})", fd, buffer.ptr(), size, offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue