Remove localerr.h
[ust.git] / tests / hello / hello.c
... / ...
CommitLineData
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
18void inthandler(int sig)
19{
20 printf("in handler\n");
21 exit(0);
22}
23
24int 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
50int main()
51{
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
77MARKER_LIB;
78TRACEPOINT_LIB;
This page took 0.030414 seconds and 4 git commands to generate.