ABI update: only send loglevel value to UST: fixed loglevels
[lttng-tools.git] / src / bin / lttng-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
00187dd4 22#include <pthread.h>
6df2e2c9 23#include <unistd.h>
20fe2104 24#include <urcu/list.h>
d4a2a84a 25
00187dd4
DG
26#include "trace-kernel.h"
27#include "trace-ust.h"
28
b5541356
DG
29/*
30 * Tracing session list
31 *
32 * Statically declared in session.c and can be accessed by using
54d01ffb 33 * session_get_list() function that returns the pointer to the list.
b5541356 34 */
5b74c7b1 35struct ltt_session_list {
b5541356
DG
36 /*
37 * This lock protects any read/write access to the list and count (which is
38 * basically the list size). All public functions in session.c acquire this
39 * lock and release it before returning. If none of those functions are
40 * used, the lock MUST be acquired in order to iterate or/and do any
41 * actions on that list.
42 */
43 pthread_mutex_t lock;
6c9cc2ab 44
b5541356 45 /*
6c9cc2ab
DG
46 * Number of element in the list. The session list lock MUST be acquired if
47 * this counter is used when iterating over the session list.
b5541356
DG
48 */
49 unsigned int count;
6c9cc2ab
DG
50
51 /* Linked list head */
5b74c7b1
DG
52 struct cds_list_head head;
53};
54
b5541356
DG
55/*
56 * This data structure contains information needed to identify a tracing
57 * session for both LTTng and UST.
5b74c7b1
DG
58 */
59struct ltt_session {
74babd95
DG
60 char name[NAME_MAX];
61 char path[PATH_MAX];
20fe2104 62 struct ltt_kernel_session *kernel_session;
f6a9efaa 63 struct ltt_ust_session *ust_session;
b5541356
DG
64 /*
65 * Protect any read/write on this session data structure. This lock must be
66 * acquired *before* using any public functions declared below. Use
54d01ffb 67 * session_lock() and session_unlock() for that.
b5541356
DG
68 */
69 pthread_mutex_t lock;
70 struct cds_list_head list;
464dd62d 71 int enabled; /* enabled/started flag */
a991f516 72 int id; /* session unique identifier */
6df2e2c9
MD
73 /* UID/GID of the user owning the session */
74 uid_t uid;
75 gid_t gid;
5b74c7b1
DG
76};
77
78/* Prototypes */
6df2e2c9 79int session_create(char *name, char *path, uid_t uid, gid_t gid);
271933a4 80int session_destroy(struct ltt_session *session);
6c9cc2ab 81
54d01ffb
DG
82void session_lock(struct ltt_session *session);
83void session_lock_list(void);
84void session_unlock(struct ltt_session *session);
85void session_unlock_list(void);
6c9cc2ab 86
54d01ffb
DG
87struct ltt_session *session_find_by_name(char *name);
88struct ltt_session_list *session_get_list(void);
5b74c7b1
DG
89
90#endif /* _LTT_SESSION_H */
This page took 0.035872 seconds and 5 git commands to generate.