1 /* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)resourcevar.h 8.2 (Berkeley) 01/04/94 8 */ 9 10 #ifndef _SYS_RESOURCEVAR_H_ /* tmp for user.h */ 11 #define _SYS_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 caddr_t pr_base; /* buffer base */ 28 u_long pr_size; /* buffer size */ 29 u_long pr_off; /* pc offset */ 30 u_long pr_scale; /* pc scaling */ 31 u_long pr_addr; /* temp storage for addr until AST */ 32 u_long pr_ticks; /* temp storage for ticks until AST */ 33 } p_prof; 34 #define pstat_endcopy p_start 35 struct timeval p_start; /* starting time */ 36 }; 37 38 /* 39 * Kernel shareable process resource limits. Because this structure 40 * is moderately large but changes infrequently, it is normally 41 * shared copy-on-write after forks. If a group of processes 42 * ("threads") share modifications, the PL_SHAREMOD flag is set, 43 * and a copy must be made for the child of a new fork that isn't 44 * sharing modifications to the limits. 45 */ 46 struct plimit { 47 struct rlimit pl_rlimit[RLIM_NLIMITS]; 48 int p_lflags; /* below */ 49 int p_refcnt; /* number of references */ 50 }; 51 52 /* pl_lflags: */ 53 #define PL_SHAREMOD 0x01 /* modifications are shared */ 54 55 /* make copy of plimit structure */ 56 struct plimit *limcopy __P((struct plimit *lim)); 57 58 /* add profiling ticks: in interrupt context, and from AST */ 59 void addupc_intr __P((struct proc *p, u_long pc, u_int ticks)); 60 void addupc_task __P((struct proc *p, u_long pc, u_int ticks)); 61 62 /* add user profiling from AST */ 63 #define ADDUPROF(p) addupc_task(p, (p)->p_stats->p_prof.pr_addr, \ 64 (p)->p_stats->p_prof.pr_ticks) 65 66 #endif /* !_SYS_RESOURCEVAR_H_ */ 67