module Signal: Signal
type
t
include Comparable.S
include Hashable.S
include Stringable.S
val equal : t -> t -> bool
val of_system_int : int -> t
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.
val to_system_int : t -> int
val of_caml_int : int -> t
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.
val to_caml_int : t -> int
val to_string : t -> string
to_string t
returns a human-readable name: "sigabrt", "sigalrm", ...
type
sys_behavior = [ `Continue | `Dump_core | `Ignore | `Stop | `Terminate ]
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).
type
behavior = [ `Default | `Handle of t -> unit | `Ignore ]
val default_sys_behavior : t -> sys_behavior
default_sys_behavior t
Query the default system behavior for a signal.
val signal : t -> behavior -> behavior
signal t
Set the behavior of the system on receipt of a given signal. The
first argument is the signal number. Return the behavior
previously associated with the signal. If the signal number is
invalid (or not available on your system), an Invalid_argument
exception is raised.
val set : t -> behavior -> unit
set t b
is ignore (signal t b)
val handle : t -> (t -> unit) -> unit
handle t f
is set t (`Handle f)
.
val handle_default : t -> unit
handle_default t
is set t `Default
.
val ignore : t -> unit
ignore t
is set t `Ignore
.
type
pid_spec = [ `Group of Pid.t | `My_group | `Pid of Pid.t ]
val send : t -> pid_spec -> [ `No_such_process | `Ok ]
send signal pid
sends signal
to the process whose process id is pid
.
val send_i : t -> pid_spec -> unit
send_i signal ~pid
sends signal
to the process whose process id is pid
.
* No exception will be raised if pid
is a zombie or nonexistent.
val send_exn : t -> pid_spec -> unit
send_exn signal ~pid
sends signal
to the process whose process id is
* pid
. In Caml's standard library, this is called Unix.kill
. Sending a
* signal to a zombie and/or nonexistent process will raise an exception.
type
sigprocmask_command = [ `Block | `Set | `Unblock ]
val sigprocmask : sigprocmask_command -> t list -> t list
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.
val sigpending : unit -> t list
sigpending ()
returns the set of blocked signals that are currently
* pending.
val sigsuspend : t list -> unit
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.
val abrt : t
| Dump_core | Abnormal termination |
val alrm : t
| Terminate | Timeout |
val chld : t
| Ignore | Child process terminated |
val cont : t
| Continue | Continue |
val fpe : t
| Dump_core | Arithmetic exception |
val hup : t
| Terminate | Hangup on controlling terminal |
val ill : t
| Dump_core | Invalid hardware instruction |
val int : t
| Terminate | Interactive interrupt (ctrl-C) |
val kill : t
| Terminate | Termination (cannot be ignored) |
val pipe : t
| Terminate | Broken pipe |
val prof : t
| Terminate | Profiling interrupt |
val quit : t
| Dump_core | Interactive termination |
val segv : t
| Dump_core | Invalid memory reference |
val stop : t
| Stop | Stop |
val term : t
| Terminate | Termination |
val tstp : t
| Stop | Interactive stop |
val ttin : t
| Stop | Terminal read from background process |
val ttou : t
| Stop | Terminal write from background process |
val usr1 : t
| Terminate | Application-defined signal 1 |
val usr2 : t
| Terminate | Application-defined signal 2 |
val vtalrm : t
| Terminate | Timeout in virtual time |
val zero : t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read_ml.reader
val bin_read_t_ : t Bin_prot.Unsafe_read_c.reader
val bin_read_t__ : (int -> t) Bin_prot.Unsafe_read_c.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write_ml.writer
val bin_write_t_ : t Bin_prot.Unsafe_write_c.writer
val bin_writer_t : t Bin_prot.Type_class.writer
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", ...
val sys_behavior_of_sexp : Sexplib.Sexp.t -> sys_behavior
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).
val sys_behavior_of_sexp__ : Sexplib.Sexp.t -> sys_behavior
val sexp_of_sys_behavior : sys_behavior -> Sexplib.Sexp.t