Kill or modify a process by name or ID (QNX Neutrino)
slay [options]... process_name|process_id ...
- - signal_number
- A signal number specifying which signal to raise on the processes matching process_name or process_id. For a list of signal numbers, see <signal.h>.
- -C cpunum
- Set the CPU affinity to cpunum, where the first CPU is 0. You can use this option multiple times. For more information, see Setting the runmask, below.
- Force the action to be taken on all processes sharing the same process_name or ID. Normally, slay prompts for confirmation when more than one process bears the specified name or ID.
- Set a SIGSTOP signal on a process, effectively holding its execution.
- Set the inherit mask in addition to the runmask, when used in conjunction with the -C or -R option. For more information, see Setting the runmask, below.
- -m name|pid
- Restrict the match to only the process name or to only the process ID.
By default, slay matches both process IDs and names.
This command: Matches a process with: slay 1234 ID 1234 or the name 1234 slay -m pid 1234 ID 1234 slay -m name 1234 The name 1234
- -n nodename
- Search for the specified processes on the specified remote node nodename.
- -P prio[f|r|o]
- Set the priority of the processes matching process_name to
prio. Non-root users are limited to a
maximum priority of 63; root can specify a priority up to 255.
You can change the range of privileged priorities with the
-P option for
The priority may be followed by f, r or o to change the scheduling policy to SCHED_FIFO, SCHED_RR or SCHED_OTHER, respectively.SCHED_OTHER is currently the same as SCHED_RR.
If you specify -P without -T, slay sets the priority of all threads in the specified process or processes.
- Print the process IDs, in decimal, to standard output, with one process ID per line. The processes aren't slain.
- Query before dealing with the process, even if only one process is found with a matching name or ID (overrides option -f). This option is useful for viewing the other process information that slay presents.
- Be quiet. This option is useful when you invoke slay from a C program.
- -R runmask
- Set the CPU affinity to runmask. You can use this option multiple times to specify masks that are more than 32 bits long. For more information, see Setting the runmask, below.
- Don't kill processes that have child processes. You typically use this option in a shell command that shuts down shells on other devices. Setting this option prevents slay from killing shells that have other processes (such as editors) running. If you also specify -q, slay prompts for a forced kill even if the named process has child processes.
- -s signal_name
- The signal to send. This option causes the signal sig to be raised for the processes matching the process_name or ID.
- -T tid
- Apply the action to the thread with the given ID. You can use this option to direct a signal to a specific thread, or to change a thread's priority or runmask.
- -t ttyname
- Match only those processes whose name (or ID) is process_name (process_id) and have ttyname as the controlling terminal. If ttyname doesn't begin with a slash (/), slay assumes that it starts with the /dev/ prefix.
- Set a SIGCONT signal on a process. If execution of the process was being held by a SIGSTOP signal, execution begins where it left off. If the process hadn't previously had a SIGSTOP set upon it, the SIGCONT signal has no effect.
- Be verbose; display messages about processes being signaled.
- The name of a process to operate on.
- The ID of a process to operate on.
Use the slay utility to kill or modify a process by name or by ID. Process names are specified without the path. For example, let's say you have a process called /bin/sleep that you want to kill. Entering sleep as the process name is sufficient to allow slay to find and kill it.
There are many forms of this command. The simplest and most often used form is:
This command locates the process bearing the specified name or ID. If only one is found, a SIGTERM signal is set on it. If more than one process bears the specified name or ID, you're prompted for a yes/no response for each process. When each process is listed in this form, the process name, pid, and tty group/member numbers are also displayed to help you make a selection.
Setting the runmask
On a multicore system, you can use a runmask to specify which processors a thread or process can run on. The default is all 1s (i.e. all CPUs).
You can use slay to change the runmask, or the runmask and inherit mask, for threads that are already running; to set the masks for a new process, use the on command. Both commands interpret the -C and -R options in the same way.
You can use more than one -R option to specify a runmask that's more than 32 bits long. The first -R option specifies bits 0 through 31, the second specifies bits 32 through 63, and so on.
If you use both the -C and -R options or multiple instances of them, the resultant mask is the bitwise ORing of all -C and -R options. For example, slay -R 0x1 is equivalent to slay -C0, and slay -R 0x1 -C3 is equivalent to slay -C0 -C3.
When you use -R or -C without -T, all threads in the specified process or processes are affected.
If you use -R or -C, slay always changes the runmask for the specified threads or processes. If you also specify the -i option, slay also sets the inherit mask to the same value as the runmask.
- If the resulting runmask specifies at least one CPU that's physically present, the runmask is accepted, and any bits that correspond to CPUs that aren't present are ignored. If the resulting runmask doesn't specify any CPU that are physically present, an error results.
- If you change the runmask for a process, the processor for blocked threads doesn't change until the threads become unblocked (or never if the threads remain blocked).
Kill the spooler process on node peterv:
slay -n peterv spooler
As root, change priority of the my_test process to 20:
slay -P 20 my_test
- No processes matched the supplied criteria, an error occurred, or the number of processes matched and acted upon was an even multiple of 256.
- The number of processes matched and acted upon modulo 256 (e.g. a status of 1 could mean 1 process, 257 processes, 513 processes etc.)
- If the exit status was gleaned through direct spawning, this is the number of processes matched and acted upon modulo 256. If slay was run through the shell, this is either the number of processes matched and acted upon, or it indicates why slay died due to a signal (subtract 128 from the exit status to determine the signal number).
- The number of processes matched and acted upon, modulo 256.
The exit status of slay is nonstandard for historical reasons. We strongly recommend that you not use slay in any situation where the exit status is relied upon because the status is ambiguous in some circumstances.