RFR(S): 8180039: Use more portable print format/arguments for rlim_t

David Holmes david.holmes at oracle.com
Wed May 10 00:27:58 UTC 2017


Hi Mikael,

On 10/05/2017 9:38 AM, Mikael Vidstedt wrote:
>
> Please review this small change which updates the code in the print_rlimit_info method in os_posix.cpp which prints out rlim_t/rlim_cur values (returned from getrlimit) to use more portable format specifiers and arguments/argument types.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8180039 <https://bugs.openjdk.java.net/browse/JDK-8180039>
> Webrev: http://cr.openjdk.java.net/~mikael/webrevs/8180039/webrev.00/hotspot/webrev/ <http://cr.openjdk.java.net/~mikael/webrevs/8180039/webrev.00/hotspot/webrev/>
>
> The spec says that rlim_t is an "unsigned integer type”, so casting it to a uint64_t will either zero extend it (if the rlim_t type is 32-bit), or end up with the exact same width/value (if rlim_t is 64-bit). Printing it out as a 64-bit unsigned type (using UINT64_FORMAT) will handle both the 64-bit case and the zero extended 32-bit case.

Not unreasonable. :)

Alternatively we could define RLIM_FORMAT depending on sizeof rlim_t, 
but that may be over the top.

Makes me wonder why for every xxx_t they define they don't also define a 
XXX_T_FORMAT value!

Thanks,
David

> Cheers,
> Mikael
>


More information about the hotspot-runtime-dev mailing list