1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

Assume prlimit64 is available.

This patch makes sysdeps/unix/sysv/linux code assume the prlimit64
syscall is always available, given the minimum of a 3.2 kernel.

__ASSUME_PRLIMIT64, which in fact was no longer used, is removed.
Code conditional on __NR_prlimit64 being defined is made
unconditional.  Fallback code for the case where prlimit64 produces an
ENOSYS error is removed, substantially simplifying some functions.

Tested for x86_64 and x86.

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PRLIMIT64):
	Remove macro.
	* sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Assume
	prlimit64 is always available and does not give an ENOSYS error.
	* sysdeps/unix/sysv/linux/prlimit.c [__NR_prlimit64]: Make code
	unconditional.
	[!__NR_prlimit64]: Remove conditional code.
	* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Assume
	prlimit64 is always available and does not give an ENOSYS error.
	* sysdeps/unix/sysv/linux/setrlimit64.c (__setrlimit64): Likewise.
This commit is contained in:
Joseph Myers
2017-05-09 14:05:09 +00:00
parent a972dc672c
commit 695d7d138e
6 changed files with 16 additions and 85 deletions

View File

@ -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,11 +45,7 @@ __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);
}
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)