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 | |
59b161cd | 9 | #include "../libmarkers/marker.h" |
5f54827b PMF |
10 | #include "usterr.h" |
11 | #include "tracer.h" | |
ba6459ba | 12 | #include "marker-control.h" |
9c67dc50 PMF |
13 | #include "relay.h" |
14 | ||
15 | ||
59b161cd PMF |
16 | |
17 | void probe(const struct marker *mdata, | |
18 | void *probe_private, void *call_private, | |
19 | const char *fmt, va_list *args) | |
20 | { | |
21 | printf("In probe\n"); | |
22 | } | |
23 | ||
8d938dbd PMF |
24 | void inthandler(int sig) |
25 | { | |
26 | printf("in handler\n"); | |
27 | exit(0); | |
28 | } | |
29 | ||
30 | int init_int_handler(void) | |
31 | { | |
32 | int result; | |
33 | struct sigaction act; | |
34 | ||
35 | result = sigemptyset(&act.sa_mask); | |
36 | if(result == -1) { | |
37 | PERROR("sigemptyset"); | |
38 | return -1; | |
39 | } | |
40 | ||
41 | act.sa_handler = inthandler; | |
42 | act.sa_flags = SA_RESTART; | |
43 | ||
44 | /* Only defer ourselves. Also, try to restart interrupted | |
45 | * syscalls to disturb the traced program as little as possible. | |
46 | */ | |
47 | result = sigaction(SIGINT, &act, NULL); | |
48 | if(result == -1) { | |
49 | PERROR("sigaction"); | |
50 | return -1; | |
51 | } | |
52 | ||
53 | return 0; | |
54 | } | |
55 | ||
5f54827b | 56 | int main() |
b6bf28ec | 57 | { |
5f54827b | 58 | int result; |
98963de4 | 59 | int i; |
5f54827b | 60 | |
8d938dbd PMF |
61 | init_int_handler(); |
62 | ||
68c1021b | 63 | printf("Hello, World!\n"); |
59b161cd | 64 | |
9c67dc50 | 65 | sleep(1); |
d0b5f2b9 | 66 | for(i=0; i<5000; i++) { |
20b37a31 PMF |
67 | trace_mark(ust, bar, "str %s", "FOOBAZ"); |
68 | trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800); | |
9c67dc50 | 69 | usleep(100000); |
8d938dbd | 70 | } |
59b161cd | 71 | |
68c1021b PMF |
72 | scanf("%*s"); |
73 | ||
74 | return 0; | |
75 | } | |
c463904d PMF |
76 | |
77 | MARKER_LIB |