2 * Copyright (c) 1984 through 2008, William LeFebvre
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
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
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.
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.
34 * This file defines the interface between top and the machine-dependent
35 * module. It is NOT machine dependent and should not need to be changed
36 * for any specific machine.
45 * The statics struct is filled in by machine_init. Fields marked as
46 * "optional" are not filled in by every module.
50 const char **procstate_names
;
51 const char **cpustate_names
;
52 const char **memory_names
;
53 const char **swap_names
; /* optional */
54 const char **order_names
; /* optional */
55 const char **top_color_names
; /* optional */
56 const char **kernel_names
; /* optional */
57 time_t boottime
; /* optional */
58 int modemax
; /* optional */
59 int ncpu
; /* optional */
61 unsigned int fullcmds
: 1;
62 unsigned int idle
: 1;
63 unsigned int warmup
: 1;
64 unsigned int threads
: 1;
69 * the system_info struct is filled in by a machine dependent routine.
72 #ifdef p_active /* uw7 define macro p_active */
73 #define P_ACTIVE p_pactive
75 #define P_ACTIVE p_active
81 double load_avg
[NUM_AVERAGES
];
83 int P_ACTIVE
; /* number of procs considered "active" */
91 /* cpu_states is an array of percentages * 10. For example,
92 the (integer) value 105 is 10.5% (or .105).
96 * the process_select struct tells get_process_info what processes we
97 * are interested in seeing
100 struct process_select
102 int idle
; /* show idle processes */
103 int system
; /* show system processes */
104 int fullcmd
; /* show full command */
105 int usernames
; /* show usernames */
106 int uid
; /* only this uid (unless uid == -1) */
107 char *command
; /* only this command (unless == NULL) */
108 int mode
; /* select display mode (0 is default) */
109 int threads
; /* show threads separately */
110 pid_t pid
; /* show only this pid (unless pid == -1) */
113 /* routines defined by the machine dependent module */
114 int machine_init(struct statics
*);
115 void get_system_info(struct system_info
*);
116 caddr_t
get_process_info(struct system_info
*, struct process_select
*, int);
117 char *format_header(char *);
118 char *format_next_process(caddr_t
, char *(*)(int));
120 #ifdef HAVE_FORMAT_PROCESS_HEADER
122 #endif /* _MACHINE_H_ */
123 char *format_process_header(struct process_select
*sel
, caddr_t handle
, int count
);