+static const char *cmd_name_mapping[] = {
+ [ LTTNG_UST_RELEASE ] = "Release",
+ [ LTTNG_UST_SESSION ] = "Create Session",
+ [ LTTNG_UST_TRACER_VERSION ] = "Get Tracer Version",
+
+ [ LTTNG_UST_TRACEPOINT_LIST ] = "Create Tracepoint List",
+ [ LTTNG_UST_WAIT_QUIESCENT ] = "Wait for Quiescent State",
+ [ LTTNG_UST_REGISTER_DONE ] = "Registration Done",
+ [ LTTNG_UST_TRACEPOINT_FIELD_LIST ] = "Create Tracepoint Field List",
+
+ /* Session FD commands */
+ [ LTTNG_UST_CHANNEL ] = "Create Channel",
+ [ LTTNG_UST_SESSION_START ] = "Start Session",
+ [ LTTNG_UST_SESSION_STOP ] = "Stop Session",
+
+ /* Channel FD commands */
+ [ LTTNG_UST_STREAM ] = "Create Stream",
+ [ LTTNG_UST_EVENT ] = "Create Event",
+
+ /* Event and Channel FD commands */
+ [ LTTNG_UST_CONTEXT ] = "Create Context",
+ [ LTTNG_UST_FLUSH_BUFFER ] = "Flush Buffer",
+
+ /* Event, Channel and Session commands */
+ [ LTTNG_UST_ENABLE ] = "Enable",
+ [ LTTNG_UST_DISABLE ] = "Disable",
+
+ /* Tracepoint list commands */
+ [ LTTNG_UST_TRACEPOINT_LIST_GET ] = "List Next Tracepoint",
+ [ LTTNG_UST_TRACEPOINT_FIELD_LIST_GET ] = "List Next Tracepoint Field",
+
+ /* Event FD commands */
+ [ LTTNG_UST_FILTER ] = "Create Filter",
+};
+
+static const char *str_timeout;
+static int got_timeout_env;
+
+extern void lttng_ring_buffer_client_overwrite_init(void);
+extern void lttng_ring_buffer_client_overwrite_rt_init(void);
+extern void lttng_ring_buffer_client_discard_init(void);
+extern void lttng_ring_buffer_client_discard_rt_init(void);
+extern void lttng_ring_buffer_metadata_client_init(void);
+extern void lttng_ring_buffer_client_overwrite_exit(void);
+extern void lttng_ring_buffer_client_overwrite_rt_exit(void);
+extern void lttng_ring_buffer_client_discard_exit(void);
+extern void lttng_ring_buffer_client_discard_rt_exit(void);
+extern void lttng_ring_buffer_metadata_client_exit(void);
+
+/*
+ * Force a read (imply TLS fixup for dlopen) of TLS variables.
+ */
+static
+void lttng_fixup_nest_count_tls(void)
+{
+ asm volatile ("" : : "m" (URCU_TLS(lttng_ust_nest_count)));
+}
+
+int lttng_get_notify_socket(void *owner)
+{
+ struct sock_info *info = owner;
+
+ return info->notify_socket;
+}
+
+static
+void print_cmd(int cmd, int handle)
+{
+ const char *cmd_name = "Unknown";
+
+ if (cmd >= 0 && cmd < LTTNG_ARRAY_SIZE(cmd_name_mapping)
+ && cmd_name_mapping[cmd]) {
+ cmd_name = cmd_name_mapping[cmd];
+ }
+ DBG("Message Received \"%s\" (%d), Handle \"%s\" (%d)",
+ cmd_name, cmd,
+ lttng_ust_obj_get_name(handle), handle);
+}