package async_unix
Module Async_unix.Signal
Signal handling.
To discourage use of the Signal.Expert module, we hide it here. People can use Core.Signal.Expert if they need.
include module type of Core.Signal
with type t = Core.Signal.t
with module Expert := Core.Signal.Expert
type t = Core.Signal.tinclude Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Bin_prot.Read.readerThis function only needs implementation if t exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t afterwards.
val bin_shape_t : Bin_prot.Shape.tval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.tinclude Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> tval sexp_of_t : t -> Sexplib0.Sexp.tinclude Core.Comparable.S with type t := t
include Base.Comparable.S with type t := t
ascending is identical to compare. descending x y = ascending y x. These are intended to be mnemonic when used like List.sort ~compare:ascending and List.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.
clamp_exn t ~min ~max returns t', the closest value to t such that between t' ~low:min ~high:max is true.
Raises if not (min <= max).
type comparator_witness = Core.Signal.comparator_witnessval comparator : (t, comparator_witness) Base__.Comparator.comparatorval validate_lbound : min:t Core.Maybe_bound.t -> t Validate.checkval validate_ubound : max:t Core.Maybe_bound.t -> t Validate.checkval validate_bound :
min:t Core.Maybe_bound.t ->
max:t Core.Maybe_bound.t ->
t Validate.checkmodule Replace_polymorphic_compare = Core.Signal.Replace_polymorphic_comparemodule Map = Core.Signal.Mapmodule Set = Core.Signal.Setinclude Core.Hashable.S with type t := t
val hashable : t Core.Hashtbl.Hashable.tmodule Table = Core.Signal.Tablemodule Hash_set = Core.Signal.Hash_setmodule Hash_queue = Core.Signal.Hash_queueval of_caml_int : Base.Int.t -> tof_caml_int constructs a Signal.t given an OCaml internal signal number. This is only for the use of the Core_unix module.
val to_caml_int : t -> Base.Int.tval to_string : t -> Base.String.tto_string t returns a human-readable name: "sigabrt", "sigalrm", ...
type sys_behavior = [ | `Continue(*Continue the process if it is currently stopped
*)| `Dump_core(*Terminate the process and dump core
*)| `Ignore(*Ignore the signal
*)| `Stop(*Stop (suspend) the process
*)| `Terminate(*Terminate the process
*)
]The behaviour of the system if a signal is received by a process. See include/linux/kernel.h in the Linux kernel source tree (not the file /usr/include/linux/kernel.h).
val sexp_of_sys_behavior : sys_behavior -> Sexplib0.Sexp.tval sys_behavior_of_sexp : Sexplib0.Sexp.t -> sys_behaviorval __sys_behavior_of_sexp__ : Sexplib0.Sexp.t -> sys_behaviorval default_sys_behavior : t -> sys_behaviorQueries the default system behavior for a signal.
Specific signals, along with their default behavior and meaning.
val abrt : tDump_core Abnormal termination
val alrm : tTerminate Timeout
val bus : tDump_core Bus error
val chld : tIgnore Child process terminated
val cont : tContinue Continue
val fpe : tDump_core Arithmetic exception
val hup : tTerminate Hangup on controlling terminal
val ill : tDump_core Invalid hardware instruction
val int : tTerminate Interactive interrupt (ctrl-C)
val kill : tTerminate Termination (cannot be ignored)
val pipe : tTerminate Broken pipe
val poll : tTerminate Pollable event
val prof : tTerminate Profiling interrupt
val quit : tDump_core Interactive termination
val segv : tDump_core Invalid memory reference
val sys : tDump_core Bad argument to routine
val stop : tStop Stop
val term : tTerminate Termination
val trap : tDump_core Trace/breakpoint trap
val tstp : tStop Interactive stop
val ttin : tStop Terminal read from background process
val ttou : tStop Terminal write from background process
val urg : tIgnore Urgent condition on socket
val usr1 : tTerminate Application-defined signal 1
val usr2 : tTerminate Application-defined signal 2
val vtalrm : tTerminate Timeout in virtual time
val xcpu : tDump_core Timeout in cpu time
val xfsz : tDump_core File size limit exceeded
val zero : tIgnore No-op; can be used to test whether the target process exists and the current process has permission to signal it
module Stable = Core.Signal.StableWe override values from Core.Signal that we don't want people to use with Async.
val handle :
?stop:unit Async_kernel.Deferred.t ->
t list ->
f:(t -> unit) ->
unithandle ?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 it, replacing the existing C signal handler for that signal.
val terminating : t listterminating 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 |
val is_managed_by_async : t -> boolis_managed_by_async signal returns true iff signal is being managed by Async, and hence its default behavior is no longer in effect.