+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",
+ [ LTTNG_UST_EXCLUSION ] = "Add exclusions to event",
+};
+
+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);
+
+/*
+ * Returns the HOME directory path. Caller MUST NOT free(3) the returned
+ * pointer.
+ */
+static
+const char *get_lttng_home_dir(void)
+{
+ const char *val;
+
+ val = (const char *) getenv("LTTNG_HOME");
+ if (val != NULL) {
+ return val;
+ }
+ return (const char *) getenv("HOME");
+}