user.h revision 12685
11541Srgrimes/* 21541Srgrimes * Copyright (c) 1982, 1986, 1989, 1991, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 3. All advertising materials mentioning features or use of this software 141541Srgrimes * must display the following acknowledgement: 151541Srgrimes * This product includes software developed by the University of 161541Srgrimes * California, Berkeley and its contributors. 171541Srgrimes * 4. Neither the name of the University nor the names of its contributors 181541Srgrimes * may be used to endorse or promote products derived from this software 191541Srgrimes * without specific prior written permission. 201541Srgrimes * 211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311541Srgrimes * SUCH DAMAGE. 321541Srgrimes * 331541Srgrimes * @(#)user.h 8.2 (Berkeley) 9/23/93 3412685Speter * $Id: user.h,v 1.6 1995/10/29 09:51:47 phk Exp $ 351541Srgrimes */ 361541Srgrimes 372165Spaul#ifndef _SYS_USER_H_ 382165Spaul#define _SYS_USER_H_ 392165Spaul 401541Srgrimes#include <machine/pcb.h> 411541Srgrimes#ifndef KERNEL 421541Srgrimes/* stuff that *used* to be included by user.h, or is now needed */ 431541Srgrimes#include <errno.h> 441541Srgrimes#include <sys/time.h> 451541Srgrimes#include <sys/resource.h> 461541Srgrimes#include <sys/ucred.h> 471541Srgrimes#include <sys/uio.h> 4811913Sphk#include <sys/proc.h> 4912685Speter#include <vm/vm.h> /* XXX */ 5012685Speter#include <vm/vm_param.h> /* XXX */ 5112685Speter#include <vm/pmap.h> /* XXX */ 5212685Speter#include <vm/lock.h> /* XXX */ 5312685Speter#include <vm/vm_map.h> /* XXX */ 5412685Speter#else 5512685Speter#include <vm/vm.h> /* XXX */ 5611913Sphk#endif /* !KERNEL */ 571541Srgrimes#include <sys/resourcevar.h> 581541Srgrimes#include <sys/signalvar.h> 591541Srgrimes 601541Srgrimes/* 6111865Sphk * KERN_PROC subtype ops return arrays of augmented proc structures: 6211865Sphk */ 6311865Sphkstruct kinfo_proc { 6411865Sphk struct proc kp_proc; /* proc structure */ 6511865Sphk struct eproc { 6611865Sphk struct proc *e_paddr; /* address of proc */ 6711865Sphk struct session *e_sess; /* session pointer */ 6811865Sphk struct pcred e_pcred; /* process credentials */ 6911865Sphk struct ucred e_ucred; /* current credentials */ 7011865Sphk struct vmspace e_vm; /* address space */ 7111865Sphk pid_t e_ppid; /* parent process id */ 7211865Sphk pid_t e_pgid; /* process group id */ 7311865Sphk short e_jobc; /* job control counter */ 7411865Sphk dev_t e_tdev; /* controlling tty dev */ 7511865Sphk pid_t e_tpgid; /* tty process group id */ 7611865Sphk struct session *e_tsess; /* tty session pointer */ 7711865Sphk#define WMESGLEN 7 7811865Sphk char e_wmesg[WMESGLEN+1]; /* wchan message */ 7911865Sphk segsz_t e_xsize; /* text size */ 8011865Sphk short e_xrssize; /* text rss */ 8111865Sphk short e_xccount; /* text references */ 8211865Sphk short e_xswrss; 8311865Sphk long e_flag; 8411865Sphk#define EPROC_CTTY 0x01 /* controlling tty vnode active */ 8511865Sphk#define EPROC_SLEADER 0x02 /* session leader */ 8611865Sphk char e_login[MAXLOGNAME]; /* setlogin() name */ 8711865Sphk long e_spare[4]; 8811865Sphk } kp_eproc; 8911865Sphk}; 9011865Sphkvoid fill_eproc __P((struct proc *, struct eproc *)); 9111865Sphk 9211865Sphk 9311865Sphk/* 941541Srgrimes * Per process structure containing data that isn't needed in core 951541Srgrimes * when the process isn't running (esp. when swapped out). 961541Srgrimes * This structure may or may not be at the same kernel address 971541Srgrimes * in all processes. 981541Srgrimes */ 998876Srgrimes 1001541Srgrimesstruct user { 1011541Srgrimes struct pcb u_pcb; 1021541Srgrimes 1031541Srgrimes struct sigacts u_sigacts; /* p_sigacts points here (use it!) */ 1041541Srgrimes struct pstats u_stats; /* p_stats points here (use it!) */ 1051541Srgrimes 1061541Srgrimes /* 1071541Srgrimes * Remaining fields only for core dump and/or ptrace-- 1081541Srgrimes * not valid at other times! 1091541Srgrimes */ 1101541Srgrimes struct kinfo_proc u_kproc; /* proc + eproc */ 1111541Srgrimes struct md_coredump u_md; /* machine dependent glop */ 1121541Srgrimes}; 1131541Srgrimes 1141541Srgrimes/* 1151541Srgrimes * Redefinitions to make the debuggers happy for now... This subterfuge 1161541Srgrimes * brought to you by coredump() and trace_req(). These fields are *only* 1171541Srgrimes * valid at those times! 1181541Srgrimes */ 1191541Srgrimes#define U_ar0 u_kproc.kp_proc.p_md.md_regs /* copy of curproc->p_md.md_regs */ 1201541Srgrimes#define U_tsize u_kproc.kp_eproc.e_vm.vm_tsize 1211541Srgrimes#define U_dsize u_kproc.kp_eproc.e_vm.vm_dsize 1221541Srgrimes#define U_ssize u_kproc.kp_eproc.e_vm.vm_ssize 1231541Srgrimes#define U_sig u_sigacts.ps_sig 1241541Srgrimes#define U_code u_sigacts.ps_code 1251541Srgrimes 1261541Srgrimes#ifndef KERNEL 1271541Srgrimes#define u_ar0 U_ar0 1281541Srgrimes#define u_tsize U_tsize 1291541Srgrimes#define u_dsize U_dsize 1301541Srgrimes#define u_ssize U_ssize 1311541Srgrimes#define u_sig U_sig 1321541Srgrimes#define u_code U_code 1331541Srgrimes#endif /* KERNEL */ 1342165Spaul 1352165Spaul#endif 136