I'm having an issue with the new 'prlimit' additions to 1.0.40. One of my targets runs an older kernel that predates the prlimit64 syscall. I sent in patch that guards around that code, though it would still be defined in headers and probably still cause me issues.
My other target uses kernel 2.6.36.4, which should include the syscall, but I get an error the same as this github issue. https://github.com/util-linux/util-linux/commit/01e94325e676f36b364032a6f5a9...
Also, when I try to compile sample program that target: #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> #include <stddef.h>
int main () {
int ret; ret = prlimit(0, RLIMIT_AS, NULL, NULL); if (ret != 0) { return 1; };
return 0; }
I get error prlimit.c:10:11: warning: implicit declaration of function ‘prlimit’; did you mean ‘setrlimit’? [-Wimplicit-function-declaration] 10 | ret = prlimit(0, RLIMIT_AS, NULL, NULL); | ^~~~~~~ | setrlimit
on unpatched uclibc-ng like symbols still aren't being visible.
thanks, Lance Fredrickson
On 2/4/2022 5:21 PM, Waldemar Brodkorb wrote:
The older kernel is 2.6.22.19. Looks like prlimit came around kernel 2.6.36. https://man7.org/linux/man-pages/man1/prlimit.1.html I use buildroot to compile which I think it passing all the right things. The older kernel gives me this error while compiling uclibc-ng. prlimit64 syscall just wasn't around before 2.6.36.
CC libc/sysdeps/linux/common/prlimit.os In file included from ./include/sys/syscall.h:33, from ./libc/sysdeps/linux/common/sysdep.h:19, from ./libc/sysdeps/linux/mips/sysdep.h:24, from libc/sysdeps/linux/common/prlimit.c:19: libc/sysdeps/linux/common/prlimit.c: In function 'prlimit': ./libc/sysdeps/linux/mips/sysdep.h:33:33: error: '__NR_prlimit64' undeclared (first use in this function) 33 | # define SYS_ify(syscall_name) __NR_##syscall_name | ^~~~~ ./include/bits/syscalls.h:167:11: note: in definition of macro 'internal_syscall4' 167 | : input, "r" (__a0), "r" (__a1), "r" (__a2) \ | ^~~~~ ./include/bits/syscalls.h:50:36: note: in expansion of macro 'SYS_ify' 50 | "i" (SYS_ify (name)), err, args) | ^~~~~~~ ./include/bits/syscalls.h:24:24: note: in expansion of macro 'INTERNAL_SYSCALL' 24 | long result_var = INTERNAL_SYSCALL(name, err, nr, args); \ | ^~~~~~~~~~~~~~~~ libc/sysdeps/linux/common/prlimit.c:25:10: note: in expansion of macro 'INLINE_SYSCALL' 25 | return INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit, | ^~~~~~~~~~~~~~ ./libc/sysdeps/linux/mips/sysdep.h:33:33: note: each undeclared identifier is reported only once for each function it appears in 33 | # define SYS_ify(syscall_name) __NR_##syscall_name | ^~~~~ ./include/bits/syscalls.h:167:11: note: in definition of macro 'internal_syscall4' 167 | : input, "r" (__a0), "r" (__a1), "r" (__a2) \ | ^~~~~ ./include/bits/syscalls.h:50:36: note: in expansion of macro 'SYS_ify' 50 | "i" (SYS_ify (name)), err, args) | ^~~~~~~ ./include/bits/syscalls.h:24:24: note: in expansion of macro 'INTERNAL_SYSCALL' 24 | long result_var = INTERNAL_SYSCALL(name, err, nr, args); \ | ^~~~~~~~~~~~~~~~ libc/sysdeps/linux/common/prlimit.c:25:10: note: in expansion of macro 'INLINE_SYSCALL' 25 | return INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit, | ^~~~~~~~~~~~~~ make[2]: *** [Makerules:369: libc/sysdeps/linux/common/prlimit.os] Error 1
The error with my newer (older) kernel, 2.6.36.4, was a result of my only reverting the 2nd prlimit commit and not the 1st, so that was my error.
Lance