On Mon, 26 Sep 2022 15:47:51 GMT, Julian Waters <jwat...@openjdk.org> wrote:

>> EDIT: Cave and add the ErrorOrigin enum, to differentiate which error type 
>> the error reporting functions in libjava will look up. RUNTIME refers to 
>> errors passed through the runtime via errno, and SYSTEM is for native errors 
>> not visible to the runtime.
>
> Julian Waters has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Whitespace

This seems to be trying to future-proof the reporting code by introducing a 
duality that is not actually needed at present in some cases. That means the 
code is untested. Are there planned uses of `RUNTIME` in the very near future?

src/java.base/share/native/libjava/jni_util.h line 339:

> 337:                           char *jniEntryName);
> 338: 
> 339: // RUNTIME - Errors that were passed through the runtime

If "runtime" means "C runtime" (as the system description suggests) then please 
say that.

src/java.base/share/native/libjava/jni_util.h line 348:

> 346: 
> 347: JNIEXPORT size_t JNICALL
> 348: getLastErrorString(char *buf, size_t len, ErrorOrigin origin);

AFAICS we never pass RUNTIME to `getLastErrorString`

src/java.base/share/native/libjli/java.h line 145:

> 143:  */
> 144: JNIEXPORT void JNICALL
> 145: JLI_ReportErrorMessageSys(ErrorOrigin origin, const char * message, ...);

AFAICS we never pass RUNTIME to `JLI_ReportErrorMessageSys`.

src/java.base/unix/native/libjli/java_md_common.c line 207:

> 205:     va_start(vl, fmt);
> 206:     vfprintf(stderr, fmt, vl);
> 207:     if (errno != 0) {

Is `vfprintf` guaranteed to not set `errno`?

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

PR: https://git.openjdk.org/jdk/pull/9870

Reply via email to