156777f967
On some historic 32-bit platforms (and 64-bit SuperH), __NR_getrlimit corresponds to a non-SuS-compatible version that uses a hardcoded value of 0x7fffffff as infinity. Moreover, in order to provide a backwards compatibility with that behaviour, some architectures (mips, sparc, and alpha, with latter being especially peculiar in its ways) just defined RLIM_INFINITY to that value (with alpha defining RLIM_INFINITY to 2^63-1) instead of employing sys_old_getrlimit syscall and providing __NR_ugetrlimit with proper implementation, as other arches did. Overall, that led to conclusion that printing "RLIM_INFINITY" is never enough and the actial value should be printed as well. * linux/i386/syscallent.h ([76]): Changing decoder to old_getrlimit. * linux/m68k/syscallent.h ([76]): Likewise. * linux/microblaze/syscallent.h ([76]): Likewise. * linux/powerpc/syscallent.h ([76]): Likewise. * linux/s390/syscallent.h ([76]): Likewise. * linux/sh/syscallent.h ([76]): Likewise. * linux/sh64/syscallent.h ([76]): Likewise. * resource.c (sprint_rlim64, sprint_rlim32, print_rlimit64, print_rlimit32): Remove. (STRACE_RLIM_INFINITY, STRACE_M32_RLIM_INFINITY, STRACE_RLIM64_INFINITY, OLD_GETLIMIT_INFINITY): New macro constants. (enum rlimit_decode_mode): New enumeration. (struct rlimit_64): Move type definition out of print_rlimit64. (print_rlim_t): New function, printer of an rlimit value, in accordance with rlimit decode mode and xlat verbosity mode. (print_rlimit): Printer of a fetched rlimit_64 structure. (decode_rlimit): Fetches struct rlimit/rlimit64 in accordance with current mode and personality, uses print_rlimit for printing. (do_getrlimit): New function, decodes old_getrlimit/getrlimit syscalls. (SYS_FUNC(getrlimit)): Call do_getrlimit with RDM_NORMAL mode. (SYS_FUNC(old_getrlimit)): New function, calls do_getrlimit with RDM_OLD_GETRLIMIT mode. (SYS_FUNC(setrlimit)): Call decode_rlimit with RDM_NORMAL mode. (SYS_FUNC(prlimit64)): Call decode_rlimit with RDM_PRLIMIT64 mode instead of print_rlimit64. * tests/xgetrlimit.c (sprint_rlim): Rename to... (print_rlim): ...this, print to terminal instead of string buffer in accordance with the output format expected. (main): Accomodate sprint_rlim -> print_rlim change, use sprintrc. * tests/getrlimit.c (INFINITY, INFINITY_STR): New macros. * tests/setrlimit.c: Likewise. * tests/ugetrlimit.c: Likewise.