UbixOS  2.0
resource.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2002-2018 The UbixOS Project.
3  * All rights reserved.
4  *
5  * This was developed by Christopher W. Olsen for the UbixOS Project.
6  *
7  * Redistribution and use in source and binary forms, with or without modification, are permitted
8  * provided that the following conditions are met:
9  *
10  * 1) Redistributions of source code must retain the above copyright notice, this list of
11  * conditions, the following disclaimer and the list of authors.
12  * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13  * conditions, the following disclaimer and the list of authors in the documentation and/or
14  * other materials provided with the distribution.
15  * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16  * endorse or promote products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _SYS_RESOURCE_H_
30 #define _SYS_RESOURCE_H_
31 
32 #include <sys/_types.h>
33 
34 #ifndef _RLIM_T_DECLARED
35 typedef __rlim_t rlim_t;
36 #define _RLIM_T_DECLARED
37 #endif
38 
39 
40 /*
41  * Resource limits
42  */
43 #define RLIMIT_CPU 0 /* maximum cpu time in seconds */
44 #define RLIMIT_FSIZE 1 /* maximum file size */
45 #define RLIMIT_DATA 2 /* data size */
46 #define RLIMIT_STACK 3 /* stack size */
47 #define RLIMIT_CORE 4 /* core file size */
48 #define RLIMIT_RSS 5 /* resident set size */
49 #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */
50 #define RLIMIT_NPROC 7 /* number of processes */
51 #define RLIMIT_NOFILE 8 /* number of open files */
52 #define RLIMIT_SBSIZE 9 /* maximum size of all socket buffers */
53 #define RLIMIT_VMEM 10 /* virtual process size (incl. mmap) */
54 #define RLIMIT_AS RLIMIT_VMEM /* standard name for RLIMIT_VMEM */
55 #define RLIMIT_NPTS 11 /* pseudo-terminals */
56 #define RLIMIT_SWAP 12 /* swap used */
57 #define RLIMIT_KQUEUES 13 /* kqueues allocated */
58 #define RLIMIT_UMTXP 14 /* process-shared umtx */
59 
60 #define RLIM_NLIMITS 15 /* number of resource limits */
61 
62 
63 /*
64  * Resource limit string identifiers
65  */
66 
67 static const char *rlimit_ident[RLIM_NLIMITS] = {
68  "cpu",
69  "fsize",
70  "data",
71  "stack",
72  "core",
73  "rss",
74  "memlock",
75  "nproc",
76  "nofile",
77  "sbsize",
78  "vmem",
79  "npts",
80  "swap",
81  "kqueues",
82  "umtx",
83 };
84 
85 
86 struct rlimit {
87  rlim_t rlim_cur; /* current (soft) limit */
88  rlim_t rlim_max; /* maximum value for rlim_cur */
89 };
90 
91 #endif /* !_SYS_RESOURCE_H_ */
rlimit::rlim_cur
rlim_t rlim_cur
Definition: resource.h:87
rlimit::rlim_max
rlim_t rlim_max
Definition: resource.h:88
rlimit
Definition: resource.h:86
rlim_t
__rlim_t rlim_t
Definition: resource.h:35
_types.h
__rlim_t
__int64_t __rlim_t
Definition: _types.h:42
RLIM_NLIMITS
#define RLIM_NLIMITS
Definition: resource.h:60