Implement consumer ring buffer position sampling
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-sessiond.h
1 /*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 * Copyright (C) 2013 - Raphaƫl Beamonte <raphael.beamonte@gmail.com>
4 *
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.
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 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.
17 */
18
19 #ifndef _LTT_SESSIOND_H
20 #define _LTT_SESSIOND_H
21
22 #include <urcu.h>
23 #include <urcu/wfcqueue.h>
24
25 #include <common/sessiond-comm/sessiond-comm.h>
26 #include <common/compat/poll.h>
27 #include <common/compat/socket.h>
28
29 #include "session.h"
30 #include "ust-app.h"
31 #include "version.h"
32 #include "notification-thread.h"
33
34 extern const char default_home_dir[],
35 default_tracing_group[],
36 default_ust_sock_dir[],
37 default_global_apps_pipe[];
38
39 /* Set in main.c at boot time of the daemon */
40 extern int kernel_tracer_fd;
41
42 extern struct notification_thread_handle *notification_thread_handle;
43
44 /*
45 * This contains extra data needed for processing a command received by the
46 * session daemon from the lttng client.
47 */
48 struct command_ctx {
49 int ust_sock;
50 unsigned int lttng_msg_size;
51 struct ltt_session *session;
52 struct lttcomm_lttng_msg *llm;
53 struct lttcomm_session_msg *lsm;
54 lttng_sock_cred creds;
55 };
56
57 struct ust_command {
58 int sock;
59 struct ust_register_msg reg_msg;
60 struct cds_wfcq_node node;
61 };
62
63 /*
64 * Queue used to enqueue UST registration request (ust_command) and synchronized
65 * by a futex with a scheme N wakers / 1 waiters. See futex.c/.h
66 */
67 struct ust_cmd_queue {
68 int32_t futex;
69 struct cds_wfcq_head head;
70 struct cds_wfcq_tail tail;
71 };
72
73 /*
74 * This is the wait queue containing wait nodes during the application
75 * registration process.
76 */
77 struct ust_reg_wait_queue {
78 unsigned long count;
79 struct cds_list_head head;
80 };
81
82 /*
83 * Use by the dispatch registration to queue UST command socket to wait for the
84 * notify socket.
85 */
86 struct ust_reg_wait_node {
87 struct ust_app *app;
88 struct cds_list_head head;
89 };
90
91 /*
92 * This pipe is used to inform the thread managing application notify
93 * communication that a command is queued and ready to be processed.
94 */
95 extern int apps_cmd_notify_pipe[2];
96
97 /*
98 * Used to notify that a hash table needs to be destroyed by dedicated
99 * thread. Required by design because we don't want to move destroy
100 * paths outside of large RCU read-side lock paths, and destroy cannot
101 * be called by call_rcu thread, because it may hang (waiting for
102 * call_rcu completion).
103 */
104 extern int ht_cleanup_pipe[2];
105
106 /*
107 * Populated when the daemon starts with the current page size of the system.
108 */
109 extern long page_size;
110
111 /*
112 * Global set once in main(). Agent TCP port for registration.
113 */
114 extern unsigned int agent_tcp_port;
115
116 /* Application health monitoring */
117 extern struct health_app *health_sessiond;
118
119 /*
120 * Section name to look for in the daemon configuration file.
121 */
122 extern const char * const config_section_name;
123
124 /* Is this daemon root or not. */
125 extern int is_root;
126
127 extern const char *tracing_group_name;
128
129 int sessiond_check_thread_quit_pipe(int fd, uint32_t events);
130 int sessiond_set_thread_pollset(struct lttng_poll_event *events, size_t size);
131 void sessiond_notify_ready(void);
132
133 #endif /* _LTT_SESSIOND_H */
This page took 0.04349 seconds and 4 git commands to generate.