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