Is it possible to trap Linux signals (e.g. SIGUSR1) through an handler in Erlang? (without having to resort to a driver crafted in C)
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
(NOT A REAL ANSWER)
In 2001 someone asked:
At that time the answer was:
SOURCE: http://www.erlang.org/pipermail/erlang-questions/2001-October/003752.html
As far as I know, nothing changed since then. But this is extremely interesting. If anyone has any news about this, please let us know :)
This is possible since Erlang/OTP 20.0, released in June 2017. It was done through this pull request that adds an event manager for signals called
erl_signal_server
. See the "OS Signal Event Handler" section in thekernel
manual page.If you're interested in SIGUSR1, note that the default handler will make the Erlang VM halt and produce a crash dump. To avoid that, it's not enough to add your own handler to
erl_signal_server
; you have to swap the default handler for it: