top - Import DragonFly specific patches for 3.8beta1.
[dragonfly.git] / contrib / top / top.h
1 /*
2  * Copyright (c) 1984 through 2008, William LeFebvre
3  * All rights reserved.
4  * 
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 
11  *     * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following disclaimer
13  * in the documentation and/or other materials provided with the
14  * distribution.
15  * 
16  *     * Neither the name of William LeFebvre nor the names of other
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  * 
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 /*
34  *  Top - a top users display for Berkeley Unix
35  *
36  *  General (global) definitions
37  */
38
39 #ifndef _TOP_H_
40 #define _TOP_H_
41
42 #include <sys/time.h>
43
44 /* Maximum number of columns allowed for display */
45 #define MAX_COLS        255
46
47 /* Log base 2 of 1024 is 10 (2^10 == 1024) */
48 #define LOG1024         10
49
50 /* Special atoi routine returns either a non-negative number or one of: */
51 #define Infinity        -1
52 #define Invalid         -2
53
54 /* maximum number we can have */
55 #define Largest         0x7fffffff
56
57 /*
58  * The entire display is based on these next numbers being defined as is.
59  */
60
61 #define NUM_AVERAGES    3
62
63 struct ext_decl {
64     int (*f_minibar)(char *, int);
65     int (*f_display)(char *, int);
66 };
67
68 /*
69  *  "Table_size" defines the size of the hash tables used to map uid to
70  *  username.  Things will work best if the number is a prime number.
71  *  We use a number that should be suitable for most installations.
72  */
73 #ifndef Table_size
74 #define Table_size      8191
75 #endif
76
77 void gettime(struct timeval *);
78 void quit(int);
79
80 int n_cpus;
81 int enable_ncpus;
82
83 #endif /* _TOP_H_ */