1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

Kernel: Fix the return type for syscalls

The Process::Handler type has KResultOr<FlatPtr> as its return type.
Using a different return type with an equally-sized template parameter
sort of works but breaks once that condition is no longer true, e.g.
for KResultOr<int> on x86_64.

Ideally the syscall handlers would also take FlatPtrs as their args
so we can get rid of the reinterpret_cast for the function pointer
but I didn't quite feel like cleaning that up as well.
This commit is contained in:
Gunnar Beutner 2021-06-28 20:59:35 +02:00 committed by Andreas Kling
parent b6435372cc
commit 2a78bf8596
71 changed files with 313 additions and 301 deletions

View file

@ -10,7 +10,7 @@
namespace Kernel {
KResultOr<pid_t> Process::sys$getsid(pid_t pid)
KResultOr<FlatPtr> Process::sys$getsid(pid_t pid)
{
REQUIRE_PROMISE(proc);
if (pid == 0)
@ -24,7 +24,7 @@ KResultOr<pid_t> Process::sys$getsid(pid_t pid)
return process->sid().value();
}
KResultOr<pid_t> Process::sys$setsid()
KResultOr<FlatPtr> Process::sys$setsid()
{
REQUIRE_PROMISE(proc);
InterruptDisabler disabler;
@ -43,7 +43,7 @@ KResultOr<pid_t> Process::sys$setsid()
return sid().value();
}
KResultOr<pid_t> Process::sys$getpgid(pid_t pid)
KResultOr<FlatPtr> Process::sys$getpgid(pid_t pid)
{
REQUIRE_PROMISE(proc);
if (pid == 0)
@ -55,7 +55,7 @@ KResultOr<pid_t> Process::sys$getpgid(pid_t pid)
return process->pgid().value();
}
KResultOr<pid_t> Process::sys$getpgrp()
KResultOr<FlatPtr> Process::sys$getpgrp()
{
REQUIRE_PROMISE(stdio);
return pgid().value();
@ -75,7 +75,7 @@ SessionID Process::get_sid_from_pgid(ProcessGroupID pgid)
return sid;
}
KResultOr<int> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
KResultOr<FlatPtr> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
{
REQUIRE_PROMISE(proc);
ScopedSpinLock lock(g_processes_lock); // FIXME: Use a ProcessHandle