]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /* $NetBSD: resource.h,v 1.29 2006/07/23 22:06:14 ad Exp $ */\r |
2 | \r | |
3 | /*\r | |
4 | * Copyright (c) 1982, 1986, 1993\r | |
5 | * The Regents of the University of California. All rights reserved.\r | |
6 | *\r | |
7 | * Redistribution and use in source and binary forms, with or without\r | |
8 | * modification, are permitted provided that the following conditions\r | |
9 | * are met:\r | |
10 | * 1. Redistributions of source code must retain the above copyright\r | |
11 | * notice, this list of conditions and the following disclaimer.\r | |
12 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
13 | * notice, this list of conditions and the following disclaimer in the\r | |
14 | * documentation and/or other materials provided with the distribution.\r | |
15 | * 3. Neither the name of the University nor the names of its contributors\r | |
16 | * may be used to endorse or promote products derived from this software\r | |
17 | * without specific prior written permission.\r | |
18 | *\r | |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r | |
29 | * SUCH DAMAGE.\r | |
30 | *\r | |
31 | * @(#)resource.h 8.4 (Berkeley) 1/9/95\r | |
32 | */\r | |
33 | \r | |
34 | #ifndef _SYS_RESOURCE_H_\r | |
35 | #define _SYS_RESOURCE_H_\r | |
36 | \r | |
37 | #include <sys/featuretest.h>\r | |
38 | #include <sys/time.h>\r | |
39 | \r | |
40 | /*\r | |
41 | * Process priority specifications to get/setpriority.\r | |
42 | */\r | |
43 | #define PRIO_MIN -20\r | |
44 | #define PRIO_MAX 20\r | |
45 | \r | |
46 | #define PRIO_PROCESS 0\r | |
47 | #define PRIO_PGRP 1\r | |
48 | #define PRIO_USER 2\r | |
49 | \r | |
50 | /*\r | |
51 | * Resource utilization information.\r | |
52 | */\r | |
53 | \r | |
54 | #define RUSAGE_SELF 0\r | |
55 | #define RUSAGE_CHILDREN -1\r | |
56 | \r | |
57 | struct rusage {\r | |
58 | struct timeval ru_utime; /* user time used */\r | |
59 | struct timeval ru_stime; /* system time used */\r | |
60 | long ru_maxrss; /* max resident set size */\r | |
61 | #ifdef _KERNEL\r | |
62 | #define ru_first ru_ixrss\r | |
63 | #endif\r | |
64 | long ru_ixrss; /* integral shared memory size */\r | |
65 | long ru_idrss; /* integral unshared data " */\r | |
66 | long ru_isrss; /* integral unshared stack " */\r | |
67 | long ru_minflt; /* page reclaims */\r | |
68 | long ru_majflt; /* page faults */\r | |
69 | long ru_nswap; /* swaps */\r | |
70 | long ru_inblock; /* block input operations */\r | |
71 | long ru_oublock; /* block output operations */\r | |
72 | long ru_msgsnd; /* messages sent */\r | |
73 | long ru_msgrcv; /* messages received */\r | |
74 | long ru_nsignals; /* signals received */\r | |
75 | long ru_nvcsw; /* voluntary context switches */\r | |
76 | long ru_nivcsw; /* involuntary " */\r | |
77 | #ifdef _KERNEL\r | |
78 | #define ru_last ru_nivcsw\r | |
79 | #endif\r | |
80 | };\r | |
81 | \r | |
82 | /*\r | |
83 | * Resource limits\r | |
84 | */\r | |
85 | #define RLIMIT_CPU 0 /* cpu time in milliseconds */\r | |
86 | #define RLIMIT_FSIZE 1 /* maximum file size */\r | |
87 | #define RLIMIT_DATA 2 /* data size */\r | |
88 | #define RLIMIT_STACK 3 /* stack size */\r | |
89 | #define RLIMIT_CORE 4 /* core file size */\r | |
90 | #define RLIMIT_RSS 5 /* resident set size */\r | |
91 | #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */\r | |
92 | #define RLIMIT_NPROC 7 /* number of processes */\r | |
93 | #define RLIMIT_NOFILE 8 /* number of open files */\r | |
94 | #define RLIMIT_SBSIZE 9 /* maximum size of all socket buffers */\r | |
95 | \r | |
96 | #if defined(_NETBSD_SOURCE)\r | |
97 | #define RLIM_NLIMITS 10 /* number of resource limits */\r | |
98 | #endif\r | |
99 | \r | |
100 | #define RLIM_INFINITY (~((u_quad_t)1 << 63)) /* no limit */\r | |
101 | #define RLIM_SAVED_MAX RLIM_INFINITY /* unrepresentable hard limit */\r | |
102 | #define RLIM_SAVED_CUR RLIM_INFINITY /* unrepresentable soft limit */\r | |
103 | \r | |
104 | #if defined(_KERNEL)\r | |
105 | /* 4.3BSD compatibility rlimit argument structure. */\r | |
106 | struct orlimit {\r | |
107 | int32_t rlim_cur; /* current (soft) limit */\r | |
108 | int32_t rlim_max; /* maximum value for rlim_cur */\r | |
109 | };\r | |
110 | #endif\r | |
111 | \r | |
112 | struct rlimit {\r | |
113 | rlim_t rlim_cur; /* current (soft) limit */\r | |
114 | rlim_t rlim_max; /* maximum value for rlim_cur */\r | |
115 | };\r | |
116 | \r | |
117 | #if defined(_NETBSD_SOURCE)\r | |
118 | /* Load average structure. */\r | |
119 | struct loadavg {\r | |
120 | fixpt_t ldavg[3];\r | |
121 | long fscale;\r | |
122 | };\r | |
123 | #endif\r | |
124 | \r | |
125 | #ifdef _KERNEL\r | |
126 | extern struct loadavg averunnable;\r | |
127 | struct pcred;\r | |
128 | int dosetrlimit(struct lwp *, struct proc *, int, struct rlimit *);\r | |
129 | int donice(struct lwp *, struct proc *, int);\r | |
130 | \r | |
131 | #else\r | |
132 | #include <sys/EfiCdefs.h>\r | |
133 | \r | |
134 | __BEGIN_DECLS\r | |
135 | int getpriority(int, id_t);\r | |
136 | int getrlimit(int, struct rlimit *);\r | |
137 | int getrusage(int, struct rusage *);\r | |
138 | int setpriority(int, id_t, int);\r | |
139 | int setrlimit(int, const struct rlimit *);\r | |
140 | __END_DECLS\r | |
141 | \r | |
142 | #endif /* _KERNEL */\r | |
143 | #endif /* !_SYS_RESOURCE_H_ */\r |