Modify buildsystem to be able to compile with installed libraries
[lttng-ust.git] / hello / hello.c
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <sys/mman.h>
4 #include <stdarg.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <fcntl.h>
8 #include <signal.h>
9
10 #include "marker.h"
11 #include "usterr.h"
12 #include "tracer.h"
13 #include "marker-control.h"
14 #include "relay.h"
15 #include "tp.h"
16
17
18 void inthandler(int sig)
19 {
20 printf("in handler\n");
21 exit(0);
22 }
23
24 int init_int_handler(void)
25 {
26 int result;
27 struct sigaction act;
28
29 result = sigemptyset(&act.sa_mask);
30 if(result == -1) {
31 PERROR("sigemptyset");
32 return -1;
33 }
34
35 act.sa_handler = inthandler;
36 act.sa_flags = SA_RESTART;
37
38 /* Only defer ourselves. Also, try to restart interrupted
39 * syscalls to disturb the traced program as little as possible.
40 */
41 result = sigaction(SIGINT, &act, NULL);
42 if(result == -1) {
43 PERROR("sigaction");
44 return -1;
45 }
46
47 return 0;
48 }
49
50 int main()
51 {
52 int result;
53 int i;
54
55 init_int_handler();
56
57 printf("Hello, World!\n");
58
59 sleep(1);
60 for(i=0; i<50; i++) {
61 trace_mark(ust, bar, "str %s", "FOOBAZ");
62 trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
63 trace_hello_tptest(i);
64 usleep(100000);
65 }
66
67 scanf("%*s");
68
69 ltt_trace_stop("auto");
70 ltt_trace_destroy("auto");
71
72 DBG("TRACE STOPPED");
73 scanf("%*s");
74
75 return 0;
76 }
77
78 MARKER_LIB;
79 TRACEPOINT_LIB;
This page took 0.032295 seconds and 4 git commands to generate.