From 4bf3912213ed8d0fa937fb4784a3e8e0c8fd8c3c Mon Sep 17 00:00:00 2001 From: Pavel Kozlov Date: Tue, 7 Nov 2023 15:03:12 +0400 Subject: prlimit: add name redirection and fix incorrect parameters to syscall The tst-rlimit/tst-rlimit64 tests pointed to several issueses in prlimit() function for 32-bit CPUs. This patch adds name redirection to prlimit64 in prlimit declaration to provide correct support for 64-bit offset (_FILE_OFFSET_BITS=64) on 32-bit CPUs and fixes improper field assignment and incorrect syscall paramerets in the prlimit() function. Fixes: 8c2f6218 ("setrlimit/getrlimit: fix prlimit64 syscall use for 32-bit CPUs") Signed-off-by: Pavel Kozlov --- include/sys/resource.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'include/sys/resource.h') diff --git a/include/sys/resource.h b/include/sys/resource.h index e9fac2c65..a5c69d84e 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -103,13 +103,25 @@ libc_hidden_proto(setpriority) #ifdef __USE_GNU /* Modify and return resource limits of a process atomically. */ +# ifndef __USE_FILE_OFFSET64 extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, - const struct rlimit *__new_limit, - struct rlimit *__old_limit) __THROW; - + const struct rlimit *__new_limit, + struct rlimit *__old_limit) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, + enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit), prlimit64); +# else +# define prlimit prlimit64 +# endif +# endif +# ifdef __USE_LARGEFILE64 extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit64 *__new_limit, struct rlimit64 *__old_limit) __THROW; +# endif #endif __END_DECLS -- cgit v1.2.3