瀏覽代碼

Kernel: kill() syscall should support sending a signal to yourself.

Andreas Kling 6 年之前
父節點
當前提交
258f4671ea
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Kernel/Process.cpp

+ 5 - 1
Kernel/Process.cpp

@@ -1419,7 +1419,11 @@ int Process::sys$kill(pid_t pid, int signal)
         // FIXME: Send to all processes.
         // FIXME: Send to all processes.
         ASSERT(pid != -1);
         ASSERT(pid != -1);
     }
     }
-    ASSERT(pid != current->pid()); // FIXME: Support this scenario.
+    if (pid == m_pid) {
+        send_signal(signal, this);
+        Scheduler::yield();
+        return 0;
+    }
     Process* peer = nullptr;
     Process* peer = nullptr;
     {
     {
         InterruptDisabler disabler;
         InterruptDisabler disabler;