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