Sending Kill Signals to a Process
The kill command in UNIX enables the user to send a signal to a process. A signal is a message sent to a process to interrupt it and cause a response. If the process has been designed to respond to signals of the type sent it does so; otherwise, it terminates. The following table lists some commonly used signal numbers/names and their meanings.
Signal No. | Signal Name | Meaning |
---|---|---|
1 | HUP | Hangup (often used before logging out) |
2 | INT | Interrupt (same as pressing Control+C in a terminal session) |
9 | KILL | Kill (terminates without cleanup) Only works if issued by process owner or super user (root) The program cannot respond to this signal; it must terminate |
15 | TERM | Kill (terminates gracefully after cleanup) Only works if issued by process owner or super user (root) |
The Kill menu item enables you to kill a process quickly by sending it a kill (9) signal. The Signal menu item gives you more control of the signal sent by the kill(1) command. For example you could send an INT signal or a HUP signal, and so on.
Caution - You should only send a signal to a process if you understand the implications of doing so. For example, if you select the login shell and send a kill signal, you will suddenly log out. For further information on processes and job control, contact your system administrator or see the Solaris Advanced User's Guide (Sun Microsystems).
To Kill A Process (Quick Kill)
Select a process entry in the Process Manager scrolling pane.
Choose Kill from the Process menu.
Process Manager kills the process (and its child processes) provided that you have permission to do so; otherwise an error is displayed. Sometimes it takes several seconds for the process to terminate. You can tell that a process has been killed if it is not listed the next time Process Manager updates its display.
Tip - The equivalent UNIX command is:
kill -9 PID where PID is the process ID of the selected process.
You can redefine the command performed by the Kill menu item to a different command by redefining the action labelled 'Kill' in the file:
/usr/dt/appconfig/types/C/sdtprocess.dt
To Send a Signal to a Process
Select a process entry in the Process Manager scrolling pane.
Choose Signal from the Process menu.
Process Manager displays a dialog box requesting you to specify the signals. You must supply at least one of the 42 signals defined in the signal(5) man page.
Type the relevant signal number or name and click OK.
Process Manager issues the signal command and closes the dialog box. No success message is issued. Killing a process typically kills its children.
Tip - The equivalent UNIX command is: kill -signum_name PID
where -signum_name is the signal number or name, and PID is the process ID of the selected process.
To Look Up the Owner of a Process
Select a process entry in the Process Manager scrolling pane.
Choose Look Up Owner from the Process menu.
Process Manager opens Address Manager and requests it to search the System Cards for the system user name of the selected process. For further details on Address Manager see Chapter 18, Using Address Manager.
To Show the Ancestry for a Process
Select a process entry in the Process Manager scrolling pane.
Choose Show Ancestry from the Process menu.
Process Manager displays a window containing the process trees for the specified process. Child processes are indented from the respective parent processes.
Tip - The equivalent UNIX command is:
/usr/proc/bin/ptree PID
where PID is the process ID of the selected process.
To Trace Child Processes
When a UNIX process initiates one or more dependent processes, we call these child processes, or children. Child and parent processes have the same user ID.
Select a process entry in the Process Manager scrolling pane.
Choose Trace Children from the Process menu.
Process Manager displays a record of the creation of any new children (and their children, recursively) for the selected process.
Error returns are reported using the error code names described in the Intro(2) man page.
Tip - The equivalent UNIX command is:
truss -fa -texec,fork -s¦CLD,ALRM -p PID
where PID is the process ID of the selected process.
To Trace System Calls
During its execution, a process makes calls to the UNIX kernel, or system calls. You might want to trace these system calls to see the affect they are having on other processes.
Select a process entry in the Process Manager scrolling pane.
Choose Trace System Calls from the Process menu.
Process Manager displays a dialog box requesting you to enter optional arguments.
Click OK.
Each line of the trace output reports either the fault or signal name or the system call name with its arguments and return values. For further information, see the truss(1) man page.
Tip - The equivalent UNIX command is:
truss -p PID
where PID is the process ID of the selected process.
To Show the Stack for a Process
Select a process entry in the Process Manager scrolling pane.
Choose Show Stack from the Process menu.
Process Manager displays a window containing hexadecimal and symbolic stack trace for the selected process.
Tip - The equivalent UNIX command is:
/usr/proc/bin/pstack PID
where PID is the process ID of the selected process.