Initial revision
[monky] / top.h
1 /*
2  * top.c a slightly modified wmtop.c -- copied from the WindowMaker and gkrelltop
3  * 
4  * Modified by Brenden Matthews
5  *
6  * Modified by Adi Zaimi
7  *
8  * Derived by Dan Piponi dan@tanelorn.demon.co.uk
9  * http://www.tanelorn.demon.co.uk
10  * http://wmtop.sourceforge.net 
11  * from code originally contained in wmsysmon by Dave Clark 
12 (clarkd@skynet.ca)
13  * This software is licensed through the GNU General Public License.
14  */
15
16 /*
17  * Ensure there's an operating system defined. There is *no* default
18  * because every OS has it's own way of revealing CPU/memory usage.
19  * compile with gcc -DOS ...
20  */
21
22 /******************************************/
23 /* Includes                               */
24 /******************************************/
25
26 #include "conky.h"
27 #define CPU_THRESHHOLD   0      /* threshhold for the cpu diff to appear */
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <time.h>
31 #include <dirent.h>
32 #include <string.h>
33 #include <fcntl.h>
34 #include <unistd.h>
35 #include <ctype.h>
36 #include <math.h>
37 #include <assert.h>
38 #include <limits.h>
39 #include <errno.h>
40 #include <signal.h>
41
42 #include <sys/wait.h>
43 #include <sys/stat.h>
44 #include <sys/param.h>
45 #include <sys/types.h>
46 #include <sys/ioctl.h>
47 #include <sys/time.h>
48
49 #include <regex.h>
50
51 /******************************************/
52 /* Defines                                */
53 /******************************************/
54
55
56 /*
57  * XXX: I shouldn't really use this BUFFER_LEN variable but scanf is so
58  * lame and it'll take me a while to write a replacement.
59  */
60 #define BUFFER_LEN 1024
61
62 #define PROCFS_TEMPLATE "/proc/%d/stat"
63 #define PROCFS_TEMPLATE_MEM "/proc/%d/statm"
64 #define PROCFS_CMDLINE_TEMPLATE "/proc/%d/cmdline"
65
66
67 /******************************************/
68 /* Globals                                */
69 /******************************************/
70
71
72
73
74
75
76
77 /******************************************/
78 /* Process class                          */
79 /******************************************/
80
81 /*
82  * Pointer to head of process list
83  */
84 void process_find_top(struct process **);