[ Operating System | Reference Manual | Alphabetic Index ]
kill(+Pid, +Signal)
Send the signal Signal to the process number Pid
- Pid
- Integer
- Signal
- Atom or Integer
Description
Send the signal Signal to the process with process ID Pid.
If Signal is 0, then only a check for existence of the process
is performed, i.e. kill/2 fails if the process does not exist.
A process ID of 0 can be used as a shorthand for the current process.
This predicate is modelled after the UNIX system call kill(2).
Signal names are derived from their official names by stripping
SIG and using lower case, e.g. 'segv' for SIGSEGV.
On Windows, a subset of the functionality is supported:
- Checking for process existence using signal 0
- Terminating a process using signal 'term'
- Sending signals 'abrt, 'fpe, 'ill, 'int, 'segv' or 'term'
to the current process
Modes and Determinism
Fail Conditions
Fails if Signal is 0 and process Pid does not exist
Exceptions
- (4) instantiation fault
- Pid or Signal are not instantiated.
- (5) type error
- Pid is instantiated to a non-integer.
- (5) type error
- Signal is instantiated to neither an integer nor an atom.
- (6) out of range
- Signal is not a signal name or number.
- (170) system interface error
- Pid or Signal has an invalid value.
- (170) system interface error
- No permission to access process Pid.
Examples
Success:
[eclipse]: get_flag(pid, Pid), kill(Pid, 31).
Signal 31
Pid = 2929
yes.
[eclipse]: kill(2929, 0)
yes.
[eclipse]: kill(1234, term)
yes.
Failure:
[eclipse]: kill(9999, 0)
no.
See Also
exec / 2, exec / 3, exec_group / 3, get_flag / 2, wait / 2