]>
Commit | Line | Data |
---|---|---|
ba1ffaa1 | 1 | /* Bit values & structures for resource limits. 4.4 BSD/generic GNU version. |
04277e02 | 2 | Copyright (C) 1994-2019 Free Software Foundation, Inc. |
54d79e99 | 3 | This file is part of the GNU C Library. |
28f540f4 | 4 | |
54d79e99 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 9 | |
54d79e99 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
28f540f4 | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 16 | License along with the GNU C Library; if not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
28f540f4 | 18 | |
f4017d20 UD |
19 | #ifndef _SYS_RESOURCE_H |
20 | # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." | |
21 | #endif | |
22 | ||
d71b808a UD |
23 | #include <bits/types.h> |
24 | ||
28f540f4 RM |
25 | /* These are the values for 4.4 BSD and GNU. Earlier BSD systems have a |
26 | subset of these kinds of resource limit. In systems where `getrlimit' | |
27 | and `setrlimit' are not system calls, these are the values used by the C | |
28 | library to emulate them. */ | |
29 | ||
30 | /* Kinds of resource limit. */ | |
31 | enum __rlimit_resource | |
32 | { | |
33 | /* Per-process CPU limit, in seconds. */ | |
34 | RLIMIT_CPU, | |
23396375 | 35 | #define RLIMIT_CPU RLIMIT_CPU |
28f540f4 RM |
36 | /* Largest file that can be created, in bytes. */ |
37 | RLIMIT_FSIZE, | |
23396375 | 38 | #define RLIMIT_FSIZE RLIMIT_FSIZE |
28f540f4 RM |
39 | /* Maximum size of data segment, in bytes. */ |
40 | RLIMIT_DATA, | |
23396375 | 41 | #define RLIMIT_DATA RLIMIT_DATA |
28f540f4 RM |
42 | /* Maximum size of stack segment, in bytes. */ |
43 | RLIMIT_STACK, | |
23396375 | 44 | #define RLIMIT_STACK RLIMIT_STACK |
28f540f4 RM |
45 | /* Largest core file that can be created, in bytes. */ |
46 | RLIMIT_CORE, | |
23396375 | 47 | #define RLIMIT_CORE RLIMIT_CORE |
28f540f4 RM |
48 | /* Largest resident set size, in bytes. |
49 | This affects swapping; processes that are exceeding their | |
50 | resident set size will be more likely to have physical memory | |
51 | taken from them. */ | |
52 | RLIMIT_RSS, | |
23396375 | 53 | #define RLIMIT_RSS RLIMIT_RSS |
28f540f4 RM |
54 | /* Locked-in-memory address space. */ |
55 | RLIMIT_MEMLOCK, | |
23396375 | 56 | #define RLIMIT_MEMLOCK RLIMIT_MEMLOCK |
28f540f4 RM |
57 | /* Number of processes. */ |
58 | RLIMIT_NPROC, | |
23396375 | 59 | #define RLIMIT_NPROC RLIMIT_NPROC |
28f540f4 RM |
60 | /* Number of open files. */ |
61 | RLIMIT_OFILE, | |
62 | RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing. */ | |
23396375 UD |
63 | #define RLIMIT_OFILE RLIMIT_OFILE |
64 | #define RLIMIT_NOFILE RLIMIT_NOFILE | |
a26c855c RM |
65 | /* Maximum size of all socket buffers. */ |
66 | RLIMIT_SBSIZE, | |
67 | #define RLIMIT_SBSIZE RLIMIT_SBSIZE | |
68 | /* Maximum size in bytes of the process address space. */ | |
69 | RLIMIT_AS, | |
70 | RLIMIT_VMEM = RLIMIT_AS, /* Another name for the same thing. */ | |
71 | #define RLIMIT_AS RLIMIT_AS | |
72 | #define RLIMIT_VMEM RLIMIT_AS | |
28f540f4 RM |
73 | |
74 | RLIMIT_NLIMITS, /* Number of limit flavors. */ | |
31161268 | 75 | RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same. */ |
ba1ffaa1 UD |
76 | }; |
77 | ||
9756dfe1 UD |
78 | /* Value to indicate that there is no limit. */ |
79 | #ifndef __USE_FILE_OFFSET64 | |
80 | # define RLIM_INFINITY 0x7fffffff | |
81 | #else | |
82 | # define RLIM_INFINITY 0x7fffffffffffffffLL | |
83 | #endif | |
84 | ||
85 | #ifdef __USE_LARGEFILE64 | |
86 | # define RLIM64_INFINITY 0x7fffffffffffffffLL | |
87 | #endif | |
88 | ||
a279b8ed ST |
89 | /* We can represent all limits. */ |
90 | #define RLIM_SAVED_MAX RLIM_INFINITY | |
91 | #define RLIM_SAVED_CUR RLIM_INFINITY | |
92 | ||
9756dfe1 | 93 | |
dfd2257a UD |
94 | /* Type for resource quantity measurement. */ |
95 | #ifndef __USE_FILE_OFFSET64 | |
96 | typedef __rlim_t rlim_t; | |
97 | #else | |
98 | typedef __rlim64_t rlim_t; | |
99 | #endif | |
100 | #ifdef __USE_LARGEFILE64 | |
101 | typedef __rlim64_t rlim64_t; | |
102 | #endif | |
103 | ||
ba1ffaa1 UD |
104 | struct rlimit |
105 | { | |
106 | /* The current (soft) limit. */ | |
dfd2257a | 107 | rlim_t rlim_cur; |
ba1ffaa1 | 108 | /* The hard limit. */ |
dfd2257a | 109 | rlim_t rlim_max; |
ba1ffaa1 UD |
110 | }; |
111 | ||
dfd2257a UD |
112 | #ifdef __USE_LARGEFILE64 |
113 | struct rlimit64 | |
114 | { | |
115 | /* The current (soft) limit. */ | |
116 | rlim64_t rlim_cur; | |
117 | /* The hard limit. */ | |
118 | rlim64_t rlim_max; | |
119 | }; | |
120 | #endif | |
121 | ||
ba1ffaa1 UD |
122 | /* Whose usage statistics do you want? */ |
123 | enum __rusage_who | |
124 | /* The macro definitions are necessary because some programs want | |
125 | to test for operating system features with #ifdef RUSAGE_SELF. | |
126 | In ISO C the reflexive definition is a no-op. */ | |
127 | { | |
128 | /* The calling process. */ | |
129 | RUSAGE_SELF = 0, | |
130 | #define RUSAGE_SELF RUSAGE_SELF | |
131 | /* All of its terminated child processes. */ | |
132 | RUSAGE_CHILDREN = -1 | |
133 | #define RUSAGE_CHILDREN RUSAGE_CHILDREN | |
134 | }; | |
135 | ||
05b68e14 | 136 | #include <bits/types/struct_timeval.h> |
a66bc30d | 137 | #include <bits/types/struct_rusage.h> |
ba1ffaa1 UD |
138 | |
139 | /* Priority limits. */ | |
140 | #define PRIO_MIN -20 /* Minimum priority a process can have. */ | |
141 | #define PRIO_MAX 20 /* Maximum priority a process can have. */ | |
142 | ||
143 | /* The type of the WHICH argument to `getpriority' and `setpriority', | |
144 | indicating what flavor of entity the WHO argument specifies. */ | |
145 | enum __priority_which | |
146 | { | |
147 | PRIO_PROCESS = 0, /* WHO is a process ID. */ | |
7832cb80 | 148 | #define PRIO_PROCESS PRIO_PROCESS |
ba1ffaa1 | 149 | PRIO_PGRP = 1, /* WHO is a process group ID. */ |
7832cb80 | 150 | #define PRIO_PGRP PRIO_PGRP |
ba1ffaa1 | 151 | PRIO_USER = 2 /* WHO is a user ID. */ |
7832cb80 | 152 | #define PRIO_USER PRIO_USER |
28f540f4 | 153 | }; |