1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 14:05:09 +00:00

Kernel: Use Process::credentials() and remove user ID/group ID helpers

Move away from using the group ID/user ID helpers in the process to
allow for us to take advantage of the immutable credentials instead.
This commit is contained in:
Anthony Iacono 2022-08-20 18:21:01 -04:00 committed by Andreas Kling
parent 8026d8926c
commit f86b671de2
27 changed files with 109 additions and 94 deletions

View file

@ -522,10 +522,11 @@ Time kgettimeofday()
siginfo_t Process::wait_info() const
{
auto credentials = this->credentials();
siginfo_t siginfo {};
siginfo.si_signo = SIGCHLD;
siginfo.si_pid = pid().value();
siginfo.si_uid = uid().value();
siginfo.si_uid = credentials->uid().value();
with_protected_data([&](auto& protected_data) {
if (protected_data.termination_signal != 0) {
@ -941,36 +942,6 @@ ErrorOr<void> Process::require_promise(Pledge promise)
return EPROMISEVIOLATION;
}
UserID Process::uid() const
{
return credentials()->uid();
}
GroupID Process::gid() const
{
return credentials()->gid();
}
UserID Process::euid() const
{
return credentials()->euid();
}
GroupID Process::egid() const
{
return credentials()->egid();
}
UserID Process::suid() const
{
return credentials()->suid();
}
GroupID Process::sgid() const
{
return credentials()->sgid();
}
NonnullRefPtr<Credentials> Process::credentials() const
{
return with_protected_data([&](auto& protected_data) -> NonnullRefPtr<Credentials> {