瀏覽代碼

Kernel: Remove unnecessary logic in kill() and killpg() syscalls

As Sergey pointed out, do_killpg() already interprets PID 0 as the
PGID of the calling process.
Andreas Kling 5 年之前
父節點
當前提交
1dc64ec064
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      Kernel/Process.cpp

+ 1 - 5
Kernel/Process.cpp

@@ -1689,8 +1689,6 @@ int Process::sys$killpg(int pgrp, int signum)
         return -EINVAL;
         return -EINVAL;
 
 
     InterruptDisabler disabler;
     InterruptDisabler disabler;
-    if (pgrp == 0)
-        return do_killpg(m_pgid, signum);
     return do_killpg(pgrp, signum);
     return do_killpg(pgrp, signum);
 }
 }
 
 
@@ -1791,9 +1789,7 @@ int Process::sys$kill(pid_t pid, int signal)
 {
 {
     if (signal < 0 || signal >= 32)
     if (signal < 0 || signal >= 32)
         return -EINVAL;
         return -EINVAL;
-    if (pid == 0)
-        return do_killpg(m_pgid, signal);
-    if (pid < 0)
+    if (pid <= 0)
         return do_killpg(-pid, signal);
         return do_killpg(-pid, signal);
     if (pid == -1) {
     if (pid == -1) {
         // FIXME: Send to all processes.
         // FIXME: Send to all processes.