summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-22 21:12:55 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-23 18:28:59 +0200
commit06de0e670cc94c908987462f04b01512b6010c25 (patch)
treedf42fde94533798b3414477a6e639dcec301d314
parent748b38d80f3db5f962cc7c94794d67cf7544dfa0 (diff)
downloadserenity-06de0e670cc94c908987462f04b01512b6010c25.zip
Kernel: Use IteratorDecision in Process::for_each_in_pgrp()
-rw-r--r--Kernel/Process.cpp2
-rw-r--r--Kernel/Process.h2
-rw-r--r--Kernel/TTY/TTY.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 5dee5358b5..3f81dd5f2d 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1615,7 +1615,7 @@ pid_t Process::sys$setsid()
bool found_process_with_same_pgid_as_my_pid = false;
Process::for_each_in_pgrp(pid(), [&](auto&) {
found_process_with_same_pgid_as_my_pid = true;
- return false;
+ return IterationDecision::Break;
});
if (found_process_with_same_pgid_as_my_pid)
return -EPERM;
diff --git a/Kernel/Process.h b/Kernel/Process.h
index d09f3d7f1a..919df12f56 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -456,7 +456,7 @@ inline void Process::for_each_in_pgrp(pid_t pgid, Callback callback)
for (auto* process = g_processes->head(); process;) {
auto* next_process = process->next();
if (process->pgid() == pgid) {
- if (!callback(*process))
+ if (callback(*process) == IterationDecision::Break)
break;
}
process = next_process;
diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp
index 5a9acc4f40..f3931a43ed 100644
--- a/Kernel/TTY/TTY.cpp
+++ b/Kernel/TTY/TTY.cpp
@@ -89,7 +89,7 @@ void TTY::generate_signal(int signal)
Process::for_each_in_pgrp(pgid(), [&](auto& process) {
dbgprintf("%s: Send signal %d to %d\n", tty_name().characters(), signal, process.pid());
process.send_signal(signal, nullptr);
- return true;
+ return IterationDecision::Continue;
});
}