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