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