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

Mikael Vidstedt mikael.vidstedt at oracle.com
Tue May 9 23:38:20 UTC 2017


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.

Cheers,
Mikael



More information about the hotspot-runtime-dev mailing list