feat: add signal kill all functionality

This change introduces the `lwp_signal_kill_all` function, which allows a
signal to be sent to all processes in the system. The function iterates
over all PIDs and sends the specified signal to each process, except those
that are protected from signals. This enhancement provides a convenient way
to broadcast signals across all processes in the system.

Changes:
- Added `lwp_signal_kill_all` function in `lwp_signal.c` to broadcast a
  signal to all processes by iterating over all PIDs using the existing
  `lwp_pid_for_each` function.
- Introduced a new `kill_all_param` structure to encapsulate the signal
  information needed for killing processes.
- Added internal `_kill_each` helper function for sending the signal to each
  PID.
- Updated `lwp_signal.h` with the new function prototype for `lwp_signal_kill_all`.
- Modified `sys_kill` in `lwp_syscall.c` to call `lwp_signal_kill_all` when
  a process is not specified.

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell
2024-11-12 17:35:47 +08:00
committed by Rbb666
parent c0b0838892
commit dc3270f14e
3 changed files with 41 additions and 1 deletions

View File

@@ -229,6 +229,8 @@ rt_err_t lwp_signal_setitimer(struct rt_lwp *lwp, int which,
rt_bool_t lwp_signal_restart_syscall(struct rt_lwp *lwp, int error_code);
rt_err_t lwp_signal_kill_all(long signo, long code, lwp_siginfo_ext_t value);
#ifdef __cplusplus
}
#endif