1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Kernel+AK: Add and use Userspace<T>::unsafe_userspace_ptr()

Since we already have the type information in the Userspace template,
it was a bit silly to cast manually everywhere. Just add a sufficiently
scary-sounding getter for a typed pointer.

Thanks @alimpfard for pointing out that I was being silly with tossing
out the type.

In the future we may want to make this API non-public as well.
This commit is contained in:
Andreas Kling 2020-07-31 18:46:55 +02:00
parent 5cd7159629
commit 628b3badfb
4 changed files with 13 additions and 12 deletions

View file

@ -57,7 +57,7 @@ ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
}
}
// FIXME: We should have a read() that takes a Userspace<u8*>
return description->read((u8*)buffer.ptr(), size);
return description->read(buffer.unsafe_userspace_ptr(), size);
}
}