Fix: remove unused event types in MI XML schema
[lttng-tools.git] / tests / utils / testapp / gen-ust-events / gen-ust-events.c
index 11327d5f4b6866d7c324b50223181897ccf8e862..c5dd31a355e1294229529a4ff20c3a3026bf8347 100644 (file)
@@ -15,7 +15,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#define _GNU_SOURCE
 #define _LGPL_SOURCE
 #include <assert.h>
 #include <arpa/inet.h>
@@ -32,6 +31,8 @@
 #include <signal.h>
 #include <poll.h>
 #include <errno.h>
+#include "utils.h"
+#include "signal-helper.h"
 
 #define TRACEPOINT_DEFINE
 #include "tp.h"
@@ -85,11 +86,16 @@ int main(int argc, char **argv)
        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;
 
+       if (set_signal_handler()) {
+               ret = -1;
+               goto end;
+       }
+
        if (argc >= 2) {
                /*
                 * If nr_iter is negative, do an infinite tracing loop.
@@ -127,8 +133,17 @@ int main(int argc, char **argv)
                 * that at least one tracepoint has been hit.
                 */
                create_file(after_first_event_file_path);
-               usleep(nr_usec);
+               if (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.025767 seconds and 5 git commands to generate.