88087dff3a1a6d36488310f0135e4eba7e58e76e
[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 "../libmarkers/marker.h"
10 #include "usterr.h"
11 #include "tracer.h"
12 #include "marker-control.h"
13 #include "relay.h"
14
15
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
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
56 int main()
57 {
58 int result;
59 int i;
60
61 init_int_handler();
62
63 printf("Hello, World!\n");
64
65 sleep(1);
66 for(i=0; i<50; i++) {
67 trace_mark(ust, bar, "str %s", "FOOBAZ");
68 trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
69 usleep(100000);
70 }
71
72 scanf("%*s");
73
74 return 0;
75 }
76
77 MARKER_LIB
This page took 0.029865 seconds and 3 git commands to generate.