RFR 8252248: __SIGRTMAX is not declared in musl libc

Alexander Scherbatiy alexander.scherbatiy at bell-sw.com
Tue Aug 25 17:00:37 UTC 2020


Hello,

Could your review the fix for the issue:
   Bug: https://bugs.openjdk.java.net/browse/JDK-8252248
   Fix: http://cr.openjdk.java.net/~alexsch/8252248/webrev.00/

Building JDK on Alpine Linux with musl libc gives the error:
src/java.base/linux/native/libnet/linux_close.c:63:25: error: 
'__SIGRTMAX' undeclared here (not in a function); did you mean 'SIGRTMAX'?
    63 | static int sigWakeup = (__SIGRTMAX - 2);

musl libc does not contain __SIGRTMAX definition. It defines only 
SIGRTMAX as a function call [1].

__SIGRTMAX is used in JDK in two files NativeThread.c and linux_close.c .

The first idea of the fix was simply to substitute __SIGRTMAX to 
SIGRTMAX in NativeThread.c and use the same definition
   #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
in linux_close.c.
"static int sigWakeup = (SIGRTMAX - 2)"  does not work because the 
SIGRTMAX is defined as a function and leads to "initializer element is 
not constant" error.

The fix has been discussed on the portola-dev alias [2] where it was 
pointed out that the fix can be reviewed in the mainline and it was 
suggested to rename the INTERRUPT_SIGNAL and move its definition to 
net_util_md.h.


[1] https://git.musl-libc.org/cgit/musl/tree/include/signal.h#n196
[2] 
https://mail.openjdk.java.net/pipermail/portola-dev/2020-August/000471.html

Thanks,
Alexander.



More information about the core-libs-dev mailing list