Fix: tests: extra arguments are not passed to the remove trigger command
[lttng-tools.git] / tests / utils / testapp / signal-helper.h
CommitLineData
95983a02 1/*
9d16b343 2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
95983a02 3 *
9d16b343 4 * SPDX-License-Identifier: LGPL-2.1-only
95983a02 5 *
95983a02
JG
6 */
7
8#ifndef LTTNG_TESTAPP_SIGNAL_HELPER_H
9#define LTTNG_TESTAPP_SIGNAL_HELPER_H
10
11#include <signal.h>
12
13static volatile int should_quit;
14
15static
16void sighandler(int sig)
17{
18 if (sig == SIGTERM) {
19 should_quit = 1;
20 }
21}
22
23static
24int set_signal_handler(void)
25{
26 int ret;
27 struct sigaction sa = {
28 .sa_flags = 0,
29 .sa_handler = sighandler,
30 };
31
32 ret = sigemptyset(&sa.sa_mask);
33 if (ret) {
34 perror("sigemptyset");
35 goto end;
36 }
37
38 ret = sigaction(SIGTERM, &sa, NULL);
39 if (ret) {
40 perror("sigaction");
41 goto end;
42 }
43end:
44 return ret;
45}
46
47#endif /* LTTNG_TESTAPP_SIGNAL_HELPER_H */
This page took 0.031538 seconds and 4 git commands to generate.