License header fixes
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-ust-abi.h
... / ...
CommitLineData
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 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
12 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
13 *
14 * Permission is hereby granted to use or copy this program
15 * for any purpose, provided the above notices are retained on all copies.
16 * Permission to modify the code and to distribute modified code is granted,
17 * provided the above notices are retained, and a notice that the code was
18 * modified is included with the above copyright notice.
19 */
20
21#include <stdint.h>
22
23#define LTTNG_UST_SYM_NAME_LEN 256
24
25#define LTTNG_UST_COMM_VERSION_MAJOR 2
26#define LTTNG_UST_COMM_VERSION_MINOR 0
27
28enum lttng_ust_instrumentation {
29 LTTNG_UST_TRACEPOINT = 0,
30 LTTNG_UST_PROBE = 1,
31 LTTNG_UST_FUNCTION = 2,
32};
33
34enum lttng_ust_loglevel_type {
35 LTTNG_UST_LOGLEVEL_ALL = 0,
36 LTTNG_UST_LOGLEVEL_RANGE = 1,
37 LTTNG_UST_LOGLEVEL_SINGLE = 2,
38};
39
40enum lttng_ust_output {
41 LTTNG_UST_MMAP = 0,
42};
43
44struct lttng_ust_tracer_version {
45 uint32_t major;
46 uint32_t minor;
47 uint32_t patchlevel;
48};
49
50#define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
51struct lttng_ust_channel {
52 int overwrite; /* 1: overwrite, 0: discard */
53 uint64_t subbuf_size; /* in bytes */
54 uint64_t num_subbuf;
55 unsigned int switch_timer_interval; /* usecs */
56 unsigned int read_timer_interval; /* usecs */
57 enum lttng_ust_output output; /* output mode */
58 char padding[LTTNG_UST_CHANNEL_PADDING];
59};
60
61#define LTTNG_UST_STREAM_PADDING1 16
62#define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
63struct lttng_ust_stream {
64 char padding[LTTNG_UST_STREAM_PADDING1];
65
66 union {
67 char padding[LTTNG_UST_STREAM_PADDING2];
68 } u;
69};
70
71#define LTTNG_UST_EVENT_PADDING1 16
72#define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
73struct lttng_ust_event {
74 enum lttng_ust_instrumentation instrumentation;
75 char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
76
77 enum lttng_ust_loglevel_type loglevel_type;
78 int loglevel; /* value, -1: all */
79 char padding[LTTNG_UST_EVENT_PADDING1];
80
81 /* Per instrumentation type configuration */
82 union {
83 char padding[LTTNG_UST_EVENT_PADDING2];
84 } u;
85};
86
87enum lttng_ust_context_type {
88 LTTNG_UST_CONTEXT_VTID = 0,
89 LTTNG_UST_CONTEXT_VPID = 1,
90 LTTNG_UST_CONTEXT_PTHREAD_ID = 2,
91 LTTNG_UST_CONTEXT_PROCNAME = 3,
92};
93
94#define LTTNG_UST_CONTEXT_PADDING1 16
95#define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
96struct lttng_ust_context {
97 enum lttng_ust_context_type ctx;
98 char padding[LTTNG_UST_CONTEXT_PADDING1];
99
100 union {
101 char padding[LTTNG_UST_CONTEXT_PADDING2];
102 } u;
103};
104
105/*
106 * Tracer channel attributes.
107 */
108#define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
109struct lttng_ust_channel_attr {
110 int overwrite; /* 1: overwrite, 0: discard */
111 uint64_t subbuf_size; /* bytes */
112 uint64_t num_subbuf; /* power of 2 */
113 unsigned int switch_timer_interval; /* usec */
114 unsigned int read_timer_interval; /* usec */
115 enum lttng_ust_output output; /* splice, mmap */
116 char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
117};
118
119#define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
120struct lttng_ust_tracepoint_iter {
121 char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */
122 int loglevel;
123 char padding[LTTNG_UST_TRACEPOINT_ITER_PADDING];
124};
125
126#define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
127struct lttng_ust_object_data {
128 int handle;
129 int shm_fd;
130 int wait_fd;
131 uint64_t memory_map_size;
132 char padding[LTTNG_UST_OBJECT_DATA_PADDING];
133};
134
135enum lttng_ust_calibrate_type {
136 LTTNG_UST_CALIBRATE_TRACEPOINT,
137};
138
139#define LTTNG_UST_CALIBRATE_PADDING1 16
140#define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
141struct lttng_ust_calibrate {
142 enum lttng_ust_calibrate_type type; /* type (input) */
143 char padding[LTTNG_UST_CALIBRATE_PADDING1];
144
145 union {
146 char padding[LTTNG_UST_CALIBRATE_PADDING2];
147 } u;
148};
149
150#define _UST_CMD(minor) (minor)
151#define _UST_CMDR(minor, type) (minor)
152#define _UST_CMDW(minor, type) (minor)
153
154/* Handled by object descriptor */
155#define LTTNG_UST_RELEASE _UST_CMD(0x1)
156
157/* Handled by object cmd */
158
159/* LTTng-UST commands */
160#define LTTNG_UST_SESSION _UST_CMD(0x40)
161#define LTTNG_UST_TRACER_VERSION \
162 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
163#define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
164#define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
165#define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
166
167/* Session FD commands */
168#define LTTNG_UST_METADATA \
169 _UST_CMDW(0x50, struct lttng_ust_channel)
170#define LTTNG_UST_CHANNEL \
171 _UST_CMDW(0x51, struct lttng_ust_channel)
172#define LTTNG_UST_SESSION_START _UST_CMD(0x52)
173#define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
174
175/* Channel FD commands */
176#define LTTNG_UST_STREAM _UST_CMD(0x60)
177#define LTTNG_UST_EVENT \
178 _UST_CMDW(0x61, struct lttng_ust_event)
179
180/* Event and Channel FD commands */
181#define LTTNG_UST_CONTEXT \
182 _UST_CMDW(0x70, struct lttng_ust_context)
183#define LTTNG_UST_FLUSH_BUFFER \
184 _UST_CMD(0x71)
185
186/* Event, Channel and Session commands */
187#define LTTNG_UST_ENABLE _UST_CMD(0x80)
188#define LTTNG_UST_DISABLE _UST_CMD(0x81)
189
190/* Tracepoint list commands */
191#define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
192
193#define LTTNG_UST_ROOT_HANDLE 0
194
195struct lttng_ust_obj;
196
197union ust_args {
198 struct {
199 int *shm_fd;
200 int *wait_fd;
201 uint64_t *memory_map_size;
202 } channel;
203 struct {
204 int *shm_fd;
205 int *wait_fd;
206 uint64_t *memory_map_size;
207 } stream;
208};
209
210struct lttng_ust_objd_ops {
211 long (*cmd)(int objd, unsigned int cmd, unsigned long arg,
212 union ust_args *args);
213 int (*release)(int objd);
214};
215
216/* Create root handle. Always ID 0. */
217int lttng_abi_create_root_handle(void);
218
219const struct lttng_ust_objd_ops *objd_ops(int id);
220int lttng_ust_objd_unref(int id);
221
222void lttng_ust_abi_exit(void);
223void lttng_ust_events_exit(void);
224
225#endif /* _LTTNG_UST_ABI_H */
This page took 0.022816 seconds and 4 git commands to generate.