xcall MIAMEX, MX_KILL, pid, signal, status
(Unix only) MX_KILL (MIAMEX 57) allows you to send any Unix signal to another process, provided you have sufficient privileges. It provides essentially the same functionality as the Unix kill utility (which, despite its name, allows sending any signal).
Parameters
pid (Num) [in]
is the process ID number of the target process. You can get this information from SYSTAT, or perhaps by reading the jobtbl directly.
signal (Num) [in]
is the signal to send, from the following table. Note that the actual signal numbers associated with the names are not guaranteed to be uniform across versions of Unix, although these (taken from Linux) are fairly standard. Signals that have no plausible use in applications have been omitted. Also note that these numbers are not related at all to the numbers in the SIGMASK used in functions 55 and 56. Signal 0 is particularly useful for determining if a target process still exists.
Symbol |
Value |
Meaning |
---|---|---|
None |
0 |
Used to determine if target PID exists |
SIGHUP |
1 |
Hangup (telnet or terminal session disconnected) |
SIGINT |
2 |
Ctrl+C |
SIGQUIT |
3 |
Abort foreground processes, without core dump |
SIGABRT |
6 |
Force abort; similar to SIGQUIT |
SIGKILL |
9 |
Kill (cannot be trapped) |
SIGUSR1 |
10 |
User signal (used by ITC, IJC messages) |
SIGUSR2 |
12 |
User signal (used by PolyShell) |
SIGALRM |
14 |
Alarm signal (used by sleep timers and WAKNOxs) |
SIGTERM |
15 |
Default kill signal; generates error 251 |
Definition file: ashell.def |
status (Signed Num) [out]
Returns 0 to indicate success (i.e. the signal was delivered to the target process, or, in the case of the pseudo-signal 0, it indicates that the target process exists, regardless of whether the sender has sufficient privileges to send a real signal). For any real signal (i.e. signal > 0), status will return -1 if the sender does not have sufficient privileges to deliver the signal.
In order to deliver a signal to another process, it must be logged in as the same effective user as the sender, or the sender must be root. One way to ensure this is to use the "setuid" bit on the ashell executable to make all A-Shell users the same effective user. Search this doc for "ashkill" for further information on that subject.