]> git.ipfire.org Git - thirdparty/glibc.git/blame - resource/sys/resource.h
Remove pre-ISO C support
[thirdparty/glibc.git] / resource / sys / resource.h
CommitLineData
a784e502
UD
1/* Copyright (C) 1992,94,1996-2000,2002,2004,2012
2 Free Software Foundation, Inc.
54d79e99 3 This file is part of the GNU C Library.
28f540f4 4
54d79e99 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
28f540f4 9
54d79e99
UD
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
41bdb6e2 13 Lesser General Public License for more details.
28f540f4 14
41bdb6e2
AJ
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
18 02111-1307 USA. */
28f540f4
RM
19
20#ifndef _SYS_RESOURCE_H
28f540f4 21#define _SYS_RESOURCE_H 1
5107cf1d 22
28f540f4
RM
23#include <features.h>
24
ba1ffaa1 25/* Get the system-dependent definitions of structures and bit values. */
5107cf1d 26#include <bits/resource.h>
28f540f4 27
0ed99ce4
UD
28#ifndef __id_t_defined
29typedef __id_t id_t;
30# define __id_t_defined
31#endif
32
9756dfe1
UD
33__BEGIN_DECLS
34
0ed99ce4
UD
35/* The X/Open standard defines that all the functions below must use
36 `int' as the type for the first argument. When we are compiling with
37 GNU extensions we change this slightly to provide better error
38 checking. */
48f6e9ae 39#if defined __USE_GNU && !defined __cplusplus
0ed99ce4
UD
40typedef enum __rlimit_resource __rlimit_resource_t;
41typedef enum __rusage_who __rusage_who_t;
42typedef enum __priority_which __priority_which_t;
43#else
44typedef int __rlimit_resource_t;
45typedef int __rusage_who_t;
46typedef int __priority_which_t;
47#endif
48
28f540f4
RM
49/* Put the soft and hard limits for RESOURCE in *RLIMITS.
50 Returns 0 if successful, -1 if not (and sets errno). */
dfd2257a 51#ifndef __USE_FILE_OFFSET64
0ed99ce4 52extern int getrlimit (__rlimit_resource_t __resource,
c1422e5b 53 struct rlimit *__rlimits) __THROW;
dfd2257a 54#else
f377d022
UD
55# ifdef __REDIRECT_NTH
56extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource,
57 struct rlimit *__rlimits), getrlimit64);
01cad722
UD
58# else
59# define getrlimit getrlimit64
60# endif
dfd2257a
UD
61#endif
62#ifdef __USE_LARGEFILE64
0ed99ce4 63extern int getrlimit64 (__rlimit_resource_t __resource,
c1422e5b 64 struct rlimit64 *__rlimits) __THROW;
dfd2257a 65#endif
28f540f4
RM
66
67/* Set the soft and hard limits for RESOURCE to *RLIMITS.
68 Only the super-user can increase hard limits.
69 Return 0 if successful, -1 if not (and sets errno). */
dfd2257a 70#ifndef __USE_FILE_OFFSET64
0ed99ce4 71extern int setrlimit (__rlimit_resource_t __resource,
a784e502 72 const struct rlimit *__rlimits) __THROW;
dfd2257a 73#else
f377d022
UD
74# ifdef __REDIRECT_NTH
75extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource,
a784e502 76 const struct rlimit *__rlimits),
f377d022 77 setrlimit64);
01cad722
UD
78# else
79# define setrlimit setrlimit64
80# endif
dfd2257a
UD
81#endif
82#ifdef __USE_LARGEFILE64
0ed99ce4 83extern int setrlimit64 (__rlimit_resource_t __resource,
a784e502 84 const struct rlimit64 *__rlimits) __THROW;
dfd2257a 85#endif
28f540f4 86
28f540f4
RM
87/* Return resource usage information on process indicated by WHO
88 and put it in *USAGE. Returns 0 for success, -1 for failure. */
0ed99ce4 89extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW;
28f540f4 90
28f540f4
RM
91/* Return the highest priority of any process specified by WHICH and WHO
92 (see above); if WHO is zero, the current process, process group, or user
93 (as specified by WHO) is used. A lower priority number means higher
94 priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */
0ed99ce4 95extern int getpriority (__priority_which_t __which, id_t __who) __THROW;
28f540f4
RM
96
97/* Set the priority of all processes specified by WHICH and WHO (see above)
98 to PRIO. Returns 0 on success, -1 on errors. */
0ed99ce4 99extern int setpriority (__priority_which_t __which, id_t __who, int __prio)
c1422e5b 100 __THROW;
28f540f4 101
28f540f4
RM
102__END_DECLS
103
5107cf1d 104#endif /* sys/resource.h */