module Signal: Signaltype t
include Comparable.S
include Hashable.S
include Stringable.S
val equal : t -> t -> boolval 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 -> intval 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 -> intval 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 sends signal to the process whose process id is pid.val send_i : t -> pid_spec -> unitsend_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 -> unitsend_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.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 -> tval sexp_of_t : t -> Sexplib.Sexp.tval bin_t : t Core_kernel.Std.Bin_prot.Type_class.tval bin_read_t : t Core_kernel.Std.Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Core_kernel.Std.Bin_prot.Read.readerval bin_reader_t : t Core_kernel.Std.Bin_prot.Type_class.readerval bin_size_t : t Core_kernel.Std.Bin_prot.Size.sizerval bin_write_t : t Core_kernel.Std.Bin_prot.Write.writerval 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_behaviorval 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 sends signal to the process whose process id is pid.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.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.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.Dump_core Abnormal terminationTerminate TimeoutIgnore Child process terminatedContinue ContinueDump_core Arithmetic exceptionTerminate Hangup on controlling terminalDump_core Invalid hardware instructionTerminate Interactive interrupt (ctrl-C)Terminate Termination (cannot be ignored)Terminate Broken pipeTerminate Profiling interruptDump_core Interactive terminationDump_core Invalid memory referenceStop StopTerminate TerminationStop Interactive stopStop Terminal read from background processStop Terminal write from background processTerminate Application-defined signal 1Terminate Application-defined signal 2Terminate Timeout in virtual timeIgnore No-op; can be used to test whether the target
process exists and the current process has
permission to signal itExpert 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 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.
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).