1 /* Bit values & structures for resource limits. FreeBSD version.
2 Copyright (C) 1994, 1996-1998, 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #ifndef _SYS_RESOURCE_H
21 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
24 #include <bits/types.h>
25 #include <sys/_types.h>
27 /* Transmute defines to enumerations. The macro re-definitions are
28 necessary because some programs want to test for operating system
29 features with #ifdef RUSAGE_SELF. In ISO C the reflexive
30 definition is a no-op.
32 These are the values for FreeBSD. Earlier BSD systems have a subset of
33 these kinds of resource limit. */
35 /* Kinds of resource limit. */
36 enum __rlimit_resource
38 /* Per-process CPU limit, in seconds. */
40 #define RLIMIT_CPU RLIMIT_CPU
42 /* Largest file that can be created, in bytes. */
44 #define RLIMIT_FSIZE RLIMIT_FSIZE
46 /* Maximum size of data segment, in bytes. */
48 #define RLIMIT_DATA RLIMIT_DATA
50 /* Maximum size of stack segment, in bytes. */
52 #define RLIMIT_STACK RLIMIT_STACK
54 /* Largest core file that can be created, in bytes. */
56 #define RLIMIT_CORE RLIMIT_CORE
58 /* Largest resident set size, in bytes.
59 This affects swapping; processes that are exceeding their
60 resident set size will be more likely to have physical memory
63 #define RLIMIT_RSS __RLIMIT_RSS
65 /* Locked-in-memory address space. */
67 #define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK
69 /* Number of processes. */
71 #define RLIMIT_NPROC __RLIMIT_NPROC
73 /* Number of open files. */
75 #define RLIMIT_NOFILE RLIMIT_NOFILE
77 /* Maximum size of all socket buffers. */
79 #define RLIMIT_SBSIZE __RLIMIT_SBSIZE
81 /* Address space limit. */
83 #define RLIMIT_AS RLIMIT_AS
84 RLIMIT_VMEM
= RLIMIT_AS
,
86 /* Pseudo-terminals. */
88 #define RLIMIT_NPTS RLIMIT_NPTS
92 #define RLIMIT_SWAP RLIMIT_SWAP
94 __RLIMIT_NLIMITS
= 13,
95 __RLIM_NLIMITS
= __RLIMIT_NLIMITS
96 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
97 #define RLIM_NLIMITS __RLIM_NLIMITS
100 /* Value to indicate that there is no limit. */
101 #define RLIM_INFINITY 0x7fffffffffffffffLL
102 #ifdef __USE_LARGEFILE64
103 # define RLIM64_INFINITY 0x7fffffffffffffffLL
107 /* Type for resource quantity measurement. */
108 typedef __rlim_t rlim_t
;
109 #ifdef __USE_LARGEFILE64
110 typedef __rlim64_t rlim64_t
;
115 /* The current (soft) limit. */
117 /* The hard limit. */
121 #ifdef __USE_LARGEFILE64
124 /* The current (soft) limit. */
126 /* The hard limit. */
132 __int32_t rlim_cur
; /* current (soft) limit */
133 __int32_t rlim_max
; /* maximum value for rlim_cur */
148 /* Whose usage statistics do you want? */
151 /* The calling process. */
153 #define RUSAGE_SELF RUSAGE_SELF
155 /* All of its terminated child processes. */
157 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
160 #include <bits/types/struct_timeval.h>
162 /* Structure which says how much of each resource has been used. */
165 /* Total amount of user time used. */
166 struct timeval ru_utime
;
167 /* Total amount of system time used. */
168 struct timeval ru_stime
;
169 /* Maximum resident set size (in kilobytes). */
171 /* Amount of sharing of text segment memory
172 with other processes (kilobyte-seconds). */
174 /* Amount of data segment memory used (kilobyte-seconds). */
176 /* Amount of stack memory used (kilobyte-seconds). */
178 /* Number of soft page faults (i.e. those serviced by reclaiming
179 a page from the list of pages awaiting reallocation. */
181 /* Number of hard page faults (i.e. those that required I/O). */
183 /* Number of times a process was swapped out of physical memory. */
185 /* Number of input operations via the file system. Note: This
186 and `ru_oublock' do not include operations with the cache. */
188 /* Number of output operations via the file system. */
190 /* Number of IPC messages sent. */
192 /* Number of IPC messages received. */
194 /* Number of signals delivered. */
195 long int ru_nsignals
;
196 /* Number of voluntary context switches, i.e. because the process
197 gave up the process before it had to (usually to wait for some
198 resource to be available). */
200 /* Number of involuntary context switches, i.e. a higher priority process
201 became runnable or the current process used up its time slice. */
205 /* Priority limits. */
206 #define PRIO_MIN -20 /* Minimum priority a process can have. */
207 #define PRIO_MAX 20 /* Maximum priority a process can have. */
209 /* The type of the WHICH argument to `getpriority' and `setpriority',
210 indicating what flavor of entity the WHO argument specifies. */
211 enum __priority_which
213 PRIO_PROCESS
= 0, /* WHO is a process ID. */
214 #define PRIO_PROCESS PRIO_PROCESS
215 PRIO_PGRP
= 1, /* WHO is a process group ID. */
216 #define PRIO_PGRP PRIO_PGRP
217 PRIO_USER
= 2 /* WHO is a user ID. */
218 #define PRIO_USER PRIO_USER