projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: cleanly exit from test apps on reception of SIGTERM
[lttng-tools.git]
/
tests
/
utils
/
testapp
/
gen-ust-events
/
gen-ust-events.c
diff --git
a/tests/utils/testapp/gen-ust-events/gen-ust-events.c
b/tests/utils/testapp/gen-ust-events/gen-ust-events.c
index f1eb18f52f927cb7ffd6181d11f2d19666768e42..c5dd31a355e1294229529a4ff20c3a3026bf8347 100644
(file)
--- a/
tests/utils/testapp/gen-ust-events/gen-ust-events.c
+++ b/
tests/utils/testapp/gen-ust-events/gen-ust-events.c
@@
-31,6
+31,8
@@
#include <signal.h>
#include <poll.h>
#include <errno.h>
#include <signal.h>
#include <poll.h>
#include <errno.h>
+#include "utils.h"
+#include "signal-helper.h"
#define TRACEPOINT_DEFINE
#include "tp.h"
#define TRACEPOINT_DEFINE
#include "tp.h"
@@
-84,11
+86,16
@@
int main(int argc, char **argv)
char text[10] = "test";
double dbl = 2.0;
float flt = 2222.0;
char text[10] = "test";
double dbl = 2.0;
float flt = 2222.0;
- int nr_iter = 100;
+ int nr_iter = 100
, ret = 0
;
useconds_t nr_usec = 0;
char *after_first_event_file_path = NULL;
char *before_last_event_file_path = NULL;
useconds_t nr_usec = 0;
char *after_first_event_file_path = NULL;
char *before_last_event_file_path = NULL;
+ if (set_signal_handler()) {
+ ret = -1;
+ goto end;
+ }
+
if (argc >= 2) {
/*
* If nr_iter is negative, do an infinite tracing loop.
if (argc >= 2) {
/*
* If nr_iter is negative, do an infinite tracing loop.
@@
-127,9
+134,16
@@
int main(int argc, char **argv)
*/
create_file(after_first_event_file_path);
if (nr_usec) {
*/
create_file(after_first_event_file_path);
if (nr_usec) {
- usleep(nr_usec);
+ if (usleep_safe(nr_usec)) {
+ ret = -1;
+ goto end;
+ }
+ }
+ if (should_quit) {
+ break;
}
}
}
}
- return 0;
+end:
+ exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE);
}
}
This page took
0.024942 seconds
and
4
git commands to generate.