user.h revision 11865
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
3411865Sphk * $Id: user.h,v 1.4 1995/05/30 08:14:50 rgrimes 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>
481541Srgrimes#endif
491541Srgrimes#include <sys/resourcevar.h>
501541Srgrimes#include <sys/signalvar.h>
511541Srgrimes#include <vm/vm.h>		/* XXX */
521541Srgrimes
531541Srgrimes
5411865Sphk#ifndef KERNEL
5511865Sphk#include <sys/time.h>
5611865Sphk#include <sys/ucred.h>
5711865Sphk#include <sys/proc.h>
5811865Sphk#include <vm/vm.h>
5911865Sphk#endif
6011865Sphk
611541Srgrimes/*
6211865Sphk * KERN_PROC subtype ops return arrays of augmented proc structures:
6311865Sphk */
6411865Sphkstruct kinfo_proc {
6511865Sphk	struct	proc kp_proc;			/* proc structure */
6611865Sphk	struct	eproc {
6711865Sphk		struct	proc *e_paddr;		/* address of proc */
6811865Sphk		struct	session *e_sess;	/* session pointer */
6911865Sphk		struct	pcred e_pcred;		/* process credentials */
7011865Sphk		struct	ucred e_ucred;		/* current credentials */
7111865Sphk		struct	vmspace e_vm;		/* address space */
7211865Sphk		pid_t	e_ppid;			/* parent process id */
7311865Sphk		pid_t	e_pgid;			/* process group id */
7411865Sphk		short	e_jobc;			/* job control counter */
7511865Sphk		dev_t	e_tdev;			/* controlling tty dev */
7611865Sphk		pid_t	e_tpgid;		/* tty process group id */
7711865Sphk		struct	session *e_tsess;	/* tty session pointer */
7811865Sphk#define	WMESGLEN	7
7911865Sphk		char	e_wmesg[WMESGLEN+1];	/* wchan message */
8011865Sphk		segsz_t e_xsize;		/* text size */
8111865Sphk		short	e_xrssize;		/* text rss */
8211865Sphk		short	e_xccount;		/* text references */
8311865Sphk		short	e_xswrss;
8411865Sphk		long	e_flag;
8511865Sphk#define	EPROC_CTTY	0x01	/* controlling tty vnode active */
8611865Sphk#define	EPROC_SLEADER	0x02	/* session leader */
8711865Sphk		char	e_login[MAXLOGNAME];	/* setlogin() name */
8811865Sphk		long	e_spare[4];
8911865Sphk	} kp_eproc;
9011865Sphk};
9111865Sphkvoid fill_eproc __P((struct proc *, struct eproc *));
9211865Sphk
9311865Sphk
9411865Sphk/*
951541Srgrimes * Per process structure containing data that isn't needed in core
961541Srgrimes * when the process isn't running (esp. when swapped out).
971541Srgrimes * This structure may or may not be at the same kernel address
981541Srgrimes * in all processes.
991541Srgrimes */
1008876Srgrimes
1011541Srgrimesstruct	user {
1021541Srgrimes	struct	pcb u_pcb;
1031541Srgrimes
1041541Srgrimes	struct	sigacts u_sigacts;	/* p_sigacts points here (use it!) */
1051541Srgrimes	struct	pstats u_stats;		/* p_stats points here (use it!) */
1061541Srgrimes
1071541Srgrimes	/*
1081541Srgrimes	 * Remaining fields only for core dump and/or ptrace--
1091541Srgrimes	 * not valid at other times!
1101541Srgrimes	 */
1111541Srgrimes	struct	kinfo_proc u_kproc;	/* proc + eproc */
1121541Srgrimes	struct	md_coredump u_md;	/* machine dependent glop */
1131541Srgrimes};
1141541Srgrimes
1151541Srgrimes/*
1161541Srgrimes * Redefinitions to make the debuggers happy for now...  This subterfuge
1171541Srgrimes * brought to you by coredump() and trace_req().  These fields are *only*
1181541Srgrimes * valid at those times!
1191541Srgrimes */
1201541Srgrimes#define	U_ar0	u_kproc.kp_proc.p_md.md_regs /* copy of curproc->p_md.md_regs */
1211541Srgrimes#define	U_tsize	u_kproc.kp_eproc.e_vm.vm_tsize
1221541Srgrimes#define	U_dsize	u_kproc.kp_eproc.e_vm.vm_dsize
1231541Srgrimes#define	U_ssize	u_kproc.kp_eproc.e_vm.vm_ssize
1241541Srgrimes#define	U_sig	u_sigacts.ps_sig
1251541Srgrimes#define	U_code	u_sigacts.ps_code
1261541Srgrimes
1271541Srgrimes#ifndef KERNEL
1281541Srgrimes#define	u_ar0	U_ar0
1291541Srgrimes#define	u_tsize	U_tsize
1301541Srgrimes#define	u_dsize	U_dsize
1311541Srgrimes#define	u_ssize	U_ssize
1321541Srgrimes#define	u_sig	U_sig
1331541Srgrimes#define	u_code	U_code
1341541Srgrimes#endif /* KERNEL */
1352165Spaul
1362165Spaul#endif
137