Update authors
[lttng-tools.git] / ltt-sessiond / session.h
CommitLineData
91d76f53 1/*
5b74c7b1
DG
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.
5b74c7b1
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
19#ifndef _LTT_SESSION_H
20#define _LTT_SESSION_H
21
6c9cc2ab 22//#include <lttng/lttng.h>
20fe2104 23#include <urcu/list.h>
d4a2a84a 24
b5541356
DG
25/*
26 * Tracing session list
27 *
28 * Statically declared in session.c and can be accessed by using
29 * get_session_list() function that returns the pointer to the list.
30 */
5b74c7b1 31struct ltt_session_list {
b5541356
DG
32 /*
33 * This lock protects any read/write access to the list and count (which is
34 * basically the list size). All public functions in session.c acquire this
35 * lock and release it before returning. If none of those functions are
36 * used, the lock MUST be acquired in order to iterate or/and do any
37 * actions on that list.
38 */
39 pthread_mutex_t lock;
6c9cc2ab 40
b5541356 41 /*
6c9cc2ab
DG
42 * Number of element in the list. The session list lock MUST be acquired if
43 * this counter is used when iterating over the session list.
b5541356
DG
44 */
45 unsigned int count;
6c9cc2ab
DG
46
47 /* Linked list head */
5b74c7b1
DG
48 struct cds_list_head head;
49};
50
b5541356
DG
51/*
52 * This data structure contains information needed to identify a tracing
53 * session for both LTTng and UST.
5b74c7b1
DG
54 */
55struct ltt_session {
20fe2104 56 char *name;
f3ed775e 57 char *path;
20fe2104 58 struct ltt_kernel_session *kernel_session;
b5541356 59 struct cds_list_head ust_traces;
1657e9bb 60 unsigned int ust_trace_count;
b5541356
DG
61 /*
62 * Protect any read/write on this session data structure. This lock must be
63 * acquired *before* using any public functions declared below. Use
64 * lock_session() and unlock_session() for that.
65 */
66 pthread_mutex_t lock;
67 struct cds_list_head list;
5b74c7b1
DG
68};
69
70/* Prototypes */
f3ed775e
DG
71int create_session(char *name, char *path);
72int destroy_session(char *name);
6c9cc2ab 73
b5541356 74void lock_session(struct ltt_session *session);
6c9cc2ab 75void lock_session_list(void);
b5541356 76void unlock_session(struct ltt_session *session);
6c9cc2ab
DG
77void unlock_session_list(void);
78
5b74c7b1 79struct ltt_session *find_session_by_name(char *name);
8c0faa1d 80struct ltt_session_list *get_session_list(void);
5b74c7b1
DG
81
82#endif /* _LTT_SESSION_H */
This page took 0.027261 seconds and 4 git commands to generate.