RFR: Make printing of rlim_t values more portable
david.holmes at oracle.com
Wed Apr 12 01:37:47 UTC 2017
On 12/04/2017 10:34 AM, Mikael Vidstedt wrote:
> os::Posix::print_rlimit_info has some logic to print a bunch of limit (rlim_t) values. posix doesn’t specify which exact type rlim_t has (just that it’s an unsigned integer type). Most platforms define it as an unsigned long, but in musl it’s an unsigned long long, which means that the print format (%lu) doesn’t match.
> There are a few different alternatives to fixing this, but Mikael Gerdin suggested upcasting the value to a 64-bit unsigned type and using the corresponding print format (UINT64_FORMAT). This should take care of the problem.
A reasonable approach, but stylistically I'd prefer to use uint64_t in
the cast rather than the u8 shorthand. Or perhaps we need U<n>_FORMAT
definitions to match.
More information about the portola-dev