package core_unix

  1. Overview
  2. Docs
Unix-specific portions of Core

Install

Dune Dependency

Authors

Maintainers

Sources

v0.14.0.tar.gz
md5=f9a74834f239874286d84ec99d75e5fa
sha512=d020db759cde35c0e9d9919dee2c0ea5bb5b7a5ee75515be922d816f28eb9f74dba37e6e424a636e362eab5120b2c1e672f4e5ba798f2dac7974c0e135f80faf

doc/core_unix.signal_unix/Signal_unix/index.html

Module Signal_unixSource

include module type of struct include Core.Signal end
type t = Core.Signal.t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0__.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0__.Sexp.t
include Core_kernel.Comparable.S with type t := t
include Base.Comparable.S with type t := t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int

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.

val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool

between t ~low ~high means low <= t <= high

val clamp_exn : t -> min:t -> max:t -> t

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).

val clamp : t -> min:t -> max:t -> t Base__.Or_error.t
type comparator_witness = Core.Signal.comparator_witness
val comparator : (t, comparator_witness) Base__.Comparator.comparator
val validate_lbound : min:t Base__.Maybe_bound.t -> t Base__.Validate.check
val validate_ubound : max:t Base__.Maybe_bound.t -> t Base__.Validate.check
val validate_bound : min:t Base__.Maybe_bound.t -> max:t Base__.Maybe_bound.t -> t Base__.Validate.check
module Replace_polymorphic_compare = Core.Signal.Replace_polymorphic_compare
module Map = Core.Signal.Map
module Set = Core.Signal.Set
include Core_kernel.Hashable.S with type t := t
val compare : t -> t -> Core_kernel__.Import.int
val hash_fold_t : Ppx_hash_lib.Std.Hash.state -> t -> Ppx_hash_lib.Std.Hash.state
val hash : t -> Ppx_hash_lib.Std.Hash.hash_value
val hashable : t Base.Hashable.t
module Table = Core.Signal.Table
module Hash_set = Core.Signal.Hash_set
module Hash_queue = Core.Signal.Hash_queue
include Core_kernel.Stringable.S with type t := t
Sourceval of_string : string -> t
Sourceval equal : t -> t -> bool
Sourceval 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.

Sourceval to_system_int : t -> int
Sourceval of_caml_int : int -> t

of_caml_int constructs a Signal.t given an OCaml internal signal number. This is only for the use of the Core_unix module.

Sourceval to_caml_int : t -> int
Sourceval to_string : t -> string

to_string t returns a human-readable name: "sigabrt", "sigalrm", ...

Sourcetype sys_behavior = [
  1. | `Continue
    (*

    Continue the process if it is currently stopped

    *)
  2. | `Dump_core
    (*

    Terminate the process and dump core

    *)
  3. | `Ignore
    (*

    Ignore the signal

    *)
  4. | `Stop
    (*

    Stop the process

    *)
  5. | `Terminate
    (*

    Terminate the process

    *)
]

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).

Sourceval sexp_of_sys_behavior : sys_behavior -> Ppx_sexp_conv_lib.Sexp.t
Sourceval sys_behavior_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> sys_behavior
Sourceval __sys_behavior_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> sys_behavior
Sourceval default_sys_behavior : t -> sys_behavior

Queries the default system behavior for a signal.

Sourceval handle_default : t -> unit

handle_default t is set t `Default.

Sourceval ignore : t -> unit

ignore t is set t `Ignore.

Sourcetype pid_spec = [
  1. | `Pid of Core_kernel.Pid.t
  2. | `My_group
  3. | `Group of Core_kernel.Pid.t
]
Sourceval sexp_of_pid_spec : pid_spec -> Ppx_sexp_conv_lib.Sexp.t
Sourceval send : 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.

Sourceval send_i : t -> pid_spec -> unit
Sourceval send_exn : t -> pid_spec -> unit
Sourceval can_send_to : Core_kernel.Pid.t -> bool

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

Sourcetype sigprocmask_command = [
  1. | `Set
  2. | `Block
  3. | `Unblock
]
Sourceval 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.

Sourceval sigpending : unit -> t list

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

Sourceval 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.

Sourceval abrt : t

Dump_core Abnormal termination

Sourceval alrm : t

Terminate Timeout

Sourceval bus : t

Dump_core Bus error

Sourceval chld : t

Ignore Child process terminated

Sourceval cont : t

Continue Continue

Sourceval fpe : t

Dump_core Arithmetic exception

Sourceval hup : t

Terminate Hangup on controlling terminal

Sourceval ill : t

Dump_core Invalid hardware instruction

Sourceval int : t

Terminate Interactive interrupt (ctrl-C)

Sourceval kill : t

Terminate Termination (cannot be ignored)

Sourceval pipe : t

Terminate Broken pipe

Sourceval poll : t

Terminate Pollable event

Sourceval prof : t

Terminate Profiling interrupt

Sourceval quit : t

Dump_core Interactive termination

Sourceval segv : t

Dump_core Invalid memory reference

Sourceval sys : t

Dump_core Bad argument to routine

Sourceval stop : t

Stop Stop

Sourceval term : t

Terminate Termination

Sourceval trap : t

Dump_core Trace/breakpoint trap

Sourceval tstp : t

Stop Interactive stop

Sourceval ttin : t

Stop Terminal read from background process

Sourceval ttou : t

Stop Terminal write from background process

Sourceval urg : t

Ignore Urgent condition on socket

Sourceval usr1 : t

Terminate Application-defined signal 1

Sourceval usr2 : t

Terminate Application-defined signal 2

Sourceval vtalrm : t

Terminate Timeout in virtual time

Sourceval xcpu : t

Dump_core Timeout in cpu time

Sourceval xfsz : t

Dump_core File size limit exceeded

Sourceval zero : t

Ignore No-op; can be used to test whether the target process exists and the current process has permission to signal it

Sourcemodule Expert = Core.Signal.Expert

The Expert module contains functions that novice users should avoid, due to their complexity.

Sourcemodule Stable = Core.Signal.Stable
OCaml

Innovation. Community. Security.