xref: /original-bsd/sys/sys/resourcevar.h (revision a6d4d8bb)
1 /*
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)resourcevar.h	7.1 (Berkeley) 05/09/91
8  */
9 
10 #ifndef	_RESOURCEVAR_H_		/* tmp for user.h */
11 #define	_RESOURCEVAR_H_
12 
13 /*
14  * Kernel per-process accounting / statistics
15  * (not necessarily resident except when running).
16  */
17 struct pstats {
18 #define	pstat_startzero	p_ru
19 	struct	rusage p_ru;		/* stats for this proc */
20 	struct	rusage p_cru;		/* sum of stats for reaped children */
21 #define	pstat_endzero	pstat_startcopy
22 
23 #define	pstat_startcopy	p_timer
24 	struct	itimerval p_timer[3];	/* virtual-time timers */
25 
26 	struct uprof {			/* profile arguments */
27 		short	*pr_base;	/* buffer base */
28 		unsigned pr_size;	/* buffer size */
29 		unsigned pr_off;	/* pc offset */
30 		unsigned pr_scale;	/* pc scaling */
31 	} p_prof;
32 #define	pstat_endcopy	p_start
33 	struct	timeval p_start;	/* starting time */
34 };
35 
36 /*
37  * Kernel shareable process resource limits.  Because this structure
38  * is moderately large but changes infrequently, it is normally
39  * shared copy-on-write after forks.  If a group of processes
40  * ("threads") share modifications, the PL_SHAREMOD flag is set,
41  * and a copy must be made for the child of a new fork that isn't
42  * sharing modifications to the limits.
43  */
44 struct plimit {
45 	struct	rlimit pl_rlimit[RLIM_NLIMITS];
46 	int	p_lflags;		/* below */
47 	int	p_refcnt;		/* number of references */
48 };
49 
50 /* pl_lflags: */
51 #define	PL_SHAREMOD	0x01		/* modifications are shared */
52 
53 /* make copy of plimit structure */
54 struct	plimit *limcopy __P((struct plimit *lim));
55 #endif	/* !_RESOURCEVAR_H_ */
56