#include <urcu/list.h> /* URCU list library (-lurcu) */
#include <ust/ustctl.h> /* UST control lib (-lust) */
-#include <lttng/liblttngctl.h>
+#include <lttng/lttng.h>
#include "liblttsessiondcomm.h"
#include "ltt-sessiond.h"
lta = find_app_by_pid(pid);
if (lta == NULL) {
/* App not found */
+ DBG("Application pid %d not found", pid);
return -1;
}
return ret;
}
+/*
+ * ust_stop_trace
+ *
+ * Stop a trace. This trace, identified by the pid, must be
+ * in the current session ust_traces list.
+ */
+static int ust_stop_trace(pid_t pid)
+{
+ int sock, ret;
+ struct ltt_ust_trace *trace;
+
+ DBG("Stopping trace for pid %d", pid);
+
+ trace = find_session_ust_trace_by_pid(current_session, pid);
+ if (trace == NULL) {
+ ret = LTTCOMM_NO_TRACE;
+ goto error;
+ }
+
+ /* Connect to app using ustctl API */
+ sock = connect_app(pid);
+ if (sock < 0) {
+ ret = LTTCOMM_NO_TRACEABLE;
+ goto error;
+ }
+
+ ret = ustctl_stop_trace(sock, trace->name);
+ if (ret < 0) {
+ ret = LTTCOMM_STOP_FAIL;
+ goto error;
+ }
+
+error:
+ return ret;
+}
+
/*
* copy_common_data
*
/* No auxiliary data so only send the llm struct. */
goto end;
}
+ case UST_STOP_TRACE:
+ {
+ ret = ust_stop_trace(lsm->pid);
+
+ /* No auxiliary data so only send the llm struct. */
+ goto end;
+ }
case LTTNG_LIST_SESSIONS:
{
unsigned int session_count = get_session_count();
return ret;
end:
+ DBG("Return code to client %d", ret);
/* Notify client of error */
llm.ret_code = ret;
llm.size_payload = 0;