FreeBSD/Linux Kernel Cross Reference
sys/sys/resourcevar.h
1 /* $NetBSD: resourcevar.h,v 1.19 2003/08/07 16:34:12 agc Exp $ */
2
3 /*
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)resourcevar.h 8.4 (Berkeley) 1/9/95
32 */
33
34 #ifndef _SYS_RESOURCEVAR_H_
35 #define _SYS_RESOURCEVAR_H_
36
37 /*
38 * Kernel per-process accounting / statistics
39 * (not necessarily resident except when running).
40 */
41 struct pstats {
42 #define pstat_startzero p_ru
43 struct rusage p_ru; /* stats for this proc */
44 struct rusage p_cru; /* sum of stats for reaped children */
45 #define pstat_endzero pstat_startcopy
46
47 #define pstat_startcopy p_timer
48 struct itimerval p_timer[3]; /* virtual-time timers */
49
50 struct uprof { /* profile arguments */
51 caddr_t pr_base; /* buffer base */
52 size_t pr_size; /* buffer size */
53 u_long pr_off; /* pc offset */
54 u_int pr_scale; /* pc scaling */
55 u_long pr_addr; /* temp storage for addr until AST */
56 u_long pr_ticks; /* temp storage for ticks until AST */
57 } p_prof;
58 #define pstat_endcopy p_start
59 struct timeval p_start; /* starting time */
60 };
61
62 /*
63 * Kernel shareable process resource limits. Because this structure
64 * is moderately large but changes infrequently, it is normally
65 * shared copy-on-write after forks. If a group of processes
66 * ("threads") share modifications, the PL_SHAREMOD flag is set,
67 * and a copy must be made for the child of a new fork that isn't
68 * sharing modifications to the limits.
69 */
70 struct plimit {
71 struct rlimit pl_rlimit[RLIM_NLIMITS];
72 char *pl_corename;
73 #define PL_SHAREMOD 0x01 /* modifications are shared */
74 int p_lflags;
75 int p_refcnt; /* number of references */
76 };
77
78 /* add user profiling from AST */
79 #define ADDUPROF(p) \
80 do { \
81 addupc_task(p, \
82 (p)->p_stats->p_prof.pr_addr, \
83 (p)->p_stats->p_prof.pr_ticks); \
84 (p)->p_stats->p_prof.pr_ticks = 0; \
85 } while (/* CONSTCOND */ 0)
86
87 #ifdef _KERNEL
88 extern char defcorename[];
89 void addupc_intr __P((struct proc *, u_long));
90 void addupc_task __P((struct proc *, u_long, u_int));
91 void calcru __P((struct proc *, struct timeval *, struct timeval *,
92 struct timeval *));
93 struct plimit *limcopy __P((struct plimit *));
94 void limfree __P((struct plimit *));
95 void ruadd __P((struct rusage *, struct rusage *));
96 struct pstats *pstatscopy __P((struct pstats *));
97 void pstatsfree __P((struct pstats *));
98 #endif
99 #endif /* !_SYS_RESOURCEVAR_H_ */
Cache object: 4525ac074c7207bfd81445b08f6e6cfc
|