The second argument for os::signal is a void* handler function.
The posix implementation of os::signal expects that handler argument to be a sigaction handler, taking 3 arguments.
The Windows implementation of os::signal expects that handler argument to be a signal handler, taking 1 argument. It's not a sigaction handler like POSIX because Windows seemingly doesn't support the sigaction stuff.
This all makes os::signal a quite questionable portability API. And it turns out all calls to os::signal are in posix-specific or windows-specific files. So it seems like we don't even need this portability API. Probably os::signal should be removed entirely, and windows and posix code should each have their own signal handler manipulation functions, and never the twain shall meet.
There are also some problematic uses. For example, in os_windows.cpp there is a call to os::signal with the handler being UserHandler, a function of 3 arguments (though only the first is used), which will be called with only one argument. All the other uses need to be examined.
The posix implementation of os::signal expects that handler argument to be a sigaction handler, taking 3 arguments.
The Windows implementation of os::signal expects that handler argument to be a signal handler, taking 1 argument. It's not a sigaction handler like POSIX because Windows seemingly doesn't support the sigaction stuff.
This all makes os::signal a quite questionable portability API. And it turns out all calls to os::signal are in posix-specific or windows-specific files. So it seems like we don't even need this portability API. Probably os::signal should be removed entirely, and windows and posix code should each have their own signal handler manipulation functions, and never the twain shall meet.
There are also some problematic uses. For example, in os_windows.cpp there is a call to os::signal with the handler being UserHandler, a function of 3 arguments (though only the first is used), which will be called with only one argument. All the other uses need to be examined.
- relates to
-
JDK-8295702 Signal.handle can't correctly restore all signal handlers on Posix systems
-
- Open
-
-
JDK-8294594 Fix cast-function-type warnings in signal handling code
-
- Resolved
-