user.h revision 55205
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 3450477Speter * $FreeBSD: head/sys/sys/user.h 55205 1999-12-29 04:46:21Z peter $ 351541Srgrimes */ 361541Srgrimes 372165Spaul#ifndef _SYS_USER_H_ 382165Spaul#define _SYS_USER_H_ 392165Spaul 401541Srgrimes#include <machine/pcb.h> 4155205Speter#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 */ 5455205Speter#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 */ 7242612Sjulian struct procsig e_procsig; /* shared signal structure */ 7311865Sphk struct vmspace e_vm; /* address space */ 7453275Speter struct pstats e_stats; /* process stats */ 7511865Sphk pid_t e_ppid; /* parent process id */ 7611865Sphk pid_t e_pgid; /* process group id */ 7711865Sphk short e_jobc; /* job control counter */ 7847270Sdfr udev_t e_tdev; /* controlling tty dev */ 7911865Sphk pid_t e_tpgid; /* tty process group id */ 8011865Sphk struct session *e_tsess; /* tty session pointer */ 8111865Sphk#define WMESGLEN 7 8211865Sphk char e_wmesg[WMESGLEN+1]; /* wchan message */ 8311865Sphk segsz_t e_xsize; /* text size */ 8411865Sphk short e_xrssize; /* text rss */ 8511865Sphk short e_xccount; /* text references */ 8611865Sphk short e_xswrss; 8711865Sphk long e_flag; 8811865Sphk#define EPROC_CTTY 0x01 /* controlling tty vnode active */ 8911865Sphk#define EPROC_SLEADER 0x02 /* session leader */ 9023328Sache char e_login[roundup(MAXLOGNAME, sizeof(long))]; /* setlogin() name */ 9123322Sache long e_spare[2]; 9211865Sphk } kp_eproc; 9311865Sphk}; 9411865Sphkvoid fill_eproc __P((struct proc *, struct eproc *)); 9511865Sphk 9611865Sphk 9711865Sphk/* 981541Srgrimes * Per process structure containing data that isn't needed in core 991541Srgrimes * when the process isn't running (esp. when swapped out). 1001541Srgrimes * This structure may or may not be at the same kernel address 1011541Srgrimes * in all processes. 1021541Srgrimes */ 1038876Srgrimes 1041541Srgrimesstruct user { 1051541Srgrimes struct pcb u_pcb; 1061541Srgrimes struct sigacts u_sigacts; /* p_sigacts points here (use it!) */ 1071541Srgrimes struct pstats u_stats; /* p_stats points here (use it!) */ 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 */ 12137689Sdfr#ifdef __i386__ 1221541Srgrimes#define U_ar0 u_kproc.kp_proc.p_md.md_regs /* copy of curproc->p_md.md_regs */ 12337689Sdfr#endif 12437689Sdfr#ifdef __alpha__ 12537689Sdfr#define U_ar0 u_kproc.kp_proc.p_md.md_tf /* copy of curproc->p_md.md_tf */ 12637689Sdfr#endif 1271541Srgrimes#define U_tsize u_kproc.kp_eproc.e_vm.vm_tsize 1281541Srgrimes#define U_dsize u_kproc.kp_eproc.e_vm.vm_dsize 1291541Srgrimes#define U_ssize u_kproc.kp_eproc.e_vm.vm_ssize 13041931Sjulian#define U_sig u_kproc.kp_proc.p_sig 13141931Sjulian#define U_code u_kproc.kp_proc.p_code 1321541Srgrimes 13355205Speter#ifndef _KERNEL 1341541Srgrimes#define u_ar0 U_ar0 1351541Srgrimes#define u_tsize U_tsize 1361541Srgrimes#define u_dsize U_dsize 1371541Srgrimes#define u_ssize U_ssize 1381541Srgrimes#define u_sig U_sig 1391541Srgrimes#define u_code U_code 14055205Speter#endif 1412165Spaul 1422165Spaul#endif 143