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