Module Imandrakit_io_setrlimit

type resource =
  1. | RLIMIT_CORE
    (*

    maximum size of a core file, in bytes

    *)
  2. | RLIMIT_CPU
    (*

    maximum amount of CPU time, in seconds, used by a process

    *)
  3. | RLIMIT_DATA
    (*

    maximum size of a data segment of the process, in bytes

    *)
  4. | RLIMIT_FSIZE
    (*

    maximum size of a file, in bytes, that may be created by a process

    *)
  5. | RLIMIT_NOFILE
    (*

    a number one greater than the maximum value that the system may assign to a newly-created descriptor

    *)
  6. | RLIMIT_STACK
    (*

    maximum size of the initial thread's stack, in bytes. This might clash with OCaml's stack management.

    *)
  7. | RLIMIT_AS
    (*

    maximum size of total available memory of the process, in bytes

    *)
module Raw : sig ... end
val set : resource -> nativeint -> nativeint -> bool

set resource limit returns true if setting the limit succeeded

type limits = {
  1. cur : nativeint option;
  2. max : nativeint option;
}
val show_limits : limits -> Ppx_deriving_runtime.string
val set_exn : resource -> limits -> unit

Like set, but propagates failures

  • raises Failure

    if it fails

val set_hard_exn : resource -> nativeint option -> unit
val get : resource -> (limits, nativeint) Stdlib.Result.t