Various system utility functions.
val get_editor : unit -> string option
Get the default editor (program) for this user. This functions checks the EDITOR and VISUAL environment variables and then looks into a hard coded list of editors.
val get_editor_exn : unit -> string
val get_pager : unit -> string option
Analogous to get_editor, defaulting to a list including less and more.
val page_contents : ?pager:string ->
?pager_options:string list -> ?tmp_name:string -> string -> unit
page_contents ?pager ?tmp_name str will show str in a pager. The optional tmp_name parameter gives the temporary file prefix. The temporary file is removed after running.
val pid_alive : Core.Std.Pid.t -> bool
val get_groups : string -> string list
val with_tmp : pre:string -> suf:string -> (string -> 'a) -> 'a
with_tmp pre suf f creates a temp file, calls f with the file name, and removes the file afterwards.
val diff : ?options:string list -> string -> string -> string
diff s1 s2 returns diff (1) output of the two strings. Identical files returns the empty string. The default value of options is "-d -u", to provide shorter, unified diffs.
val ip_of_name : string -> string
ip_of_name hostname looks up the hostname and prints the IP in dotted-quad format.
val getbyname_ip : unit -> string
getbyname_ip () returns the IP of the current host by resolving the hostname.
val ifconfig_ips : unit -> Core.Std.String.Set.t
ifconfig_ips () returns IPs of all active interfaces on the host by parsing ifconfig output. Note that this will include 127.0.0.1, assuming lo is up.
val checked_edit : ?create:bool -> check:(string -> string option) -> string -> [ `Abort | `Ok ]
checked_edit ~check file

Edit a file in safe way, like vipw(8). Launches your default editor on file and uses check to check its content.

check : a function returning a text representing the error in the file.
create : create the file if it doesn't exists. Default true
Returns `Ok or `Abort. If `Abort is returned the files was not modified (or created).
module Sexp_checked_edit : 
functor (S : Core.Std.Sexpable) -> sig .. end
Edit files containing sexps.
val check : string -> string option
val check_sexps : string -> string option
val edit : ?create:bool -> string -> [ `Abort | `Ok ]
val edit_sexps : ?create:bool -> string -> [ `Abort | `Ok ]
module Cpu_use : sig .. end
A module for getting a process's CPU use.
type t
val get : ?pid:Core.Std.Pid.t -> unit -> t
get returns a Cpu_use.t for the given pid or the current processes's pid, if none given. Note that the cpu_use given by this initial value will probably be invalid.
val update_exn : t -> unit
update_exn updates a Cpu_use.t. It will fail if the process no longer exists.
val cpu_use : t -> float
cpu_use gives an estimated CPU usage (between 0 and 1) in the time period between the last 2 calls to update_exn.
val resident_mem_use_in_kb : t -> float
val age : t -> Core.Std.Time.Span.t
val fds : t -> int
module Lsb_release : sig .. end
type t = {
distributor_id : string;
release : string;
codename : string;
}
val codename : t -> string
val release : t -> string
val distributor_id : t -> string
module Fields : sig .. end
val names : string list
val codename : (t, string) Fieldslib.Field.t
val release : (t, string) Fieldslib.Field.t
val distributor_id : (t, string) Fieldslib.Field.t
val fold : init:'acc__ ->
distributor_id:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) ->
release:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) ->
codename:('acc__ -> (t, string) Fieldslib.Field.t -> 'acc__) -> 'acc__
val make_creator : distributor_id:((t, string) Fieldslib.Field.t ->
                'compile_acc__ -> ('input__ -> string) * 'compile_acc__) ->
release:((t, string) Fieldslib.Field.t ->
         'compile_acc__ -> ('input__ -> string) * 'compile_acc__) ->
codename:((t, string) Fieldslib.Field.t ->
          'compile_acc__ -> ('input__ -> string) * 'compile_acc__) ->
'compile_acc__ -> ('input__ -> t) * 'compile_acc__
val create : distributor_id:string -> release:string -> codename:string -> t
val map : distributor_id:((t, string) Fieldslib.Field.t -> string) ->
release:((t, string) Fieldslib.Field.t -> string) ->
codename:((t, string) Fieldslib.Field.t -> string) -> t
val iter : distributor_id:((t, string) Fieldslib.Field.t -> unit) ->
release:((t, string) Fieldslib.Field.t -> unit) ->
codename:((t, string) Fieldslib.Field.t -> unit) -> unit
val for_all : distributor_id:((t, string) Fieldslib.Field.t -> bool) ->
release:((t, string) Fieldslib.Field.t -> bool) ->
codename:((t, string) Fieldslib.Field.t -> bool) -> bool
val exists : distributor_id:((t, string) Fieldslib.Field.t -> bool) ->
release:((t, string) Fieldslib.Field.t -> bool) ->
codename:((t, string) Fieldslib.Field.t -> bool) -> bool
val to_list : distributor_id:((t, string) Fieldslib.Field.t -> 'elem__) ->
release:((t, string) Fieldslib.Field.t -> 'elem__) ->
codename:((t, string) Fieldslib.Field.t -> 'elem__) -> 'elem__ list
val map_poly : ([< `Read | `Set_and_create ], t, 'x0) Fieldslib.Field.user -> 'x0 list
module Direct : sig .. end
val iter : t ->
distributor_id:((t, string) Fieldslib.Field.t -> t -> string -> unit) ->
release:((t, string) Fieldslib.Field.t -> t -> string -> unit) ->
codename:((t, string) Fieldslib.Field.t -> t -> string -> unit) -> unit
val fold : t ->
init:'acc__ ->
distributor_id:('acc__ ->
                (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) ->
release:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) ->
codename:('acc__ -> (t, string) Fieldslib.Field.t -> t -> string -> 'acc__) ->
'acc__
val query : unit -> t
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t