Skip to content
Advertisement

How to kill a process in a system call?

I found out that sys_kill can be used to kill process from a system call, but when i compile the following code, i get the following error:

JavaScript
JavaScript

Advertisement

Answer

It is often not possible to call the entry point of a system call from the kernel, since the API is for use from user space. Sometimes the functionality is provided in code close to the implementation code. It is usually made available throughout the kernel via an EXPORT_SYMBOL() macro.

For the kill() system call there is the internal kernel function kill_pid, with the declaration

JavaScript

You need to pass a struct pointer to the process, signal number, and boolean 1. Look at other code making this call for how to do so.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement