From 06de0e670cc94c908987462f04b01512b6010c25 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Aug 2019 21:12:55 +0200 Subject: Kernel: Use IteratorDecision in Process::for_each_in_pgrp() --- Kernel/Process.cpp | 2 +- Kernel/Process.h | 2 +- Kernel/TTY/TTY.cpp | 2 +- 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; }); } -- cgit v1.2.3