|
|
1.1 ! root 1: /* proc.h 6.1 83/07/29 */ ! 2: ! 3: #ifdef KERNEL ! 4: #include "../h/ipc.h" ! 5: #include "../h/shm.h" ! 6: #include "../h/sem.h" ! 7: #else ! 8: #include <sys/ipc.h> ! 9: #include <sys/shm.h> ! 10: #include <sys/sem.h> ! 11: #endif KERNEL ! 12: ! 13: /* ! 14: * One structure allocated per active ! 15: * process. It contains all data needed ! 16: * about the process while the ! 17: * process may be swapped out. ! 18: * Other per process data (user.h) ! 19: * is swapped with the process. ! 20: */ ! 21: struct proc { ! 22: struct proc *p_link; /* linked list of running processes */ ! 23: struct proc *p_rlink; ! 24: struct pte *p_addr; /* u-area kernel map address */ ! 25: char p_usrpri; /* user-priority based on p_cpu and p_nice */ ! 26: char p_pri; /* priority, negative is high */ ! 27: char p_cpu; /* cpu usage for scheduling */ ! 28: char p_stat; ! 29: char p_time; /* resident time for scheduling */ ! 30: char p_nice; /* nice for cpu usage */ ! 31: char p_slptime; /* time since last block */ ! 32: char p_cursig; ! 33: int p_sig; /* signals pending to this process */ ! 34: int p_sigmask; /* current signal mask */ ! 35: int p_sigignore; /* signals being ignored */ ! 36: int p_sigcatch; /* signals being caught by user */ ! 37: int p_flag; ! 38: short p_uid; /* user id, used to direct tty signals */ ! 39: short p_pgrp; /* name of process group leader */ ! 40: short p_pid; /* unique process id */ ! 41: short p_ppid; /* process id of parent */ ! 42: u_short p_xstat; /* Exit status for wait */ ! 43: struct rusage *p_ru; /* mbuf holding exit information */ ! 44: short p_poip; /* page outs in progress */ ! 45: short p_szpt; /* copy of page table size */ ! 46: size_t p_tsize; /* size of text (clicks) */ ! 47: size_t p_dsize; /* size of data space (clicks) */ ! 48: size_t p_ssize; /* copy of stack size (clicks) */ ! 49: size_t p_rssize; /* current resident set size in clicks */ ! 50: size_t p_maxrss; /* copy of u.u_rlimit[MAXRSS] */ ! 51: size_t p_swrss; /* resident set size before last swap */ ! 52: swblk_t p_swaddr; /* disk address of u area when swapped */ ! 53: caddr_t p_wchan; /* event process is awaiting */ ! 54: /* begin shared memory stuff */ ! 55: struct sem_undo *p_sem_undo; /* ptr to process undo struct */ ! 56: struct pte *p_smbeg; /* starting pte for shared memory */ ! 57: struct pte *p_smend; /* ending pte for shared memory */ ! 58: struct shm_pt p_shmpt[SHMSEG]; /*shared memory structures */ ! 59: /* end shared memory stuff */ ! 60: struct text *p_textp; /* pointer to text structure */ ! 61: struct pte *p_p0br; /* page table base P0BR */ ! 62: struct pte *p_p1br; /* page table base P1BR */ ! 63: struct proc *p_xlink; /* linked list of procs sharing same text */ ! 64: short p_cpticks; /* ticks of cpu time */ ! 65: float p_pctcpu; /* %cpu for this process during p_time */ ! 66: short p_ndx; /* proc index for memall (because of vfork) */ ! 67: short p_idhash; /* hashed based on p_pid for kill+exit+... */ ! 68: struct proc *p_pptr; /* pointer to process structure of parent */ ! 69: struct proc *p_cptr; /* pointer to youngest living child */ ! 70: struct proc *p_osptr; /* pointer to older sibling processes */ ! 71: struct proc *p_ysptr; /* pointer to younger siblings */ ! 72: struct itimerval p_realtimer; ! 73: struct quota *p_quota; /* quotas for this process */ ! 74: int p_ckey; /* code key for this process or 0 */ ! 75: int p_dkey; /* data key for this process or 0 */ ! 76: }; ! 77: ! 78: #define PIDHSZ 63 ! 79: #define PIDHASH(pid) ((pid) % PIDHSZ) ! 80: ! 81: #ifdef KERNEL ! 82: short pidhash[PIDHSZ]; ! 83: struct proc *pfind(); ! 84: struct proc *proc, *procNPROC; /* the proc table itself */ ! 85: int nproc; ! 86: ! 87: #define NQS 32 /* 32 run queues */ ! 88: struct prochd { ! 89: struct proc *ph_link; /* linked list of running processes */ ! 90: struct proc *ph_rlink; ! 91: } qs[NQS]; ! 92: int whichqs; /* bit mask summarizing non-empty qs's */ ! 93: #endif ! 94: ! 95: /* stat codes */ ! 96: #define SSLEEP 1 /* awaiting an event */ ! 97: #define SWAIT 2 /* (abandoned state) */ ! 98: #define SRUN 3 /* running */ ! 99: #define SIDL 4 /* intermediate state in process creation */ ! 100: #define SZOMB 5 /* intermediate state in process termination */ ! 101: #define SSTOP 6 /* process being traced */ ! 102: ! 103: /* flag codes */ ! 104: #define SLOAD 0x0000001 /* in core */ ! 105: #define SSYS 0x0000002 /* swapper or pager process */ ! 106: #define SLOCK 0x0000004 /* process being swapped out */ ! 107: #define SSWAP 0x0000008 /* save area flag */ ! 108: #define STRC 0x0000010 /* process is being traced */ ! 109: #define SWTED 0x0000020 /* another tracing flag */ ! 110: #define SULOCK 0x0000040 /* user settable lock in core */ ! 111: #define SPAGE 0x0000080 /* process in page wait state */ ! 112: #define SKEEP 0x0000100 /* another flag to prevent swap out */ ! 113: #define SOMASK 0x0000200 /* restore old mask after taking signal */ ! 114: #define SWEXIT 0x0000400 /* working on exiting */ ! 115: #define SPHYSIO 0x0000800 /* doing physical i/o (bio.c) */ ! 116: #define SVFORK 0x0001000 /* process resulted from vfork() */ ! 117: #define SVFDONE 0x0002000 /* another vfork flag */ ! 118: #define SNOVM 0x0004000 /* no vm, parent in a vfork() */ ! 119: #define SPAGI 0x0008000 /* init data space on demand, from inode */ ! 120: #define SSEQL 0x0010000 /* user warned of sequential vm behavior */ ! 121: #define SUANOM 0x0020000 /* user warned of random vm behavior */ ! 122: #define STIMO 0x0040000 /* timing out during sleep */ ! 123: /* was SDETACH */ ! 124: #define SOUSIG 0x0100000 /* using old signal mechanism */ ! 125: #define SOWEUPC 0x0200000 /* owe process an addupc() call at next ast */ ! 126: #define SSEL 0x0400000 /* selecting; wakeup/waiting danger */ ! 127: #define SLOGIN 0x0800000 /* a login process (legit child of init) */ ! 128: #define SPTECHG 0x1000000 /* pte's for process have changed */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.