RFR: 8313306: More sensible reservation logging [v2]

Thomas Stuefe stuefe at openjdk.org
Tue Jan 30 10:39:41 UTC 2024


On Tue, 30 Jan 2024 10:21:04 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> i.e rather than passing `errno` as a parameter, you should be passing `ep.errno()`
>
>> crude approach of trcVerbose
> 
> Opinions differ, obviously, since these trace lines are from me originally. Not sure what's crude about them.
> 
> I don't care much one way or the other, but just to defend my original code: 
> - errno numerical are short, concise and well defined within their OS. 
> - their enum counterparts (EINVAL etc) are too
> - strerror is not as clear and, most annoyingly, localization-dependent. A german customer running the JVM with a german locale will see (and give to your support people) logs containing german error messages.

> i.e rather than passing `errno` as a parameter, you should be passing `ep.errno()`

That is right, I did not think of that. By the time the raw errno is passed to the logging function, it may have been changed already. That is very improbable, but could happen.

E.g. 

log_info(os)("Something happen (%s) (errno=%d)", some_function_that_changes_errno_and_returns_string(), errno);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17356#discussion_r1470979089


More information about the hotspot-runtime-dev mailing list