1OPENPROC(3)                Linux Programmer's Manual               OPENPROC(3)
2
3
4

NAME

6       openproc, closeproc  - initialize process information from /proc/
7

SYNOPSIS

9       #include <proc/readproc.h>
10
11       PROCTAB* openproc (int flags, ... );
12       void closeproc (PROCTAB* PT);
13
14

SYNOPSIS

16       The openproc function initializes a PROCTAB structure which can be used
17       by iterated readproc calls to get information on current processes. De‐
18       pending  on  flags, openproc may need a second argument or a second and
19       third argument (see below).
20
21       closeproc closes all files opened by openproc and deallocates the  mem‐
22       ory allocated by openproc.
23
24       The PROCTAB structure is defined in <proc/readproc.h>
25
26

RETURN VALUE

28       openproc  returns a pointer to a PROCTAB structure, or NULL if an error
29       occurs. This usually means that /proc cannot be read by the process.
30
31

FLAGS

33       The behaviour of openproc is controlled by the following set of  flags,
34       which  may  be ORed together. There are three different kinds of flags.
35       The first group of flags determines which information  gets  read  from
36       /proc/#pid  for  each process. The second group of flags (of which only
37       one can be enacted for a opendir call) restricts which processes infor‐
38       mation  is read for by providing a list of criteria. The third group of
39       flags restricts this as well, but doesn't need arguments. These may  be
40       used together again.
41
42
43       PROC_FILLMEM
44            read information from /proc/#pid/statm
45
46       PROC_FILLCOM
47            allocate   cmdline  part  of  proc_t  and  read  information  from
48            /proc/#pid/cmdline
49
50       PROC_FILLENV
51            allocate  environ  part  of  proc_t  and  read  information   from
52            /proc/#pid/environ
53
54       PROC_FILLUSR
55            resolve user ids to names via /etc/passwd
56
57       PROC_FILLGRP
58            resolve group ids to names via /etc/group
59
60       PROC_FILLSTATUS
61            read information from /proc/#pid/status
62
63       PROC_FILLSTAT
64            read information from /proc/#pid/stat
65
66       PROC_FILLARG
67            equivalent to PROC_FILLCOM
68
69       PROC_FILLCGROUP
70            alloc and fill in cgroup
71
72       PROC_FILLSUPGRP
73            resolve supplementary group id -> group name
74
75       PROC_FILLOOM
76            fill in proc_t oom_score and oom_adj
77
78       PROC_FILLNS
79            fill in proc_t namespace information
80
81       PROC_FILLSYSTEMD
82            fill in proc_t systemd information
83
84       PROC_LOOSE_TASKS
85            threat threads as if they were processes
86
87       PROC_PID (2nd argument pid_t* pidlist)
88            lookup  only processes whose pid is contained in pidlist (the list
89            is terminated with 0)
90
91       PROC_UID (arguments uid_t* uidlist, int n)
92            lookup only processes whose user id is contained in uidlist (where
93            n is the number of uids contained in the list)
94
95       PROC_EDITCGRPCVT
96            edit cgroup as single vector
97
98       PROC_EDITCMDLCVT
99            edit cmdline as single vector
100
101       PROC_EDITENVRCVT
102            edit environ as single vector
103
104

NOTE

106       Only one of the flags needing additional arguments (PROC_{PID,UID}) may
107       be used at a time.
108
109

SEE ALSO

111       readproc(3), readproctab(3), /proc/, /usr/include/proc/readproc.h,
112

REPORTING BUGS

114       Please send bug reports to ⟨procps@freelists.org⟩
115
116
117
118Linux Manpage                    14 July 2014                      OPENPROC(3)
Impressum