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