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.
18       Depending 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 determins 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_FILLWCHAN
67            do WCHAN lookup.
68
69       PROC_FILLARG
70            equivalent to PROC_FILLCOM.
71
72       PROC_FILLSWAP
73            read the "swap" field from /proc/#pid/smaps.
74
75       PROC_LOOSE_TASKS
76            threat threads as if they were processes.
77
78       PROC_PID (2nd argument pid_t*pidlist)
79            lookup  only  processes  whose  pid is contained in pidlist.  This
80            list must be terminated by 0.
81
82       PROC_UID (arguments uid_t*uidlist,intn)
83            lookup only processes whose user id is contained in uidlist.  n is
84            the number of uids contained in the list uidlist.
85
86

NOTE

88       Only one of the flags needing additional arguments (PROC_{PID,UID}) may
89       be used.
90
91

SEE ALSO

93       readproc(3), readproctab(3), /proc/, /usr/include/proc/readproc.h,
94
95
96
97Linux Manpage                    20 June 2014                      OPENPROC(3)
Impressum