lkmi_proc
#include <lkmi.h >
int lkmi_proc (unsigned pid, lkmi_proc_t *proc_info);
- proc_info
-
Pointer to structure lkmi_proc_t which is described bellow.
Function obtains informations for process pid and
fills structure proc_info.
- pid
-
The process id.
- szName
-
The filename of the executable.
- state
-
State of process: R process is running, S process is sleeping,
D process is sleeping in an uninterruptible wait,
Z process is zombie, T process is traced or stopped.
- euid
-
The effective user id. This value is obtained using stat (2) on /proc/pid/stat file.
On stat (2) failed then value is set to -1.
- egid
-
The effective group id. This value is obtained using stat (2) on /proc/pid/stat file.
On stat (2) failed then value is set to -1.
- ppid
-
The pid of the parent process.
- pgrp
-
The pgrp of the process.
- session
-
The session id of the process.
- tty
-
The tty the process uses.
- tpgid
-
The process group ID of the process which currently owns the tty that the
process is connected to.
- flags
-
The flags of the process.
Currently, every flag has the math bit set, because crt0.s checks for
math emulation, so this is not included in the output. This is
probably a bug, as not every process is a compiled C program. The math
bit should be a decimal 4, and the traced bit is decimal 10.
- minflt
-
The number of minor faults the process has made, those which have not
required loading a memory page from disk.
- cminflt
-
The number of minor faults that the process and its children have made.
- majflt
-
The number of major faults the process has made, those which have
required loading a memory page from disk.
- cmajflt
-
The number of major faults that the process and its children have made.
- utime
-
The number of jiffies that this process has been scheduled in user mode.
- stime
-
The number of jiffies that this process has been scheduled in kernel mode.
- cutime
-
The number of jiffies that this process and its children have been scheduled
in user mode.
- cstime
-
The number of jiffies that this process and its children have been scheduled
in kernel mode.
- counter
-
The current maximum size in jiffies of the process's next timeslice, of what
is currently left of its current timeslice, if it is the currently running
process.
- priority
-
The standard nice value, plus fifteen. The value is never negative in the
kernel.
- timeout
-
The time in jiffies of the process's next timeout.
- itrealvalue
-
The time in jiffies of the process's next timeout.
- starttime
-
Time the process started in jiffies after system boot.
- vsize
-
The virtual memory size.
- rss
-
Resident Set Size: number of pages the process has in real memory, minus 3
for administrative purposes. This is just the pages which count towards
text, data, or stack space. This does not include pages which have not been
demand-loaded in, or which are swapped out.
- rlim
-
The current limit in bytes on the RSS of the process (usually 2,147,483,647).
- startcode
-
The address above which program text can run.
- endcode
-
The address below which program text can run.
- startstack
-
The address of the start of the stack.
- kstkesp
-
The current value of ESP (32-bit stack pointer), as found in the kernel
stack page for the process.
- kstkeip
-
The current EIP (32-bit instruction pointer).
- signal
-
The bitmap of pending signals.
- blocked
-
The bitmap of blocked signals.
- sigignore
-
The bitmap of ignored signals.
- sigcatch
-
The bitmap of catched signals.
- wchan
-
This is the channel in which the process is waiting. This is the address
of a system call, and can be looked up in a namelist if you need a textual
name. (If you have an up-to-date /etc/psdatabase, then try
ps -l to see the
WCHAN
field in action)
- sched
-
Current scheduler for process SCHED_OTHER means usual scheduler,
SCHED_RR means Round Robin scheduler and
SCHED_FIFO means First In First Out scheduler.
- sched_priority
-
Scheduler priority if used other than SCHED_OTHER process
scheduler. If some error occurred then field is set to -1.
If function succeeds then 0 is returned, otherwise is returned
-1 and errno is set.
- ENOENT
-
Directory /proc is not mounted or proc filesystem is not
included in the kernel or requested process does not exist.
- EINVAL
-
NULL pointer is assigned as parameter proc_info.
The lkmi_proc function may also fail and set errno
for any of the errors specified for the routine access(2).
The lkmi_proc function may also fail and set errno
for any of the errors specified for the routine fopen(3).
Please use the SourceForge Reporting page
which is located here:
Bug Report
This function is written as part of lkmi library for Linux system
and may be freely distributed under GPL terms.
Copyright (c) 1995, 2002 David Doubrava (linux_monitor(at)volny(dot)cz).
Origin of values description is in Linux kernel source.
lkmi,
lkmi_cpu,
lkmi_files,
lkmi_filesys,
lkmi_hdd,
lkmi_hw_intr,
lkmi_inodes,
lkmi_memory,
lkmi_memoryswap,
lkmi_net,
lkmi_proc,
lkmi_readprocesses,
lkmi_swap,
lkmi_swapex,
lkmi_system