1: /* sh.proc.h 4.1 10/9/80 */
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: short p_pid;
23: short p_jobid; /* pid of job leader */
24: /* if a job is stopped/background p_jobid gives its pgrp */
25: time_t p_btime; /* begin time */
26: time_t p_etime; /* end time */
27: long p_stime; /* system cpu time */
28: long p_utime; /* user cpu time */
29: #ifdef VMUNIX
30: struct vtimes p_vtimes;
31: #endif
32: char *p_command; /* first PMAXLEN chars of command */
33: };
34:
35: /* flag values for p_flags */
36: #define PRUNNING (1<<0) /* running */
37: #define PSTOPPED (1<<1) /* stopped */
38: #define PNEXITED (1<<2) /* normally exited */
39: #define PAEXITED (1<<3) /* abnormally exited */
40: #define PSIGNALED (1<<4) /* terminated by a signal != SIGINT */
41:
42: #define PALLSTATES (PRUNNING|PSTOPPED|PNEXITED|PAEXITED|PSIGNALED|PINTERRUPTED)
43: #define PNOTIFY (1<<5) /* notify async when done */
44: #define PTIME (1<<6) /* job times should be printed */
45: #define PAWAITED (1<<7) /* top level is waiting for it */
46: #define PFOREGND (1<<8) /* started in shells pgrp */
47: #define PDUMPED (1<<9) /* process dumped core */
48: #define PDIAG (1<<10) /* diagnostic output also piped out */
49: #define PPOU (1<<11) /* piped output */
50: #define PREPORTED (1<<12) /* status has been reported */
51: #define PINTERRUPTED (1<<13) /* job stopped via interrupt signal */
52: #define PPTIME (1<<14) /* time individual process */
53: #define PNEEDNOTE (1<<15) /* notify as soon as practical */
54:
55: #define PNULL (struct process *)0
56: #define PMAXLEN 80
57:
58: /* defines for arguments to pprint */
59: #define NUMBER 01
60: #define NAME 02
61: #define REASON 04
62: #define AMPERSAND 010
63: #define FANCY 020
64: #define SHELLDIR 040 /* print shell's dir if not the same */
65: #define JOBDIR 0100 /* print job's dir if not the same */
66: #define AREASON 0200
67:
68: struct process proclist; /* list head of all processes */
69: bool pnoprocesses; /* pchild found nothing to wait for */
70:
71: struct process *pholdjob; /* one level stack of current jobs */
72:
73: struct process *pcurrjob; /* current job */
74: struct process *pcurrent; /* current job in table */
75: struct process *pprevious; /* previous job in table */
76:
77: short pmaxindex; /* current maximum job index */
78:
79: bool timesdone; /* shtimes buffer full ? */
80:
81: int psigint();
82: struct process *pgetcurr();
83: struct process *plookup();
84: struct process *pfind();
Defined variables
proclist
defined in line
68; used 14 times
- in /usr/src/ucb/csh/sh.proc.c line
51,
162,
186,
273,
290,
322,
401,
416-417(2),
713,
931,
954,
960,
995
Defined struct's
process
defined in line
15; used 94 times
- in line 16-17(4),
68-75(10),
82-84(6)
- in /usr/src/ucb/csh/sh.proc.c line
24-25(4),
158(2),
180(2),
207-209(4),
266(2),
288(2),
301-303(4),
334(2),
361-364(6),
380(2),
398(2),
516(2),
537-540(4),
665(2),
673(2),
701(2),
728(2),
747(2),
763(2),
779(2),
840(2),
897-900(4),
928(2),
936-940(4),
988-993(8),
1012(2)
Defined macros
FANCY
defined in line
63; used 3 times
NAME
defined in line
60; used 7 times
PDIAG
defined in line
48; used 2 times
PNULL
defined in line
55; used 15 times
- in /usr/src/ucb/csh/sh.proc.c line
51,
162,
186,
290,
338,
411-413(2),
496,
507,
943-948(2),
959,
993,
1000,
1065
PPOU
defined in line
49; used 2 times
PRUNNING
defined in line
36; used 17 times
- in line 42
- in /usr/src/ucb/csh/sh.proc.c line
58,
100,
113,
167,
214(2),
228,
275,
366(2),
637,
656,
716,
861,
907-908(2)
PSTOPPED
defined in line
37; used 22 times
- in line 42
- in /usr/src/ucb/csh/sh.proc.c line
58-60(2),
100,
116-121(2),
129,
144,
167,
235-243(4),
518,
637,
656,
716,
907-909(2),
921,
932,
998
PTIME
defined in line
44; used 6 times
Usage of this include