1kvm_nextproc(3KVM)        Kernel VM Library Functions       kvm_nextproc(3KVM)
2
3
4

NAME

6       kvm_nextproc, kvm_getproc, kvm_setproc - read system process structures
7

SYNOPSIS

9       cc [ flag... ] file... -lkvm [ library...]
10       #include <kvm.h>
11       #include <sys/param.h>
12       #include <sys/time.h>
13       #include <sys/proc.h>
14
15       struct proc *kvm_nextproc(kvm_t *kd);
16
17
18       int kvm_setproc(kvm_t *kd);
19
20
21       struct proc *kvm_getproc(kvm_t *kd, pid_t pid);
22
23

DESCRIPTION

25       The  kvm_nextproc()  function  reads  sequentially  all  of  the system
26       process  structures   from   the   kernel   identified   by   kd   (see
27       kvm_open(3KVM)).  Each  call to kvm_nextproc() returns a pointer to the
28       static memory area that contains a copy of the next valid process table
29       entry.  There  is  no  guarantee that the data will remain valid across
30       calls  to  kvm_nextproc(),  kvm_setproc(),  or  kvm_getproc().  If  the
31       process  structure  must  be saved, it should be copied to non-volatile
32       storage.
33
34
35       For performance reasons, many implementations will cache a set of  sys‐
36       tem  process  structures.  Since  the  system state is liable to change
37       between calls to kvm_nextproc(), and since the cache may contain  obso‐
38       lete  information,  there  is no guarantee that every process structure
39       returned refers to an active process, nor is it certain that  all  pro‐
40       cesses will be reported.
41
42
43       The   kvm_setproc()   function   rewinds  the  process  list,  enabling
44       kvm_nextproc() to rescan from the beginning of the system  process  ta‐
45       ble.  This  function  will  always  flush  the process structure cache,
46       allowing an application to re-scan the process table of a running  sys‐
47       tem.
48
49
50       The  kvm_getproc()  function  locates the proc structure of the process
51       specified by pid and returns a pointer to it.  Although  this  function
52       does  not  interact  with  the  process  table  pointer  manipulated by
53       kvm_nextproc(), the restrictions regarding the  validity  of  the  data
54       still apply.
55

RETURN VALUES

57       On  success,  kvm_nextproc()  returns  a  pointer to a copy of the next
58       valid process table entry. On failure, it returns NULL.
59
60
61       On success, kvm_getproc() returns a pointer to the  proc  structure  of
62       the process specified by pid. On failure, it returns NULL.
63
64
65       The kvm_setproc() function returns 0 on success and −1 on failure.
66

ATTRIBUTES

68       See attributes(5) for descriptions of the following attributes:
69
70
71
72
73       ┌─────────────────────────────┬─────────────────────────────┐
74       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
75       ├─────────────────────────────┼─────────────────────────────┤
76       │Interface Stability          │Stable                       │
77       ├─────────────────────────────┼─────────────────────────────┤
78       │MT-Level                     │Unsafe                       │
79       └─────────────────────────────┴─────────────────────────────┘
80

SEE ALSO

82       kvm_getu(3KVM), kvm_open(3KVM), kvm_kread(3KVM), attributes(5)
83
84
85
86SunOS 5.11                        2 May 2002                kvm_nextproc(3KVM)
Impressum