The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/user.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1982, 1986, 1989, 1991, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by the University of
   16  *      California, Berkeley and its contributors.
   17  * 4. Neither the name of the University nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  *      @(#)user.h      8.2 (Berkeley) 9/23/93
   34  * $FreeBSD: releng/5.2/sys/sys/user.h 114983 2003-05-13 20:36:02Z jhb $
   35  */
   36 
   37 #ifndef _SYS_USER_H_
   38 #define _SYS_USER_H_
   39 
   40 #include <machine/pcb.h>
   41 #ifndef _KERNEL
   42 /* stuff that *used* to be included by user.h, or is now needed */
   43 #include <sys/errno.h>
   44 #include <sys/time.h>
   45 #include <sys/resource.h>
   46 #include <sys/ucred.h>
   47 #include <sys/uio.h>
   48 #include <sys/queue.h>
   49 #include <sys/_lock.h>
   50 #include <sys/_mutex.h>
   51 #include <sys/proc.h>
   52 #include <vm/vm.h>              /* XXX */
   53 #include <vm/vm_param.h>        /* XXX */
   54 #include <vm/pmap.h>            /* XXX */
   55 #include <vm/vm_map.h>          /* XXX */
   56 #endif /* !_KERNEL */
   57 #ifndef _SYS_RESOURCEVAR_H_
   58 #include <sys/resourcevar.h>
   59 #endif
   60 #ifndef _SYS_SIGNALVAR_H_
   61 #include <sys/signalvar.h>
   62 #endif
   63 
   64 /*
   65  * KERN_PROC subtype ops return arrays of selected proc structure entries:
   66  *
   67  * When adding new fields to this structure, ALWAYS add them at the end
   68  * and decrease the size of the spare field by the amount of space that
   69  * you are adding.  Byte aligned data should be added to the ki_sparestring
   70  * space; other entries should be added to the ki_spare space. Always
   71  * verify that sizeof(struct kinfo_proc) == KINFO_PROC_SIZE when you are
   72  * done. If you change the size of this structure, many programs will stop
   73  * working! Once you have added the new field, you will need to add code
   74  * to initialize it in two places: kern/kern_proc.c in the function
   75  * fill_kinfo_proc and in lib/libkvm/kvm_proc.c in the function kvm_proclist.
   76  */
   77 #if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || \
   78     defined(__amd64__)
   79 #define KINFO_PROC_SIZE 912             /* the correct size for kinfo_proc */
   80 #endif
   81 #ifdef  __i386__
   82 #define KINFO_PROC_SIZE 648             /* the correct size for kinfo_proc */
   83 #endif
   84 #ifdef  __powerpc__
   85 #define KINFO_PROC_SIZE 656
   86 #endif
   87 #ifndef KINFO_PROC_SIZE
   88 #error  "Unknown architecture"
   89 #endif
   90 #define WMESGLEN        8               /* size of returned wchan message */
   91 #define LOCKNAMELEN     8               /* size of returned lock name */
   92 #define OCOMMLEN        16              /* size of returned ki_ocomm name */
   93 #define COMMLEN         19              /* size of returned ki_comm name */
   94 #define KI_NGROUPS      16              /* number of groups in ki_groups */
   95 #define LOGNAMELEN      17              /* size of returned ki_login */
   96 
   97 struct kinfo_proc {
   98         int     ki_structsize;          /* size of this structure */
   99         int     ki_layout;              /* reserved: layout identifier */
  100         struct  pargs *ki_args;         /* address of command arguments */
  101         struct  proc *ki_paddr;         /* address of proc */
  102         struct  user *ki_addr;          /* kernel virtual addr of u-area */
  103         struct  vnode *ki_tracep;       /* pointer to trace file */
  104         struct  vnode *ki_textvp;       /* pointer to executable file */
  105         struct  filedesc *ki_fd;        /* pointer to open file info */
  106         struct  vmspace *ki_vmspace;    /* pointer to kernel vmspace struct */
  107         void    *ki_wchan;              /* sleep address */
  108         pid_t   ki_pid;                 /* Process identifier */
  109         pid_t   ki_ppid;                /* parent process id */
  110         pid_t   ki_pgid;                /* process group id */
  111         pid_t   ki_tpgid;               /* tty process group id */
  112         pid_t   ki_sid;                 /* Process session ID */
  113         pid_t   ki_tsid;                /* Terminal session ID */
  114         short   ki_jobc;                /* job control counter */
  115         udev_t  ki_tdev;                /* controlling tty dev */
  116         sigset_t ki_siglist;            /* Signals arrived but not delivered */
  117         sigset_t ki_sigmask;            /* Current signal mask */
  118         sigset_t ki_sigignore;          /* Signals being ignored */
  119         sigset_t ki_sigcatch;           /* Signals being caught by user */
  120         uid_t   ki_uid;                 /* effective user id */
  121         uid_t   ki_ruid;                /* Real user id */
  122         uid_t   ki_svuid;               /* Saved effective user id */
  123         gid_t   ki_rgid;                /* Real group id */
  124         gid_t   ki_svgid;               /* Saved effective group id */
  125         short   ki_ngroups;             /* number of groups */
  126         gid_t   ki_groups[KI_NGROUPS];  /* groups */
  127         vm_size_t ki_size;              /* virtual size */
  128         segsz_t ki_rssize;              /* current resident set size in pages */
  129         segsz_t ki_swrss;               /* resident set size before last swap */
  130         segsz_t ki_tsize;               /* text size (pages) XXX */
  131         segsz_t ki_dsize;               /* data size (pages) XXX */
  132         segsz_t ki_ssize;               /* stack size (pages) */
  133         u_short ki_xstat;               /* Exit status for wait & stop signal */
  134         u_short ki_acflag;              /* Accounting flags */
  135         fixpt_t ki_pctcpu;              /* %cpu for process during ki_swtime */
  136         u_int   ki_estcpu;              /* Time averaged value of ki_cpticks */
  137         u_int   ki_slptime;             /* Time since last blocked */
  138         u_int   ki_swtime;              /* Time swapped in or out */
  139         u_int64_t ki_runtime;           /* Real time in microsec */
  140         struct  timeval ki_start;       /* starting time */
  141         struct  timeval ki_childtime;   /* time used by process children */
  142         long    ki_flag;                /* P_* flags */
  143         long    ki_kiflag;              /* KI_* flags (below) */
  144         int     ki_traceflag;           /* Kernel trace points */
  145         char    ki_stat;                /* S* process status */
  146         char    ki_nice;                /* Process "nice" value */
  147         char    ki_lock;                /* Process lock (prevent swap) count */
  148         char    ki_rqindex;             /* Run queue index */
  149         u_char  ki_oncpu;               /* Which cpu we are on */
  150         u_char  ki_lastcpu;             /* Last cpu we were on */
  151         char    ki_ocomm[OCOMMLEN+1];   /* command name */
  152         char    ki_wmesg[WMESGLEN+1];   /* wchan message */
  153         char    ki_login[LOGNAMELEN+1]; /* setlogin name */
  154         char    ki_lockname[LOCKNAMELEN+1]; /* lock name */
  155         char    ki_comm[COMMLEN+1];     /* command name */
  156         char    ki_sparestrings[85];    /* spare string space */
  157         struct  rusage ki_rusage;       /* process rusage statistics */
  158         long    ki_sflag;               /* PS_* flags */
  159         struct  priority ki_pri;        /* process priority */
  160         long    ki_tdflags;             /* XXXKSE kthread flag */
  161         struct  pcb *ki_pcb;            /* kernel virtual addr of pcb */
  162         void    *ki_kstack;             /* kernel virtual addr of stack */
  163         long    ki_spare[22];           /* spare constants */
  164 };
  165 void fill_kinfo_proc(struct proc *, struct kinfo_proc *);
  166 
  167 /* ki_sessflag values */
  168 #define KI_CTTY         0x00000001      /* controlling tty vnode active */
  169 #define KI_SLEADER      0x00000002      /* session leader */
  170 #define KI_LOCKBLOCK    0x00000004      /* proc blocked on lock ki_lockname */
  171 
  172 /*
  173  * Per process structure containing data that isn't needed in core
  174  * when the process isn't running (esp. when swapped out).
  175  */
  176 struct user {
  177         struct  pstats u_stats;         /* *p_stats */
  178         /*
  179          * Remaining field for a.out core dumps - not valid at other times!
  180          */
  181         struct  kinfo_proc u_kproc;     /* eproc */
  182 };
  183 
  184 #endif

Cache object: 41ae056e7e693466e57a627f18885340


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.