Annotation of researchv9/sys/h/user.h, revision 1.1

1.1     ! root        1: #ifdef KERNEL
        !             2: #include "../machine/pcb.h"
        !             3: #include "../machine/reg.h"
        !             4: #include "../h/dmap.h"
        !             5: #include "../h/vtimes.h"
        !             6: #else
        !             7: #include <machine/reg.h>
        !             8: #include <machine/pcb.h>
        !             9: #include <sys/dmap.h>
        !            10: #include <sys/vtimes.h>
        !            11: #endif
        !            12: /*
        !            13:  * The user structure.
        !            14:  * One allocated per process.
        !            15:  * Contains all per process data
        !            16:  * that doesn't need to be referenced
        !            17:  * while the process is swapped.
        !            18:  * The user block is UPAGES*NBPG bytes
        !            19:  * long; resides at virtual user
        !            20:  * loc 0x80000000-UPAGES*NBPG; contains the system
        !            21:  * stack per user; is cross referenced
        !            22:  * with the proc structure for the
        !            23:  * same process.
        !            24:  */
        !            25:  
        !            26: #define        SHSIZE  32
        !            27: #define        NOGROUP (short)-1               /* end of group marker */
        !            28: 
        !            29: struct user
        !            30: {
        !            31:        char    u_stack[KERNSTACK];     /* the kernel stack */
        !            32:        struct  pcb u_pcb;
        !            33:        int     u_arg[5];               /* arguments to current system call */
        !            34:        label_t u_qsav;                 /* for non-local gotos on interrupts */
        !            35:        char    u_segflg;               /* 0:user D; 1:system; 2:user I */
        !            36:        char    u_error;                /* return error code */
        !            37:        short   u_uid;                  /* effective user id */
        !            38:        short   u_gid;                  /* effective group id */
        !            39:        short   u_ruid;                 /* real user id */
        !            40:        short   u_rgid;                 /* real group id */
        !            41:        short   u_groups[NGROUPS];      /* access group id array */
        !            42:        struct  proc *u_procp;          /* pointer to proc structure */
        !            43:        int     *u_ap;                  /* pointer to arglist */
        !            44:        union {                         /* syscall return values */
        !            45:                struct  {
        !            46:                        int     R_val1;
        !            47:                        int     R_val2;
        !            48:                } u_rv;
        !            49: #define        r_val1  u_rv.R_val1
        !            50: #define        r_val2  u_rv.R_val2
        !            51:                off_t   r_off;
        !            52:                time_t  r_time;
        !            53:        } u_r;
        !            54:        caddr_t u_base;                 /* base address for IO */
        !            55:        unsigned int u_count;           /* bytes remaining for IO */
        !            56:        off_t   u_offset;               /* offset in file for IO */
        !            57:        struct  inode *u_cdir;          /* pointer to inode of current directory */
        !            58:        struct  inode *u_rdir;          /* root directory of current process */
        !            59:        char    u_dbuf[DIRSIZ];         /* current pathname component */
        !            60:        caddr_t u_dirp;                 /* pathname pointer */
        !            61:        struct  direct u_dent;          /* current directory entry */
        !            62: /*     struct  inode *u_pdir;          /* inode of parent directory of dirp */
        !            63:        struct  file *u_ofile[NOFILE];  /* pointers to file structures of open files */
        !            64:        char    u_pofile[NOFILE];       /* per-process flags of open files */
        !            65: #define        EXCLOSE 01              /* auto-close on exec */
        !            66:        label_t u_ssav;                 /* label variable for swapping */
        !            67:        int     (*u_signal[NSIG])();    /* disposition of signals */
        !            68:        int     u_code;                 /* ``code'' to trap */
        !            69: /* on SIGILL code passes compatibility mode fault address  */
        !            70: /* on SIGFPE code passes more specific kind of floating point fault */
        !            71:        int     *u_ar0;                 /* address of users saved R0 */
        !            72:        struct uprof {                  /* profile arguments */
        !            73:                short   *pr_base;       /* buffer base */
        !            74:                unsigned pr_size;       /* buffer size */
        !            75:                unsigned pr_off;        /* pc offset */
        !            76:                unsigned pr_scale;      /* pc scaling */
        !            77:        } u_prof;
        !            78:        char    u_eosys;                /* special action on end of syscall */
        !            79:        char    u_sep;                  /* flag for I and D separation */
        !            80:        dev_t   u_ttydev;               /* dev,ino of controlling tty */
        !            81:        ino_t   u_ttyino;
        !            82:        union {
        !            83:           struct {                     /* header of executable file */
        !            84: #ifdef sun
        !            85:                unsigned short Ux_mach; /* machine type */
        !            86:                unsigned short Ux_mag;  /* magic number */
        !            87: #else
        !            88:                unsigned Ux_mag;        /* magic number */
        !            89: #endif
        !            90:                unsigned Ux_tsize;      /* text size */
        !            91:                unsigned Ux_dsize;      /* data size */
        !            92:                unsigned Ux_bsize;      /* bss size */
        !            93:                unsigned Ux_ssize;      /* symbol table size */
        !            94:                unsigned Ux_entloc;     /* entry location */
        !            95:                unsigned Ux_unused;
        !            96:                unsigned Ux_relflg;
        !            97:           } Ux_A;
        !            98:           char ux_shell[SHSIZE];       /* #! and name of interpreter */
        !            99:        } u_exdata;
        !           100: #ifdef sun
        !           101: #define        ux_mach         Ux_A.Ux_mach
        !           102: #define M_OLDSUN2      0       /* old sun-2 executable files */
        !           103: #define M_68010                1       /* runs on either 68010 or 68020 */
        !           104: #define M_68020                2       /* runs only on 68020 */
        !           105: 
        !           106: #define        OMAGIC  0407            /* old impure format */
        !           107: #define        NMAGIC  0410            /* read-only text */
        !           108: #define        ZMAGIC  0413            /* demand load format */
        !           109: #endif
        !           110: #define        ux_mag          Ux_A.Ux_mag
        !           111: #define        ux_tsize        Ux_A.Ux_tsize
        !           112: #define        ux_dsize        Ux_A.Ux_dsize
        !           113: #define        ux_bsize        Ux_A.Ux_bsize
        !           114: #define        ux_ssize        Ux_A.Ux_ssize
        !           115: #define        ux_entloc       Ux_A.Ux_entloc
        !           116: #define        ux_unused       Ux_A.Ux_unused
        !           117: #define        ux_relflg       Ux_A.Ux_relflg
        !           118: 
        !           119:        char    u_comm[DIRSIZ];
        !           120:        time_t  u_start;
        !           121:        char    u_acflag;
        !           122:        short   u_fpflag;               /* unused now, will be later */
        !           123:        short   u_cmask;                /* mask for file creation */
        !           124:        size_t  u_tsize;                /* text size (clicks) */
        !           125:        size_t  u_dsize;                /* data size (clicks) */
        !           126:        size_t  u_ssize;                /* stack size (clicks) */
        !           127:        struct  vtimes u_vm;            /* stats for this proc */
        !           128:        struct  vtimes u_cvm;           /* sum of stats for reaped children */
        !           129:        struct  dmap u_dmap;            /* disk map for data segment */
        !           130:        struct  dmap u_smap;            /* disk map for stack segment */
        !           131:        struct  dmap u_cdmap, u_csmap;  /* shadows of u_dmap, u_smap, for
        !           132:                                           use of parent during fork */
        !           133:        time_t  u_outime;               /* user time at last sample */
        !           134:        size_t  u_odsize, u_ossize;     /* for (clumsy) expansion swaps */
        !           135:        int     u_limit[8];             /* see <sys/vlimit.h> */
        !           136:        int     u_nbadio;               /* # IO operations on hungup streams */
        !           137:        char    u_logname[8];           /* login name */
        !           138: #ifdef sun
        !           139:        int     u_lofault;              /* catch faults in locore.s */
        !           140:        struct  hole {                  /* a data space hole (no swap space) */
        !           141:                int     uh_first;       /* first data page in hole */
        !           142:                int     uh_last;        /* last data page in hole */
        !           143:        } u_hole;
        !           144:        /* sun2 only */
        !           145:        int     u_memropc[12];          /* state of ropc */
        !           146:        struct skyctx {
        !           147:                u_int    usc_regs[8];   /* the Sky registers */
        !           148:                short    usc_cmd;       /* current command */
        !           149:                short    usc_used;      /* user is using Sky */
        !           150:        } u_skyctx;
        !           151:        /* end sun2 only */
        !           152:        /* 68020/68881 only */
        !           153:        struct fp_status u_fp_status;   /* user visible fpp state */
        !           154:        struct fp_istate u_fp_istate;   /* internal fpp state */
        !           155:        /* end 68020/68881 only */
        !           156:        /* 68020/fpa only */
        !           157:         struct fpa_istate u_fpa_istate; /* supervisor privilege regs  */
        !           158:        struct fpa_status u_fpa_status; /* user privilege regs    */
        !           159:        /* end 68020/fpa only */
        !           160: #endif sun
        !           161: };
        !           162: 
        !           163: /* u_eosys values */
        !           164: #define        JUSTRETURN      0
        !           165: #define        RESTARTSYS      1
        !           166: #define        SIMULATERTI     2
        !           167: #define        REALLYRETURN    3
        !           168: 
        !           169: /* u_error codes */
        !           170: #ifdef KERNEL
        !           171: #include "../h/errno.h"
        !           172: #else
        !           173: #include <errno.h>
        !           174: #endif
        !           175: 
        !           176: #ifdef KERNEL
        !           177: #ifdef sun
        !           178: #define        u       (*(struct user *)UADDR)
        !           179: #else sun
        !           180: extern struct user u;
        !           181: #endif sun
        !           182: extern struct user swaputl;
        !           183: extern struct user forkutl;
        !           184: extern struct user xswaputl;
        !           185: extern struct user xswap2utl;
        !           186: extern struct user pushutl;
        !           187: extern struct user vfutl;
        !           188: extern struct user prusrutl;
        !           189: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.