aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2017-01-24 10:59:30 +0100
committerBjörn-Egil Dahlberg <[email protected]>2017-02-02 09:40:28 +0100
commitd4bd17da9759af54227891a90d9fb83d5bfe6d7e (patch)
treea1b75a3b750b073d46e7a34bfe4a80eddc62a02e /erts
parent9ccb988eeb79815a33e0dd138278e0c29ed3ca6a (diff)
downloadotp-d4bd17da9759af54227891a90d9fb83d5bfe6d7e.tar.gz
otp-d4bd17da9759af54227891a90d9fb83d5bfe6d7e.tar.bz2
otp-d4bd17da9759af54227891a90d9fb83d5bfe6d7e.zip
erts: Use os module instead of erts_internal for set_signal/2
* Add specs * Change return signature to 'ok' instead of 'true'
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/bif.c14
-rw-r--r--erts/emulator/beam/bif.tab2
-rw-r--r--erts/emulator/beam/erl_bif_os.c14
-rw-r--r--erts/emulator/test/os_signal_SUITE.erl48
4 files changed, 39 insertions, 39 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 452bfef71a..1048300cf7 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -5280,17 +5280,3 @@ BIF_RETTYPE dt_restore_tag_1(BIF_ALIST_1)
#endif
BIF_RET(am_true);
}
-
-BIF_RETTYPE erts_internal_set_signal_2(BIF_ALIST_2) {
- if (is_atom(BIF_ARG_1) && ((BIF_ARG_2 == am_ignore) ||
- (BIF_ARG_2 == am_default) ||
- (BIF_ARG_2 == am_handle))) {
- if (!erts_set_signal(BIF_ARG_1, BIF_ARG_2))
- goto error;
-
- BIF_RET(am_true);
- }
-
-error:
- BIF_ERROR(BIF_P, BADARG);
-}
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 318a4fd264..f90fae6041 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -668,7 +668,7 @@ gcbif erlang:ceil/1
bif math:floor/1
bif math:ceil/1
bif math:fmod/2
-bif erts_internal:set_signal/2
+bif os:set_signal/2
#
# Obsolete
diff --git a/erts/emulator/beam/erl_bif_os.c b/erts/emulator/beam/erl_bif_os.c
index 46777d3aa5..edc3c82b23 100644
--- a/erts/emulator/beam/erl_bif_os.c
+++ b/erts/emulator/beam/erl_bif_os.c
@@ -203,3 +203,17 @@ BIF_RETTYPE os_unsetenv_1(BIF_ALIST_1)
}
BIF_RET(am_true);
}
+
+BIF_RETTYPE os_set_signal_2(BIF_ALIST_2) {
+ if (is_atom(BIF_ARG_1) && ((BIF_ARG_2 == am_ignore) ||
+ (BIF_ARG_2 == am_default) ||
+ (BIF_ARG_2 == am_handle))) {
+ if (!erts_set_signal(BIF_ARG_1, BIF_ARG_2))
+ goto error;
+
+ BIF_RET(am_ok);
+ }
+
+error:
+ BIF_ERROR(BIF_P, BADARG);
+}
diff --git a/erts/emulator/test/os_signal_SUITE.erl b/erts/emulator/test/os_signal_SUITE.erl
index 7c3950114f..9aa49a453e 100644
--- a/erts/emulator/test/os_signal_SUITE.erl
+++ b/erts/emulator/test/os_signal_SUITE.erl
@@ -92,9 +92,9 @@ set_unset(_Config) ->
sigusr1, sigusr2,
sigchld,
sigstop, sigtstp],
- F1 = fun(Sig) -> true = erts_internal:set_signal(Sig,handle) end,
- F2 = fun(Sig) -> true = erts_internal:set_signal(Sig,default) end,
- F3 = fun(Sig) -> true = erts_internal:set_signal(Sig,ignore) end,
+ F1 = fun(Sig) -> ok = os:set_signal(Sig,handle) end,
+ F2 = fun(Sig) -> ok = os:set_signal(Sig,default) end,
+ F3 = fun(Sig) -> ok = os:set_signal(Sig,ignore) end,
%% set handle
ok = lists:foreach(F1, Signals),
%% set ignore
@@ -106,7 +106,7 @@ set_unset(_Config) ->
t_sighup(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
- erts_internal:set_signal(sighup, handle),
+ os:set_signal(sighup, handle),
ok = kill("HUP", OsPid),
ok = kill("HUP", OsPid),
ok = kill("HUP", OsPid),
@@ -121,7 +121,7 @@ t_sighup(_Config) ->
ok = kill("HUP", OsPid),
%% ignore
Pid2 = setup_service(),
- erts_internal:set_signal(sighup, ignore),
+ os:set_signal(sighup, ignore),
ok = kill("HUP", OsPid),
ok = kill("HUP", OsPid),
ok = kill("HUP", OsPid),
@@ -129,13 +129,13 @@ t_sighup(_Config) ->
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
%% reset to handle (it's the default)
- erts_internal:set_signal(sighup, handle),
+ os:set_signal(sighup, handle),
ok.
t_sigusr1(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
- erts_internal:set_signal(sigusr1, handle),
+ os:set_signal(sigusr1, handle),
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
@@ -150,7 +150,7 @@ t_sigusr1(_Config) ->
ok = kill("USR1", OsPid),
%% ignore
Pid2 = setup_service(),
- erts_internal:set_signal(sigusr1, ignore),
+ os:set_signal(sigusr1, ignore),
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
ok = kill("USR1", OsPid),
@@ -158,13 +158,13 @@ t_sigusr1(_Config) ->
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
%% reset to ignore (it's the default)
- erts_internal:set_signal(sigusr1, handle),
+ os:set_signal(sigusr1, handle),
ok.
t_sigusr2(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
- erts_internal:set_signal(sigusr2, handle),
+ os:set_signal(sigusr2, handle),
ok = kill("USR2", OsPid),
ok = kill("USR2", OsPid),
ok = kill("USR2", OsPid),
@@ -179,7 +179,7 @@ t_sigusr2(_Config) ->
ok = kill("USR2", OsPid),
%% ignore
Pid2 = setup_service(),
- erts_internal:set_signal(sigusr2, ignore),
+ os:set_signal(sigusr2, ignore),
ok = kill("USR2", OsPid),
ok = kill("USR2", OsPid),
ok = kill("USR2", OsPid),
@@ -187,13 +187,13 @@ t_sigusr2(_Config) ->
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
%% reset to ignore (it's the default)
- erts_internal:set_signal(sigusr2, ignore),
+ os:set_signal(sigusr2, ignore),
ok.
t_sigterm(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
- erts_internal:set_signal(sigterm, handle),
+ os:set_signal(sigterm, handle),
ok = kill("TERM", OsPid),
ok = kill("TERM", OsPid),
ok = kill("TERM", OsPid),
@@ -208,7 +208,7 @@ t_sigterm(_Config) ->
ok = kill("TERM", OsPid),
%% ignore
Pid2 = setup_service(),
- erts_internal:set_signal(sigterm, ignore),
+ os:set_signal(sigterm, ignore),
ok = kill("TERM", OsPid),
ok = kill("TERM", OsPid),
ok = kill("TERM", OsPid),
@@ -216,13 +216,13 @@ t_sigterm(_Config) ->
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
%% reset to handle (it's the default)
- erts_internal:set_signal(sigterm, handle),
+ os:set_signal(sigterm, handle),
ok.
t_sigchld(_Config) ->
Pid1 = setup_service(),
OsPid = os:getpid(),
- erts_internal:set_signal(sigchld, handle),
+ os:set_signal(sigchld, handle),
ok = kill("CHLD", OsPid),
ok = kill("CHLD", OsPid),
ok = kill("CHLD", OsPid),
@@ -237,7 +237,7 @@ t_sigchld(_Config) ->
ok = kill("CHLD", OsPid),
%% ignore
Pid2 = setup_service(),
- erts_internal:set_signal(sigchld, ignore),
+ os:set_signal(sigchld, ignore),
ok = kill("CHLD", OsPid),
ok = kill("CHLD", OsPid),
ok = kill("CHLD", OsPid),
@@ -245,19 +245,19 @@ t_sigchld(_Config) ->
io:format("Msgs2: ~p~n", [Msgs2]),
[] = Msgs2,
%% reset to handle (it's the default)
- erts_internal:set_signal(sigchld, ignore),
+ os:set_signal(sigchld, ignore),
ok.
t_sigalrm(_Config) ->
Pid1 = setup_service(),
- true = erts_internal:set_signal(sigalrm, handle),
+ ok = os:set_signal(sigalrm, handle),
ok = os_signal_SUITE:set_alarm(1),
receive after 3000 -> ok end,
Msgs1 = fetch_msgs(Pid1),
[{notify,sigalrm}] = Msgs1,
io:format("Msgs1: ~p~n", [Msgs1]),
- erts_internal:set_signal(sigalrm, ignore),
+ os:set_signal(sigalrm, ignore),
Pid2 = setup_service(),
ok = os_signal_SUITE:set_alarm(1),
receive after 3000 -> ok end,
@@ -265,18 +265,18 @@ t_sigalrm(_Config) ->
[] = Msgs2,
io:format("Msgs2: ~p~n", [Msgs2]),
Pid3 = setup_service(),
- erts_internal:set_signal(sigalrm, handle),
+ os:set_signal(sigalrm, handle),
ok = os_signal_SUITE:set_alarm(1),
receive after 3000 -> ok end,
Msgs3 = fetch_msgs(Pid3),
[{notify,sigalrm}] = Msgs3,
io:format("Msgs3: ~p~n", [Msgs3]),
- erts_internal:set_signal(sigalrm, ignore),
+ os:set_signal(sigalrm, ignore),
ok.
t_sigchld_fork(_Config) ->
Pid1 = setup_service(),
- true = erts_internal:set_signal(sigchld, handle),
+ ok = os:set_signal(sigchld, handle),
{ok,OsPid} = os_signal_SUITE:fork(),
receive after 3000 -> ok end,
Msgs1 = fetch_msgs(Pid1),
@@ -286,7 +286,7 @@ t_sigchld_fork(_Config) ->
io:format("exit status from ~w : ~w~n", [OsPid,Status]),
42 = Status,
%% reset to ignore (it's the default)
- erts_internal:set_signal(sigchld, ignore),
+ os:set_signal(sigchld, ignore),
ok.