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