1/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
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.
8
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
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_RESOURCE_H
19#define _SYS_RESOURCE_H 1
20
21#include <features.h>
22
23/* Get the system-dependent definitions of structures and bit values. */
24#include <bits/resource.h>
25
26#ifndef __id_t_defined
27typedef __id_t id_t;
28# define __id_t_defined
29#endif
30
31__BEGIN_DECLS
32
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. */
37#if defined __USE_GNU && !defined __cplusplus
38typedef enum __rlimit_resource __rlimit_resource_t;
39typedef enum __rusage_who __rusage_who_t;
40typedef enum __priority_which __priority_which_t;
41#else
42typedef int __rlimit_resource_t;
43typedef int __rusage_who_t;
44typedef int __priority_which_t;
45#endif
46
47/* Put the soft and hard limits for RESOURCE in *RLIMITS.
48 Returns 0 if successful, -1 if not (and sets errno). */
49#ifndef __USE_FILE_OFFSET64
50extern int getrlimit (__rlimit_resource_t __resource,
51 struct rlimit *__rlimits) __THROW __nonnull ((2));
52#else
53# ifdef __REDIRECT_NTH
54extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource,
55 struct rlimit *__rlimits), getrlimit64)
56 __nonnull ((2));
57# else
58# define getrlimit getrlimit64
59# endif
60#endif
61#ifdef __USE_LARGEFILE64
62extern int getrlimit64 (__rlimit_resource_t __resource,
63 struct rlimit64 *__rlimits) __THROW __nonnull ((2));
64#endif
65
66/* Set the soft and hard limits for RESOURCE to *RLIMITS.
67 Only the super-user can increase hard limits.
68 Return 0 if successful, -1 if not (and sets errno). */
69#ifndef __USE_FILE_OFFSET64
70extern int setrlimit (__rlimit_resource_t __resource,
71 const struct rlimit *__rlimits) __THROW __nonnull ((2));
72#else
73# ifdef __REDIRECT_NTH
74extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource,
75 const struct rlimit *__rlimits),
76 setrlimit64) __nonnull ((2));
77# else
78# define setrlimit setrlimit64
79# endif
80#endif
81#ifdef __USE_LARGEFILE64
82extern int setrlimit64 (__rlimit_resource_t __resource,
83 const struct rlimit64 *__rlimits) __THROW
84 __nonnull ((2));
85#endif
86
87/* Return resource usage information on process indicated by WHO
88 and put it in *USAGE. Returns 0 for success, -1 for failure. */
89extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW;
90
91#ifdef __USE_TIME_BITS64
92# if defined(__REDIRECT_NTH)
93extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who,
94 struct rusage *__usage),
95 __getrusage64);
96# else
97# define getrusage __getrusage64
98# endif
99#endif
100
101/* Return the highest priority of any process specified by WHICH and WHO
102 (see above); if WHO is zero, the current process, process group, or user
103 (as specified by WHO) is used. A lower priority number means higher
104 priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */
105extern int getpriority (__priority_which_t __which, id_t __who) __THROW;
106
107/* Set the priority of all processes specified by WHICH and WHO (see above)
108 to PRIO. Returns 0 on success, -1 on errors. */
109extern int setpriority (__priority_which_t __which, id_t __who, int __prio)
110 __THROW;
111
112__END_DECLS
113
114#endif /* sys/resource.h */
115

source code of include/x86_64-linux-gnu/sys/resource.h