src: fix segfault handling/RegisterSignalHandler
src: do not use posix feature macro in node.h
This macro is only defined when building Node.js, so addons cannot use it as a way of detecting feature availability.
src: reset SIGSEGV handler before crashing
Without this, we would re-enter the signal handler immediately after re-raising the signal, leading to an infinite loop.
##### src: implement reset_handler for SIGSEGV handling
Otherwise, this makes RegisterSignalHandler()
behave differently
for SIGSEGV
than it does for all other signals.
Encoding the reset_handler
bit as part of the function pointer value
is a bit of a hack, and may not work on all platforms.
(This commit can be left out, if people feel like it should be. It can also be replaced by not making the reset_handler
argument part of the public API.)
src: forbid reset_handler for SIGSEGV handling
This is not easily implementable, and should be explicitly disallowed.
RegisterSignalHandler()
test: add addon tests for Ensure coverage for the different combinations of arguments.
Refs: https://github.com/nodejs/node/pull/27246
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines