Commit | Line | Data |
---|---|---|
68c1021b PMF |
1 | #include <stdio.h> |
2 | #include <unistd.h> | |
b6bf28ec | 3 | #include <sys/mman.h> |
9c67dc50 PMF |
4 | #include <stdarg.h> |
5 | #include <sys/types.h> | |
6 | #include <sys/stat.h> | |
7 | #include <fcntl.h> | |
68c1021b | 8 | |
1f8b0dff | 9 | #include "marker.h" |
5f54827b PMF |
10 | #include "usterr.h" |
11 | #include "tracer.h" | |
ba6459ba | 12 | #include "marker-control.h" |
9c67dc50 | 13 | #include "relay.h" |
474d745f | 14 | #include "tp.h" |
9c67dc50 | 15 | |
59b161cd | 16 | |
8d938dbd PMF |
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 | ||
5f54827b | 49 | int main() |
b6bf28ec | 50 | { |
5f54827b | 51 | int result; |
98963de4 | 52 | int i; |
5f54827b | 53 | |
8d938dbd PMF |
54 | init_int_handler(); |
55 | ||
68c1021b | 56 | printf("Hello, World!\n"); |
59b161cd | 57 | |
9c67dc50 | 58 | sleep(1); |
688760ef | 59 | for(i=0; i<50; i++) { |
20b37a31 PMF |
60 | trace_mark(ust, bar, "str %s", "FOOBAZ"); |
61 | trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800); | |
474d745f | 62 | trace_hello_tptest(i); |
9c67dc50 | 63 | usleep(100000); |
8d938dbd | 64 | } |
59b161cd | 65 | |
68c1021b PMF |
66 | scanf("%*s"); |
67 | ||
688760ef PMF |
68 | ltt_trace_stop("auto"); |
69 | ltt_trace_destroy("auto"); | |
70 | ||
71 | DBG("TRACE STOPPED"); | |
72 | scanf("%*s"); | |
73 | ||
68c1021b PMF |
74 | return 0; |
75 | } | |
c463904d | 76 | |
1f8b0dff PMF |
77 | MARKER_LIB; |
78 | TRACEPOINT_LIB; |