This source file includes following definitions.
- zalloc
1
2 #ifndef __TRACE_AGENT_H__
3 #define __TRACE_AGENT_H__
4 #include <pthread.h>
5 #include <stdbool.h>
6
7 #define MAX_CPUS 256
8 #define PIPE_INIT (1024*1024)
9
10
11
12
13
14
15
16
17
18 struct agent_info {
19 unsigned long pipe_size;
20 bool use_stdout;
21 int cpus;
22 int ctl_fd;
23 struct rw_thread_info *rw_ti[MAX_CPUS];
24 };
25
26
27
28
29
30
31
32
33
34
35 struct rw_thread_info {
36 int cpu_num;
37 int in_fd;
38 int out_fd;
39 int read_pipe;
40 int write_pipe;
41 unsigned long pipe_size;
42 };
43
44
45 extern bool global_sig_receive;
46
47
48 extern bool global_run_operation;
49 extern pthread_mutex_t mutex_notify;
50 extern pthread_cond_t cond_wakeup;
51
52
53 extern int rw_ctl_init(const char *ctl_path);
54 extern void *rw_ctl_loop(int ctl_fd);
55
56
57 extern void *rw_thread_info_new(void);
58 extern void *rw_thread_init(int cpu, const char *in_path, const char *out_path,
59 bool stdout_flag, unsigned long pipe_size,
60 struct rw_thread_info *rw_ti);
61 extern pthread_t rw_thread_run(struct rw_thread_info *rw_ti);
62
63 static inline void *zalloc(size_t size)
64 {
65 return calloc(1, size);
66 }
67
68 #define pr_err(format, ...) fprintf(stderr, format, ## __VA_ARGS__)
69 #define pr_info(format, ...) fprintf(stdout, format, ## __VA_ARGS__)
70 #ifdef DEBUG
71 #define pr_debug(format, ...) fprintf(stderr, format, ## __VA_ARGS__)
72 #else
73 #define pr_debug(format, ...) do {} while (0)
74 #endif
75
76 #endif