1

I am writing a new syscall where I want to send a kill(pid, SIGSTOP) signal to a process that I just created in order to move it from the runqueue to the waitqueue. Then, I can wake it up again using kill(pid, SIGCONT).

The problem is that the kill is only used from the userspace, how can I send a signal from inside the kernel itself? is there an equivalent function to use that can do so? I found kill_pid, but I don't know how its headers should be included.

Mina Ashraf
  • 353
  • 1
  • 12
  • Signals can be generated at any time, but are only delivered when the process is being scheduled, not when it is running. See https://stackoverflow.com/q/1860175/1216776 for some details. – stark May 13 '21 at 21:05

1 Answers1

1

It seems like you found the correct method of sending a signal to a process from kernel space - kill_pid which is also exported, which means it is available to kernel modules. Using elixir - lets look at some usage examples - this shows you in which header file the symbol is defined - so you should start by including sched/signal.h and do the process for any other dependencies you may have

Efi Weiss
  • 638
  • 6
  • 12