Annotation of coherent/b/bin/ps/ps3.0/nps.c, revision 1.1.1.1

1.1       root        1: #include "ps.h"
                      2: 
                      3: /*
                      4:  * Print out process status.
                      5:  */
                      6: void
                      7: main(argc, argv)
                      8:        int argc;
                      9:        char *argv[];
                     10: {
                     11:        int i;          /* Every program needs a loop counter :-).  */
                     12:        int num_procs;  /* How many processes are there? */
                     13:        /*
                     14:         * The command arguments in argv are digested into 'args'.
                     15:         */
                     16:        PROC_ARGS args;
                     17: 
                     18:        /*
                     19:         * proc_table is the process table as read from /dev/proc.
                     20:         */
                     21:        PROC *proc_table;
                     22: 
                     23:        /*
                     24:         * proc_data is the table of all information for each process.
                     25:         * It includes pointers into proc_table, and lots of other
                     26:         * goodies.
                     27:         */
                     28:        PROC_DATA *proc_data;
                     29: 
                     30:        /*
                     31:         * Digest the command line.
                     32:         *
                     33:         * This routine will not return if there are errors in
                     34:         * the command line.
                     35:         */
                     36:        cvt_args( &args, argc, argv );
                     37: 
                     38:        /*
                     39:         * Read in all that handy cached information.
                     40:         */
                     41:        /*
                     42:         * There is no caching yet.
                     43:         */
                     44: 
                     45:        /*
                     46:         * Read in the process table.  Note that memory for
                     47:         * proc_table will be allocated.
                     48:         *
                     49:         * The number of processes (i.e. the size of proc_table)
                     50:         * will be returned in num_procs.
                     51:         */
                     52:        proc_table = create_proc_table( &num_procs, &args );
                     53: 
                     54:        /*
                     55:         * Pull together all the data for each process into
                     56:         * a single table of PROC_DATA structures.
                     57:         */
                     58:        proc_data = create_proc_data( proc_table, num_procs, &args );
                     59:        
                     60:        /*
                     61:         * Print any headers we might need.
                     62:         */
                     63:        print_headers( &args );
                     64: 
                     65:        /*
                     66:         * Walk through proc_data[] printing each appropriate entry.
                     67:         */
                     68:        for ( i = 0; i < num_procs; ++i ) {
                     69:                if ( wanted_process( &proc_data[i], &args ) ) {
                     70:                        print_process( &proc_data[i], &args );
                     71:                }
                     72:        }
                     73: 
                     74: } /* main() */
                     75: 
                     76: /*
                     77:  * Digest the command line.
                     78:  */
                     79: void
                     80: cvt_args( args, argc, argv )
                     81:        PROC_ARGS *args;
                     82:        int argc;
                     83:        char *argv[];
                     84: {
                     85: } /* cvt_args() */
                     86: 
                     87: /*
                     88:  * Is this process one we want to print?
                     89:  */
                     90: boolean
                     91: wanted_process( process, args )
                     92:        PROC_DATA *process;
                     93:        PROC_ARGS *args;
                     94: {
                     95:        return( TRUE ); /* STUB */
                     96: } /* wanted_process() */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.