of_system_int
and to_system_int
return and take respectively a signal number
corresponding to those in the system's /usr/include/bits/signum.h (or equivalent). It
is not guaranteed that these numbers are portable across any given pair of systems --
although some are defined as standard by POSIX.
of_caml_int
constructs a Signal.t given an O'Caml internal signal number. This is
only for the use of the Core_unix module.
to_string t
returns a human-readable name: "sigabrt", "sigalrm", ...
The default behaviour of the system if these signals trickle to the top level of a program. See include/linux/kernel.h in the Linux kernel source tree (not the file /usr/include/linux/kernel.h).
handle_default t
is set t `Default
.
ignore t
is set t `Ignore
.
send signal pid_spec
sends signal
to the processes specified by pid_spec
.
send_i
is like send
, except that it silently returns if the specified processes
don't exist.
send_exn
is like send
, except that it raises if the specified processes
don't exist.
All of send
, send_i
, and send_exn
raise if you don't have permission to send the
signal to the specified processes or if signal
is unknown.
can_send_to pid
returns true if pid
is running and the current process has
permission to send it signals.
sigprocmask cmd sigs
changes the set of blocked signals.
* If cmd
is `Set
, blocked signals are set to those in the list sigs
.
* If cmd
is `Block
, the signals in sigs
are added to the set of blocked
* signals.
* If cmd
is `Unblock
, the signals in sigs
are removed from the set of
* blocked signals.
* sigprocmask
returns the set of previously blocked signals.
sigpending ()
returns the set of blocked signals that are currently
* pending.
sigsuspend sigs
atomically sets the blocked signals to sigs
and waits for
* a non-ignored, non-blocked signal to be delivered. On return, the blocked
* signals are reset to their initial value.
Specific signals, along with their default behavior and meaning.
Dump_core
Abnormal termination
Dump_core
Abnormal termination
Terminate
Timeout
Terminate
Timeout
Ignore
Child process terminated
Ignore
Child process terminated
Continue
Continue
Continue
Continue
Dump_core
Arithmetic exception
Dump_core
Arithmetic exception
Terminate
Hangup on controlling terminal
Terminate
Hangup on controlling terminal
Dump_core
Invalid hardware instruction
Dump_core
Invalid hardware instruction
Terminate
Interactive interrupt (ctrl-C)
Terminate
Interactive interrupt (ctrl-C)
Terminate
Termination (cannot be ignored)
Terminate
Termination (cannot be ignored)
Terminate
Broken pipe
Terminate
Broken pipe
Terminate
Profiling interrupt
Terminate
Profiling interrupt
Dump_core
Interactive termination
Dump_core
Interactive termination
Dump_core
Invalid memory reference
Dump_core
Invalid memory reference
Stop
Stop
Stop
Stop
Terminate
Termination
Terminate
Termination
Stop
Interactive stop
Stop
Interactive stop
Stop
Terminal read from background process
Stop
Terminal read from background process
Stop
Terminal write from background process
Stop
Terminal write from background process
Terminate
Application-defined signal 1
Terminate
Application-defined signal 1
Terminate
Application-defined signal 2
Terminate
Application-defined signal 2
Terminate
Timeout in virtual time
Terminate
Timeout in virtual time
Ignore
No-op; can be used to test whether the target
process exists and the current process has
permission to signal it
Expert
module contains functions that novice users should avoid, due to their
complexity.
We override values from Core.Std.Signal
that we don't want people to use with
Async.
handle ?stop signals ~f
arranges so that whenever a signal in signals
is
delivered, f
is called on that signal. If f
raises, then an exception will be
raised to the monitor in effect when handle
was called.
Multiple calls to handle
with the same signal will cause all the handlers to run
when that signal is delivered, not just the last handler from the last call to
handle
.
The first time handle
is called for a signal, it will install a C signal handler for
that signal, which will replace the existing C signal handler for that signal.
terminating
is a list of signals that can be supplied to handle
and whose default
behavior is to terminate the program: alrm hup int term usr1 usr2.
Various signals whose default_sys_behavior
is `Terminate
are not included:
| kill | it's not allowed to be handled | | pipe | Async already ignores this signal, since it handles EPIPE | | prof | so that we can profile things with -p | | vtalrm | it already has a handler |
is_managed_by_async signal
returns true iff signal
is being managed by Async, and
hence its default behavior is no longer in effect.