home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * @(#) user.h 2.6 88/07/13
- *
- * Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
- * Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
- * This Module contains Proprietary Information of
- * The Santa Cruz Operation, Microsoft Corporation
- * and AT&T, and should be treated as Confidential.
- */
-
- #ifndef X_MAGIC
- #include "a.out.h"
- #endif
-
- /*
- * The user structure.
- * One allocated per process.
- * Contains all per process data that doesn't need to be referenced
- * while the process is swapped.
- * The user block is USIZE*click bytes long; resides at virtual kernel
- * SPTADDR, contains the system stack per user; is cross referenced
- * with the proc structure for the same process.
- */
-
- #define PSARGSZ 40 /* Space in u-block for exec arguments */
- /* Used by ps command */
- #define SHLBMAX 2 /* maximum # of shared libraries per process */
- #define SHLBPDES 2 /* maximum # of page directory entries per shlib */
-
- #ifdef M_I386
- typedef char *faddr_u;
- #else /* M_I8086 or M_I286 */
- typedef union {
- char far *fu_far;
- char *fu_near;
- } faddr_u;
- #endif
-
- struct user
- {
- char u_kstack[KSSIZE]; /* kernel stack, per process */
- label_t u_rsav; /* save info when exchanging stacks */
- label_t u_qsav; /* label variable for quits and interrupts */
- label_t u_ssav; /* label variable for swapping */
- char u_segflg; /* IO flag: 0:user D; 1:system; 2:user I */
- uchar_t u_error; /* return error code */
- ushort u_uid; /* effective user id */
- ushort u_gid; /* effective group id */
- ushort u_ruid; /* real user id */
- ushort u_rgid; /* real group id */
- struct proc *u_procp; /* pointer to proc structure */
- int *u_ap; /* pointer to arglist */
- union { /* syscall return values */
- struct {
- int r_val1;
- int r_val2;
- }r_reg;
- off_t r_off;
- time_t r_time;
- long r_long;
- faddr_t r_faddr;
- #ifndef M_I386
- char far *r_far;
- #endif
- } u_r;
- faddr_u u_baseu; /* base address for IO */
- unsigned u_count; /* bytes remaining for IO */
- off_t u_offset; /* offset in file for IO */
- short u_fmode; /* file mode for IO */
- daddr_t u_rablock; /* read ahead block addr */
- short u_errcnt; /* syscall error count */
- inodep_t u_cdir; /* current directory of process */
- inodep_t u_rdir; /* root directory of process */
- faddr_u u_dirpu; /* pathname pointer */
- struct direct u_dent; /* current directory entry */
- inodep_t u_pdir; /* inode of parent directory of dirp */
- filep_t u_ofile[NOFILE]; /* pointers to open file structures */
- char u_pofile[NOFILE]; /* per-process flags of open files */
- int u_arg[10]; /* arguments to current system call */
- unsigned u_tsize; /* text size */
- unsigned u_dsize; /* data size */
- unsigned u_ssize; /* stack size */
- #ifdef M_I386
- int (*u_signal[MAXSIG])(); /* disposition of signals */
- int (*u_sigreturn)(); /* for cleanup */
- #else
- int (far *u_signal[NSIG])(); /* disposition of signals */
- #endif
- time_t u_utime; /* this process user time */
- time_t u_stime; /* this process system time */
- time_t u_cutime; /* sum of childs' utimes */
- time_t u_cstime; /* sum of childs' stimes */
- int *u_ar0; /* address of users saved R0 */
- char u_psargs[PSARGSZ]; /* args from exec system call */
- struct { /* profile arguments */
- faddr_u pr_baseu; /* buffer base */
- unsigned pr_size; /* buffer size */
- long pr_off; /* pc offset */
- unsigned pr_scale; /* pc scaling */
- faddr_u pr_syspcu; /* address of user pc during syscall */
- } u_prof;
- char u_intflg; /* catch intr from sys */
- char u_sep; /* flag for I and D separation */
- char u_osvers; /* version of binary (SYS2, 3, 5, etc) */
- char u_hugex; /* allows exec of proc > swapper when set */
- char u_lock; /* for plock() system call */
- char u_cpu; /* cpu type for this program */
- unsigned short u_renv; /* runtime environment */
- struct tty *u_ttyp; /* pointer to pgrp in tty structure */
- dev_t u_ttyd; /* controlling tty dev */
- struct u_exdata { /* header information */
- long x_text; /* size of text segment(s) */
- long x_data; /* size of initialized data segment(s) */
- long x_bss; /* size of uninitialized data segment(s) */
- long x_stack; /* size of stack (if XE_FS set) */
- long x_entry; /* entry offset */
- unsigned short x_eseg; /* entry segment */
- unsigned short x_renv; /* run-time environment */
- char x_osvers;
- char x_cpu; /* cpu type */
- #ifdef M_I386
- char x_excoff; /* flags for exec'ing coff binary */
- char x_coff; /* flag for coff binary */
- #endif
- long x_segsize; /* segment table size */
- long x_segpos; /* segment table position */
- } u_exdata;
- char u_comm[DIRSIZ];
- time_t u_start;
- time_t u_ticks;
- long u_mem;
- long u_ior;
- long u_iow;
- long u_iosw;
- long u_ioch;
- char u_acflag;
- char u_nfsflgs; /* reserved for future use */
- short u_cmask; /* mask for file creation */
- daddr_t u_limit; /* maximum write address */
- short u_t[32]; /* used to be int u_t[32] */
- #ifdef M_I386
- unsigned u_lsize; /* library size in bytes */
- inodep_t u_ip[SHLBMAX+1];
- inodep_t u_exip[SHLBMAX+1];
- char u_nshlibs;
- char u_exnshlibs;
- short u_spare;
- short u_shlpdindex[SHLBMAX*SHLBPDES];
- struct tabent
- u_shlpdent[SHLBMAX*SHLBPDES];
- struct ldtinfo *u_shlinfo;
- #endif
- inodep_t u_ttyip; /* stream controlling tty */
- int u_sdsaved; /* we have saved the shared data */
- /* machine dependent fields */
- int u_fper; /* FP error register */
- char u_fpsaved; /* FP regs saved for this proc */
- char u_fpused; /* FP used for this process */
- #ifdef M_I386
- char u_fpad[2];
- struct u_fps { /* 80287 save status */
- struct fp_hardware {
- unsigned int fp_cntrl; /* control word */
- unsigned int fp_stat; /* status word */
- unsigned int fp_tag; /* tag word */
- unsigned long fp_ip; /* instruction pointer*/
- unsigned short fp_cs; /* code selector */
- unsigned short fp_ds; /* data selector */
- unsigned long fp_op; /* operand offset */
- unsigned long fp_rsvd;
- unsigned char fp_regs[80]; /* register stack */
- unsigned short fp_new_status;
- unsigned char fp_pad[6];
- } fp_hardware;
- struct fp_emul {
- char fp_emul[214]; /* (extras for emulator) */
- char fp_epad[2];
- } fp_emul;
- } u_fps;
- #else
- struct { /* 80287 save status */
- int fp_cntrl; /* control word */
- int fp_stat; /* status word */
- int fp_tag; /* tag word */
- int fp_ip[2]; /* instruction pointer */
- int fp_op[2]; /* operand pointer */
- char fp_regs[100]; /* temporary registers */
- int fp_spare; /* (2 xtra for emulator) */
- } u_fps;
- #endif
- unsigned short u_lxrw; /* R/W access of text segments */
- faddr_u u_stkbotu; /* start or bottom of user stack */
- #ifdef M_I386
- caddr_t u_stktop; /* end or top of user stack */
- #endif
- faddr_u u_edatau; /* end of user data before brks
- seg:off for 286, 32 bit addr for 386 */
- caddr_t u_sdata; /* start of user data */
- #ifndef M_I386
- struct segtmp far *u_segoff; /* ptr to segoff array used by exec */
- #endif
- #ifdef M_I8086
- /* following are 8086 only fields */
- short u_usegs[NSEG]; /* segments table for mem management*/
- caddr_t u_topstk; /* user data address of stack top*/
- caddr_t u_botstk; /* " " " " bottom*/
- unsigned u_flags; /* misc flags */
- caddr_t u_seginfo; /* seginfo table pointer */
- unsigned u_curbrk; /* current break val: brkctl */
- unsigned u_hdrsiz; /* 8086 only x.out hdr size */
- struct ex86 {
- long x_reloc;
- long x_syms;
- unsigned short x_ext;
- char x_relsym;
- char x_res;
- } u_ex86;
- #endif
- #ifdef M_I386
- #ifdef VPIX
- struct tss *u_tss; /* pointer to tss for proc (if any) */
- short u_tsslimit; /* tss size */
- short u_weitek; /* was, reserved 1 */
- #else
- int u_res0; /* reserved 0 */
- short u_res1; /* reserved 1 */
- short u_weitek; /* was, reserved 1 */
- #endif
- struct tabent u_tpdent[TXTPDENT]; /* text page directory entries */
- struct tabent u_dpdent[DATAPDENT]; /* data page directory entries */
- struct tabent u_shmpdent[SHMPDENT]; /* shared data page dir entries */
- int u_dtime; /* time spent on this data segment */
- struct ldtinfo *u_ldtinfo; /* pointer to ldtinfo array for exec */
- unsigned short u_ldtlimit; /* current size(index) of ldt */
- short u_physmap; /* was: char u_lpad[2] */
- struct descriptor u_ldt[1]; /* ldt grows up from here */
- #endif
- };
- extern struct user u;
-
- #define u_rval1 u_r.r_reg.r_val1
- #define u_rval2 u_r.r_reg.r_val2
- #define u_roff u_r.r_off
- #define u_rtime u_r.r_time
- #define u_rlong u_r.r_long
- #define u_rfaddr u_r.r_faddr
- #define u_rfar u_r.r_far
-
- #define IS386() ((u.u_cpu & XC_386) == XC_386)
- #define ISCOFF() ((u.u_exdata.x_coff & XCB_COFF) == XCB_COFF)
- #define ISCOFFEXEC() ((u.u_exdata.x_excoff & XCB_COFF) == XCB_COFF)
- #define IS_5_3() ((u.u_renv & XE_5_3 ) == XE_5_3 )
-
- #ifdef M_I286
- # define u_base u_baseu.fu_far
- # define u_dirp u_dirpu.fu_far
- # define u_stkbot u_stkbotu.fu_far
- # define u_edata u_edatau.fu_far
- #endif /* M_I286 */
-
- #ifdef M_I8086
- # define u_base u_baseu.fu_near
- # define u_dirp u_dirpu.fu_near
- # define u_stkbot u_stkbotu.fu_near
- # define u_edata u_edatau.fu_near
- #endif /* M_I8086 */
-
- #ifdef M_I386
- # define u_base u_baseu
- # define u_dirp u_dirpu
- # define u_stkbot u_stkbotu
- # define u_edata u_edatau
- #endif /* M_I386 */
-
- #ifdef M_I386
- #define pr_base pr_baseu
- #define pr_syspc pr_syspcu
- #else
- #define pr_base pr_baseu.fu_far
- #define pr_syspc pr_syspcu.fu_far
- #endif
-
- #define U_WRITE 0
- #define U_READ 1
-
- /* segflg values */
- #define U_UD 0 /* user data */
- #define U_KD 1 /* kernel data */
- #define U_UI 2 /* user code */
-
- /* ioflag values: Read/Write, User/Kernel, Ins/Data */
- #define U_WUD 0
- #define U_RUD 1
- #define U_WKD 2
- #define U_RKD 3
- #define U_WUI 4
- #define U_RUI 5
-
- #define EXCLOSE 01
-
- /* values for u_nfsflgs (all bits reserved for NFS) */
- #define NFSNEGO 0x01 /* core negotiate wanted or not */
- #define NFSNOCASE 0x80 /* caseless compare needed (core server proc)*/
-
- /* u_flags */
- #define UF_WSWAP 0x1 /* Words in longs swapped relative to kernel */
-
- /* values for u_hugex flag */
- #define HX_SMALL 0x01 /* not currently bigger than swap area */
- #define HX_BIG 0x02 /* proc is bigger than swap area*/
-