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