mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:37:35 +00:00
Kernel: Use IteratorDecision in Process::for_each_in_pgrp()
This commit is contained in:
parent
748b38d80f
commit
06de0e670c
3 changed files with 3 additions and 3 deletions
|
@ -1615,7 +1615,7 @@ pid_t Process::sys$setsid()
|
||||||
bool found_process_with_same_pgid_as_my_pid = false;
|
bool found_process_with_same_pgid_as_my_pid = false;
|
||||||
Process::for_each_in_pgrp(pid(), [&](auto&) {
|
Process::for_each_in_pgrp(pid(), [&](auto&) {
|
||||||
found_process_with_same_pgid_as_my_pid = true;
|
found_process_with_same_pgid_as_my_pid = true;
|
||||||
return false;
|
return IterationDecision::Break;
|
||||||
});
|
});
|
||||||
if (found_process_with_same_pgid_as_my_pid)
|
if (found_process_with_same_pgid_as_my_pid)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
|
@ -456,7 +456,7 @@ inline void Process::for_each_in_pgrp(pid_t pgid, Callback callback)
|
||||||
for (auto* process = g_processes->head(); process;) {
|
for (auto* process = g_processes->head(); process;) {
|
||||||
auto* next_process = process->next();
|
auto* next_process = process->next();
|
||||||
if (process->pgid() == pgid) {
|
if (process->pgid() == pgid) {
|
||||||
if (!callback(*process))
|
if (callback(*process) == IterationDecision::Break)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
process = next_process;
|
process = next_process;
|
||||||
|
|
|
@ -89,7 +89,7 @@ void TTY::generate_signal(int signal)
|
||||||
Process::for_each_in_pgrp(pgid(), [&](auto& process) {
|
Process::for_each_in_pgrp(pgid(), [&](auto& process) {
|
||||||
dbgprintf("%s: Send signal %d to %d\n", tty_name().characters(), signal, process.pid());
|
dbgprintf("%s: Send signal %d to %d\n", tty_name().characters(), signal, process.pid());
|
||||||
process.send_signal(signal, nullptr);
|
process.send_signal(signal, nullptr);
|
||||||
return true;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue