X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=ltt-sessiond%2Fmain.c;h=150f211fb825a44e1e614a3222744d7edf51a4bc;hp=70ce53c8b1cd50c87e1712bc42a2c2e0ba0f9bd4;hb=520ff6876d5fdf7e5421733a8f2a7d0c20e43c8c;hpb=47b74d6393632d4d793a89d24b0fd600eac602b5 diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 70ce53c8b..150f211fb 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -374,6 +374,42 @@ error: 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 * @@ -564,6 +600,13 @@ static int process_client_msg(int sock, struct lttcomm_session_msg *lsm) /* 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();