]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/setrlimit64.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / setrlimit64.c
CommitLineData
045c13d1 1/* Linux setrlimit64 implementation (64 bits off_t).
04277e02 2 Copyright (C) 2010-2019 Free Software Foundation, Inc.
5bd6dc5c
UD
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
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
5bd6dc5c
UD
18
19#include <errno.h>
5bd6dc5c 20#include <sys/types.h>
045c13d1
AZ
21#include <shlib-compat.h>
22
23/* Add this redirection so the strong_alias for __RLIM_T_MATCHES_RLIM64_T
d35989be
AJ
24 linking setrlimit64 to {__}setrlimit does not throw a type error. */
25#undef setrlimit
26#undef __setrlimit
045c13d1
AZ
27#define setrlimit setrlimit_redirect
28#define __setrlimit __setrlimit_redirect
29#include <sys/resource.h>
30#undef setrlimit
31#undef __setrlimit
5bd6dc5c
UD
32
33/* Set the soft and hard limits for RESOURCE to *RLIMITS.
34 Only the super-user can increase hard limits.
35 Return 0 if successful, -1 if not (and sets errno). */
36int
045c13d1 37__setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
5bd6dc5c 38{
695d7d13 39 return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
5bd6dc5c 40}
8e900969
AJ
41/* Alpha defines a versioned setrlimit{64}. */
42#ifndef USE_VERSIONED_RLIMIT
045c13d1 43weak_alias (__setrlimit64, setrlimit64)
8e900969 44#endif
045c13d1
AZ
45
46#if __RLIM_T_MATCHES_RLIM64_T
47strong_alias (__setrlimit64, __setrlimit)
8e900969 48# ifndef USE_VERSIONED_RLIMIT
045c13d1 49weak_alias (__setrlimit64, setrlimit)
8e900969 50# endif
dd3121df
L
51# ifdef SHARED
52__hidden_ver1 (__setrlimit64, __GI___setrlimit, __setrlimit64);
53# endif
045c13d1 54#endif