| 1 | /* |
| 2 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> |
| 3 | * |
| 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. |
| 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 | * |
| 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. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _LTT_SESSIOND_H |
| 19 | #define _LTT_SESSIOND_H |
| 20 | |
| 21 | #define _LGPL_SOURCE |
| 22 | #include <urcu.h> |
| 23 | #include <urcu/wfqueue.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 | |
| 32 | extern const char default_home_dir[], |
| 33 | default_tracing_group[], |
| 34 | default_ust_sock_dir[], |
| 35 | default_global_apps_pipe[]; |
| 36 | |
| 37 | /* Set in main.c at boot time of the daemon */ |
| 38 | extern int kernel_tracer_fd; |
| 39 | |
| 40 | /* |
| 41 | * This contains extra data needed for processing a command received by the |
| 42 | * session daemon from the lttng client. |
| 43 | */ |
| 44 | struct command_ctx { |
| 45 | int ust_sock; |
| 46 | unsigned int lttng_msg_size; |
| 47 | struct ltt_session *session; |
| 48 | struct lttcomm_lttng_msg *llm; |
| 49 | struct lttcomm_session_msg *lsm; |
| 50 | lttng_sock_cred creds; |
| 51 | }; |
| 52 | |
| 53 | struct ust_command { |
| 54 | int sock; |
| 55 | struct ust_register_msg reg_msg; |
| 56 | struct cds_wfq_node node; |
| 57 | }; |
| 58 | |
| 59 | /* |
| 60 | * Queue used to enqueue UST registration request (ust_commant) and protected |
| 61 | * by a futex with a scheme N wakers / 1 waiters. See futex.c/.h |
| 62 | */ |
| 63 | struct ust_cmd_queue { |
| 64 | int32_t futex; |
| 65 | struct cds_wfq_queue queue; |
| 66 | }; |
| 67 | |
| 68 | /* |
| 69 | * This pipe is used to inform the thread managing application notify |
| 70 | * communication that a command is queued and ready to be processed. |
| 71 | */ |
| 72 | extern int apps_cmd_notify_pipe[2]; |
| 73 | |
| 74 | /* |
| 75 | * Populated when the daemon starts with the current page size of the system. |
| 76 | */ |
| 77 | extern long page_size; |
| 78 | |
| 79 | int sessiond_set_thread_pollset(struct lttng_poll_event *events, size_t size); |
| 80 | int sessiond_check_thread_quit_pipe(int fd, uint32_t events); |
| 81 | |
| 82 | #endif /* _LTT_SESSIOND_H */ |