summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/setpgid.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-12-29 00:10:17 -0800
committerAndreas Kling <kling@serenityos.org>2021-12-29 18:08:15 +0100
commitbad6d50b86ae1e0a46219baf149fa0a3574af9ce (patch)
tree83d0da5a800509416d70555b751cd01244cbe98c /Kernel/Syscalls/setpgid.cpp
parentc4f60844c5d2bd51e70a621753208fe0c9392339 (diff)
downloadserenity-bad6d50b86ae1e0a46219baf149fa0a3574af9ce.zip
Kernel: Use Process::require_promise() instead of REQUIRE_PROMISE()
This change lays the foundation for making the require_promise return an error hand handling the process abort outside of the syscall implementations, to avoid cases where we would leak resources. It also has the advantage that it makes removes a gs pointer read to look up the current thread, then process for every syscall. We can instead go through the Process this pointer in most cases.
Diffstat (limited to 'Kernel/Syscalls/setpgid.cpp')
-rw-r--r--Kernel/Syscalls/setpgid.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Kernel/Syscalls/setpgid.cpp b/Kernel/Syscalls/setpgid.cpp
index 7aaf54d077..2abf7b7a90 100644
--- a/Kernel/Syscalls/setpgid.cpp
+++ b/Kernel/Syscalls/setpgid.cpp
@@ -13,7 +13,7 @@ namespace Kernel {
ErrorOr<FlatPtr> Process::sys$getsid(pid_t pid)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
- REQUIRE_PROMISE(proc);
+ require_promise(Pledge::proc);
if (pid == 0)
return sid().value();
auto process = Process::from_pid(pid);
@@ -27,7 +27,7 @@ ErrorOr<FlatPtr> Process::sys$getsid(pid_t pid)
ErrorOr<FlatPtr> Process::sys$setsid()
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
- REQUIRE_PROMISE(proc);
+ require_promise(Pledge::proc);
InterruptDisabler disabler;
bool found_process_with_same_pgid_as_my_pid = false;
Process::for_each_in_pgrp(pid().value(), [&](auto&) {
@@ -48,7 +48,7 @@ ErrorOr<FlatPtr> Process::sys$setsid()
ErrorOr<FlatPtr> Process::sys$getpgid(pid_t pid)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
- REQUIRE_PROMISE(proc);
+ require_promise(Pledge::proc);
if (pid == 0)
return pgid().value();
auto process = Process::from_pid(pid);
@@ -60,7 +60,7 @@ ErrorOr<FlatPtr> Process::sys$getpgid(pid_t pid)
ErrorOr<FlatPtr> Process::sys$getpgrp()
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
- REQUIRE_PROMISE(stdio);
+ require_promise(Pledge::stdio);
return pgid().value();
}
@@ -80,7 +80,7 @@ SessionID Process::get_sid_from_pgid(ProcessGroupID pgid)
ErrorOr<FlatPtr> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
- REQUIRE_PROMISE(proc);
+ require_promise(Pledge::proc);
ProcessID pid = specified_pid ? ProcessID(specified_pid) : this->pid();
if (specified_pgid < 0) {
// The value of the pgid argument is less than 0, or is not a value supported by the implementation.