Add the sessiond notification-handling subsystem
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-sessiond.h
CommitLineData
8c0faa1d
DG
1/*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
88564da0 3 * Copyright (C) 2013 - Raphaël Beamonte <raphael.beamonte@gmail.com>
fac6795d 4 *
d14d33bf
AM
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2 only,
7 * as published by the Free Software Foundation.
8c0faa1d 8 *
fac6795d
DG
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d14d33bf 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fac6795d 12 * GNU General Public License for more details.
8c0faa1d 13 *
d14d33bf
AM
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
fac6795d
DG
17 */
18
19#ifndef _LTT_SESSIOND_H
20#define _LTT_SESSIOND_H
21
f6a9efaa 22#include <urcu.h>
8bdee6e2 23#include <urcu/wfcqueue.h>
099e26bd 24
10a8a223 25#include <common/sessiond-comm/sessiond-comm.h>
d0b96690 26#include <common/compat/poll.h>
730389d9 27#include <common/compat/socket.h>
10a8a223
DG
28
29#include "session.h"
56fff090 30#include "ust-app.h"
88564da0 31#include "version.h"
099e26bd 32
686204ab
MD
33extern const char default_home_dir[],
34 default_tracing_group[],
35 default_ust_sock_dir[],
36 default_global_apps_pipe[];
fac6795d 37
2f77fc4b
DG
38/* Set in main.c at boot time of the daemon */
39extern int kernel_tracer_fd;
40
5461b305
DG
41/*
42 * This contains extra data needed for processing a command received by the
43 * session daemon from the lttng client.
44 */
45struct command_ctx {
46 int ust_sock;
47 unsigned int lttng_msg_size;
48 struct ltt_session *session;
49 struct lttcomm_lttng_msg *llm;
50 struct lttcomm_session_msg *lsm;
730389d9 51 lttng_sock_cred creds;
5461b305
DG
52};
53
099e26bd
DG
54struct ust_command {
55 int sock;
56 struct ust_register_msg reg_msg;
8bdee6e2 57 struct cds_wfcq_node node;
099e26bd
DG
58};
59
60/*
7a44d6f1 61 * Queue used to enqueue UST registration request (ust_command) and synchronized
099e26bd
DG
62 * by a futex with a scheme N wakers / 1 waiters. See futex.c/.h
63 */
64struct ust_cmd_queue {
65 int32_t futex;
8bdee6e2
SM
66 struct cds_wfcq_head head;
67 struct cds_wfcq_tail tail;
099e26bd
DG
68};
69
f45e313d
DG
70/*
71 * This is the wait queue containing wait nodes during the application
72 * registration process.
73 */
74struct ust_reg_wait_queue {
75 unsigned long count;
76 struct cds_list_head head;
77};
78
79/*
80 * Use by the dispatch registration to queue UST command socket to wait for the
81 * notify socket.
82 */
83struct ust_reg_wait_node {
84 struct ust_app *app;
85 struct cds_list_head head;
86};
87
d0b96690
DG
88/*
89 * This pipe is used to inform the thread managing application notify
90 * communication that a command is queued and ready to be processed.
91 */
92extern int apps_cmd_notify_pipe[2];
93
0b2dc8df
MD
94/*
95 * Used to notify that a hash table needs to be destroyed by dedicated
96 * thread. Required by design because we don't want to move destroy
97 * paths outside of large RCU read-side lock paths, and destroy cannot
98 * be called by call_rcu thread, because it may hang (waiting for
99 * call_rcu completion).
100 */
101extern int ht_cleanup_pipe[2];
102
12744796
DG
103/*
104 * Populated when the daemon starts with the current page size of the system.
105 */
106extern long page_size;
107
4d076222 108/*
022d91ba 109 * Global set once in main(). Agent TCP port for registration.
4d076222 110 */
022d91ba 111extern unsigned int agent_tcp_port;
4d076222 112
5e97de00
JG
113/* Application health monitoring */
114extern struct health_app *health_sessiond;
115
26296c48
JG
116/*
117 * Section name to look for in the daemon configuration file.
118 */
119extern const char * const config_section_name;
120
f43f95a9
DG
121/* Is this daemon root or not. */
122extern int is_root;
123
d0b96690 124int sessiond_check_thread_quit_pipe(int fd, uint32_t events);
5e97de00 125int sessiond_set_thread_pollset(struct lttng_poll_event *events, size_t size);
ef367a93
JG
126void sessiond_notify_ready(void);
127
fac6795d 128#endif /* _LTT_SESSIOND_H */
This page took 0.066839 seconds and 5 git commands to generate.