user.h revision 34924
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 3434924Sbde * $Id: user.h,v 1.14 1997/03/03 09:51:15 ache 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 */ 4318207Sbde#include <sys/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 */ 5222521Sdyson#include <sys/lock.h> /* XXX */ 5312685Speter#include <vm/vm_map.h> /* XXX */ 5411913Sphk#endif /* !KERNEL */ 5534924Sbde#ifndef _SYS_RESOURCEVAR_H_ 561541Srgrimes#include <sys/resourcevar.h> 5734924Sbde#endif 5834924Sbde#ifndef _SYS_SIGNALVAR_H_ 591541Srgrimes#include <sys/signalvar.h> 6034924Sbde#endif 611541Srgrimes 621541Srgrimes/* 6311865Sphk * KERN_PROC subtype ops return arrays of augmented proc structures: 6411865Sphk */ 6511865Sphkstruct kinfo_proc { 6611865Sphk struct proc kp_proc; /* proc structure */ 6711865Sphk struct eproc { 6811865Sphk struct proc *e_paddr; /* address of proc */ 6911865Sphk struct session *e_sess; /* session pointer */ 7011865Sphk struct pcred e_pcred; /* process credentials */ 7111865Sphk struct ucred e_ucred; /* current credentials */ 7211865Sphk struct vmspace e_vm; /* address space */ 7311865Sphk pid_t e_ppid; /* parent process id */ 7411865Sphk pid_t e_pgid; /* process group id */ 7511865Sphk short e_jobc; /* job control counter */ 7611865Sphk dev_t e_tdev; /* controlling tty dev */ 7711865Sphk pid_t e_tpgid; /* tty process group id */ 7811865Sphk struct session *e_tsess; /* tty session pointer */ 7911865Sphk#define WMESGLEN 7 8011865Sphk char e_wmesg[WMESGLEN+1]; /* wchan message */ 8111865Sphk segsz_t e_xsize; /* text size */ 8211865Sphk short e_xrssize; /* text rss */ 8311865Sphk short e_xccount; /* text references */ 8411865Sphk short e_xswrss; 8511865Sphk long e_flag; 8611865Sphk#define EPROC_CTTY 0x01 /* controlling tty vnode active */ 8711865Sphk#define EPROC_SLEADER 0x02 /* session leader */ 8823328Sache char e_login[roundup(MAXLOGNAME, sizeof(long))]; /* setlogin() name */ 8923322Sache long e_spare[2]; 9011865Sphk } kp_eproc; 9111865Sphk}; 9211865Sphkvoid fill_eproc __P((struct proc *, struct eproc *)); 9311865Sphk 9411865Sphk 9511865Sphk/* 961541Srgrimes * Per process structure containing data that isn't needed in core 971541Srgrimes * when the process isn't running (esp. when swapped out). 981541Srgrimes * This structure may or may not be at the same kernel address 991541Srgrimes * in all processes. 1001541Srgrimes */ 1018876Srgrimes 1021541Srgrimesstruct user { 1031541Srgrimes struct pcb u_pcb; 1041541Srgrimes 1051541Srgrimes struct sigacts u_sigacts; /* p_sigacts points here (use it!) */ 1061541Srgrimes struct pstats u_stats; /* p_stats points here (use it!) */ 1071541Srgrimes 1081541Srgrimes /* 1091541Srgrimes * Remaining fields only for core dump and/or ptrace-- 1101541Srgrimes * not valid at other times! 1111541Srgrimes */ 1121541Srgrimes struct kinfo_proc u_kproc; /* proc + eproc */ 1131541Srgrimes struct md_coredump u_md; /* machine dependent glop */ 1141541Srgrimes}; 1151541Srgrimes 1161541Srgrimes/* 1171541Srgrimes * Redefinitions to make the debuggers happy for now... This subterfuge 1181541Srgrimes * brought to you by coredump() and trace_req(). These fields are *only* 1191541Srgrimes * valid at those times! 1201541Srgrimes */ 1211541Srgrimes#define U_ar0 u_kproc.kp_proc.p_md.md_regs /* copy of curproc->p_md.md_regs */ 1221541Srgrimes#define U_tsize u_kproc.kp_eproc.e_vm.vm_tsize 1231541Srgrimes#define U_dsize u_kproc.kp_eproc.e_vm.vm_dsize 1241541Srgrimes#define U_ssize u_kproc.kp_eproc.e_vm.vm_ssize 1251541Srgrimes#define U_sig u_sigacts.ps_sig 1261541Srgrimes#define U_code u_sigacts.ps_code 1271541Srgrimes 1281541Srgrimes#ifndef KERNEL 1291541Srgrimes#define u_ar0 U_ar0 1301541Srgrimes#define u_tsize U_tsize 1311541Srgrimes#define u_dsize U_dsize 1321541Srgrimes#define u_ssize U_ssize 1331541Srgrimes#define u_sig U_sig 1341541Srgrimes#define u_code U_code 1351541Srgrimes#endif /* KERNEL */ 1362165Spaul 1372165Spaul#endif 138