parse_fdinfo: Don't advance pointer twice [BZ #31798]
[glibc.git] / sysdeps / unix / sysv / linux / setrlimit64.c
blob084700c335dd3694e795439cc598794c6667d7ab
1 /* Linux setrlimit64 implementation (64 bits off_t).
2 Copyright (C) 2010-2024 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, see
17 <https://www.gnu.org/licenses/>. */
19 #include <errno.h>
20 #include <sys/types.h>
21 #include <sysdep.h>
22 #include <shlib-compat.h>
24 /* Add this redirection so the strong_alias for __RLIM_T_MATCHES_RLIM64_T
25 linking setrlimit64 to {__}setrlimit does not throw a type error. */
26 #undef setrlimit
27 #undef __setrlimit
28 #define setrlimit setrlimit_redirect
29 #define __setrlimit __setrlimit_redirect
30 #include <sys/resource.h>
31 #undef setrlimit
32 #undef __setrlimit
34 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
35 Only the super-user can increase hard limits.
36 Return 0 if successful, -1 if not (and sets errno). */
37 int
38 __setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
40 return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
42 /* Alpha defines a versioned setrlimit{64}. */
43 #ifndef USE_VERSIONED_RLIMIT
44 weak_alias (__setrlimit64, setrlimit64)
45 #endif
47 #if __RLIM_T_MATCHES_RLIM64_T
48 strong_alias (__setrlimit64, __setrlimit)
49 # ifndef USE_VERSIONED_RLIMIT
50 weak_alias (__setrlimit64, setrlimit)
51 # endif
52 # ifdef SHARED
53 __hidden_ver1 (__setrlimit64, __GI___setrlimit, __setrlimit64);
54 # endif
55 #endif