modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/i386-linux-gnu/bits/resource.h (about) 1 /* Bit values & structures for resource limits. Linux version. 2 Copyright (C) 1994-2018 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 #include <bits/types/struct_timeval.h> 173 #include <bits/types/struct_rusage.h> 174 175 /* Priority limits. */ 176 #define PRIO_MIN -20 /* Minimum priority a process can have. */ 177 #define PRIO_MAX 20 /* Maximum priority a process can have. */ 178 179 /* The type of the WHICH argument to `getpriority' and `setpriority', 180 indicating what flavor of entity the WHO argument specifies. */ 181 enum __priority_which { 182 PRIO_PROCESS = 0, /* WHO is a process ID. */ 183 #define PRIO_PROCESS PRIO_PROCESS 184 PRIO_PGRP = 1, /* WHO is a process group ID. */ 185 #define PRIO_PGRP PRIO_PGRP 186 PRIO_USER = 2 /* WHO is a user ID. */ 187 #define PRIO_USER PRIO_USER 188 }; 189 190 __BEGIN_DECLS 191 #ifdef __USE_GNU 192 /* Modify and return resource limits of a process atomically. */ 193 # ifndef __USE_FILE_OFFSET64 194 extern int prlimit(__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit) __THROW; 195 # else 196 # ifdef __REDIRECT_NTH 197 extern int __REDIRECT_NTH(prlimit, (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit * __new_limit, struct rlimit * __old_limit), prlimit64); 198 # else 199 # define prlimit prlimit64 200 # endif 201 # endif 202 # ifdef __USE_LARGEFILE64 203 extern int prlimit64(__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit64 *__new_limit, struct rlimit64 *__old_limit) __THROW; 204 # endif 205 #endif 206 207 __END_DECLS