Remove application from socket hash table upon unregister
[lttng-tools.git] / lttng-sessiond / lttng-ust-abi.h
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
14 #include <stdint.h>
15
16 #define LTTNG_UST_SYM_NAME_LEN 256
17
18 #define LTTNG_UST_COMM_VERSION_MAJOR 0
19 #define LTTNG_UST_COMM_VERSION_MINOR 1
20
21 enum lttng_ust_instrumentation {
22 LTTNG_UST_TRACEPOINT = 0,
23 LTTNG_UST_PROBE = 1,
24 LTTNG_UST_FUNCTION = 2,
25 LTTNG_UST_TRACEPOINT_LOGLEVEL = 3,
26 };
27
28 enum lttng_ust_output {
29 LTTNG_UST_MMAP = 0,
30 };
31
32 struct lttng_ust_tracer_version {
33 uint32_t version;
34 uint32_t patchlevel;
35 uint32_t sublevel;
36 };
37
38 struct lttng_ust_channel {
39 int overwrite; /* 1: overwrite, 0: discard */
40 uint64_t subbuf_size; /* in bytes */
41 uint64_t num_subbuf;
42 unsigned int switch_timer_interval; /* usecs */
43 unsigned int read_timer_interval; /* usecs */
44 enum lttng_ust_output output; /* output mode */
45 /* The following fields are used internally within UST. */
46 int shm_fd;
47 int wait_fd;
48 uint64_t memory_map_size;
49 };
50
51 /*
52 * This structure is only used internally within UST. It is not per-se
53 * part of the communication between sessiond and UST.
54 */
55 struct lttng_ust_stream {
56 int shm_fd;
57 int wait_fd;
58 uint64_t memory_map_size;
59 };
60
61 struct lttng_ust_event {
62 char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
63 enum lttng_ust_instrumentation instrumentation;
64 /* Per instrumentation type configuration */
65 union {
66 } u;
67 };
68
69 enum lttng_ust_context_type {
70 LTTNG_UST_CONTEXT_VTID = 0,
71 LTTNG_UST_CONTEXT_VPID = 1,
72 LTTNG_UST_CONTEXT_PTHREAD_ID = 2,
73 LTTNG_UST_CONTEXT_PROCNAME = 3,
74 };
75
76 struct lttng_ust_context {
77 enum lttng_ust_context_type ctx;
78 union {
79 } u;
80 };
81
82 /*
83 * Tracer channel attributes.
84 */
85 struct lttng_ust_channel_attr {
86 int overwrite; /* 1: overwrite, 0: discard */
87 uint64_t subbuf_size; /* bytes */
88 uint64_t num_subbuf; /* power of 2 */
89 unsigned int switch_timer_interval; /* usec */
90 unsigned int read_timer_interval; /* usec */
91 enum lttng_ust_output output; /* splice, mmap */
92 };
93
94 struct lttng_ust_tracepoint_iter {
95 char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */
96 char loglevel[LTTNG_UST_SYM_NAME_LEN]; /* loglevel */
97 int64_t loglevel_value;
98 };
99
100 struct lttng_ust_object_data {
101 int handle;
102 int shm_fd;
103 int wait_fd;
104 uint64_t memory_map_size;
105 };
106
107 #define _UST_CMD(minor) (minor)
108 #define _UST_CMDR(minor, type) (minor)
109 #define _UST_CMDW(minor, type) (minor)
110
111 /* Handled by object descriptor */
112 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
113
114 /* Handled by object cmd */
115
116 /* LTTng-UST commands */
117 #define LTTNG_UST_SESSION _UST_CMD(0x40)
118 #define LTTNG_UST_TRACER_VERSION \
119 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
120 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
121 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
122 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
123
124 /* Session FD commands */
125 #define LTTNG_UST_METADATA \
126 _UST_CMDW(0x50, struct lttng_ust_channel)
127 #define LTTNG_UST_CHANNEL \
128 _UST_CMDW(0x51, struct lttng_ust_channel)
129 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
130 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
131
132 /* Channel FD commands */
133 #define LTTNG_UST_STREAM _UST_CMD(0x60)
134 #define LTTNG_UST_EVENT \
135 _UST_CMDW(0x61, struct lttng_ust_event)
136
137 /* Event and Channel FD commands */
138 #define LTTNG_UST_CONTEXT \
139 _UST_CMDW(0x70, struct lttng_ust_context)
140 #define LTTNG_UST_FLUSH_BUFFER \
141 _UST_CMD(0x71)
142
143 /* Event, Channel and Session commands */
144 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
145 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
146
147 /* Tracepoint list commands */
148 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
149
150 #define LTTNG_UST_ROOT_HANDLE 0
151
152 struct lttng_ust_obj;
153
154 struct lttng_ust_objd_ops {
155 long (*cmd)(int objd, unsigned int cmd, unsigned long arg);
156 int (*release)(int objd);
157 };
158
159 /* Create root handle. Always ID 0. */
160 int lttng_abi_create_root_handle(void);
161
162 const struct lttng_ust_objd_ops *objd_ops(int id);
163 int lttng_ust_objd_unref(int id);
164
165 void lttng_ust_abi_exit(void);
166 void lttng_ust_events_exit(void);
167
168 #endif /* _LTTNG_UST_ABI_H */
This page took 0.03173 seconds and 4 git commands to generate.