[BACK]Return to machine.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / top

Annotation of src/usr.bin/top/machine.h, Revision 1.6

1.6     ! deraadt     1: /*     $OpenBSD: machine.h,v 1.5 2002/06/12 06:07:16 mpech Exp $       */
        !             2:
        !             3: /*
        !             4:  *  Top users/processes display for Unix
        !             5:  *  Version 3
        !             6:  *
        !             7:  * Copyright (c) 1984, 1989, William LeFebvre, Rice University
        !             8:  * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
        !             9:  *
        !            10:  * Redistribution and use in source and binary forms, with or without
        !            11:  * modification, are permitted provided that the following conditions
        !            12:  * are met:
        !            13:  * 1. Redistributions of source code must retain the above copyright
        !            14:  *    notice, this list of conditions and the following disclaimer.
        !            15:  * 2. Redistributions in binary form must reproduce the above copyright
        !            16:  *    notice, this list of conditions and the following disclaimer in the
        !            17:  *    documentation and/or other materials provided with the distribution.
        !            18:  *
        !            19:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            20:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            21:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            22:  * IN NO EVENT SHALL THE AUTHOR OR HIS EMPLOYER BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            23:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            24:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            25:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            26:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            27:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            28:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            29:  */
1.1       downsj     30:
                     31: /*
                     32:  *  This file defines the interface between top and the machine-dependent
                     33:  *  module.  It is NOT machine dependent and should not need to be changed
                     34:  *  for any specific machine.
                     35:  */
                     36:
                     37: /*
                     38:  * the statics struct is filled in by machine_init
                     39:  */
                     40: struct statics
                     41: {
                     42:     char **procstate_names;
                     43:     char **cpustate_names;
                     44:     char **memory_names;
                     45: #ifdef ORDER
                     46:     char **order_names;
                     47: #endif
                     48: };
                     49:
                     50: /*
                     51:  * the system_info struct is filled in by a machine dependent routine.
                     52:  */
                     53:
                     54: struct system_info
                     55: {
1.5       mpech      56:     pid_t  last_pid;
1.1       downsj     57:     double load_avg[NUM_AVERAGES];
                     58:     int    p_total;
                     59:     int    p_active;     /* number of procs considered "active" */
                     60:     int    *procstates;
                     61:     int    *cpustates;
                     62:     int    *memory;
                     63: };
                     64:
                     65: /* cpu_states is an array of percentages * 10.  For example,
                     66:    the (integer) value 105 is 10.5% (or .105).
                     67:  */
                     68:
                     69: /*
                     70:  * the process_select struct tells get_process_info what processes we
                     71:  * are interested in seeing
                     72:  */
                     73:
                     74: struct process_select
                     75: {
                     76:     int idle;          /* show idle processes */
                     77:     int system;                /* show system processes */
                     78:     int uid;           /* only this uid (unless uid == -1) */
                     79:     char *command;     /* only this command (unless == NULL) */
                     80: };
                     81:
1.2       downsj     82: /* prototypes */
1.3       millert    83: extern int display_init(struct statics *);
1.1       downsj     84:
1.2       downsj     85: /* machine.c */
1.3       millert    86: extern int machine_init(struct statics *);
                     87: extern char *format_header(char *);
                     88: extern void get_system_info(struct system_info *);
1.4       millert    89: extern caddr_t get_process_info(struct system_info *, struct process_select *,
                     90:     int (*)(const void *, const void *));
                     91: extern char *format_next_process(caddr_t, char *(*)());
1.3       millert    92: extern int proc_compate(const void *, const void *);
                     93: extern int proc_owner(pid_t);