On Thu, 26 Sep 2024 07:04:52 GMT, Christoph Langer <[email protected]> wrote:

> I found some strange handling of the return value on macOS. Here we check 
> already the return value of pthread_create ; but then it seems we add the 
> errno twice when calling JLI_ReportErrorMessageSys, once in the calling 
> params and once in JLI_ReportErrorMessageSys itself. Should we better call 
> with the return value of pthread_create in the error case? Or just with a 
> string without additional parameters? The comment about Solaris 8 is also 
> very outdated, don't think we need that any more in jdk24.
> 
> ```
> src/java.base/macosx/native/libjli/java_md_macosx.m 
> 
> 312     if (pthread_create(&main_thr, NULL, &apple_main, &args) != 0) {
> 313         JLI_ReportErrorMessageSys("Could not create main thread: %s\n", 
> strerror(errno));
> 
> src/java.base/unix/native/libjli/java_md_common.c
> 
> 244  JLI_ReportErrorMessageSys(const char* fmt, ...) {
> 245      va_list vl;
> 246      char *emsg;
> 247  
> 248      /*
> 249       * TODO: its safer to use strerror_r but is not available on
> 250       * Solaris 8. Until then....
> 251       */
> 252      emsg = strerror(errno);
> 253      if (emsg != NULL) {
> 254          fprintf(stderr, "%s\n", emsg);
> 255      }
> ```

Ah, that problem with JLI_ReportErrorMessageSys. I recall that me and Thomas 
reported a possibly related issue for it ages ago
https://bugs.openjdk.org/browse/JDK-8292016

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

PR Comment: https://git.openjdk.org/jdk/pull/21182#issuecomment-2376597702

Reply via email to