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