summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/fork.cpp4
-rw-r--r--Kernel/Syscalls/setpgid.cpp6
-rw-r--r--Kernel/Syscalls/waitid.cpp4
3 files changed, 9 insertions, 5 deletions
diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp
index cf1ee14fdf..ad4f716a0c 100644
--- a/Kernel/Syscalls/fork.cpp
+++ b/Kernel/Syscalls/fork.cpp
@@ -96,7 +96,9 @@ ErrorOr<FlatPtr> Process::sys$fork(RegisterState& regs)
});
}));
- child->m_pg = m_pg;
+ child->m_pg.with([&](auto& child_pg) {
+ child_pg = m_pg.with([&](auto& pg) { return pg; });
+ });
with_protected_data([&](auto& my_protected_data) {
child->with_mutable_protected_data([&](auto& child_protected_data) {
diff --git a/Kernel/Syscalls/setpgid.cpp b/Kernel/Syscalls/setpgid.cpp
index 01c6fdb459..96b5da049a 100644
--- a/Kernel/Syscalls/setpgid.cpp
+++ b/Kernel/Syscalls/setpgid.cpp
@@ -38,7 +38,8 @@ ErrorOr<FlatPtr> Process::sys$setsid()
return EPERM;
// Create a new Session and a new ProcessGroup.
- m_pg = TRY(ProcessGroup::try_create(ProcessGroupID(pid().value())));
+ auto process_group = TRY(ProcessGroup::create(ProcessGroupID(pid().value())));
+ m_pg.with([&](auto& pg) { pg = move(process_group); });
m_tty = nullptr;
return with_mutable_protected_data([&](auto& protected_data) -> ErrorOr<FlatPtr> {
protected_data.sid = pid().value();
@@ -119,7 +120,8 @@ ErrorOr<FlatPtr> Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
return EPERM;
}
// FIXME: There are more EPERM conditions to check for here..
- process->m_pg = TRY(ProcessGroup::try_find_or_create(new_pgid));
+ auto process_group = TRY(ProcessGroup::find_or_create(new_pgid));
+ process->m_pg.with([&](auto& pg) { pg = move(process_group); });
return with_mutable_protected_data([&](auto& protected_data) -> ErrorOr<FlatPtr> {
auto credentials = this->credentials();
diff --git a/Kernel/Syscalls/waitid.cpp b/Kernel/Syscalls/waitid.cpp
index 8e13825189..8a5e08313d 100644
--- a/Kernel/Syscalls/waitid.cpp
+++ b/Kernel/Syscalls/waitid.cpp
@@ -10,7 +10,7 @@
namespace Kernel {
-ErrorOr<siginfo_t> Process::do_waitid(Variant<Empty, NonnullRefPtr<Process>, NonnullLockRefPtr<ProcessGroup>> waitee, int options)
+ErrorOr<siginfo_t> Process::do_waitid(Variant<Empty, NonnullRefPtr<Process>, NonnullRefPtr<ProcessGroup>> waitee, int options)
{
ErrorOr<siginfo_t> result = siginfo_t {};
if (Thread::current()->block<Thread::WaitBlocker>({}, options, move(waitee), result).was_interrupted())
@@ -25,7 +25,7 @@ ErrorOr<FlatPtr> Process::sys$waitid(Userspace<Syscall::SC_waitid_params const*>
TRY(require_promise(Pledge::proc));
auto params = TRY(copy_typed_from_user(user_params));
- Variant<Empty, NonnullRefPtr<Process>, NonnullLockRefPtr<ProcessGroup>> waitee;
+ Variant<Empty, NonnullRefPtr<Process>, NonnullRefPtr<ProcessGroup>> waitee;
switch (params.idtype) {
case P_ALL:
break;