]>
Commit | Line | Data |
---|---|---|
bfff8b1b | 1 | /* Copyright (C) 1992-2017 Free Software Foundation, Inc. |
54d79e99 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
54d79e99 | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 8 | |
54d79e99 UD |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 RM |
17 | |
18 | #ifndef _SYS_RESOURCE_H | |
28f540f4 | 19 | #define _SYS_RESOURCE_H 1 |
5107cf1d | 20 | |
28f540f4 RM |
21 | #include <features.h> |
22 | ||
ba1ffaa1 | 23 | /* Get the system-dependent definitions of structures and bit values. */ |
5107cf1d | 24 | #include <bits/resource.h> |
28f540f4 | 25 | |
0ed99ce4 UD |
26 | #ifndef __id_t_defined |
27 | typedef __id_t id_t; | |
28 | # define __id_t_defined | |
29 | #endif | |
30 | ||
9756dfe1 UD |
31 | __BEGIN_DECLS |
32 | ||
0ed99ce4 UD |
33 | /* The X/Open standard defines that all the functions below must use |
34 | `int' as the type for the first argument. When we are compiling with | |
35 | GNU extensions we change this slightly to provide better error | |
36 | checking. */ | |
48f6e9ae | 37 | #if defined __USE_GNU && !defined __cplusplus |
0ed99ce4 UD |
38 | typedef enum __rlimit_resource __rlimit_resource_t; |
39 | typedef enum __rusage_who __rusage_who_t; | |
40 | typedef enum __priority_which __priority_which_t; | |
41 | #else | |
42 | typedef int __rlimit_resource_t; | |
43 | typedef int __rusage_who_t; | |
44 | typedef int __priority_which_t; | |
45 | #endif | |
46 | ||
28f540f4 RM |
47 | /* Put the soft and hard limits for RESOURCE in *RLIMITS. |
48 | Returns 0 if successful, -1 if not (and sets errno). */ | |
dfd2257a | 49 | #ifndef __USE_FILE_OFFSET64 |
0ed99ce4 | 50 | extern int getrlimit (__rlimit_resource_t __resource, |
c1422e5b | 51 | struct rlimit *__rlimits) __THROW; |
dfd2257a | 52 | #else |
f377d022 UD |
53 | # ifdef __REDIRECT_NTH |
54 | extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource, | |
55 | struct rlimit *__rlimits), getrlimit64); | |
01cad722 UD |
56 | # else |
57 | # define getrlimit getrlimit64 | |
58 | # endif | |
dfd2257a UD |
59 | #endif |
60 | #ifdef __USE_LARGEFILE64 | |
0ed99ce4 | 61 | extern int getrlimit64 (__rlimit_resource_t __resource, |
c1422e5b | 62 | struct rlimit64 *__rlimits) __THROW; |
dfd2257a | 63 | #endif |
28f540f4 RM |
64 | |
65 | /* Set the soft and hard limits for RESOURCE to *RLIMITS. | |
66 | Only the super-user can increase hard limits. | |
67 | Return 0 if successful, -1 if not (and sets errno). */ | |
dfd2257a | 68 | #ifndef __USE_FILE_OFFSET64 |
0ed99ce4 | 69 | extern int setrlimit (__rlimit_resource_t __resource, |
a784e502 | 70 | const struct rlimit *__rlimits) __THROW; |
dfd2257a | 71 | #else |
f377d022 UD |
72 | # ifdef __REDIRECT_NTH |
73 | extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource, | |
a784e502 | 74 | const struct rlimit *__rlimits), |
f377d022 | 75 | setrlimit64); |
01cad722 UD |
76 | # else |
77 | # define setrlimit setrlimit64 | |
78 | # endif | |
dfd2257a UD |
79 | #endif |
80 | #ifdef __USE_LARGEFILE64 | |
0ed99ce4 | 81 | extern int setrlimit64 (__rlimit_resource_t __resource, |
a784e502 | 82 | const struct rlimit64 *__rlimits) __THROW; |
dfd2257a | 83 | #endif |
28f540f4 | 84 | |
28f540f4 RM |
85 | /* Return resource usage information on process indicated by WHO |
86 | and put it in *USAGE. Returns 0 for success, -1 for failure. */ | |
0ed99ce4 | 87 | extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; |
28f540f4 | 88 | |
28f540f4 RM |
89 | /* Return the highest priority of any process specified by WHICH and WHO |
90 | (see above); if WHO is zero, the current process, process group, or user | |
91 | (as specified by WHO) is used. A lower priority number means higher | |
92 | priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */ | |
0ed99ce4 | 93 | extern int getpriority (__priority_which_t __which, id_t __who) __THROW; |
28f540f4 RM |
94 | |
95 | /* Set the priority of all processes specified by WHICH and WHO (see above) | |
96 | to PRIO. Returns 0 on success, -1 on errors. */ | |
0ed99ce4 | 97 | extern int setpriority (__priority_which_t __which, id_t __who, int __prio) |
c1422e5b | 98 | __THROW; |
28f540f4 | 99 | |
28f540f4 RM |
100 | __END_DECLS |
101 | ||
5107cf1d | 102 | #endif /* sys/resource.h */ |