X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Ftestapp%2Fsignal-helper.h;fp=tests%2Futils%2Ftestapp%2Fsignal-helper.h;h=0000000000000000000000000000000000000000;hp=ceadcb37277225bab6adf92667032888f6be49a0;hb=c9e313bc594f40a86eed237dce222c0fc99c957f;hpb=4878de5c7deb512bbdac4fdfc498907efa06fb7c diff --git a/tests/utils/testapp/signal-helper.h b/tests/utils/testapp/signal-helper.h deleted file mode 100644 index ceadcb372..000000000 --- a/tests/utils/testapp/signal-helper.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2018 Jérémie Galarneau - * - * SPDX-License-Identifier: LGPL-2.1-only - * - */ - -#ifndef LTTNG_TESTAPP_SIGNAL_HELPER_H -#define LTTNG_TESTAPP_SIGNAL_HELPER_H - -#include - -static volatile int should_quit; - -static -void sighandler(int sig) -{ - if (sig == SIGTERM) { - should_quit = 1; - } -} - -static -int set_signal_handler(void) -{ - int ret; - struct sigaction sa {}; - sa.sa_flags = 0; - sa.sa_handler = sighandler; - - ret = sigemptyset(&sa.sa_mask); - if (ret) { - perror("sigemptyset"); - goto end; - } - - ret = sigaction(SIGTERM, &sa, NULL); - if (ret) { - perror("sigaction"); - goto end; - } -end: - return ret; -} - -#endif /* LTTNG_TESTAPP_SIGNAL_HELPER_H */