Add configure LTTNG_TOOLS_COMPAT_BIN_PREFIX env var support
[lttng-tools.git] / lttng-sessiond / trace-kernel.h
1 /*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef _LTT_TRACE_KERNEL_H
20 #define _LTT_TRACE_KERNEL_H
21
22 #include <limits.h>
23 #include <urcu/list.h>
24
25 #include <lttng/lttng.h>
26 #include <lttng-kernel.h>
27
28 /* Kernel event list */
29 struct ltt_kernel_event_list {
30 struct cds_list_head head;
31 };
32
33 /* Channel stream list */
34 struct ltt_kernel_stream_list {
35 struct cds_list_head head;
36 };
37
38 /* Channel list */
39 struct ltt_kernel_channel_list {
40 struct cds_list_head head;
41 };
42
43 /* Kernel event */
44 struct ltt_kernel_event {
45 int fd;
46 int enabled;
47 /*
48 * TODO: need internal representation to support more than a
49 * single context.
50 */
51 struct lttng_kernel_context *ctx;
52 struct lttng_kernel_event *event;
53 struct cds_list_head list;
54 };
55
56 /* Kernel channel */
57 struct ltt_kernel_channel {
58 int fd;
59 int enabled;
60 char *pathname;
61 unsigned int stream_count;
62 unsigned int event_count;
63 /*
64 * TODO: need internal representation to support more than a
65 * single context.
66 */
67 struct lttng_kernel_context *ctx;
68 struct lttng_channel *channel;
69 struct ltt_kernel_event_list events_list;
70 struct ltt_kernel_stream_list stream_list;
71 struct cds_list_head list;
72 };
73
74 /* Metadata */
75 struct ltt_kernel_metadata {
76 int fd;
77 char *pathname;
78 struct lttng_channel *conf;
79 };
80
81 /* Channel stream */
82 struct ltt_kernel_stream {
83 int fd;
84 char *pathname;
85 int state;
86 struct cds_list_head list;
87 };
88
89 /* Kernel session */
90 struct ltt_kernel_session {
91 int fd;
92 int metadata_stream_fd;
93 int consumer_fds_sent;
94 int consumer_fd;
95 unsigned int channel_count;
96 unsigned int stream_count_global;
97 char *trace_path;
98 struct ltt_kernel_metadata *metadata;
99 struct ltt_kernel_channel_list channel_list;
100 };
101
102 /*
103 * Lookup functions. NULL is returned if not found.
104 */
105 struct ltt_kernel_event *trace_kernel_get_event_by_name(
106 char *name, struct ltt_kernel_channel *channel);
107 struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
108 char *name, struct ltt_kernel_session *session);
109
110 /*
111 * Create functions malloc() the data structure.
112 */
113 struct ltt_kernel_session *trace_kernel_create_session(char *path);
114 struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *chan, char *path);
115 struct ltt_kernel_event *trace_kernel_create_event(struct lttng_event *ev);
116 struct ltt_kernel_metadata *trace_kernel_create_metadata(char *path);
117 struct ltt_kernel_stream *trace_kernel_create_stream(void);
118
119 /*
120 * Destroy functions free() the data structure and remove from linked list if
121 * it's applies.
122 */
123 void trace_kernel_destroy_session(struct ltt_kernel_session *session);
124 void trace_kernel_destroy_metadata(struct ltt_kernel_metadata *metadata);
125 void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel);
126 void trace_kernel_destroy_event(struct ltt_kernel_event *event);
127 void trace_kernel_destroy_stream(struct ltt_kernel_stream *stream);
128
129 #endif /* _LTT_TRACE_KERNEL_H */
This page took 0.040818 seconds and 4 git commands to generate.