]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/unix/sysv/linux/setrlimit.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / setrlimit.c
index 01812ac355b481520f3de61474cb8bb526f63e24..8b7b33ec4a7ed86aaa8d3cebb11c69be503a99f0 100644 (file)
@@ -1,5 +1,5 @@
 /* Linux setrlimit implementation (32 bits off_t).
-   Copyright (C) 2016-2017 Free Software Foundation, Inc.
+   Copyright (C) 2016-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <sys/resource.h>
@@ -34,7 +34,6 @@
 int
 __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim)
 {
-# ifdef __NR_prlimit64
   struct rlimit64 rlim64;
 
   if (rlim->rlim_cur == RLIM_INFINITY)
@@ -46,13 +45,10 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim)
   else
     rlim64.rlim_max = rlim->rlim_max;
 
-  int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
-  if (res == 0 || errno != ENOSYS)
-    return res;
-# endif
-  return INLINE_SYSCALL_CALL (setrlimit, resource, rlim);
+  return INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
 }
 
+libc_hidden_def (__setrlimit)
 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
 strong_alias (__setrlimit, __setrlimit_1)
 compat_symbol (libc, __setrlimit, setrlimit, GLIBC_2_0);