1 /* $OpenBSD: machine.h,v 1.2 1997/08/22 07:16:28 downsj Exp $ */ 2 3 /* 4 * This file defines the interface between top and the machine-dependent 5 * module. It is NOT machine dependent and should not need to be changed 6 * for any specific machine. 7 */ 8 9 /* 10 * the statics struct is filled in by machine_init 11 */ 12 struct statics 13 { 14 char **procstate_names; 15 char **cpustate_names; 16 char **memory_names; 17 #ifdef ORDER 18 char **order_names; 19 #endif 20 }; 21 22 /* 23 * the system_info struct is filled in by a machine dependent routine. 24 */ 25 26 struct system_info 27 { 28 int last_pid; 29 double load_avg[NUM_AVERAGES]; 30 int p_total; 31 int p_active; /* number of procs considered "active" */ 32 int *procstates; 33 int *cpustates; 34 int *memory; 35 }; 36 37 /* cpu_states is an array of percentages * 10. For example, 38 the (integer) value 105 is 10.5% (or .105). 39 */ 40 41 /* 42 * the process_select struct tells get_process_info what processes we 43 * are interested in seeing 44 */ 45 46 struct process_select 47 { 48 int idle; /* show idle processes */ 49 int system; /* show system processes */ 50 int uid; /* only this uid (unless uid == -1) */ 51 char *command; /* only this command (unless == NULL) */ 52 }; 53 54 /* prototypes */ 55 extern int display_init __P((struct statics *)); 56 57 /* machine.c */ 58 extern int machine_init __P((struct statics *)); 59 extern char *format_header __P((char *)); 60 extern void get_system_info __P((struct system_info *)); 61 extern caddr_t get_process_info __P((struct system_info *, 62 struct process_select *, 63 int (*)(const void *, const void *))); 64 extern char *format_next_process __P((caddr_t, char *(*)())); 65 extern int proc_compate __P((const void *, const void *)); 66 extern int proc_owner __P((pid_t)); 67