xref: /freebsd/usr.bin/top/top.h (revision c5fda9bac0325eb8c5b447717862d279006f318f)
1 /*
2  * $FreeBSD$
3  */
4 /*
5  *  Top - a top users display for Berkeley Unix
6  *
7  *  General (global) definitions
8  */
9 
10 #ifndef TOP_H
11 #define TOP_H
12 
13 #include <unistd.h>
14 
15 #define Default_DELAY 2
16 
17 /* Number of lines of header information on the standard screen */
18 extern int Header_lines;	/* 7 */
19 
20 /* Maximum number of columns allowed for display */
21 #define MAX_COLS	512
22 
23 /* Special atoi routine returns either a non-negative number or one of: */
24 #define Infinity	-1
25 #define Invalid		-2
26 
27 /* maximum number we can have */
28 #define Largest		0x7fffffff
29 
30 /*
31  * The entire display is based on these next numbers being defined as is.
32  */
33 
34 /* Exit code for system errors */
35 #define TOP_EX_SYS_ERROR	23
36 
37 enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX };
38 
39 /*
40  * Format modifiers
41  */
42 #define FMT_SHOWARGS 0x00000001
43 
44 extern enum displaymodes displaymode;
45 
46 extern int pcpu_stats;
47 extern int overstrike;
48 extern pid_t mypid;
49 
50 
51 extern const char * myname;
52 
53 extern int (*compares[])(const void*, const void*);
54 
55 char* kill_procs(char *);
56 char* renice_procs(char *);
57 
58 extern char copyright[];
59 
60 void quit(int);
61 
62 /*
63  *  The space command forces an immediate update.  Sometimes, on loaded
64  *  systems, this update will take a significant period of time (because all
65  *  the output is buffered).  So, if the short-term load average is above
66  *  "LoadMax", then top will put the cursor home immediately after the space
67  *  is pressed before the next update is attempted.  This serves as a visual
68  *  acknowledgement of the command.
69  */
70 #define LoadMax  5.0
71 
72 /*
73  *  "Nominal_TOPN" is used as the default TOPN when
74  *  the output is a dumb terminal.  If we didn't do this, then
75  *  we will get every
76  *  process in the system when running top on a dumb terminal (or redirected
77  *  to a file).  Note that Nominal_TOPN is a default:  it can still be
78  *  overridden on the command line, even with the value "infinity".
79  */
80 #define Nominal_TOPN	18
81 
82 /*
83  *  If the local system's getpwnam interface uses random access to retrieve
84  *  a record (i.e.: 4.3 systems, Sun "yellow pages"), then defining
85  *  RANDOM_PW will take advantage of that fact.
86  */
87 
88 #define RANDOM_PW	1
89 
90 #endif /* TOP_H */
91