MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / cmd_killall

Function cmd_killall

components/lwp/lwp_pid.c:1882–1898  ·  view source on GitHub ↗

* @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) */

Source from the content-addressed store, hash-verified

1880 * Requires at least 2 arguments (command name + process name)
1881 */
1882static 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}
1899MSH_CMD_EXPORT_ALIAS(cmd_killall, killall, kill processes by name);
1900
1901#endif

Callers

nothing calls this directly

Calls 7

rt_kprintfFunction · 0.85
lwp_name2pidFunction · 0.85
lwp_pid_lock_takeFunction · 0.85
lwp_signal_killFunction · 0.85
lwp_from_pid_raw_lockedFunction · 0.85
lwp_pid_lock_releaseFunction · 0.85
rt_thread_mdelayFunction · 0.85

Tested by

no test coverage detected