kill()¶
Purpose¶
kill() sends a signal to a process or process group.
Despite its name, it can send any signal, not only termination signals.
Header¶
Prototype¶
Minimal Example¶
Common Pitfalls¶
- Assuming the target process exits immediately.
- Not checking permissions.
- Sending signals to the wrong process group by using negative PID values incorrectly.
- Forgetting to call
waitpid()after terminating a child.