#include "liblttsessiondcomm.h"
#include "lttngerr.h"
+#include "lttng-share.h"
/* Socket to session daemon for communication */
static int sessiond_socket;
goto end;
}
- size = llm.trace_name_offset + llm.data_size;
+ size = llm.data_size;
if (size == 0) {
goto end;
}
}
/*
- * BEGIN KERNEL CONTROL
- */
-
-/*
- * lttng_kernel_enable_event
+ * lttng_start_tracing
*
- * Enable an event in the kernel tracer.
+ * Start tracing for all trace of the session.
*/
-int lttng_kernel_enable_event(char *event_name)
+int lttng_start_tracing(char *session_name)
{
- strncpy(lsm.u.event.event_name, event_name, NAME_MAX);
- return ask_sessiond(KERNEL_ENABLE_EVENT, NULL);
+ strncpy(lsm.session_name, session_name, NAME_MAX);
+ return ask_sessiond(LTTNG_START_TRACE, NULL);
}
/*
- * lttng_kernel_disable_event
+ * lttng_stop_tracing
*
- * Disable an event in the kernel tracer.
+ * Stop tracing for all trace of the session.
*/
-int lttng_kernel_disable_event(char *event_name)
+int lttng_stop_tracing(char *session_name)
{
- strncpy(lsm.u.event.event_name, event_name, NAME_MAX);
- return ask_sessiond(KERNEL_DISABLE_EVENT, NULL);
+ strncpy(lsm.session_name, session_name, NAME_MAX);
+ return ask_sessiond(LTTNG_STOP_TRACE, NULL);
}
/*
- * lttng_kernel_create_session
- *
- * Create a session in the kernel tracer.
+ * BEGIN Kernel control API
+ */
+
+/*
+ * lttng_kernel_enable_event
*/
-int lttng_kernel_create_session(void)
+int lttng_kernel_enable_event(struct lttng_event *ev, char *channel_name)
{
- return ask_sessiond(KERNEL_CREATE_SESSION, NULL);
+ int ret;
+
+ if (strlen(channel_name) == 0) {
+ strncpy(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME, NAME_MAX);
+ } else {
+ strncpy(lsm.u.enable.channel_name, channel_name, NAME_MAX);
+ }
+
+ if (ev == NULL) {
+ ret = ask_sessiond(LTTNG_KERNEL_ENABLE_ALL_EVENT, NULL);
+ } else {
+ memcpy(&lsm.u.enable.event, ev, sizeof(struct lttng_event));
+ ret = ask_sessiond(LTTNG_KERNEL_ENABLE_EVENT, NULL);
+ }
+
+ return ret;
}
/*
- * lttng_kernel_create_channel
+ * lttng_kernel_disable_event
*
- * Create a channel in the kernel tracer.
+ * Disable an event in the kernel tracer.
*/
-int lttng_kernel_create_channel(void)
+int lttng_kernel_disable_event(char *name, char *channel_name)
{
- return ask_sessiond(KERNEL_CREATE_CHANNEL, NULL);
+ int ret;
+
+ if (strlen(channel_name) == 0) {
+ strncpy(lsm.u.disable.channel_name, DEFAULT_CHANNEL_NAME, NAME_MAX);
+ } else {
+ strncpy(lsm.u.disable.channel_name, channel_name, NAME_MAX);
+ }
+
+ if (name == NULL) {
+ ret = ask_sessiond(LTTNG_KERNEL_DISABLE_ALL_EVENT, NULL);
+ } else {
+ strncpy(lsm.u.disable.name, name, NAME_MAX);
+ ret = ask_sessiond(LTTNG_KERNEL_DISABLE_EVENT, NULL);
+ }
+
+ return ret;
}
/*
- * lttng_kernel_open_metadata
+ * lttng_kernel_enable_channel
*
- * Open metadata in the kernel tracer.
+ * Enable recording for a channel for the kernel tracer.
*/
-int lttng_kernel_open_metadata(void)
+int lttng_kernel_enable_channel(char *name)
{
- return ask_sessiond(KERNEL_OPEN_METADATA, NULL);
+ strncpy(lsm.u.enable.channel_name, name, NAME_MAX);
+ return ask_sessiond(LTTNG_KERNEL_ENABLE_CHANNEL, NULL);
}
/*
- * lttng_kernel_create_stream
+ * lttng_kernel_disable_channel
*
- * Create stream in the kernel tracer.
+ * Disable recording for the channel for the kernel tracer.
*/
-int lttng_kernel_create_stream(void)
+int lttng_kernel_disable_channel(char *name)
{
- return ask_sessiond(KERNEL_CREATE_STREAM, NULL);
+ return ask_sessiond(LTTNG_KERNEL_DISABLE_CHANNEL, NULL);
}
/*
- * lttng_kernel_start_tracing
+ * lttng_kernel_create_channel
*
- * Start kernel tracing.
+ * Create a channel in the kernel tracer.
*/
-int lttng_kernel_start_tracing(void)
+int lttng_kernel_create_channel(struct lttng_channel *chan)
{
- return ask_sessiond(KERNEL_START_TRACE, NULL);
+ memcpy(&lsm.u.channel.chan, chan, sizeof(struct lttng_channel));
+ return ask_sessiond(LTTNG_KERNEL_CREATE_CHANNEL, NULL);
}
/*
- * lttng_kernel_stop_tracing
+ * lttng_list_events
*
- * Stop kernel tracing.
+ * List all available events in the kernel.
+ *
+ * Return the size (bytes) of the list and set the event_list array.
+ * On error, return negative value.
*/
-int lttng_kernel_stop_tracing(void)
+int lttng_kernel_list_events(char **event_list)
{
- return ask_sessiond(KERNEL_STOP_TRACE, NULL);
+ return ask_sessiond(LTTNG_KERNEL_LIST_EVENTS, (void **) event_list);
}
/*
- * END KERNEL CONTROL
+ * END Kernel control API
*/
/*
return lttcomm_get_readable_code(code);
}
-/*
- * lttng_ust_start_trace
- *
- * Request a trace start for pid.
- */
-int lttng_ust_start_trace(pid_t pid)
-{
- lsm.pid = pid;
- return ask_sessiond(UST_START_TRACE, NULL);
-}
-
-/*
- * lttng_ust_stop_trace
- *
- * Request a trace stop for pid.
- */
-int lttng_ust_stop_trace(pid_t pid)
-{
- lsm.pid = pid;
- return ask_sessiond(UST_STOP_TRACE, NULL);
-}
-
-/*
- * lttng_ust_create_trace
- *
- * Request a trace creation for pid.
- */
-int lttng_ust_create_trace(pid_t pid)
-{
- lsm.pid = pid;
- return ask_sessiond(UST_CREATE_TRACE, NULL);
-}
-
/*
* lttng_ust_list_apps
*
* Return the number of pids.
* On error, return negative value.
*/
-int lttng_ust_list_apps(pid_t **pids)
+int lttng_ust_list_traceable_apps(pid_t **pids)
{
int ret;
- ret = ask_sessiond(UST_LIST_APPS, (void**) pids);
+ ret = ask_sessiond(LTTNG_LIST_TRACEABLE_APPS, (void**) pids);
if (ret < 0) {
return ret;
}
* lttng_list_traces
*
* Ask the session daemon for all traces (kernel and ust) for the session
- * identified by uuid.
+ * identified by name.
*
* Return the number of traces.
* On error, return negative value.
*/
-int lttng_list_traces(uuid_t *uuid, struct lttng_trace **traces)
+/*
+int lttng_list_traces(char *session_name, struct lttng_trace **traces)
{
int ret;
- uuid_copy(lsm.session_uuid, *uuid);
+ strncpy(lsm.session_name, session_name, NAME_MAX);
ret = ask_sessiond(LTTNG_LIST_TRACES, (void **) traces);
if (ret < 0) {
return ret / sizeof(struct lttng_trace);
}
+*/
/*
* lttng_create_session
*
* Create a brand new session using name.
*/
-int lttng_create_session(char *name)
+int lttng_create_session(char *name, char *path)
{
strncpy(lsm.session_name, name, NAME_MAX);
+ strncpy(lsm.path, path, PATH_MAX);
return ask_sessiond(LTTNG_CREATE_SESSION, NULL);
}
*
* Destroy session using name.
*/
-int lttng_destroy_session(uuid_t *uuid)
+int lttng_destroy_session(char *name)
{
- uuid_copy(lsm.session_uuid, *uuid);
+ strncpy(lsm.session_name, name, NAME_MAX);
return ask_sessiond(LTTNG_DESTROY_SESSION, NULL);
}
return ret;
}
-/*
- * lttng_set_current_session_uuid
- *
- * Set the session uuid for current lsm.
- */
-void lttng_set_current_session_uuid(uuid_t *uuid)
+void lttng_set_session_name(char *name)
{
- uuid_copy(lsm.session_uuid, *uuid);
+ strncpy(lsm.session_name, name, NAME_MAX);
}
/*