mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Kernel+LibC: Turn errno codes into a strongly typed enum
..and allow implicit creation of KResult and KResultOr from ErrnoCode. This means that kernel functions that return those types can finally do "return EINVAL;" and it will just work. There's a handful of functions that still deal with signed integers that should be converted to return KResults.
This commit is contained in:
parent
e279b45aed
commit
19d3f8cab7
48 changed files with 591 additions and 506 deletions
|
@ -33,10 +33,10 @@ KResult Process::do_kill(Process& process, int signal)
|
|||
// FIXME: Allow sending SIGCONT to everyone in the process group.
|
||||
// FIXME: Should setuid processes have some special treatment here?
|
||||
if (!is_superuser() && m_euid != process.m_uid && m_uid != process.m_uid)
|
||||
return KResult(-EPERM);
|
||||
return EPERM;
|
||||
if (process.is_kernel_process() && signal == SIGKILL) {
|
||||
klog() << "attempted to send SIGKILL to kernel process " << process.name().characters() << "(" << process.pid().value() << ")";
|
||||
return KResult(-EPERM);
|
||||
return EPERM;
|
||||
}
|
||||
if (signal != 0)
|
||||
return process.send_signal(signal, this);
|
||||
|
@ -72,7 +72,7 @@ KResult Process::do_killpg(ProcessGroupID pgrp, int signal)
|
|||
});
|
||||
|
||||
if (group_was_empty)
|
||||
return KResult(-ESRCH);
|
||||
return ESRCH;
|
||||
if (any_succeeded)
|
||||
return KSuccess;
|
||||
return error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue