RFR: 8351491: Add info from release file to hserr file [v3]

Thomas Stuefe stuefe at openjdk.org
Fri Apr 4 07:32:57 UTC 2025


On Thu, 3 Apr 2025 15:47:27 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> The release file of the JDK image contains useful info, for example the SOURCE used to built this image e.g.
>> SOURCE=".:git:21af8c7e7405"
>> Also the MODULES list is probably useful to have.
>> Add this info (or the complete content of the release file) to the hs_err files.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use one time PeriodicTask

src/hotspot/share/runtime/os.cpp line 1539:

> 1537:   char* release_file = (char*) os::malloc(rfile_len, mtInternal);
> 1538:   if (release_file) {
> 1539:     os::snprintf(release_file, rfile_len, "%s/release", home);

Instead of the manual malloc, just do this:


stringStream ss;
ss.print(""%s/release", home);


then you can use `ss.base()` for the assembled path.

src/hotspot/share/runtime/os.cpp line 1553:

> 1551:         return;
> 1552:       }
> 1553:       fseek(file, 0, SEEK_SET);

There is no need to seek to the end to get the file size. Use fstat instead.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24244#discussion_r2028264049
PR Review Comment: https://git.openjdk.org/jdk/pull/24244#discussion_r2028267066


More information about the hotspot-dev mailing list