Commit | Line | Data |
---|---|---|
9f3fdbc6 MD |
1 | #ifndef _LTTNG_UST_ABI_H |
2 | #define _LTTNG_UST_ABI_H | |
3 | ||
4 | /* | |
5 | * lttng-ust-abi.h | |
6 | * | |
7 | * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
8 | * | |
9 | * LTTng-UST ABI header | |
10 | * | |
11 | * Dual LGPL v2.1/GPL v2 license. | |
12 | */ | |
13 | ||
0a42beb6 MD |
14 | #include <stdint.h> |
15 | ||
9f3fdbc6 MD |
16 | #define LTTNG_UST_SYM_NAME_LEN 128 |
17 | ||
b35d179d MD |
18 | #define LTTNG_UST_COMM_VERSION_MAJOR 0 |
19 | #define LTTNG_UST_COMM_VERSION_MINOR 1 | |
20 | ||
9f3fdbc6 MD |
21 | enum lttng_ust_instrumentation { |
22 | LTTNG_UST_TRACEPOINT = 0, | |
b35d179d MD |
23 | LTTNG_UST_PROBE = 1, |
24 | LTTNG_UST_FUNCTION = 2, | |
9f3fdbc6 MD |
25 | }; |
26 | ||
9f3fdbc6 | 27 | enum lttng_ust_output { |
b35d179d | 28 | LTTNG_UST_MMAP = 0, |
9f3fdbc6 MD |
29 | }; |
30 | ||
b35d179d MD |
31 | struct lttng_ust_tracer_version { |
32 | uint32_t version; | |
33 | uint32_t patchlevel; | |
34 | uint32_t sublevel; | |
35 | }; | |
9f3fdbc6 MD |
36 | |
37 | struct lttng_ust_channel { | |
38 | int overwrite; /* 1: overwrite, 0: discard */ | |
39 | uint64_t subbuf_size; /* in bytes */ | |
40 | uint64_t num_subbuf; | |
41 | unsigned int switch_timer_interval; /* usecs */ | |
42 | unsigned int read_timer_interval; /* usecs */ | |
b35d179d | 43 | enum lttng_ust_output output; /* output mode */ |
193183fb MD |
44 | /* The following fields are used internally within UST. */ |
45 | int shm_fd; | |
46 | int wait_fd; | |
47 | uint64_t memory_map_size; | |
9f3fdbc6 MD |
48 | }; |
49 | ||
381c0f1e MD |
50 | /* |
51 | * This structure is only used internally within UST. It is not per-se | |
52 | * part of the communication between sessiond and UST. | |
53 | */ | |
54 | struct lttng_ust_stream { | |
55 | int shm_fd; | |
56 | int wait_fd; | |
57 | uint64_t memory_map_size; | |
58 | }; | |
59 | ||
9f3fdbc6 MD |
60 | struct lttng_ust_event { |
61 | char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ | |
62 | enum lttng_ust_instrumentation instrumentation; | |
63 | /* Per instrumentation type configuration */ | |
64 | union { | |
65 | } u; | |
66 | }; | |
67 | ||
9f3fdbc6 | 68 | enum lttng_ust_context_type { |
3b402b40 | 69 | LTTNG_UST_CONTEXT_VTID = 0, |
c1ef86f0 MD |
70 | LTTNG_UST_CONTEXT_VPID = 1, |
71 | LTTNG_UST_CONTEXT_PTHREAD_ID = 2, | |
4847e9bb | 72 | LTTNG_UST_CONTEXT_PROCNAME = 3, |
9f3fdbc6 MD |
73 | }; |
74 | ||
75 | struct lttng_ust_context { | |
76 | enum lttng_ust_context_type ctx; | |
77 | union { | |
78 | } u; | |
79 | }; | |
80 | ||
92462b01 MD |
81 | /* |
82 | * Tracer channel attributes. | |
83 | */ | |
84 | struct lttng_ust_channel_attr { | |
85 | int overwrite; /* 1: overwrite, 0: discard */ | |
86 | uint64_t subbuf_size; /* bytes */ | |
87 | uint64_t num_subbuf; /* power of 2 */ | |
88 | unsigned int switch_timer_interval; /* usec */ | |
89 | unsigned int read_timer_interval; /* usec */ | |
90 | enum lttng_ust_output output; /* splice, mmap */ | |
91 | }; | |
92 | ||
93 | struct lttng_ust_object_data { | |
94 | int handle; | |
95 | int shm_fd; | |
96 | int wait_fd; | |
97 | uint64_t memory_map_size; | |
98 | }; | |
99 | ||
9f3fdbc6 MD |
100 | #define _UST_CMD(minor) (minor) |
101 | #define _UST_CMDR(minor, type) (minor) | |
102 | #define _UST_CMDW(minor, type) (minor) | |
103 | ||
46050b1a MD |
104 | /* Handled by object descriptor */ |
105 | #define LTTNG_UST_RELEASE _UST_CMD(0x1) | |
106 | ||
107 | /* Handled by object cmd */ | |
108 | ||
9f3fdbc6 MD |
109 | /* LTTng-UST commands */ |
110 | #define LTTNG_UST_SESSION _UST_CMD(0x40) | |
111 | #define LTTNG_UST_TRACER_VERSION \ | |
112 | _UST_CMDR(0x41, struct lttng_ust_tracer_version) | |
113 | #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42) | |
114 | #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43) | |
11ff9c7d | 115 | #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44) |
9f3fdbc6 | 116 | |
46050b1a | 117 | /* Session FD commands */ |
9f3fdbc6 MD |
118 | #define LTTNG_UST_METADATA \ |
119 | _UST_CMDW(0x50, struct lttng_ust_channel) | |
120 | #define LTTNG_UST_CHANNEL \ | |
121 | _UST_CMDW(0x51, struct lttng_ust_channel) | |
122 | #define LTTNG_UST_SESSION_START _UST_CMD(0x52) | |
123 | #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53) | |
124 | ||
46050b1a | 125 | /* Channel FD commands */ |
9f3fdbc6 MD |
126 | #define LTTNG_UST_STREAM _UST_CMD(0x60) |
127 | #define LTTNG_UST_EVENT \ | |
128 | _UST_CMDW(0x61, struct lttng_ust_event) | |
129 | ||
46050b1a | 130 | /* Event and Channel FD commands */ |
9f3fdbc6 MD |
131 | #define LTTNG_UST_CONTEXT \ |
132 | _UST_CMDW(0x70, struct lttng_ust_context) | |
43d330a4 | 133 | #define LTTNG_UST_FLUSH_BUFFER \ |
43861eab | 134 | _UST_CMD(0x71) |
9f3fdbc6 | 135 | |
46050b1a | 136 | /* Event, Channel and Session commands */ |
9f3fdbc6 MD |
137 | #define LTTNG_UST_ENABLE _UST_CMD(0x80) |
138 | #define LTTNG_UST_DISABLE _UST_CMD(0x81) | |
139 | ||
46050b1a MD |
140 | #define LTTNG_UST_ROOT_HANDLE 0 |
141 | ||
142 | struct obj; | |
143 | ||
144 | struct objd_ops { | |
145 | long (*cmd)(int objd, unsigned int cmd, unsigned long arg); | |
146 | int (*release)(int objd); | |
147 | }; | |
148 | ||
149 | /* Create root handle. Always ID 0. */ | |
150 | int lttng_abi_create_root_handle(void); | |
151 | ||
152 | const struct objd_ops *objd_ops(int id); | |
1ea11eab | 153 | int objd_unref(int id); |
46050b1a MD |
154 | |
155 | void lttng_ust_abi_exit(void); | |
1ea11eab | 156 | void ltt_events_exit(void); |
b35d179d | 157 | |
9f3fdbc6 | 158 | #endif /* _LTTNG_UST_ABI_H */ |