resourcevar.h revision 50477
11541Srgrimes/* 21541Srgrimes * Copyright (c) 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 * 3314501Shsu * @(#)resourcevar.h 8.4 (Berkeley) 1/9/95 3450477Speter * $FreeBSD: head/sys/sys/resourcevar.h 50477 1999-08-28 01:08:13Z peter $ 351541Srgrimes */ 361541Srgrimes 371541Srgrimes#ifndef _SYS_RESOURCEVAR_H_ 381541Srgrimes#define _SYS_RESOURCEVAR_H_ 391541Srgrimes 4034924Sbde#include <sys/resource.h> 4134924Sbde 421541Srgrimes/* 431541Srgrimes * Kernel per-process accounting / statistics 441541Srgrimes * (not necessarily resident except when running). 451541Srgrimes */ 461541Srgrimesstruct pstats { 471541Srgrimes#define pstat_startzero p_ru 481541Srgrimes struct rusage p_ru; /* stats for this proc */ 491541Srgrimes struct rusage p_cru; /* sum of stats for reaped children */ 5044725Sbde u_int64_t p_uu; /* previous user time (us) */ 5144725Sbde u_int64_t p_su; /* previous system time (us) */ 5244725Sbde u_int64_t p_iu; /* previous interrupt time (us) */ 531541Srgrimes#define pstat_endzero pstat_startcopy 541541Srgrimes 551541Srgrimes#define pstat_startcopy p_timer 561541Srgrimes struct itimerval p_timer[3]; /* virtual-time timers */ 571541Srgrimes 581541Srgrimes struct uprof { /* profile arguments */ 591541Srgrimes caddr_t pr_base; /* buffer base */ 601541Srgrimes u_long pr_size; /* buffer size */ 611541Srgrimes u_long pr_off; /* pc offset */ 621541Srgrimes u_long pr_scale; /* pc scaling */ 631541Srgrimes u_long pr_addr; /* temp storage for addr until AST */ 641541Srgrimes u_long pr_ticks; /* temp storage for ticks until AST */ 651541Srgrimes } p_prof; 661541Srgrimes#define pstat_endcopy p_start 671541Srgrimes struct timeval p_start; /* starting time */ 681541Srgrimes}; 691541Srgrimes 701541Srgrimes/* 711541Srgrimes * Kernel shareable process resource limits. Because this structure 721541Srgrimes * is moderately large but changes infrequently, it is normally 731541Srgrimes * shared copy-on-write after forks. If a group of processes 741541Srgrimes * ("threads") share modifications, the PL_SHAREMOD flag is set, 751541Srgrimes * and a copy must be made for the child of a new fork that isn't 761541Srgrimes * sharing modifications to the limits. 771541Srgrimes */ 781541Srgrimesstruct plimit { 791541Srgrimes struct rlimit pl_rlimit[RLIM_NLIMITS]; 801541Srgrimes#define PL_SHAREMOD 0x01 /* modifications are shared */ 811541Srgrimes int p_lflags; 821541Srgrimes int p_refcnt; /* number of references */ 8336441Sphk rlim_t p_cpulimit; /* current cpu limit in usec */ 841541Srgrimes}; 851541Srgrimes 861541Srgrimes#ifdef KERNEL 8734924Sbdestruct proc; 8834924Sbde 891541Srgrimesvoid addupc_intr __P((struct proc *p, u_long pc, u_int ticks)); 901541Srgrimesvoid addupc_task __P((struct proc *p, u_long pc, u_int ticks)); 914470Sbdevoid calcru __P((struct proc *p, struct timeval *up, struct timeval *sp, 9214501Shsu struct timeval *ip)); 934470Sbdeint fuswintr __P((void *base)); 941541Srgrimesstruct plimit 951541Srgrimes *limcopy __P((struct plimit *lim)); 964470Sbdevoid ruadd __P((struct rusage *ru, struct rusage *ru2)); 974470Sbdeint suswintr __P((void *base, int word)); 981541Srgrimes#endif 994470Sbde 1001541Srgrimes#endif /* !_SYS_RESOURCEVAR_H_ */ 101