lttng-sessiond: do not call ustctl_register_done()
[lttng-tools.git] / lttng-sessiond / trace-kernel.h
CommitLineData
fda89c9b
DG
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
82a3637f
DG
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
fda89c9b
DG
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
62499ad6
DG
19#ifndef _LTT_TRACE_KERNEL_H
20#define _LTT_TRACE_KERNEL_H
fda89c9b 21
9e78d6ae
DG
22#include <limits.h>
23#include <urcu/list.h>
d4a2a84a 24
f3ed775e 25#include <lttng/lttng.h>
1e307fab 26#include <lttng-kernel.h>
54012638 27
20fe2104
DG
28/* Kernel event list */
29struct ltt_kernel_event_list {
30 struct cds_list_head head;
31};
32
8c0faa1d
DG
33/* Channel stream list */
34struct ltt_kernel_stream_list {
35 struct cds_list_head head;
36};
37
38/* Channel list */
39struct ltt_kernel_channel_list {
40 struct cds_list_head head;
41};
42
20fe2104
DG
43/* Kernel event */
44struct ltt_kernel_event {
20fe2104 45 int fd;
e953ef25 46 int enabled;
2bdd86d4
MD
47 /*
48 * TODO: need internal representation to support more than a
49 * single context.
50 */
d65106b1 51 struct lttng_kernel_context *ctx;
f34daff7 52 struct lttng_kernel_event *event;
20fe2104
DG
53 struct cds_list_head list;
54};
55
56/* Kernel channel */
57struct ltt_kernel_channel {
58 int fd;
d36b8583 59 int enabled;
8c0faa1d
DG
60 char *pathname;
61 unsigned int stream_count;
cbbbb275 62 unsigned int event_count;
2bdd86d4
MD
63 /*
64 * TODO: need internal representation to support more than a
65 * single context.
66 */
d65106b1 67 struct lttng_kernel_context *ctx;
f3ed775e 68 struct lttng_channel *channel;
20fe2104 69 struct ltt_kernel_event_list events_list;
8c0faa1d
DG
70 struct ltt_kernel_stream_list stream_list;
71 struct cds_list_head list;
20fe2104
DG
72};
73
aaf26714
DG
74/* Metadata */
75struct ltt_kernel_metadata {
76 int fd;
8c0faa1d 77 char *pathname;
f3ed775e 78 struct lttng_channel *conf;
aaf26714
DG
79};
80
8c0faa1d
DG
81/* Channel stream */
82struct ltt_kernel_stream {
83 int fd;
84 char *pathname;
85 int state;
86 struct cds_list_head list;
87};
88
20fe2104
DG
89/* Kernel session */
90struct ltt_kernel_session {
91 int fd;
8c0faa1d 92 int metadata_stream_fd;
3bd1e081 93 int consumer_fds_sent;
d9800920 94 int consumer_fd;
8c0faa1d
DG
95 unsigned int channel_count;
96 unsigned int stream_count_global;
63053e7c 97 char *trace_path;
aaf26714 98 struct ltt_kernel_metadata *metadata;
8c0faa1d 99 struct ltt_kernel_channel_list channel_list;
6df2e2c9
MD
100 /* UID/GID of the user owning the session */
101 uid_t uid;
102 gid_t gid;
fda89c9b
DG
103};
104
62499ad6
DG
105/*
106 * Lookup functions. NULL is returned if not found.
107 */
108struct ltt_kernel_event *trace_kernel_get_event_by_name(
19e70852 109 char *name, struct ltt_kernel_channel *channel);
62499ad6 110struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
19e70852
DG
111 char *name, struct ltt_kernel_session *session);
112
54012638 113/*
c363b55d 114 * Create functions malloc() the data structure.
54012638 115 */
f9815039 116struct ltt_kernel_session *trace_kernel_create_session(char *path);
62499ad6
DG
117struct ltt_kernel_channel *trace_kernel_create_channel(struct lttng_channel *chan, char *path);
118struct ltt_kernel_event *trace_kernel_create_event(struct lttng_event *ev);
119struct ltt_kernel_metadata *trace_kernel_create_metadata(char *path);
120struct ltt_kernel_stream *trace_kernel_create_stream(void);
54012638 121
c363b55d
DG
122/*
123 * Destroy functions free() the data structure and remove from linked list if
124 * it's applies.
125 */
62499ad6
DG
126void trace_kernel_destroy_session(struct ltt_kernel_session *session);
127void trace_kernel_destroy_metadata(struct ltt_kernel_metadata *metadata);
128void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel);
129void trace_kernel_destroy_event(struct ltt_kernel_event *event);
130void trace_kernel_destroy_stream(struct ltt_kernel_stream *stream);
c363b55d 131
62499ad6 132#endif /* _LTT_TRACE_KERNEL_H */
This page took 0.031118 seconds and 4 git commands to generate.