* @brief Kills all processes matching the given name * * @param[in] argc Argument count (must be >= 2) * @param[in] argv Argument vector containing process name to kill * * @note Sends SIGKILL signal to all processes with the specified name. * Requires at least 2 arguments (command name + process name) */
| 1880 | * Requires at least 2 arguments (command name + process name) |
| 1881 | */ |
| 1882 | static void cmd_killall(int argc, char** argv) |
| 1883 | { |
| 1884 | int pid; |
| 1885 | if (argc < 2) |
| 1886 | { |
| 1887 | rt_kprintf("killall processes_name\n"); |
| 1888 | return; |
| 1889 | } |
| 1890 | |
| 1891 | while((pid = lwp_name2pid(argv[1])) > 0) |
| 1892 | { |
| 1893 | lwp_pid_lock_take(); |
| 1894 | lwp_signal_kill(lwp_from_pid_raw_locked(pid), SIGKILL, SI_USER, 0); |
| 1895 | lwp_pid_lock_release(); |
| 1896 | rt_thread_mdelay(100); |
| 1897 | } |
| 1898 | } |
| 1899 | MSH_CMD_EXPORT_ALIAS(cmd_killall, killall, kill processes by name); |
| 1900 | |
| 1901 | #endif |
nothing calls this directly
no test coverage detected