2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 * Copyright (C) 2013 - Raphaƫl Beamonte <raphael.beamonte@gmail.com>
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.
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.
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.
19 #ifndef _LTT_SESSIOND_H
20 #define _LTT_SESSIOND_H
23 #include <urcu/wfcqueue.h>
25 #include <common/sessiond-comm/sessiond-comm.h>
26 #include <common/compat/poll.h>
27 #include <common/compat/socket.h>
31 #include "notification-thread.h"
32 #include "sessiond-config.h"
34 extern const char default_home_dir
[],
35 default_tracing_group
[],
36 default_ust_sock_dir
[],
37 default_global_apps_pipe
[];
39 /* Set in main.c at boot time of the daemon */
40 extern int kernel_tracer_fd
;
42 /* Notification thread handle. */
43 extern struct notification_thread_handle
*notification_thread_handle
;
46 * This contains extra data needed for processing a command received by the
47 * session daemon from the lttng client.
51 unsigned int lttng_msg_size
;
52 struct ltt_session
*session
;
53 struct lttcomm_lttng_msg
*llm
;
54 struct lttcomm_session_msg
*lsm
;
55 lttng_sock_cred creds
;
60 struct ust_register_msg reg_msg
;
61 struct cds_wfcq_node node
;
65 * Queue used to enqueue UST registration request (ust_command) and synchronized
66 * by a futex with a scheme N wakers / 1 waiters. See futex.c/.h
68 struct ust_cmd_queue
{
70 struct cds_wfcq_head head
;
71 struct cds_wfcq_tail tail
;
75 * This is the wait queue containing wait nodes during the application
76 * registration process.
78 struct ust_reg_wait_queue
{
80 struct cds_list_head head
;
84 * Use by the dispatch registration to queue UST command socket to wait for the
87 struct ust_reg_wait_node
{
89 struct cds_list_head head
;
93 * This pipe is used to inform the thread managing application notify
94 * communication that a command is queued and ready to be processed.
96 extern int apps_cmd_notify_pipe
[2];
99 * Used to notify that a hash table needs to be destroyed by dedicated
100 * thread. Required by design because we don't want to move destroy
101 * paths outside of large RCU read-side lock paths, and destroy cannot
102 * be called by call_rcu thread, because it may hang (waiting for
103 * call_rcu completion).
105 extern int ht_cleanup_pipe
[2];
107 extern int kernel_poll_pipe
[2];
110 * Populated when the daemon starts with the current page size of the system.
111 * Set in main() with the current page size.
113 extern long page_size
;
115 /* Application health monitoring */
116 extern struct health_app
*health_sessiond
;
118 extern struct sessiond_config config
;
120 extern int lttng_sessiond_ready
;
122 extern int ust_consumerd64_fd
, ust_consumerd32_fd
;
124 /* Parent PID for --sig-parent option */
126 /* Internal parent PID use with daemonize. */
127 extern pid_t child_ppid
;
129 int sessiond_init_thread_quit_pipe(void);
130 int sessiond_check_thread_quit_pipe(int fd
, uint32_t events
);
131 int sessiond_wait_for_quit_pipe(unsigned int timeout_us
);
132 int sessiond_notify_quit_pipe(void);
133 void sessiond_close_quit_pipe(void);
135 int sessiond_set_thread_pollset(struct lttng_poll_event
*events
, size_t size
);
136 void sessiond_notify_ready(void);
137 void sessiond_signal_parents(void);
139 void sessiond_set_client_thread_state(bool running
);
140 void sessiond_wait_client_thread_stopped(void);
142 #endif /* _LTT_SESSIOND_H */