| procps.h | | procps.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| // __mips_eabi means eabi, which comes in both sizes, but isn't used. | | // __mips_eabi means eabi, which comes in both sizes, but isn't used. | |
| // | | // | |
| // PowerPC: Big ugly problem! 32-bit Macs are still popular. :-/ | | // PowerPC: Big ugly problem! 32-bit Macs are still popular. :-/ | |
| // | | // | |
| // x86-64: So far, nobody has been dumb enough to go 32-bit. | | // x86-64: So far, nobody has been dumb enough to go 32-bit. | |
| // | | // | |
| // Unknown: PA-RISC and zSeries | | // Unknown: PA-RISC and zSeries | |
| // | | // | |
| #if defined(k64test) || (defined(_ABIN32) && _MIPS_SIM == _ABIN32) | | #if defined(k64test) || (defined(_ABIN32) && _MIPS_SIM == _ABIN32) | |
| #define KLONG long long // not typedef; want "unsigned KLONG" to work | | #define KLONG long long // not typedef; want "unsigned KLONG" to work | |
|
| #define KLF "L" | | #define KLF "ll" | |
| #define STRTOUKL strtoull | | #define STRTOUKL strtoull | |
| #else | | #else | |
| #define KLONG long | | #define KLONG long | |
| #define KLF "l" | | #define KLF "l" | |
| #define STRTOUKL strtoul | | #define STRTOUKL strtoul | |
| #endif | | #endif | |
| | | | |
| // since gcc-2.5 | | // since gcc-2.5 | |
| #define NORETURN __attribute__((__noreturn__)) | | #define NORETURN __attribute__((__noreturn__)) | |
| #define FUNCTION __attribute__((__const__)) // no access to global mem, ev
en via ptr, and no side effect | | #define FUNCTION __attribute__((__const__)) // no access to global mem, ev
en via ptr, and no side effect | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 105 | |
| | | | |
| // Like HIDDEN, but for an alias that gets created. | | // Like HIDDEN, but for an alias that gets created. | |
| // In gcc-3.2 there is an alias+hidden conflict. | | // In gcc-3.2 there is an alias+hidden conflict. | |
| // Many will have patched this bug, but oh well. | | // Many will have patched this bug, but oh well. | |
| #if ( __GNUC__ == 3 && __GNUC_MINOR__ > 2 ) || __GNUC__ > 3 | | #if ( __GNUC__ == 3 && __GNUC_MINOR__ > 2 ) || __GNUC__ > 3 | |
| #define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(
#x),visibility("hidden"))) | | #define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(
#x),visibility("hidden"))) | |
| #else | | #else | |
| #define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(
#x))) | | #define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(
#x))) | |
| #endif | | #endif | |
| | | | |
|
| typedef void (*message_fn)(const char *restrict, ...) __attribute__((format
(printf,1,2))); | | typedef void (*message_fn)(const char *__restrict, ...) __attribute__((form
at(printf,1,2))); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| readproc.h | | readproc.h | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| // 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 | |
|
| | | unsigned long // next 2 fields are NOT filled in by readproc | |
| | | maj_delta, // stat (special) major page faults since last upda | |
| | | te | |
| | | min_delta; // stat (special) minor page faults since last upda | |
| | | te | |
| unsigned | | unsigned | |
| pcpu; // stat (special) %CPU usage (is not filled in by
readproc!!!) | | pcpu; // stat (special) %CPU usage (is not filled in by
readproc!!!) | |
| char | | char | |
| state, // stat,status single-char code for process stat
e (S=sleeping) | | state, // stat,status single-char code for process stat
e (S=sleeping) | |
| #ifdef QUICK_THREADS | | #ifdef QUICK_THREADS | |
| pad_1, // n/a padding (psst, also used if mult
i-threaded) | | pad_1, // n/a padding (psst, also used if mult
i-threaded) | |
| #else | | #else | |
| pad_1, // n/a padding | | pad_1, // n/a padding | |
| #endif | | #endif | |
| pad_2, // n/a padding | | pad_2, // n/a padding | |
| | | | |
| skipping to change at line 175 | | skipping to change at line 178 | |
| | | | |
| #define PROCPATHLEN 64 // must hold /proc/2000222000/task/2000222000/cmdli
ne | | #define PROCPATHLEN 64 // must hold /proc/2000222000/task/2000222000/cmdli
ne | |
| | | | |
| typedef struct PROCTAB { | | typedef struct PROCTAB { | |
| DIR* procfs; | | DIR* procfs; | |
| // char deBug0[64]; | | // char deBug0[64]; | |
| DIR* taskdir; // for threads | | DIR* taskdir; // for threads | |
| // char deBug1[64]; | | // char deBug1[64]; | |
| pid_t taskdir_user; // for threads | | pid_t taskdir_user; // for threads | |
| int did_fake; // used when taskdir is missing | | int did_fake; // used when taskdir is missing | |
|
| int(*finder)(struct PROCTAB *restrict const, proc_t *restrict const); | | int(*finder)(struct PROCTAB *__restrict const, proc_t *__restrict const | |
| proc_t*(*reader)(struct PROCTAB *restrict const, proc_t *restrict const | | ); | |
| ); | | proc_t*(*reader)(struct PROCTAB *__restrict const, proc_t *__restrict c | |
| int(*taskfinder)(struct PROCTAB *restrict const, const proc_t *restrict | | onst); | |
| const, proc_t *restrict const, char *restrict const); | | int(*taskfinder)(struct PROCTAB *__restrict const, const proc_t *__rest | |
| proc_t*(*taskreader)(struct PROCTAB *restrict const, const proc_t *rest | | rict const, proc_t *__restrict const, char *__restrict const); | |
| rict const, proc_t *restrict const, char *restrict const); | | proc_t*(*taskreader)(struct PROCTAB *__restrict const, const proc_t *__ | |
| | | restrict const, proc_t *__restrict const, char *__restrict const); | |
| pid_t* pids; // pids of the procs | | pid_t* pids; // pids of the procs | |
| uid_t* uids; // uids of procs | | uid_t* uids; // uids of procs | |
| int nuid; // cannot really sentinel-terminate unsigned
short[] | | int nuid; // cannot really sentinel-terminate unsigned
short[] | |
| int i; // generic | | int i; // generic | |
| unsigned flags; | | unsigned flags; | |
| unsigned u; // generic | | unsigned u; // generic | |
| void * vp; // generic | | void * vp; // generic | |
| char path[PROCPATHLEN]; // must hold /proc/2000222000/task/2000
222000/cmdline | | char path[PROCPATHLEN]; // must hold /proc/2000222000/task/2000
222000/cmdline | |
| unsigned pathlen; // length of string in the above (w/o '\0') | | unsigned pathlen; // length of string in the above (w/o '\0') | |
| } PROCTAB; | | } PROCTAB; | |
| | | | |
| skipping to change at line 202 | | skipping to change at line 205 | |
| | | | |
| typedef struct proc_data_t { // valued by: (else zero) | | typedef struct proc_data_t { // valued by: (else zero) | |
| proc_t **tab; // readproctab2, readproctab3 | | proc_t **tab; // readproctab2, readproctab3 | |
| proc_t **proc; // readproctab2 | | proc_t **proc; // readproctab2 | |
| proc_t **task; // * readproctab2 | | proc_t **task; // * readproctab2 | |
| int n; // readproctab2, readproctab3 | | int n; // readproctab2, readproctab3 | |
| int nproc; // readproctab2 | | int nproc; // readproctab2 | |
| int ntask; // * readproctab2 | | int ntask; // * readproctab2 | |
| } proc_data_t; // * when PROC_LOOSE_TASKS set | | } proc_data_t; // * when PROC_LOOSE_TASKS set | |
| | | | |
|
| extern proc_data_t *readproctab2(int(*want_proc)(proc_t *buf), int(*want_ta | | extern proc_data_t *readproctab2(int(*want_proc)(proc_t *buf), int(*want_ta | |
| sk)(proc_t *buf), PROCTAB *restrict const PT); | | sk)(proc_t *buf), PROCTAB *__restrict const PT); | |
| extern proc_data_t *readproctab3(int(*want_task)(proc_t *buf), PROCTAB *res | | extern proc_data_t *readproctab3(int(*want_task)(proc_t *buf), PROCTAB *__r | |
| trict const PT); | | estrict const PT); | |
| | | | |
| // Convenient wrapper around openproc and readproc to slurp in the whole pr
ocess | | // Convenient wrapper around openproc and readproc to slurp in the whole pr
ocess | |
| // table subset satisfying the constraints of flags and the optional PID li
st. | | // table subset satisfying the constraints of flags and the optional PID li
st. | |
| // Free allocated memory with exit(). Access via tab[N]->member. The poin
ter | | // Free allocated memory with exit(). Access via tab[N]->member. The poin
ter | |
| // list is NULL terminated. | | // list is NULL terminated. | |
| extern proc_t** readproctab(int flags, ... /* same as openproc */ ); | | extern proc_t** readproctab(int flags, ... /* same as openproc */ ); | |
| | | | |
| // Clean-up open files, etc from the openproc() | | // Clean-up open files, etc from the openproc() | |
| extern void closeproc(PROCTAB* PT); | | extern void closeproc(PROCTAB* PT); | |
| | | | |
| // Retrieve the next process or task matching the criteria set by the openp
roc(). | | // Retrieve the next process or task matching the criteria set by the openp
roc(). | |
| // | | // | |
| // Note: When NULL is used as the readproc 'p', readtask 't' or readeither
'x' | | // Note: When NULL is used as the readproc 'p', readtask 't' or readeither
'x' | |
| // parameter, the library will allocate the necessary proc_t storage. | | // parameter, the library will allocate the necessary proc_t storage. | |
| // | | // | |
| // Alternatively, you may provide your own reuseable buffer address | | // Alternatively, you may provide your own reuseable buffer address | |
| // in which case that buffer *MUST* be initialized to zero one time | | // in which case that buffer *MUST* be initialized to zero one time | |
| // only before first use. Thereafter, the library will manage such | | // only before first use. Thereafter, the library will manage such | |
| // a passed proc_t, freeing any additional acquired memory associated | | // a passed proc_t, freeing any additional acquired memory associated | |
| // with the previous process or thread. | | // with the previous process or thread. | |
|
| extern proc_t* readproc(PROCTAB *restrict const PT, proc_t *restrict p); | | extern proc_t* readproc(PROCTAB *__restrict const PT, proc_t *__restrict p) | |
| extern proc_t* readtask(PROCTAB *restrict const PT, const proc_t *restrict | | ; | |
| const p, proc_t *restrict t); | | extern proc_t* readtask(PROCTAB *__restrict const PT, const proc_t *__restr | |
| extern proc_t* readeither(PROCTAB *restrict const PT, proc_t *restrict x); | | ict const p, proc_t *__restrict t); | |
| | | extern proc_t* readeither(PROCTAB *__restrict const PT, proc_t *__restrict | |
| | | x); | |
| | | | |
| // warning: interface may change | | // warning: interface may change | |
|
| extern int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid
); | | extern int read_cmdline(char *__restrict const dst, unsigned sz, unsigned p
id); | |
| | | | |
| extern void look_up_our_self(proc_t *p); | | extern void look_up_our_self(proc_t *p); | |
| | | | |
| // Deallocate space allocated by readproc | | // Deallocate space allocated by readproc | |
| extern void freeproc(proc_t* p); | | extern void freeproc(proc_t* p); | |
| | | | |
| // Fill out a proc_t for a single task | | // Fill out a proc_t for a single task | |
| extern proc_t * get_proc_stats(pid_t pid, proc_t *p); | | extern proc_t * get_proc_stats(pid_t pid, proc_t *p); | |
| | | | |
| // openproc/readproctab: | | // openproc/readproctab: | |
| | | | |
| skipping to change at line 274 | | skipping to change at line 277 | |
| #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_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 | |
| | | | |
| // it helps to give app code a few spare bits | | // it helps to give app code a few spare bits | |
| #define PROC_SPARE_1 0x01000000 | | #define PROC_SPARE_1 0x01000000 | |
| #define PROC_SPARE_2 0x02000000 | | #define PROC_SPARE_2 0x02000000 | |
| #define PROC_SPARE_3 0x04000000 | | #define PROC_SPARE_3 0x04000000 | |
| #define PROC_SPARE_4 0x08000000 | | #define PROC_SPARE_4 0x08000000 | |
| | | | |
| EXTERN_C_END | | EXTERN_C_END | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 16 lines changed or deleted | | 25 lines changed or added | |
|
| sysinfo.h | | sysinfo.h | |
| | | | |
| skipping to change at line 59 | | skipping to change at line 59 | |
| extern unsigned long kb_slab; | | extern unsigned long kb_slab; | |
| extern unsigned long nr_reversemaps; | | extern unsigned long nr_reversemaps; | |
| extern unsigned long kb_committed_as; | | extern unsigned long kb_committed_as; | |
| extern unsigned long kb_dirty; | | extern unsigned long kb_dirty; | |
| extern unsigned long kb_inactive; | | extern unsigned long kb_inactive; | |
| extern unsigned long kb_mapped; | | extern unsigned long kb_mapped; | |
| extern unsigned long kb_pagetables; | | extern unsigned long kb_pagetables; | |
| | | | |
| #define BUFFSIZE (64*1024) | | #define BUFFSIZE (64*1024) | |
| typedef unsigned long long jiff; | | typedef unsigned long long jiff; | |
|
| extern void getstat(jiff *restrict cuse, jiff *restrict cice, jiff *restric | | extern void getstat(jiff *__restrict cuse, jiff *__restrict cice, jiff *__r | |
| t csys, jiff *restrict cide, jiff *restrict ciow, jiff *restrict cxxx, jiff | | estrict csys, jiff *__restrict cide, jiff *__restrict ciow, jiff *__restric | |
| *restrict cyyy, jiff *restrict czzz, | | t cxxx, jiff *__restrict cyyy, jiff *__restrict czzz, | |
| unsigned long *restrict pin, unsigned long *restrict pout, unsi | | unsigned long *__restrict pin, unsigned long *__restrict pout, | |
| gned long *restrict s_in, unsigned long *restrict sout, | | unsigned long *__restrict s_in, unsigned long *__restrict sout, | |
| unsigned *restrict intr, unsigned *restrict ctxt, | | unsigned *__restrict intr, unsigned *__restrict ctxt, | |
| unsigned int *restrict running, unsigned int *restrict blocked, | | unsigned int *__restrict running, unsigned int *__restrict bloc | |
| unsigned int *restrict btime, unsigned int *restrict processes) | | ked, | |
| ; | | unsigned int *__restrict btime, unsigned int *__restrict proces | |
| | | ses); | |
| | | | |
| extern void meminfo(void); | | extern void meminfo(void); | |
| | | | |
| extern unsigned long vm_nr_dirty; | | extern unsigned long vm_nr_dirty; | |
| extern unsigned long vm_nr_writeback; | | extern unsigned long vm_nr_writeback; | |
| extern unsigned long vm_nr_pagecache; | | extern unsigned long vm_nr_pagecache; | |
| extern unsigned long vm_nr_page_table_pages; | | extern unsigned long vm_nr_page_table_pages; | |
| extern unsigned long vm_nr_reverse_maps; | | extern unsigned long vm_nr_reverse_maps; | |
| extern unsigned long vm_nr_mapped; | | extern unsigned long vm_nr_mapped; | |
| extern unsigned long vm_nr_slab; | | extern unsigned long vm_nr_slab; | |
| | | | |
End of changes. 1 change blocks. |
| 9 lines changed or deleted | | 10 lines changed or added | |
|