RFR: Make printing of rlim_t values more portable

Mikael Vidstedt mikael.vidstedt at oracle.com
Wed Apr 12 01:44:40 UTC 2017

> On Apr 11, 2017, at 6:37 PM, David Holmes <david.holmes at oracle.com> wrote:
> 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.
>> http://cr.openjdk.java.net/~mikael/webrevs/portola/rlimit/webrev.01/hotspot/webrev/
> 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.

I agree that uint64_t would be better. Will fix!


More information about the portola-dev mailing list