Module Std.Procfs

module Procfs: Procfs


Process and system stats
type bigint = Core.Std.Big_int.big_int 
val input_all_with_reused_buffer : unit -> (string -> string) Core.Std.Staged.t
module Process: sig .. end
module Meminfo: sig .. end
module Kstat: sig .. end
module Loadavg: sig .. end
val get_all_procs : unit -> Process.t list
get_all_procs returns a list of all processes on the system
val with_pid_exn : Core.Std.Pid.t -> Process.t
with_pid_exn pid returns a single process that matches pid, or raises Not_found
val with_pid : Core.Std.Pid.t -> Process.t option
with_pid pid returns a single process that matches pid
val with_uid : int -> Process.t list
with_uid uid returns all processes owned by uid
val pgrep : (Process.t -> bool) -> Process.t list
pgrep f returns all processes for which f is true
val pkill : signal:Core.Std.Signal.t ->
(Process.t -> bool) ->
(Core.Std.Pid.t * (unit, Core.Std.Unix.error) Core.Std.Result.t) list
pkill ~signal f sends the signal to all processes for which f returns true. It returns the list of processes that were signaled, and the resulting errors if any.
val with_username_exn : string -> Process.t list
with_username_exn user calls with_uid after looking up the user's uid
val with_username : string -> Process.t list option
with_username user calls with_uid after looking up the user's uid
val jiffies_per_second_exn : unit -> float
jiffies_per_second_exn. A jiffy "is one tick of the system timer interrupt. It is not an absolute time interval unit, since its duration depends on the clock interrupt frequency of the particular hardware platform."

Further reading: https://secure.wikimedia.org/wikipedia/en/wiki/Jiffy_(time)

val jiffies_per_second : unit -> float option
val meminfo_exn : unit -> Meminfo.t
meminfo_exn queries /proc/meminfo and fills out Meminfo.t. All values in bytes.
val meminfo : unit -> Meminfo.t option
val loadavg_exn : unit -> Loadavg.t
loadavg_exn parses /proc/loadavg.
val loadavg : unit -> Loadavg.t option
module Net: sig .. end
module Mount: sig .. end
val mounts : unit -> Mount.t list
val mounts_of_fstab : unit -> Mount.t list
val supported_filesystems : unit -> string list
val uptime : unit -> Core.Std.Time.Span.t
val process_age : Process.t -> Core.Std.Time.Span.t option
val process_age' : jiffies_per_second:float -> Process.t -> Core.Std.Time.Span.t
val bigint_of_sexp : Sexplib.Sexp.t -> bigint
val sexp_of_bigint : bigint -> Sexplib.Sexp.t

The filename of the executable

One character from the string "RSDZTW"

The PID of the parent.

The process group ID of the process.

The session ID of the process.

The tty the process uses.

The process group ID of the process which currently owns the tty...

The kernel flags word of the process.

The number of minor faults the process has made which have not required loading a memory page from disk.

The number of minor faults that the process’s waited-for children have made.

The number of major faults the process has made which have required loading a page from disk.

The number of major faults that the process’s waited-for children have made.

The number of jiffies that this process has been scheduled in user mode.

The number of jiffies that this process has been scheduled in kernel mode.

The number of jiffies that this process’s waited-for children have been scheduled in user mode.

The number of jiffies that this process’s waited-for children have been scheduled in kernel mode.

The standard nice value, plus fifteen. The value is never negative in the kernel.

The nice value ranges from 19 to -19

placeholder for removed field

The time in jiffies before the next SIGALRM is sent to the process due to an interval timer.

The time in jiffies the process started after system boot.

Virtual memory size in bytes.

Resident Set Size: number of pages the process has in real memory.

Current limit in bytes on the rss of the process.

The address above which program text can run.

The address below which program text can run.

The address of the start of the stack.

The current value of esp (stack pointer)

The current value of eip (instruction pointer)

The bitmap of pending signals.

The bitmap of blocked signals.

The bitmap of ignored signals.

The bitmap of caught signals.

This is the "channel" in which the process is waiting. Address of a system call.

(no longer maintained)

(no longer maintained)

Signal sent to parent when we die.

CPU number last executed on.

Real-time scheduling priority.

Scheduling policy

total program size

resident set size

shared pages

text (code)

library

data/stack

dirty pages (unused)

Real user ID

Effective user ID

Saved user ID

FS user ID

Real group ID

Effective group ID

Saved group ID

FS group ID

File descriptor (0=stdin, 1=stdout, etc.)

Kind of file

Process ID

Command-line (not reliable).

Symlink to working directory.

Process environment.

Symlink to executed command.

Per-process root (e.g. chroot)

Per-process rlimit settings

Status information.

Memory status information.

Some more assorted status information.

Status information for each task (thread)

Show what top would show for COMMAND

File descriptors

OOM killer niceness range: -17 to +15

OOM "sacrifice" priority

t corresponds to the values in /proc/meminfo. All values in bytes.

t corresponds to the values in /proc/loadavg.

get_all_procs returns a list of all processes on the system

with_pid_exn pid returns a single process that matches pid, or raises Not_found

with_pid pid returns a single process that matches pid

with_uid uid returns all processes owned by uid

pgrep f returns all processes for which f is true

pkill ~signal f sends the signal to all processes for which f returns true. It returns the list of processes that were signaled, and the resulting errors if any.

with_username_exn user calls with_uid after looking up the user's uid

with_username user calls with_uid after looking up the user's uid

jiffies_per_second_exn. A jiffy "is one tick of the system timer interrupt. It is not an absolute time interval unit, since its duration depends on the clock interrupt frequency of the particular hardware platform."

Further reading: https://secure.wikimedia.org/wikipedia/en/wiki/Jiffy_(time)

meminfo_exn queries /proc/meminfo and fills out Meminfo.t. All values in bytes.

loadavg_exn parses /proc/loadavg.

/proc/net/tcp, or what netstat or lsof -i parses.

These don't do any IO and should be async-ok

This does IO and is not async-ok.