package core_unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Signal handlers.

val of_system_int : int -> Core.Signal.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 : Core.Signal.t -> int
type pid_spec = [
  1. | `Pid of Core.Pid.t
  2. | `My_group
  3. | `Group of Core.Pid.t
]
val sexp_of_pid_spec : pid_spec -> Sexplib0.Sexp.t
val send : Core.Signal.t -> pid_spec -> [ `Ok | `No_such_process ]

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 : Core.Signal.t -> pid_spec -> unit
val send_exn : Core.Signal.t -> pid_spec -> unit
val can_send_to : Core.Pid.t -> bool

can_send_to pid returns true if pid is running and the current process has permission to send it signals.

type sigprocmask_command = [
  1. | `Set
  2. | `Block
  3. | `Unblock
]
val sigprocmask : sigprocmask_command -> Core.Signal.t list -> Core.Signal.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 -> Core.Signal.t list

sigpending () returns the set of blocked signals that are currently pending.

val sigsuspend : Core.Signal.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.