Cleanup: work-around missing inet.h struct mmsghdr fwd declaration
[lttng-ust.git] / tests / hello / hello.c
index 03d07b675e8e99107ec12c78bd6a5de1f4ef9815..68c137ee304d043489c673713e1f2ab98d80cd58 100644 (file)
 #include <fcntl.h>
 #include <signal.h>
 #include <string.h>
+/*
+ * Work-around inet.h missing struct mmsghdr forward declaration, with
+ * triggers a warning when system files warnings are enabled.
+ */
+struct mmsghdr;
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdbool.h>
 
+#define TRACEPOINT_DEFINE
 #include "ust_tests_hello.h"
 
 void inthandler(int sig)
 {
        printf("in SIGUSR1 handler\n");
-       tracepoint(ust_tests_hello_tptest_sighandler);
+       tracepoint(ust_tests_hellotptest_sighandler);
 }
 
 int init_int_handler(void)
@@ -64,23 +73,30 @@ int init_int_handler(void)
 
 int main(int argc, char **argv)
 {
-       int i;
+       int i, netint;
        long values[] = { 1, 2, 3 };
        char text[10] = "test";
        double dbl = 2.0;
        float flt = 2222.0;
+       int delay = 0;
+       bool mybool = 123;      /* should print "1" */
 
        init_int_handler();
 
-       printf("Hello, World!\n");
+       if (argc == 2)
+               delay = atoi(argv[1]);
+
+       fprintf(stderr, "Hello, World!\n");
 
-       sleep(10);
+       sleep(delay);
 
-       //for (i = 0; i < 50; i++) {
+       fprintf(stderr, "Tracing... ");
        for (i = 0; i < 1000000; i++) {
-               tracepoint(ust_tests_hello_tptest, i, values,
-                          text, strlen(text), dbl, flt);
+               netint = htonl(i);
+               tracepoint(ust_tests_hello, tptest, i, netint, values,
+                          text, strlen(text), dbl, flt, mybool);
                //usleep(100000);
        }
+       fprintf(stderr, " done.\n");
        return 0;
 }
This page took 0.038701 seconds and 5 git commands to generate.