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

Function cmd_kill

components/lwp/lwp_pid.c:1848–1870  ·  view source on GitHub ↗

* @brief Command handler for killing processes * * @param[in] argc Argument count * @param[in] argv Argument vector (contains PID and optional signal) * * @note Usage: * - kill * - kill -s * Default signal is SIGKILL (9) */

Source from the content-addressed store, hash-verified

1846 * Default signal is SIGKILL (9)
1847 */
1848static void cmd_kill(int argc, char** argv)
1849{
1850 int pid;
1851 int sig = SIGKILL;
1852
1853 if (argc < 2)
1854 {
1855 rt_kprintf("kill pid or kill pid -s signal\n");
1856 return;
1857 }
1858
1859 pid = atoi(argv[1]);
1860 if (argc >= 4)
1861 {
1862 if (argv[2][0] == '-' && argv[2][1] == 's')
1863 {
1864 sig = atoi(argv[3]);
1865 }
1866 }
1867 lwp_pid_lock_take();
1868 lwp_signal_kill(lwp_from_pid_raw_locked(pid), sig, SI_USER, 0);
1869 lwp_pid_lock_release();
1870}
1871MSH_CMD_EXPORT_ALIAS(cmd_kill, kill, send a signal to a process);
1872
1873/**

Callers

nothing calls this directly

Calls 5

rt_kprintfFunction · 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

Tested by

no test coverage detected