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