mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
Kernel: Clarify why ftruncate() & pread() are passed off_t const*
I fell into this trap and tried to switch the syscalls to pass by the `off_t` by register. I think it makes sense to add a clarifying comment for future readers of the code, so they don't fall into the same trap. :^)
This commit is contained in:
parent
9d034785de
commit
b5367bbf31
2 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
// NOTE: The length is passed by pointer because off_t is 64bit,
|
||||||
|
// hence it can't be passed by register on 32bit platforms.
|
||||||
ErrorOr<FlatPtr> Process::sys$ftruncate(int fd, Userspace<off_t const*> userspace_length)
|
ErrorOr<FlatPtr> Process::sys$ftruncate(int fd, Userspace<off_t const*> userspace_length)
|
||||||
{
|
{
|
||||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||||
|
|
|
@ -86,6 +86,8 @@ ErrorOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size)
|
||||||
return TRY(description->read(user_buffer, size));
|
return TRY(description->read(user_buffer, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: The offset is passed by pointer because off_t is 64bit,
|
||||||
|
// hence it can't be passed by register on 32bit platforms.
|
||||||
ErrorOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size, Userspace<off_t const*> 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)
|
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue