module Signal: Signaltype t
include Comparable.S
include Hashable.S
include Stringable.S
val equal : t -> t -> bool
val of_system_int : int -> tof_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 -> tof_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 -> stringto_string t returns a human-readable name: "sigabrt", "sigalrm", ...typesys_behavior =[ `Continue | `Dump_core | `Ignore | `Stop | `Terminate ]
val default_sys_behavior : t -> sys_behaviordefault_sys_behavior t
Query the default system behavior for a signal.val handle_default : t -> unithandle_default t is set t `Default.val ignore : t -> unitignore t is set t `Ignore.typepid_spec =[ `Group of Core_kernel.Std.Pid.t | `My_group | `Pid of Core_kernel.Std.Pid.t ]
val send : t -> pid_spec -> [ `No_such_process | `Ok ]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.
val send_i : t -> pid_spec -> unit
val send_exn : t -> pid_spec -> unit
val can_send_to : Core_kernel.Std.Pid.t -> boolcan_send_to pid returns true if pid is running and the current process has
permission to send it signals.typesigprocmask_command =[ `Block | `Set | `Unblock ]
val sigprocmask : sigprocmask_command -> t list -> t listsigprocmask 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 listsigpending () returns the set of blocked signals that are currently
pending.val sigsuspend : t list -> unitsigsuspend 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.val abrt : tDump_core Abnormal terminationval alrm : tTerminate Timeoutval chld : tIgnore Child process terminatedval cont : tContinue Continueval fpe : tDump_core Arithmetic exceptionval hup : tTerminate Hangup on controlling terminalval ill : tDump_core Invalid hardware instructionval int : tTerminate Interactive interrupt (ctrl-C)val kill : tTerminate Termination (cannot be ignored)val pipe : tTerminate Broken pipeval prof : tTerminate Profiling interruptval quit : tDump_core Interactive terminationval segv : tDump_core Invalid memory referenceval stop : tStop Stopval term : tTerminate Terminationval tstp : tStop Interactive stopval ttin : tStop Terminal read from background processval ttou : tStop Terminal write from background processval usr1 : tTerminate Application-defined signal 1val usr2 : tTerminate Application-defined signal 2val vtalrm : tTerminate Timeout in virtual timeval zero : tIgnore No-op; can be used to test whether the target
process exists and the current process has
permission to signal itmodule Expert:sig..end
Expert module contains functions that novice users should avoid, due to their
complexity.
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_t : t Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_t : t Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_t : t Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_t : t Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_t : t Core_kernel.Std.Bin_prot.Type_class.writerof_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_behaviorval __sys_behavior_of_sexp__ : Sexplib.Sexp.t -> sys_behavior
val sexp_of_sys_behavior : sys_behavior -> Sexplib.Sexp.tdefault_sys_behavior t
Query the default system behavior for a signal.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
Terminate Timeout
Ignore Child process terminated
Continue Continue
Dump_core Arithmetic exception
Terminate Hangup on controlling terminal
Dump_core Invalid hardware instruction
Terminate Interactive interrupt (ctrl-C)
Terminate Termination (cannot be ignored)
Terminate Broken pipe
Terminate Profiling interrupt
Dump_core Interactive termination
Dump_core Invalid memory reference
Stop Stop
Terminate Termination
Stop Interactive stop
Stop Terminal read from background process
Stop Terminal write from background process
Terminate Application-defined signal 1
Terminate Application-defined signal 2
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
The Expert module contains functions that novice users should avoid, due to their
complexity.
An OCaml signal handler can run at any time, which introduces all the semantic
complexities of multithreading. It is much easier to use Async's signal handling, see
Async_unix.Signal, which does not involve multithreading, and runs user code as
ordinary Async jobs. Also, beware that there can only be a single OCaml signal
handler for any signal, so handling a signal with a Core signal handler will
interfere if Async is attempting to handle the same signal.
All signal handler functions are called with Exn.handle_uncaught_and_exit, to
prevent the signal handler from raising, because raising from a signal handler could
raise to any allocation or GC point in any thread, which would be impossible to
reason about.
If you do use Core signal handlers, you should strive to make the signal handler
perform a simple idempotent action, like setting a ref.
signal t sets the behavior of the system on receipt of signal t and returns the
behavior previously associated with t. If t is not available on your system,
signal raises.
set t b is ignore (signal t b)
handle t f is set t (`Handle f).