Annotation of researchv10no/cmd/ps/ps.h, revision 1.1

1.1     ! root        1: #include <string.h>
        !             2: #include <sys/param.h>
        !             3: #include <sys/stat.h>
        !             4: #include <sys/user.h>
        !             5: #include <sys/proc.h>
        !             6: #include <sys/reg.h>
        !             7: #include <sys/pioctl.h>
        !             8: #include <sys/pte.h>
        !             9: #include <sys/vm.h>
        !            10: 
        !            11: #define        UBASE   (long)USRSTACK
        !            12: #define NSTACK 8192
        !            13: 
        !            14: char *malloc();
        !            15: #define Malloc(type,n)         (type *)malloc((n)*sizeof(type))
        !            16: 
        !            17: #define Kread(addr, destp)     ((addr) && kread(addr, (char *)destp, sizeof(*(destp))))
        !            18: 
        !            19: #define min(a,b)       ((a) <= (b) ? (a) : (b))
        !            20: #define max(a,b)       ((a) >= (b) ? (a) : (b))
        !            21: #define minmax(x,a,b)  min(b,max(a,x))
        !            22: 
        !            23: #define ENTRYSIZ       DIRSIZ
        !            24: 
        !            25: typedef struct Entry {
        !            26:        struct Entry *next;
        !            27:        unsigned int e_val;
        !            28:        char e_name[ENTRYSIZ];
        !            29: } Entry;
        !            30: 
        !            31: typedef struct List {
        !            32:        struct List *next;
        !            33:        int nentry;
        !            34:        struct Entry *begin;
        !            35: } List;
        !            36: 
        !            37: typedef struct Select {
        !            38:        long flag;
        !            39:        char *id;
        !            40:        dev_t dev; ino_t ino;
        !            41: } Select;
        !            42: 
        !            43: #define        SELTTY  1
        !            44: #define SELXFL 2
        !            45: #define SELFIL 4
        !            46: 
        !            47: typedef struct Psline {
        !            48:        int weight;
        !            49:        char *string;
        !            50: } Psline;
        !            51: 
        !            52: int Pslcomp();
        !            53: char *printp(), *fdprint(), *iprint();
        !            54: char *gettty(), *getfs(), *getuname(), *getargs(), *memcpy();
        !            55: char *lookdir();
        !            56: List *devlist, *prlist, *getdir();
        !            57: Select *selbeg, *selend;
        !            58: int Fflag, fflag, hflag, lflag, Nflag, nflag, Tflag, uflag;
        !            59: int aflag, rflag, tflag, xflag;
        !            60: int mypid, myuid;
        !            61: int drum, memory;
        !            62: char *drumf, *memf, *nlistf;
        !            63: 
        !            64: char *progname;
        !            65: 
        !            66: long lseek();
        !            67: 
        !            68: /*
        !            69:  * data-fetching functions
        !            70:  */
        !            71: extern struct ftab {
        !            72:        int (*f_proc)();        /* fetch a particular proc entry */
        !            73:        List *(*f_prlist)();    /* fetch list of all processes */
        !            74:        char *(*f_uarea)();     /* fetch user block */
        !            75:        int (*f_stack)();       /* fetch top of stack seg, for arguments */
        !            76:        int (*f_kread)();               /* read kernel memory */
        !            77:        int (*f_init)();                /* init, open files */
        !            78: } ftab[];
        !            79: int mode;              /* index into ftab */
        !            80: 
        !            81: #define        getproc(s, pp)  (*ftab[mode].f_proc)(s, pp)
        !            82: #define        getprlist()     (*ftab[mode].f_prlist)()
        !            83: #define        getuarea(f, p, u)       (*ftab[mode].f_uarea)(f, p, u)
        !            84: #define        getstack(f, p, u, s)    (*ftab[mode].f_stack)(f, p, u, s)
        !            85: #define        kread(a, b, s)  (*ftab[mode].f_kread)(a, b, s)
        !            86: #define        openfiles()     (*ftab[mode].f_init)();

unix.superglobalmegacorp.com

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