modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/arm-linux-gnueabihf/bits/resource.h (about) 1 /* Bit values & structures for resource limits. Linux version. 2 Copyright (C) 1994-2016 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 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. 9 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 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <http://www.gnu.org/licenses/>. */ 18 19 #ifndef _SYS_RESOURCE_H 20 #error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." 21 #endif 22 23 #include <bits/types.h> 24 25 /* Transmute defines to enumerations. The macro re-definitions are 26 necessary because some programs want to test for operating system 27 features with #ifdef RUSAGE_SELF. In ISO C the reflexive 28 definition is a no-op. */ 29 30 /* Kinds of resource limit. */ 31 enum __rlimit_resource { 32 /* Per-process CPU limit, in seconds. */ 33 RLIMIT_CPU = 0, 34 #define RLIMIT_CPU RLIMIT_CPU 35 36 /* Largest file that can be created, in bytes. */ 37 RLIMIT_FSIZE = 1, 38 #define RLIMIT_FSIZE RLIMIT_FSIZE 39 40 /* Maximum size of data segment, in bytes. */ 41 RLIMIT_DATA = 2, 42 #define RLIMIT_DATA RLIMIT_DATA 43 44 /* Maximum size of stack segment, in bytes. */ 45 RLIMIT_STACK = 3, 46 #define RLIMIT_STACK RLIMIT_STACK 47 48 /* Largest core file that can be created, in bytes. */ 49 RLIMIT_CORE = 4, 50 #define RLIMIT_CORE RLIMIT_CORE 51 52 /* Largest resident set size, in bytes. 53 This affects swapping; processes that are exceeding their 54 resident set size will be more likely to have physical memory 55 taken from them. */ 56 __RLIMIT_RSS = 5, 57 #define RLIMIT_RSS __RLIMIT_RSS 58 59 /* Number of open files. */ 60 RLIMIT_NOFILE = 7, 61 __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ 62 #define RLIMIT_NOFILE RLIMIT_NOFILE 63 #define RLIMIT_OFILE __RLIMIT_OFILE 64 65 /* Address space limit. */ 66 RLIMIT_AS = 9, 67 #define RLIMIT_AS RLIMIT_AS 68 69 /* Number of processes. */ 70 __RLIMIT_NPROC = 6, 71 #define RLIMIT_NPROC __RLIMIT_NPROC 72 73 /* Locked-in-memory address space. */ 74 __RLIMIT_MEMLOCK = 8, 75 #define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK 76 77 /* Maximum number of file locks. */ 78 __RLIMIT_LOCKS = 10, 79 #define RLIMIT_LOCKS __RLIMIT_LOCKS 80 81 /* Maximum number of pending signals. */ 82 __RLIMIT_SIGPENDING = 11, 83 #define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING 84 85 /* Maximum bytes in POSIX message queues. */ 86 __RLIMIT_MSGQUEUE = 12, 87 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE 88 89 /* Maximum nice priority allowed to raise to. 90 Nice levels 19 .. -20 correspond to 0 .. 39 91 values of this resource limit. */ 92 __RLIMIT_NICE = 13, 93 #define RLIMIT_NICE __RLIMIT_NICE 94 95 /* Maximum realtime priority allowed for non-priviledged 96 processes. */ 97 __RLIMIT_RTPRIO = 14, 98 #define RLIMIT_RTPRIO __RLIMIT_RTPRIO 99 100 /* Maximum CPU time in µs that a process scheduled under a real-time 101 scheduling policy may consume without making a blocking system 102 call before being forcibly descheduled. */ 103 __RLIMIT_RTTIME = 15, 104 #define RLIMIT_RTTIME __RLIMIT_RTTIME 105 106 __RLIMIT_NLIMITS = 16, 107 __RLIM_NLIMITS = __RLIMIT_NLIMITS 108 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS 109 #define RLIM_NLIMITS __RLIM_NLIMITS 110 }; 111 112 /* Value to indicate that there is no limit. */ 113 #ifndef __USE_FILE_OFFSET64 114 #define RLIM_INFINITY ((__rlim_t) -1) 115 #else 116 #define RLIM_INFINITY 0xffffffffffffffffuLL 117 #endif 118 119 #ifdef __USE_LARGEFILE64 120 #define RLIM64_INFINITY 0xffffffffffffffffuLL 121 #endif 122 123 /* We can represent all limits. */ 124 #define RLIM_SAVED_MAX RLIM_INFINITY 125 #define RLIM_SAVED_CUR RLIM_INFINITY 126 127 /* Type for resource quantity measurement. */ 128 #ifndef __USE_FILE_OFFSET64 129 typedef __rlim_t rlim_t; 130 #else 131 typedef __rlim64_t rlim_t; 132 #endif 133 #ifdef __USE_LARGEFILE64 134 typedef __rlim64_t rlim64_t; 135 #endif 136 137 struct rlimit { 138 /* The current (soft) limit. */ 139 rlim_t rlim_cur; 140 /* The hard limit. */ 141 rlim_t rlim_max; 142 }; 143 144 #ifdef __USE_LARGEFILE64 145 struct rlimit64 { 146 /* The current (soft) limit. */ 147 rlim64_t rlim_cur; 148 /* The hard limit. */ 149 rlim64_t rlim_max; 150 }; 151 #endif 152 153 /* Whose usage statistics do you want? */ 154 enum __rusage_who { 155 /* The calling process. */ 156 RUSAGE_SELF = 0, 157 #define RUSAGE_SELF RUSAGE_SELF 158 159 /* All of its terminated child processes. */ 160 RUSAGE_CHILDREN = -1 161 #define RUSAGE_CHILDREN RUSAGE_CHILDREN 162 #ifdef __USE_GNU 163 , 164 /* The calling thread. */ 165 RUSAGE_THREAD = 1 166 #define RUSAGE_THREAD RUSAGE_THREAD 167 /* Name for the same functionality on Solaris. */ 168 #define RUSAGE_LWP RUSAGE_THREAD 169 #endif 170 }; 171 172 #define __need_timeval 173 #include <bits/time.h> /* For `struct timeval'. */ 174 175 /* Structure which says how much of each resource has been used. */ 176 177 /* The purpose of all the unions is to have the kernel-compatible layout 178 while keeping the API type as 'long int', and among machines where 179 __syscall_slong_t is not 'long int', this only does the right thing 180 for little-endian ones, like x32. */ 181 struct rusage { 182 /* Total amount of user time used. */ 183 struct timeval ru_utime; 184 /* Total amount of system time used. */ 185 struct timeval ru_stime; 186 /* Maximum resident set size (in kilobytes). */ 187 __extension__ union { 188 long int ru_maxrss; 189 __syscall_slong_t __ru_maxrss_word; 190 }; 191 /* Amount of sharing of text segment memory 192 with other processes (kilobyte-seconds). */ 193 /* Maximum resident set size (in kilobytes). */ 194 __extension__ union { 195 long int ru_ixrss; 196 __syscall_slong_t __ru_ixrss_word; 197 }; 198 /* Amount of data segment memory used (kilobyte-seconds). */ 199 __extension__ union { 200 long int ru_idrss; 201 __syscall_slong_t __ru_idrss_word; 202 }; 203 /* Amount of stack memory used (kilobyte-seconds). */ 204 __extension__ union { 205 long int ru_isrss; 206 __syscall_slong_t __ru_isrss_word; 207 }; 208 /* Number of soft page faults (i.e. those serviced by reclaiming 209 a page from the list of pages awaiting reallocation. */ 210 __extension__ union { 211 long int ru_minflt; 212 __syscall_slong_t __ru_minflt_word; 213 }; 214 /* Number of hard page faults (i.e. those that required I/O). */ 215 __extension__ union { 216 long int ru_majflt; 217 __syscall_slong_t __ru_majflt_word; 218 }; 219 /* Number of times a process was swapped out of physical memory. */ 220 __extension__ union { 221 long int ru_nswap; 222 __syscall_slong_t __ru_nswap_word; 223 }; 224 /* Number of input operations via the file system. Note: This 225 and `ru_oublock' do not include operations with the cache. */ 226 __extension__ union { 227 long int ru_inblock; 228 __syscall_slong_t __ru_inblock_word; 229 }; 230 /* Number of output operations via the file system. */ 231 __extension__ union { 232 long int ru_oublock; 233 __syscall_slong_t __ru_oublock_word; 234 }; 235 /* Number of IPC messages sent. */ 236 __extension__ union { 237 long int ru_msgsnd; 238 __syscall_slong_t __ru_msgsnd_word; 239 }; 240 /* Number of IPC messages received. */ 241 __extension__ union { 242 long int ru_msgrcv; 243 __syscall_slong_t __ru_msgrcv_word; 244 }; 245 /* Number of signals delivered. */ 246 __extension__ union { 247 long int ru_nsignals; 248 __syscall_slong_t __ru_nsignals_word; 249 }; 250 /* Number of voluntary context switches, i.e. because the process 251 gave up the process before it had to (usually to wait for some 252 resource to be available). */ 253 __extension__ union { 254 long int ru_nvcsw; 255 __syscall_slong_t __ru_nvcsw_word; 256 }; 257 /* Number of involuntary context switches, i.e. a higher priority process 258 became runnable or the current process used up its time slice. */ 259 __extension__ union { 260 long int ru_nivcsw; 261 __syscall_slong_t __ru_nivcsw_word; 262 }; 263 }; 264 265 /* Priority limits. */ 266 #define PRIO_MIN -20 /* Minimum priority a process can have. */ 267 #define PRIO_MAX 20 /* Maximum priority a process can have. */ 268 269 /* The type of the WHICH argument to `getpriority' and `setpriority', 270 indicating what flavor of entity the WHO argument specifies. */ 271 enum __priority_which { 272 PRIO_PROCESS = 0, /* WHO is a process ID. */ 273 #define PRIO_PROCESS PRIO_PROCESS 274 PRIO_PGRP = 1, /* WHO is a process group ID. */ 275 #define PRIO_PGRP PRIO_PGRP 276 PRIO_USER = 2 /* WHO is a user ID. */ 277 #define PRIO_USER PRIO_USER 278 }; 279 280 __BEGIN_DECLS 281 #ifdef __USE_GNU 282 /* Modify and return resource limits of a process atomically. */ 283 #ifndef __USE_FILE_OFFSET64 284 extern int prlimit(__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit) __THROW; 285 #else 286 #ifdef __REDIRECT_NTH 287 extern int __REDIRECT_NTH(prlimit, (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit * __new_limit, struct rlimit * __old_limit), prlimit64); 288 #else 289 #define prlimit prlimit64 290 #endif 291 #endif 292 #ifdef __USE_LARGEFILE64 293 extern int prlimit64(__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit64 *__new_limit, struct rlimit64 *__old_limit) __THROW; 294 #endif 295 #endif 296 297 __END_DECLS