|
|
1.1 ! root 1: /* user.h 4.8 81/04/28 */ ! 2: ! 3: #ifdef KERNEL ! 4: #include "../h/pcb.h" ! 5: #include "../h/dmap.h" ! 6: #include "../h/vtimes.h" ! 7: #include "assym.s" ! 8: #else ! 9: #include <sys/pcb.h> ! 10: #include <sys/dmap.h> ! 11: #include <sys/vtimes.h> ! 12: #endif ! 13: /* ! 14: * The user structure. ! 15: * One allocated per process. ! 16: * Contains all per process data ! 17: * that doesn't need to be referenced ! 18: * while the process is swapped. ! 19: * The user block is UPAGES*NBPG bytes ! 20: * long; resides at virtual user ! 21: * loc 0x80000000-UPAGES*NBPG; contains the system ! 22: * stack per user; is cross referenced ! 23: * with the proc structure for the ! 24: * same process. ! 25: */ ! 26: ! 27: #define SHSIZE 32 ! 28: ! 29: struct user ! 30: { ! 31: struct pcb u_pcb; ! 32: int u_arg[5]; /* arguments to current system call */ ! 33: label_t u_qsav; /* for non-local gotos on interrupts */ ! 34: char u_segflg; /* 0:user D; 1:system; 2:user I */ ! 35: char u_error; /* return error code */ ! 36: short u_uid; /* effective user id */ ! 37: short u_gid; /* effective group id */ ! 38: short u_ruid; /* real user id */ ! 39: short u_rgid; /* real group id */ ! 40: struct proc *u_procp; /* pointer to proc structure */ ! 41: int *u_ap; /* pointer to arglist */ ! 42: union { /* syscall return values */ ! 43: struct { ! 44: int R_val1; ! 45: int R_val2; ! 46: } u_rv; ! 47: #define r_val1 u_rv.R_val1 ! 48: #define r_val2 u_rv.R_val2 ! 49: off_t r_off; ! 50: time_t r_time; ! 51: } u_r; ! 52: caddr_t u_base; /* base address for IO */ ! 53: unsigned int u_count; /* bytes remaining for IO */ ! 54: off_t u_offset; /* offset in file for IO */ ! 55: struct inode *u_cdir; /* pointer to inode of current directory */ ! 56: struct inode *u_rdir; /* root directory of current process */ ! 57: char u_dbuf[DIRSIZ]; /* current pathname component */ ! 58: caddr_t u_dirp; /* pathname pointer */ ! 59: struct direct u_dent; /* current directory entry */ ! 60: struct inode *u_pdir; /* inode of parent directory of dirp */ ! 61: struct file *u_ofile[NOFILE]; /* pointers to file structures of open files */ ! 62: char u_pofile[NOFILE]; /* per-process flags of open files */ ! 63: #define EXCLOSE 01 /* auto-close on exec */ ! 64: label_t u_ssav; /* label variable for swapping */ ! 65: int (*u_signal[NSIG])(); /* disposition of signals */ ! 66: int u_code; /* ``code'' to trap */ ! 67: /* on SIGILL code passes compatibility mode fault address */ ! 68: /* on SIGFPE code passes more specific kind of floating point fault */ ! 69: int *u_ar0; /* address of users saved R0 */ ! 70: struct uprof { /* profile arguments */ ! 71: short *pr_base; /* buffer base */ ! 72: unsigned pr_size; /* buffer size */ ! 73: unsigned pr_off; /* pc offset */ ! 74: unsigned pr_scale; /* pc scaling */ ! 75: } u_prof; ! 76: char u_eosys; /* special action on end of syscall */ ! 77: char u_sep; /* flag for I and D separation */ ! 78: struct tty *u_ttyp; /* controlling tty pointer */ ! 79: dev_t u_ttyd; /* controlling tty dev */ ! 80: union { ! 81: struct { /* header of executable file */ ! 82: int Ux_mag; /* magic number */ ! 83: unsigned Ux_tsize; /* text size */ ! 84: unsigned Ux_dsize; /* data size */ ! 85: unsigned Ux_bsize; /* bss size */ ! 86: unsigned Ux_ssize; /* symbol table size */ ! 87: unsigned Ux_entloc; /* entry location */ ! 88: unsigned Ux_unused; ! 89: unsigned Ux_relflg; ! 90: } Ux_A; ! 91: char ux_shell[SHSIZE]; /* #! and name of interpreter */ ! 92: } u_exdata; ! 93: #define ux_mag Ux_A.Ux_mag ! 94: #define ux_tsize Ux_A.Ux_tsize ! 95: #define ux_dsize Ux_A.Ux_dsize ! 96: #define ux_bsize Ux_A.Ux_bsize ! 97: #define ux_ssize Ux_A.Ux_ssize ! 98: #define ux_entloc Ux_A.Ux_entloc ! 99: #define ux_unused Ux_A.Ux_unused ! 100: #define ux_relflg Ux_A.Ux_relflg ! 101: ! 102: char u_comm[DIRSIZ]; ! 103: time_t u_start; ! 104: char u_acflag; ! 105: short u_fpflag; /* unused now, will be later */ ! 106: short u_cmask; /* mask for file creation */ ! 107: size_t u_tsize; /* text size (clicks) */ ! 108: size_t u_dsize; /* data size (clicks) */ ! 109: size_t u_ssize; /* stack size (clicks) */ ! 110: struct vtimes u_vm; /* stats for this proc */ ! 111: struct vtimes u_cvm; /* sum of stats for reaped children */ ! 112: struct dmap u_dmap; /* disk map for data segment */ ! 113: struct dmap u_smap; /* disk map for stack segment */ ! 114: struct dmap u_cdmap, u_csmap; /* shadows of u_dmap, u_smap, for ! 115: use of parent during fork */ ! 116: time_t u_outime; /* user time at last sample */ ! 117: size_t u_odsize, u_ossize; /* for (clumsy) expansion swaps */ ! 118: size_t u_vrpages[NOFILE]; /* number vread pages hanging on fd */ ! 119: int u_limit[8]; /* see <sys/limit.h> */ ! 120: #ifdef notdef ! 121: unsigned u_vsave; /* saved previous fault page number */ ! 122: #endif ! 123: int u_stack[1]; ! 124: ! 125: /* ! 126: * kernel stack per user ! 127: * extends from u + UPAGES*512 ! 128: * backward not to reach here ! 129: */ ! 130: /* SHOULD INSTEAD GROW STACK BACKWARDS ABOVE u. TOWARDS A VIRTUAL HOLE */ ! 131: }; ! 132: ! 133: /* u_eosys values */ ! 134: #define JUSTRETURN 0 ! 135: #define RESTARTSYS 1 ! 136: #define SIMULATERTI 2 ! 137: ! 138: /* u_error codes */ ! 139: #include <errno.h> ! 140: ! 141: #ifdef KERNEL ! 142: extern struct user u; ! 143: extern struct user swaputl; ! 144: extern struct user forkutl; ! 145: extern struct user xswaputl; ! 146: extern struct user xswap2utl; ! 147: extern struct user pushutl; ! 148: extern struct user vfutl; ! 149: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.