1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)user.h	7.1 (Berkeley) 6/4/86
   7:  */
   8: 
   9: #ifdef KERNEL
  10: #include "../machine/pcb.h"
  11: #include "dmap.h"
  12: #include "time.h"
  13: #include "resource.h"
  14: #include "namei.h"
  15: #else
  16: #include <machine/pcb.h>
  17: #include <sys/dmap.h>
  18: #include <sys/time.h>
  19: #include <sys/resource.h>
  20: #include <sys/namei.h>
  21: #endif
  22: 
  23: /*
  24:  * Per process structure containing data that
  25:  * isn't needed in core when the process is swapped out.
  26:  */
  27: 
  28: #define MAXCOMLEN   16      /* <= MAXNAMLEN, >= sizeof(ac_comm) */
  29: 
  30: struct  user {
  31:     struct  pcb u_pcb;
  32:     struct  proc *u_procp;      /* pointer to proc structure */
  33:     int *u_ar0;         /* address of users saved R0 */
  34:     char    u_comm[MAXCOMLEN + 1];
  35: 
  36: /* syscall parameters, results and catches */
  37:     int u_arg[8];       /* arguments to current system call */
  38:     int *u_ap;          /* pointer to arglist */
  39:     label_t u_qsave;        /* for non-local gotos on interrupts */
  40:     union {             /* syscall return values */
  41:         struct  {
  42:             int R_val1;
  43:             int R_val2;
  44:         } u_rv;
  45: #define r_val1  u_rv.R_val1
  46: #define r_val2  u_rv.R_val2
  47:         off_t   r_off;
  48:         time_t  r_time;
  49:     } u_r;
  50:     char    u_error;        /* return error code */
  51:     char    u_eosys;        /* special action on end of syscall */
  52: 
  53: /* 1.1 - processes and protection */
  54:     uid_t   u_uid;          /* effective user id */
  55:     uid_t   u_ruid;         /* real user id */
  56:     gid_t   u_gid;          /* effective group id */
  57:     gid_t   u_rgid;         /* real group id */
  58:     gid_t   u_groups[NGROUPS];  /* groups, 0 terminated */
  59: 
  60: /* 1.2 - memory management */
  61:     size_t  u_tsize;        /* text size (clicks) */
  62:     size_t  u_dsize;        /* data size (clicks) */
  63:     size_t  u_ssize;        /* stack size (clicks) */
  64:     struct  dmap u_dmap;        /* disk map for data segment */
  65:     struct  dmap u_smap;        /* disk map for stack segment */
  66:     struct  dmap u_cdmap, u_csmap;  /* shadows of u_dmap, u_smap, for
  67: 					   use of parent during fork */
  68:     label_t u_ssave;        /* label variable for swapping */
  69:     size_t  u_odsize, u_ossize; /* for (clumsy) expansion swaps */
  70:     time_t  u_outime;       /* user time at last sample */
  71: 
  72: /* 1.3 - signal management */
  73:     int (*u_signal[NSIG])();    /* disposition of signals */
  74:     int u_sigmask[NSIG];    /* signals to be blocked */
  75:     int u_sigonstack;       /* signals to take on sigstack */
  76:     int u_sigintr;      /* signals that interrupt syscalls */
  77:     int u_oldmask;      /* saved mask from before sigpause */
  78:     int u_code;         /* ``code'' to trap */
  79:     struct  sigstack u_sigstack;    /* sp & on stack state variable */
  80: #define u_onstack   u_sigstack.ss_onstack
  81: #define u_sigsp     u_sigstack.ss_sp
  82: 
  83: /* 1.4 - descriptor management */
  84:     struct  file *u_ofile[NOFILE];  /* file structures for open files */
  85:     char    u_pofile[NOFILE];   /* per-process flags of open files */
  86:     int u_lastfile;     /* high-water mark of u_ofile */
  87: #define UF_EXCLOSE  0x1     /* auto-close on exec */
  88: #define UF_MAPPED   0x2     /* mapped from device */
  89:     struct  inode *u_cdir;      /* current directory */
  90:     struct  inode *u_rdir;      /* root directory of current process */
  91:     struct  tty *u_ttyp;        /* controlling tty pointer */
  92:     dev_t   u_ttyd;         /* controlling tty dev */
  93:     short   u_cmask;        /* mask for file creation */
  94: 
  95: /* 1.5 - timing and statistics */
  96:     struct  rusage u_ru;        /* stats for this proc */
  97:     struct  rusage u_cru;       /* sum of stats for reaped children */
  98:     struct  itimerval u_timer[3];
  99:     int u_XXX[3];
 100:     struct  timeval u_start;
 101:     short   u_acflag;
 102: 
 103:     struct uprof {          /* profile arguments */
 104:         short   *pr_base;   /* buffer base */
 105:         unsigned pr_size;   /* buffer size */
 106:         unsigned pr_off;    /* pc offset */
 107:         unsigned pr_scale;  /* pc scaling */
 108:     } u_prof;
 109: 
 110: /* 1.6 - resource controls */
 111:     struct  rlimit u_rlimit[RLIM_NLIMITS];
 112:     struct  quota *u_quota;     /* user's quota structure */
 113:     int u_qflags;       /* per process quota flags */
 114: 
 115: /* namei & co. */
 116:     struct nameicache {     /* last successful directory search */
 117:         int nc_prevoffset;  /* offset at which last entry found */
 118:         ino_t nc_inumber;   /* inum of cached directory */
 119:         dev_t nc_dev;       /* dev of cached directory */
 120:         time_t nc_time;     /* time stamp for cache entry */
 121:     } u_ncache;
 122:     struct  nameidata u_nd;
 123: 
 124:     int u_stack[1];
 125: };
 126: 
 127: /* u_eosys values */
 128: #define JUSTRETURN  1
 129: #define RESTARTSYS  2
 130: #define NORMALRETURN    3
 131: 
 132: /* u_error codes */
 133: #ifdef KERNEL
 134: #include "errno.h"
 135: #else
 136: #include <errno.h>
 137: #endif
 138: 
 139: #ifdef KERNEL
 140: extern  struct user u;
 141: extern  struct user swaputl;
 142: extern  struct user forkutl;
 143: extern  struct user xswaputl;
 144: extern  struct user xswap2utl;
 145: extern  struct user pushutl;
 146: extern  struct user vfutl;
 147: #endif

Defined struct's

nameicache defined in line 116; never used
uprof defined in line 103; used 4 times
user defined in line 30; used 58 times

Defined macros

JUSTRETURN defined in line 128; used 1 times
MAXCOMLEN defined in line 28; used 7 times
NORMALRETURN defined in line 130; used 2 times
u_onstack defined in line 80; used 6 times
u_sigsp defined in line 81; used 2 times

Usage of this include

user.h used 111 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1447
Valid CSS Valid XHTML 1.0 Strict