|
|
1.1 ! root 1: #ifndef _LNODE_ ! 2: #ifdef KERNEL ! 3: #include "../h/lnode.h" ! 4: #else ! 5: #include <sys/lnode.h> ! 6: #endif ! 7: #endif ! 8: ! 9: /* ! 10: * One structure allocated per active ! 11: * process. It contains all data needed ! 12: * about the process while the ! 13: * process may be swapped out. ! 14: * Other per process data (user.h) ! 15: * is swapped with the process. ! 16: */ ! 17: ! 18: struct proc ! 19: { ! 20: struct proc *p_link; /* linked list of running processes */ ! 21: struct proc *p_rlink; /* (used by hardware q instructions) */ ! 22: struct pte *p_addr; /* u-area kernel map address */ ! 23: char p_usrpri; /* user-priority based on p_cpu and p_nice */ ! 24: char p_pri; /* priority, negative is high */ ! 25: u_char p_cpu; /* cpu usage for scheduling */ ! 26: char p_stat; ! 27: char p_time; /* resident time for scheduling */ ! 28: char p_nice; /* nice for cpu usage */ ! 29: char p_slptime; /* time since last block */ ! 30: char p_cursig; ! 31: long p_sig; /* signals pending to this process */ ! 32: long p_siga0; /* low bit of 2 bit signal action */ ! 33: long p_siga1; /* high bit of 2 bit signal action */ ! 34: #define p_ignsig p_siga0 /* ignored signal mask */ ! 35: int p_flag; ! 36: short p_uid; /* user id, used to direct tty signals */ ! 37: short p_pgrp; /* name of process group leader */ ! 38: short p_pid; /* unique process id */ ! 39: short p_ppid; /* process id of parent */ ! 40: KL_p p_lnode; /* per-user scheduling */ ! 41: float p_sharepri; /* priority based on p_nice and p_lnode->kl.l_usage */ ! 42: short p_poip; /* count of page outs in progress */ ! 43: short p_szpt; /* copy of page table size */ ! 44: size_t p_tsize; /* size of text (clicks) */ ! 45: size_t p_dsize; /* size of data space (clicks) */ ! 46: size_t p_ssize; /* copy of stack size (clicks) */ ! 47: size_t p_rssize; /* current resident set size in clicks */ ! 48: size_t p_maxrss; /* copy of u.u_limit[MAXRSS] */ ! 49: size_t p_swrss; /* resident set size before last swap */ ! 50: swblk_t p_swaddr; /* disk address of u area when swapped */ ! 51: caddr_t p_wchan; /* event process is awaiting */ ! 52: struct text *p_textp; /* pointer to text structure */ ! 53: u_short p_clktim; /* time to alarm clock signal */ ! 54: u_short p_tsleep; /* time to tsleep */ ! 55: struct pte *p_p0br; /* page table base P0BR */ ! 56: struct proc *p_xlink; /* linked list of procs sharing same text */ ! 57: short p_cpticks; /* ticks of cpu time */ ! 58: float p_pctcpu; /* %cpu for this process during p_time */ ! 59: short p_ndx; /* proc index for memall (because of vfork) */ ! 60: short p_idhash; /* hashed based on p_pid for kill+exit+... */ ! 61: struct proc *p_pptr; /* pointer to process structure of parent */ ! 62: struct inode *p_trace; /* inode for new process tracing stuff */ ! 63: }; ! 64: ! 65: #define PIDHSZ 63 ! 66: #define PIDHASH(pid) ((pid) % PIDHSZ) ! 67: ! 68: #ifdef KERNEL ! 69: short pidhash[PIDHSZ]; ! 70: ! 71: struct proc *pfind(); ! 72: #endif ! 73: ! 74: #ifdef KERNEL ! 75: struct proc *proc, *procNPROC; /* the proc table itself */ ! 76: int nproc; ! 77: ! 78: #define NQS 32 /* 32 run queues */ ! 79: struct prochd { ! 80: struct proc *ph_link; /* linked list of running processes */ ! 81: struct proc *ph_rlink; ! 82: } qs[NQS]; ! 83: int whichqs; /* bit mask summarizing non-empty qs's */ ! 84: #endif ! 85: ! 86: /* stat codes */ ! 87: #define SSLEEP 1 /* awaiting an event */ ! 88: #define SWAIT 2 /* (abandoned state) */ ! 89: #define SRUN 3 /* running */ ! 90: #define SIDL 4 /* intermediate state in process creation */ ! 91: #define SZOMB 5 /* intermediate state in process termination */ ! 92: #define SSTOP 6 /* process being traced */ ! 93: ! 94: /* flag codes */ ! 95: #define SLOAD 0x00000001 /* in core */ ! 96: #define SSYS 0x00000002 /* swapper or pager process */ ! 97: #define SLOCK 0x00000004 /* process being swapped out */ ! 98: #define SSWAP 0x00000008 /* save area flag */ ! 99: #define STRC 0x00000010 /* process is being traced */ ! 100: #define SWTED 0x00000020 /* another tracing flag */ ! 101: #define SULOCK 0x00000040 /* user settable lock in core */ ! 102: #define SPAGE 0x00000080 /* process in page wait state */ ! 103: #define SKEEP 0x00000100 /* another flag to prevent swap out */ ! 104: #define SDLYU 0x00000200 /* delayed unlock of pages */ ! 105: #define SWEXIT 0x00000400 /* working on exiting */ ! 106: #define SPHYSIO 0x00000800 /* doing physical i/o (bio.c) */ ! 107: #define SVFORK 0x00001000 /* process resulted from vfork() */ ! 108: #define SVFDONE 0x00002000 /* another vfork flag */ ! 109: #define SNOVM 0x00004000 /* no vm, parent in a vfork() */ ! 110: #define SPAGI 0x00008000 /* init data space on demand, from inode */ ! 111: #define SSEQL 0x00010000 /* user warned of sequential vm behavior */ ! 112: #define SUANOM 0x00020000 /* user warned of random vm behavior */ ! 113: #define STIMO 0x00040000 /* timing out during sleep */ ! 114: #define SDETACH 0x00080000 /* detached inherited by init */ ! 115: #define SNUSIG 0x00100000 /* using new signal mechanism */ ! 116: #define SOWEUPC 0x00200000 /* owe process an addupc() call at next ast */ ! 117: #define SSEL 0x00400000 /* selecting: wakeup/waiting danger */ ! 118: #define SPROCTR 0x00800000 /* tracing via /proc */ ! 119: #define SPROCIO 0x01000000 /* doing I/O via /proc, so don't swap */ ! 120: #define SSEXEC 0x02000000 /* stop on exec */ ! 121: #define SPROCWT 0x04000000 /* wanted by /proc after SPAGE */ ! 122: ! 123: #define PTRACED(p) ((p)->p_trace || ((p)->p_flag&(STRC|SPROCTR|SSEXEC))) ! 124: ! 125: /* ! 126: * parallel proc structure ! 127: * to replace part with times ! 128: * to be passed to parent process ! 129: * in ZOMBIE state. ! 130: * ! 131: * THIS SHOULD BE DONE WITH A union() CONSTRUCTION ! 132: */ ! 133: struct xproc ! 134: { ! 135: struct proc *xp_link; ! 136: struct proc *xp_rlink; ! 137: struct pte *xp_addr; ! 138: char xp_usrpri; /* user-priority based on p_cpu and p_nice */ ! 139: char xp_pri; /* priority, negative is high */ ! 140: char xp_cpu; /* cpu usage for scheduling */ ! 141: char xp_stat; ! 142: char xp_time; /* resident time for scheduling */ ! 143: char xp_nice; /* nice for cpu usage */ ! 144: char xp_slptime; ! 145: char xp_cursig; ! 146: long xp_sig; /* signals pending to this process */ ! 147: long xp_siga0; ! 148: long xp_siga1; ! 149: int xp_flag; ! 150: short xp_uid; /* user id, used to direct tty signals */ ! 151: short xp_pgrp; /* name of process group leader */ ! 152: short xp_pid; /* unique process id */ ! 153: short xp_ppid; /* process id of parent */ ! 154: KL_p xp_lnode; /* per-user scheduling */ ! 155: float xp_sharepri; /* priority based on p_nice and p_lnode->kl.l_usage */ ! 156: short xp_xstat; /* Exit status for wait */ ! 157: struct vtimes xp_vm; ! 158: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.