xref: /freebsd/usr.bin/top/top.h (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1 /*-
2  * Top - a top users display for Berkeley Unix
3  */
4 
5 #ifndef TOP_H
6 #define TOP_H
7 
8 #include <unistd.h>
9 
10 /* Number of lines of header information on the standard screen */
11 extern int Header_lines;
12 
13 /* Special atoi routine returns either a non-negative number or one of: */
14 #define Infinity	-1
15 #define Invalid		-2
16 
17 /* maximum number we can have */
18 #define Largest		0x7fffffff
19 
20 /* Exit code for system errors */
21 #define TOP_EX_SYS_ERROR	23
22 
23 enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX };
24 
25 /*
26  * Format modifiers
27  */
28 #define FMT_SHOWARGS 0x00000001
29 
30 extern enum displaymodes displaymode;
31 
32 extern int pcpu_stats;
33 extern int overstrike;
34 extern pid_t mypid;
35 
36 extern int (*compares[])(const void*, const void*);
37 
38 extern int show_args;
39 
40 const char* kill_procs(char *);
41 const char* renice_procs(char *);
42 
43 extern char copyright[];
44 
45 void quit(int);
46 
47 /*
48  *  The space command forces an immediate update.  Sometimes, on loaded
49  *  systems, this update will take a significant period of time (because all
50  *  the output is buffered).  So, if the short-term load average is above
51  *  "LoadMax", then top will put the cursor home immediately after the space
52  *  is pressed before the next update is attempted.  This serves as a visual
53  *  acknowledgement of the command.
54  */
55 #define LoadMax  5.0
56 
57 /*
58  *  "Nominal_TOPN" is used as the default TOPN when
59  *  the output is a dumb terminal.  If we didn't do this, then
60  *  we will get every
61  *  process in the system when running top on a dumb terminal (or redirected
62  *  to a file).  Note that Nominal_TOPN is a default:  it can still be
63  *  overridden on the command line, even with the value "infinity".
64  */
65 #define Nominal_TOPN	18
66 
67 #endif /* TOP_H */
68