Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1575-Add-support-for-SIGCONT-system-signal.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1575-Add-support-for-SIGCONT-system-signal.patch of Package erlang
From 5cf21abc9b93687183d92922d4d6b510902dd5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <jean-sebastien.pedron@dumbbell.fr> Date: Mon, 14 Oct 2024 18:57:13 +0200 Subject: [PATCH] Add support for `SIGCONT` system signal This signal is used after `SIGSTOP` or `SIGTSTP` to resume a system process. Shell job control relies on these signals. --- erts/emulator/beam/atom.names | 1 + erts/emulator/sys/unix/sys.c | 4 +++- erts/emulator/test/os_signal_SUITE.erl | 32 +++++++++++++++++++++++++- lib/kernel/doc/kernel_app.md | 2 ++ lib/kernel/src/os.erl | 3 ++- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/erts/emulator/beam/atom.names b/erts/emulator/beam/atom.names index ff5f2c1303..b017300f4a 100644 --- a/erts/emulator/beam/atom.names +++ b/erts/emulator/beam/atom.names @@ -673,6 +673,7 @@ atom sigstop atom sigint atom sigsegv atom sigtstp +atom sigcont atom sigquit atom sigwinch atom siginfo diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index da034cb373..cd9800d19c 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -682,7 +682,7 @@ static RETSIGTYPE suspend_signal(int signum) SIGUSR1 Term User-defined signal 1 SIGUSR2 Term User-defined signal 2 !SIGCHLD Ign Child stopped or terminated - !SIGCONT Cont Continue if stopped + SIGCONT Cont Continue if stopped SIGSTOP Stop Stop process SIGTSTP Stop Stop typed at terminal !SIGTTIN Stop Terminal input for background process @@ -709,6 +709,7 @@ signalterm_to_signum(Eterm signal) case am_sigchld: return SIGCHLD; case am_sigstop: return SIGSTOP; case am_sigtstp: return SIGTSTP; + case am_sigcont: return SIGCONT; case am_sigwinch: return SIGWINCH; #ifdef SIGINFO case am_siginfo: return SIGINFO; @@ -734,6 +735,7 @@ signum_to_signalterm(int signum) case SIGCHLD: return am_sigchld; case SIGSTOP: return am_sigstop; case SIGTSTP: return am_sigtstp; /* ^z */ + case SIGCONT: return am_sigcont; case SIGWINCH: return am_sigwinch; #ifdef SIGINFO case SIGINFO: return am_siginfo; /* ^t */ diff --git a/erts/emulator/test/os_signal_SUITE.erl b/erts/emulator/test/os_signal_SUITE.erl index 4887baf732..072e10b816 100644 --- a/erts/emulator/test/os_signal_SUITE.erl +++ b/erts/emulator/test/os_signal_SUITE.erl @@ -42,6 +42,7 @@ t_sigalrm/1, t_sigchld/1, t_sigchld_fork/1, + t_sigcont/1, t_sigwinch/1, t_siginfo/1]). @@ -95,7 +96,7 @@ set_unset(_Config) -> sigalrm, sigterm, sigusr1, sigusr2, sigchld, - sigstop, sigtstp], + sigstop, sigtstp, sigcont], 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, @@ -302,6 +303,35 @@ sigchld_fork() -> os:set_signal(sigchld, ignore), ok. +t_sigcont(_Config) -> + Pid1 = setup_service(), + OsPid = os:getpid(), + os:set_signal(sigcont, handle), + ok = kill("CONT", OsPid), + ok = kill("CONT", OsPid), + ok = kill("CONT", OsPid), + Msgs1 = fetch_msgs(Pid1), + io:format("Msgs1: ~p~n", [Msgs1]), + [{notify,sigcont}, + {notify,sigcont}, + {notify,sigcont}] = Msgs1, + %% no proc + ok = kill("CONT", OsPid), + ok = kill("CONT", OsPid), + ok = kill("CONT", OsPid), + %% ignore + Pid2 = setup_service(), + os:set_signal(sigcont, ignore), + ok = kill("CONT", OsPid), + ok = kill("CONT", OsPid), + ok = kill("CONT", OsPid), + Msgs2 = fetch_msgs(Pid2), + io:format("Msgs2: ~p~n", [Msgs2]), + [] = Msgs2, + %% reset to ignore (it's the default) + os:set_signal(sigcont, ignore), + ok. + t_sigwinch(_Config) -> Pid1 = setup_service(), OsPid = os:getpid(), diff --git a/lib/kernel/doc/src/kernel_app.xml b/lib/kernel/doc/src/kernel_app.xml index 186ce889e5..f1b52ef54a 100644 --- a/lib/kernel/doc/src/kernel_app.xml +++ b/lib/kernel/doc/src/kernel_app.xml @@ -108,6 +108,8 @@ <item><p>Stop process</p></item> <tag><c>sigtstp</c></tag> <item><p>Stop typed at terminal</p></item> + <tag><c>sigcont</c></tag> + <item><p>Continue after stop</p></item> <tag><c>sigwinch</c></tag> <item><p>Window size change</p></item> <tag><c>siginfo</c></tag> diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index bab043370d..26a03952e7 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -302,7 +302,8 @@ Each signal my be set to one of the following options: -spec set_signal(Signal, Option) -> 'ok' when Signal :: 'sighup' | 'sigquit' | 'sigabrt' | 'sigalrm' | 'sigterm' | 'sigusr1' | 'sigusr2' | 'sigchld' | - 'sigstop' | 'sigtstp' | 'sigwinch' | 'siginfo', + 'sigstop' | 'sigtstp' | 'sigcont' | 'sigwinch' | + 'siginfo', Option :: 'default' | 'handle' | 'ignore'. set_signal(_Signal, _Option) -> -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor