Download ashxcall 05 09 01

Transcript
MIAMEX 57: Send signal to another process
xcall MIAMEX, MX_KILL, pid, signal, status
(UNIX only) This function allows you to send any UNIX signal to another process (provided you have
sufficient privileges – see note below). It provides essentially the same functionality as the UNIX kill utility
(which, despite its name, allows sending any signal).
Parameters
pid (numeric)
is the process ID number of the target process. (You can get this information from SYSTAT, or
perhaps by reading the jobtbl directly.)
signal (numeric)
is the signal to send, from the table below. 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.)
Value
Name
Meaning
0
None
Used to determine if target PID exists
1
SIGHUP
Hangup (telnet or terminal session disconnected)
2
SIGINT
Control-C
3
SIGQUIT
Abort foreground processes, without core dump
6
SIGABRT
Force abort; similar to SIGQUIT
9
SIGKILL
Kill (cannot be trapped)
10
SIGUSR1
User signal (used by ITC, IJC messages)
12
SIGUSR2
User signal (used by PolyShell)
14
SIGALRM
Alarm signal (used by sleep timers and WAKNO.SBR)
15
SIGTERM
Default kill signal; generates error 251
Signal 0 is particularly useful for determining if a target process still exists.
status (numeric variable)
returns 0 to indicate success.
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. Refer to the A-Shell Setup Guide (Installation) for further information
on that subject.
page 226
A-Shell XCALL Reference