View Source Stdio.Procfs (stdio v0.2.0)
Read data from procfs.
Link to this section Summary
Link to this section Types
Link to this section Functions
@spec children(:prx.pid_t(), Path.t()) :: [:prx.pid_t()]
Get descendents of a process.
Child processes are enumerated by reading proc(5)
:
if the Linux kernel was compiled with
CONFIG_PROC_CHILDREN
, the/proc/[pid]/task/[pid]/children
file is readotherwise,
children/1
falls back to walking /proc
examples
Examples
iex> Stdio.Procfs.children(0) |> Enum.sort() |> List.first()
1
Return a snapshot of the current system processes.
Generates a snapshot of running system processes by walking the procfs
filesystem (usually mounted as /proc
).
The returned value is a map list of key/value pairs read from
/proc/[pid]/status
.
examples
Examples
iex> pid = Stdio.Procfs.ps() |> Enum.sort(&(&1["ppid"] < &2["ppid"])) |> List.first()
iex> pid["pid"]
"1"