00001 /* 00002 * Copyright (c) 1982, 1986, 1989, 1991, 1993 00003 * The Regents of the University of California. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. All advertising materials mentioning features or use of this software 00014 * must display the following acknowledgement: 00015 * This product includes software developed by the University of 00016 * California, Berkeley and its contributors. 00017 * 4. Neither the name of the University nor the names of its contributors 00018 * may be used to endorse or promote products derived from this software 00019 * without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00022 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00023 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00024 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00025 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00026 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00027 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00028 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00029 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00030 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00031 * SUCH DAMAGE. 00032 * 00033 * @(#)user.h 8.2 (Berkeley) 9/23/93 00034 * $FreeBSD: src/sys/sys/user.h,v 1.53 2003/05/13 20:36:02 jhb Exp $ 00035 */ 00036 00037 #ifndef _SYS_USER_H_ 00038 #define _SYS_USER_H_ 00039 00040 #include <machine/pcb.h> 00041 #ifndef _KERNEL 00042 /* stuff that *used* to be included by user.h, or is now needed */ 00043 #include <sys/errno.h> 00044 #include <sys/time.h> 00045 #include <sys/resource.h> 00046 #include <sys/ucred.h> 00047 #include <sys/uio.h> 00048 #include <sys/queue.h> 00049 #include <sys/_lock.h> 00050 #include <sys/_mutex.h> 00051 #include <sys/proc.h> 00052 #include <vm/vm.h> /* XXX */ 00053 #include <vm/vm_param.h> /* XXX */ 00054 #include <vm/pmap.h> /* XXX */ 00055 #include <vm/vm_map.h> /* XXX */ 00056 #endif /* !_KERNEL */ 00057 #ifndef _SYS_RESOURCEVAR_H_ 00058 #include <sys/resourcevar.h> 00059 #endif 00060 #ifndef _SYS_SIGNALVAR_H_ 00061 #include <sys/signalvar.h> 00062 #endif 00063 00064 /* 00065 * KERN_PROC subtype ops return arrays of selected proc structure entries: 00066 * 00067 * When adding new fields to this structure, ALWAYS add them at the end 00068 * and decrease the size of the spare field by the amount of space that 00069 * you are adding. Byte aligned data should be added to the ki_sparestring 00070 * space; other entries should be added to the ki_spare space. Always 00071 * verify that sizeof(struct kinfo_proc) == KINFO_PROC_SIZE when you are 00072 * done. If you change the size of this structure, many programs will stop 00073 * working! Once you have added the new field, you will need to add code 00074 * to initialize it in two places: kern/kern_proc.c in the function 00075 * fill_kinfo_proc and in lib/libkvm/kvm_proc.c in the function kvm_proclist. 00076 */ 00077 #if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || \ 00078 defined(__amd64__) 00079 #define KINFO_PROC_SIZE 912 /* the correct size for kinfo_proc */ 00080 #endif 00081 #ifdef __i386__ 00082 #define KINFO_PROC_SIZE 648 /* the correct size for kinfo_proc */ 00083 #endif 00084 #ifdef __powerpc__ 00085 #define KINFO_PROC_SIZE 656 00086 #endif 00087 #ifndef KINFO_PROC_SIZE 00088 #error "Unknown architecture" 00089 #endif 00090 #define WMESGLEN 8 /* size of returned wchan message */ 00091 #define LOCKNAMELEN 8 /* size of returned lock name */ 00092 #define OCOMMLEN 16 /* size of returned ki_ocomm name */ 00093 #define COMMLEN 19 /* size of returned ki_comm name */ 00094 #define KI_NGROUPS 16 /* number of groups in ki_groups */ 00095 #define LOGNAMELEN 17 /* size of returned ki_login */ 00096 00097 struct kinfo_proc { 00098 int ki_structsize; /* size of this structure */ 00099 int ki_layout; /* reserved: layout identifier */ 00100 struct pargs *ki_args; /* address of command arguments */ 00101 struct proc *ki_paddr; /* address of proc */ 00102 struct user *ki_addr; /* kernel virtual addr of u-area */ 00103 struct vnode *ki_tracep; /* pointer to trace file */ 00104 struct vnode *ki_textvp; /* pointer to executable file */ 00105 struct filedesc *ki_fd; /* pointer to open file info */ 00106 struct vmspace *ki_vmspace; /* pointer to kernel vmspace struct */ 00107 void *ki_wchan; /* sleep address */ 00108 pid_t ki_pid; /* Process identifier */ 00109 pid_t ki_ppid; /* parent process id */ 00110 pid_t ki_pgid; /* process group id */ 00111 pid_t ki_tpgid; /* tty process group id */ 00112 pid_t ki_sid; /* Process session ID */ 00113 pid_t ki_tsid; /* Terminal session ID */ 00114 short ki_jobc; /* job control counter */ 00115 udev_t ki_tdev; /* controlling tty dev */ 00116 sigset_t ki_siglist; /* Signals arrived but not delivered */ 00117 sigset_t ki_sigmask; /* Current signal mask */ 00118 sigset_t ki_sigignore; /* Signals being ignored */ 00119 sigset_t ki_sigcatch; /* Signals being caught by user */ 00120 uid_t ki_uid; /* effective user id */ 00121 uid_t ki_ruid; /* Real user id */ 00122 uid_t ki_svuid; /* Saved effective user id */ 00123 gid_t ki_rgid; /* Real group id */ 00124 gid_t ki_svgid; /* Saved effective group id */ 00125 short ki_ngroups; /* number of groups */ 00126 gid_t ki_groups[KI_NGROUPS]; /* groups */ 00127 vm_size_t ki_size; /* virtual size */ 00128 segsz_t ki_rssize; /* current resident set size in pages */ 00129 segsz_t ki_swrss; /* resident set size before last swap */ 00130 segsz_t ki_tsize; /* text size (pages) XXX */ 00131 segsz_t ki_dsize; /* data size (pages) XXX */ 00132 segsz_t ki_ssize; /* stack size (pages) */ 00133 u_short ki_xstat; /* Exit status for wait & stop signal */ 00134 u_short ki_acflag; /* Accounting flags */ 00135 fixpt_t ki_pctcpu; /* %cpu for process during ki_swtime */ 00136 u_int ki_estcpu; /* Time averaged value of ki_cpticks */ 00137 u_int ki_slptime; /* Time since last blocked */ 00138 u_int ki_swtime; /* Time swapped in or out */ 00139 u_int64_t ki_runtime; /* Real time in microsec */ 00140 struct timeval ki_start; /* starting time */ 00141 struct timeval ki_childtime; /* time used by process children */ 00142 long ki_flag; /* P_* flags */ 00143 long ki_kiflag; /* KI_* flags (below) */ 00144 int ki_traceflag; /* Kernel trace points */ 00145 char ki_stat; /* S* process status */ 00146 char ki_nice; /* Process "nice" value */ 00147 char ki_lock; /* Process lock (prevent swap) count */ 00148 char ki_rqindex; /* Run queue index */ 00149 u_char ki_oncpu; /* Which cpu we are on */ 00150 u_char ki_lastcpu; /* Last cpu we were on */ 00151 char ki_ocomm[OCOMMLEN+1]; /* command name */ 00152 char ki_wmesg[WMESGLEN+1]; /* wchan message */ 00153 char ki_login[LOGNAMELEN+1]; /* setlogin name */ 00154 char ki_lockname[LOCKNAMELEN+1]; /* lock name */ 00155 char ki_comm[COMMLEN+1]; /* command name */ 00156 char ki_sparestrings[85]; /* spare string space */ 00157 struct rusage ki_rusage; /* process rusage statistics */ 00158 long ki_sflag; /* PS_* flags */ 00159 struct priority ki_pri; /* process priority */ 00160 long ki_tdflags; /* XXXKSE kthread flag */ 00161 struct pcb *ki_pcb; /* kernel virtual addr of pcb */ 00162 void *ki_kstack; /* kernel virtual addr of stack */ 00163 long ki_spare[22]; /* spare constants */ 00164 }; 00165 void fill_kinfo_proc(struct proc *, struct kinfo_proc *); 00166 00167 /* ki_sessflag values */ 00168 #define KI_CTTY 0x00000001 /* controlling tty vnode active */ 00169 #define KI_SLEADER 0x00000002 /* session leader */ 00170 #define KI_LOCKBLOCK 0x00000004 /* proc blocked on lock ki_lockname */ 00171 00172 /* 00173 * Per process structure containing data that isn't needed in core 00174 * when the process isn't running (esp. when swapped out). 00175 */ 00176 struct user { 00177 struct pstats u_stats; /* *p_stats */ 00178 /* 00179 * Remaining field for a.out core dumps - not valid at other times! 00180 */ 00181 struct kinfo_proc u_kproc; /* eproc */ 00182 }; 00183 00184 #endif
1.7.1