Annotation of 42BSD/bin/csh/sh.proc.h, revision 1.1.1.1

1.1       root        1: /* sh.proc.h 4.4 2/9/83 */
                      2: 
                      3: /*
                      4:  * C shell - process structure declarations
                      5:  */
                      6: 
                      7: /*
                      8:  * Structure for each process the shell knows about:
                      9:  *     allocated and filled by pcreate.
                     10:  *     flushed by pflush; freeing always happens at top level
                     11:  *         so the interrupt level has less to worry about.
                     12:  *     processes are related to "friends" when in a pipeline;
                     13:  *         p_friends links makes a circular list of such jobs
                     14:  */
                     15: struct process {
                     16:        struct  process *p_next;        /* next in global "proclist" */
                     17:        struct  process *p_friends;     /* next in job list (or self) */
                     18:        struct  directory *p_cwd;       /* cwd of the job (only in head) */
                     19:        short   unsigned p_flags;       /* various job status flags */
                     20:        char    p_reason;               /* reason for entering this state */
                     21:        char    p_index;                /* shorthand job index */
                     22:        int     p_pid;
                     23:        int     p_jobid;                /* pid of job leader */
                     24:        /* if a job is stopped/background p_jobid gives its pgrp */
                     25:        struct  timeval p_btime;        /* begin time */
                     26:        struct  timeval p_etime;        /* end time */
                     27:        struct  rusage p_rusage;
                     28:        long    p_utime;        /* XXX */
                     29:        long    p_stime;        /* XXX */
                     30:        char    *p_command;             /* first PMAXLEN chars of command */
                     31: };
                     32: 
                     33: /* flag values for p_flags */
                     34: #define        PRUNNING        (1<<0)          /* running */
                     35: #define        PSTOPPED        (1<<1)          /* stopped */
                     36: #define        PNEXITED        (1<<2)          /* normally exited */
                     37: #define        PAEXITED        (1<<3)          /* abnormally exited */
                     38: #define        PSIGNALED       (1<<4)          /* terminated by a signal != SIGINT */
                     39: 
                     40: #define        PALLSTATES      (PRUNNING|PSTOPPED|PNEXITED|PAEXITED|PSIGNALED|PINTERRUPTED)
                     41: #define        PNOTIFY         (1<<5)          /* notify async when done */
                     42: #define        PTIME           (1<<6)          /* job times should be printed */
                     43: #define        PAWAITED        (1<<7)          /* top level is waiting for it */
                     44: #define        PFOREGND        (1<<8)          /* started in shells pgrp */
                     45: #define        PDUMPED         (1<<9)          /* process dumped core */
                     46: #define        PDIAG           (1<<10)         /* diagnostic output also piped out */
                     47: #define        PPOU            (1<<11)         /* piped output */
                     48: #define        PREPORTED       (1<<12)         /* status has been reported */
                     49: #define        PINTERRUPTED    (1<<13)         /* job stopped via interrupt signal */
                     50: #define        PPTIME          (1<<14)         /* time individual process */
                     51: #define        PNEEDNOTE       (1<<15)         /* notify as soon as practical */
                     52: 
                     53: #define        PNULL           (struct process *)0
                     54: #define        PMAXLEN         80
                     55: 
                     56: /* defines for arguments to pprint */
                     57: #define        NUMBER          01
                     58: #define        NAME            02
                     59: #define        REASON          04
                     60: #define        AMPERSAND       010
                     61: #define        FANCY           020
                     62: #define        SHELLDIR        040             /* print shell's dir if not the same */
                     63: #define        JOBDIR          0100            /* print job's dir if not the same */
                     64: #define        AREASON         0200
                     65: 
                     66: struct process proclist;               /* list head of all processes */
                     67: bool   pnoprocesses;                   /* pchild found nothing to wait for */
                     68: 
                     69: struct process *pholdjob;              /* one level stack of current jobs */
                     70: 
                     71: struct process *pcurrjob;              /* current job */
                     72: struct process *pcurrent;              /* current job in table */
                     73: struct process *pprevious;             /* previous job in table */
                     74: 
                     75: short  pmaxindex;                      /* current maximum job index */
                     76: 
                     77: bool   timesdone;                      /* shtimes buffer full ? */
                     78: 
                     79: int    psigint();
                     80: struct process *pgetcurr();
                     81: struct process *plookup();
                     82: struct process *pfind();

unix.superglobalmegacorp.com

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