aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 22:59:29 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 22:59:29 +0200
commit669b8404d1d177d9d1e9fc646bbf1cdbb957c056 (patch)
treed70859a937fba2f9504b9abc4715da9aee87fda1 /src
parentnet: drop the _all suffix (diff)
downloadcimple-669b8404d1d177d9d1e9fc646bbf1cdbb957c056.tar.gz
cimple-669b8404d1d177d9d1e9fc646bbf1cdbb957c056.zip
signal: refactoring
Diffstat (limited to 'src')
-rw-r--r--src/server.c2
-rw-r--r--src/signal.c14
-rw-r--r--src/signal.h6
-rw-r--r--src/tcp_server.c2
-rw-r--r--src/worker.c2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/server.c b/src/server.c
index 273a355..ff5b9e1 100644
--- a/src/server.c
+++ b/src/server.c
@@ -213,7 +213,7 @@ int server_create(struct server **_server, const struct settings *settings)
struct storage_settings storage_settings;
int ret = 0;
- ret = signal_handle_stop_signals();
+ ret = signal_handle_stops();
if (ret < 0)
return ret;
diff --git a/src/signal.c b/src/signal.c
index 0676e60..7d00bc9 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -35,7 +35,7 @@ static int my_sigaction(int signo, const struct sigaction *act)
return ret;
}
-int signal_handle_stop_signals(void)
+int signal_handle_stops(void)
{
int ret = 0;
@@ -75,12 +75,7 @@ int signal_block_all(sigset_t *old)
return signal_set(&new, old);
}
-int signal_restore(const sigset_t *new)
-{
- return signal_set(new, NULL);
-}
-
-int signal_unblock_all_except_stop_signals(void)
+int signal_block_stops(void)
{
sigset_t set;
sigemptyset(&set);
@@ -90,3 +85,8 @@ int signal_unblock_all_except_stop_signals(void)
return signal_set(&set, NULL);
}
+
+int signal_restore(const sigset_t *new)
+{
+ return signal_set(new, NULL);
+}
diff --git a/src/signal.h b/src/signal.h
index 713c842..4f1c280 100644
--- a/src/signal.h
+++ b/src/signal.h
@@ -11,11 +11,11 @@
#include <signal.h>
extern volatile sig_atomic_t global_stop_flag;
-int signal_handle_stop_signals(void);
+int signal_handle_stops(void);
int signal_block_all(sigset_t *old);
-int signal_restore(const sigset_t *new);
+int signal_block_stops(void);
-int signal_unblock_all_except_stop_signals(void);
+int signal_restore(const sigset_t *new);
#endif
diff --git a/src/tcp_server.c b/src/tcp_server.c
index dbf1146..277f81e 100644
--- a/src/tcp_server.c
+++ b/src/tcp_server.c
@@ -62,7 +62,7 @@ static void *connection_thread(void *_ctx)
/* Let the child thread handle its signals except those that should be
* handled in the main thread. */
- ret = signal_unblock_all_except_stop_signals();
+ ret = signal_block_stops();
if (ret < 0)
goto free_ctx;
diff --git a/src/worker.c b/src/worker.c
index 2771ff2..ab06563 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -27,7 +27,7 @@ int worker_create(struct worker **_worker)
{
int ret = 0;
- ret = signal_handle_stop_signals();
+ ret = signal_handle_stops();
if (ret < 0)
return ret;