| readproc.h | | readproc.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| // s signal, blocked, sigignore, sigcatch, | | // s signal, blocked, sigignore, sigcatch, | |
| // lu flags, min_flt, cmin_flt, maj_flt, cmaj_flt, utime, stime, | | // lu flags, min_flt, cmin_flt, maj_flt, cmaj_flt, utime, stime, | |
| // lu rss_rlim, start_code, end_code, start_stack, kstk_esp, kstk_eip, | | // lu rss_rlim, start_code, end_code, start_stack, kstk_esp, kstk_eip, | |
| // lu start_time, vsize, wchan, | | // lu start_time, vsize, wchan, | |
| | | | |
| // This is to help document a transition from pid to tgid/tid caused | | // This is to help document a transition from pid to tgid/tid caused | |
| // by the introduction of thread support. It is used in cases where | | // by the introduction of thread support. It is used in cases where | |
| // neither tgid nor tid seemed correct. (in other words, FIXME) | | // neither tgid nor tid seemed correct. (in other words, FIXME) | |
| #define XXXID tid | | #define XXXID tid | |
| | | | |
|
| | | enum ns_type { | |
| | | IPCNS = 0, | |
| | | MNTNS, | |
| | | NETNS, | |
| | | PIDNS, | |
| | | USERNS, | |
| | | UTSNS, | |
| | | NUM_NS // total namespaces (fencepost) | |
| | | }; | |
| | | extern const char *get_ns_name(int id); | |
| | | extern int get_ns_id(const char *name); | |
| | | | |
| // Basic data structure which holds all information we can get about a proc
ess. | | // Basic data structure which holds all information we can get about a proc
ess. | |
| // (unless otherwise specified, fields are read from /proc/#/stat) | | // (unless otherwise specified, fields are read from /proc/#/stat) | |
| // | | // | |
| // Most of it comes from task_struct in linux/sched.h | | // Most of it comes from task_struct in linux/sched.h | |
| // | | // | |
| typedef struct proc_t { | | typedef struct proc_t { | |
| // 1st 16 bytes | | // 1st 16 bytes | |
| int | | int | |
| tid, // (special) task id, the POSIX thread ID (see
also: tgid) | | tid, // (special) task id, the POSIX thread ID (see
also: tgid) | |
| ppid; // stat,status pid of parent process | | ppid; // stat,status pid of parent process | |
| | | | |
| skipping to change at line 159 | | skipping to change at line 171 | |
| suid, sgid, // status saved | | suid, sgid, // status saved | |
| fuid, fgid, // status fs (used for file access only) | | fuid, fgid, // status fs (used for file access only) | |
| tpgid, // stat terminal process group id | | tpgid, // stat terminal process group id | |
| exit_signal, // stat might not be SIGCHLD | | exit_signal, // stat might not be SIGCHLD | |
| processor; // stat current (or most recent?) CPU | | processor; // stat current (or most recent?) CPU | |
| #ifdef OOMEM_ENABLE | | #ifdef OOMEM_ENABLE | |
| int | | int | |
| oom_score, // oom_score (badness for OOM killer) | | oom_score, // oom_score (badness for OOM killer) | |
| oom_adj; // oom_adj (adjustment to OOM score) | | oom_adj; // oom_adj (adjustment to OOM score) | |
| #endif | | #endif | |
|
| | | long | |
| | | ns[NUM_NS]; // (ns subdir) inode number of namespaces | |
| } proc_t; | | } proc_t; | |
| | | | |
| // PROCTAB: data structure holding the persistent information readproc need
s | | // PROCTAB: data structure holding the persistent information readproc need
s | |
| // from openproc(). The setup is intentionally similar to the dirent inter
face | | // from openproc(). The setup is intentionally similar to the dirent inter
face | |
| // and other system table interfaces (utmp+wtmp come to mind). | | // and other system table interfaces (utmp+wtmp come to mind). | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| #include <dirent.h> | | #include <dirent.h> | |
| #include <unistd.h> | | #include <unistd.h> | |
| | | | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 282 | |
| #define PROC_FILLENV 0x0004 // alloc and fill in `environ' | | #define PROC_FILLENV 0x0004 // alloc and fill in `environ' | |
| #define PROC_FILLUSR 0x0008 // resolve user id number -> user name | | #define PROC_FILLUSR 0x0008 // resolve user id number -> user name | |
| #define PROC_FILLGRP 0x0010 // resolve group id number -> group nam
e | | #define PROC_FILLGRP 0x0010 // resolve group id number -> group nam
e | |
| #define PROC_FILLSTATUS 0x0020 // read status | | #define PROC_FILLSTATUS 0x0020 // read status | |
| #define PROC_FILLSTAT 0x0040 // read stat | | #define PROC_FILLSTAT 0x0040 // read stat | |
| #define PROC_FILLWCHAN 0x0080 // look up WCHAN name | | #define PROC_FILLWCHAN 0x0080 // look up WCHAN name | |
| #define PROC_FILLARG 0x0100 // alloc and fill in `cmdline' | | #define PROC_FILLARG 0x0100 // alloc and fill in `cmdline' | |
| #define PROC_FILLCGROUP 0x0200 // alloc and fill in `cgroup` | | #define PROC_FILLCGROUP 0x0200 // alloc and fill in `cgroup` | |
| #define PROC_FILLSUPGRP 0x0400 // resolve supplementary group id -> gr
oup name | | #define PROC_FILLSUPGRP 0x0400 // resolve supplementary group id -> gr
oup name | |
| #define PROC_FILLOOM 0x0800 // fill in proc_t oom_score and oom_adj | | #define PROC_FILLOOM 0x0800 // fill in proc_t oom_score and oom_adj | |
|
| | | #define PROC_FILLNS 0x8000 // fill in proc_t namespace information | |
| | | | |
| #define PROC_LOOSE_TASKS 0x2000 // treat threads as if they were proces
ses | | #define PROC_LOOSE_TASKS 0x2000 // treat threads as if they were proces
ses | |
| | | | |
| // Obsolete, consider only processes with one of the passed: | | // Obsolete, consider only processes with one of the passed: | |
| #define PROC_PID 0x1000 // process id numbers ( 0 terminated
) | | #define PROC_PID 0x1000 // process id numbers ( 0 terminated
) | |
| #define PROC_UID 0x4000 // user id numbers ( length needed
) | | #define PROC_UID 0x4000 // user id numbers ( length needed
) | |
| | | | |
| #define PROC_EDITCGRPCVT 0x10000 // edit `cgroup' as single vector | | #define PROC_EDITCGRPCVT 0x10000 // edit `cgroup' as single vector | |
| #define PROC_EDITCMDLCVT 0x20000 // edit `cmdline' as single vector | | #define PROC_EDITCMDLCVT 0x20000 // edit `cmdline' as single vector | |
| #define PROC_EDITENVRCVT 0x40000 // edit `environ' as single vector | | #define PROC_EDITENVRCVT 0x40000 // edit `environ' as single vector | |
| | | | |
End of changes. 3 change blocks. |
| 0 lines changed or deleted | | 15 lines changed or added | |
|