Skip to content

Commit

Permalink
Merge pull request #4553 from jktomer/master
Browse files Browse the repository at this point in the history
fix: Handle SIGUSR1 even under +B i / +B d

OTP-17275 PR-4553
  • Loading branch information
rickard-green authored Mar 16, 2021
2 parents d0adb15 + 8798603 commit 98f6d7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions erts/emulator/sys/unix/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,6 @@ void erts_replace_intr(void) {
void init_break_handler(void)
{
sys_signal(SIGINT, request_break);
#ifndef ETHR_UNUSABLE_SIGUSRX
sys_signal(SIGUSR1, generic_signal_handler);
#endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */
sys_signal(SIGQUIT, generic_signal_handler);
}

Expand All @@ -694,6 +691,9 @@ void
erts_sys_unix_later_init(void)
{
sys_signal(SIGTERM, generic_signal_handler);
#ifndef ETHR_UNUSABLE_SIGUSRX
sys_signal(SIGUSR1, generic_signal_handler);
#endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */

/* Ignore SIGCHLD to ensure orphaned processes don't turn into zombies on
* death when we're pid 1. */
Expand Down
10 changes: 5 additions & 5 deletions erts/emulator/test/os_signal_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ suite() ->
all() ->
case os:type() of
{win32, _} -> [];
_ -> [set_unset,
t_sighup,
_ -> [t_sighup,
t_sigusr1,
t_sigusr2,
t_sigterm,
t_sigalrm,
t_sigchld,
t_sigchld_fork]
t_sigchld_fork,
set_unset]
end.

init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
Expand Down Expand Up @@ -135,7 +135,7 @@ t_sighup(_Config) ->
t_sigusr1(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
os:set_signal(sigusr1, handle),
% shouldn't need to explicitly set_signal to handle USR1, it's the default
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
Expand All @@ -157,7 +157,7 @@ t_sigusr1(_Config) ->
Msgs2 = fetch_msgs(Pid2),
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
%% reset to ignore (it's the default)
%% reset to handle (default) so as not to break other tests
os:set_signal(sigusr1, handle),
ok.

Expand Down

0 comments on commit 98f6d7e

Please sign in to comment.