Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8180039

Use more portable print format/arguments for rlim_t

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • None
    • hotspot
    • None
    • b21

      In os_posix.c/print_rlimit_info there are a handful of printouts of values returned from calls to getrlimit, and specifically the rlim_cur field of the rlimit struct. The type of the rlim_cur field is rlim_t, but the spec doesn't say which exact type rlim_t is based on (it just mentions that it's an unsigned integer type).

      Depending on the platform and/or flags used when compiling the code, the rlim_t type may, for example, either be an unsigned long, or an unsigned long long. This means that it's not always correct to use the %lu format specifier when printing the value, and since the print calls are being verified this will turn into a build error if the format and argument types do not match.

            mikael Mikael Vidstedt
            mikael Mikael Vidstedt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: