projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Initial import of kconsumerd and libkernelctl
[lttng-tools.git]
/
ltt-sessiond
/
trace.c
diff --git
a/ltt-sessiond/trace.c
b/ltt-sessiond/trace.c
index 92f8d48ce141960902cba89e1b939de2fab48b5b..9a3c95956439e08a462b8e1e21f25ed050359a08 100644
(file)
--- a/
ltt-sessiond/trace.c
+++ b/
ltt-sessiond/trace.c
@@
-29,6
+29,7
@@
#include "lttngerr.h"
#include "trace.h"
#include "session.h"
#include "lttngerr.h"
#include "trace.h"
#include "session.h"
+#include "ltt-sessiond.h"
static struct ltt_ust_trace *find_session_ust_trace_by_pid(
struct ltt_session *session, pid_t pid);
static struct ltt_ust_trace *find_session_ust_trace_by_pid(
struct ltt_session *session, pid_t pid);
@@
-111,12
+112,12
@@
void get_traces_per_session(struct ltt_session *session, struct lttng_trace *tra
* This trace is then appended to the current session
* ust trace list.
*/
* This trace is then appended to the current session
* ust trace list.
*/
-int ust_create_trace(
int sock, pid_t pid
)
+int ust_create_trace(
struct command_ctx *cmd_ctx
)
{
int ret;
struct ltt_ust_trace *trace;
{
int ret;
struct ltt_ust_trace *trace;
- DBG("Creating trace for pid %d", pid);
+ DBG("Creating trace for pid %d",
cmd_ctx->lsm->
pid);
trace = malloc(sizeof(struct ltt_ust_trace));
if (trace == NULL) {
trace = malloc(sizeof(struct ltt_ust_trace));
if (trace == NULL) {
@@
-126,7
+127,7
@@
int ust_create_trace(int sock, pid_t pid)
}
/* Init */
}
/* Init */
- trace->pid = pid;
+ trace->pid =
cmd_ctx->lsm->
pid;
trace->shmid = 0;
/* NOTE: to be removed. Trace name will no longer be
* required for LTTng userspace tracer. For now, we set it
trace->shmid = 0;
/* NOTE: to be removed. Trace name will no longer be
* required for LTTng userspace tracer. For now, we set it
@@
-134,18
+135,19
@@
int ust_create_trace(int sock, pid_t pid)
*/
snprintf(trace->name, 5, "auto");
*/
snprintf(trace->name, 5, "auto");
- ret = ustctl_create_trace(sock, trace->name);
+ ret = ustctl_create_trace(
cmd_ctx->ust_
sock, trace->name);
if (ret < 0) {
ret = LTTCOMM_CREATE_FAIL;
if (ret < 0) {
ret = LTTCOMM_CREATE_FAIL;
- goto error;
+ goto error
_create
;
}
/* Check if current session is valid */
}
/* Check if current session is valid */
- if (c
urrent_
session) {
- cds_list_add(&trace->list, &c
urrent_
session->ust_traces);
- c
urrent_
session->ust_trace_count++;
+ if (c
md_ctx->
session) {
+ cds_list_add(&trace->list, &c
md_ctx->
session->ust_traces);
+ c
md_ctx->
session->ust_trace_count++;
}
}
- return 0;
+
+ return LTTCOMM_OK;
error_create:
free(trace);
error_create:
free(trace);
@@
-159,25
+161,27
@@
error:
* Start a trace. This trace, identified by the pid, must be
* in the current session ust_traces list.
*/
* Start a trace. This trace, identified by the pid, must be
* in the current session ust_traces list.
*/
-int ust_start_trace(
int sock, pid_t pid
)
+int ust_start_trace(
struct command_ctx *cmd_ctx
)
{
int ret;
struct ltt_ust_trace *trace;
{
int ret;
struct ltt_ust_trace *trace;
- DBG("Starting trace for pid %d", pid);
+ DBG("Starting trace for pid %d",
cmd_ctx->lsm->
pid);
- trace = find_session_ust_trace_by_pid(c
urrent_session,
pid);
+ trace = find_session_ust_trace_by_pid(c
md_ctx->session, cmd_ctx->lsm->
pid);
if (trace == NULL) {
ret = LTTCOMM_NO_TRACE;
goto error;
}
if (trace == NULL) {
ret = LTTCOMM_NO_TRACE;
goto error;
}
- ret = ustctl_start_trace(sock, "auto");
+ ret = ustctl_start_trace(
cmd_ctx->ust_
sock, "auto");
if (ret < 0) {
ret = LTTCOMM_START_FAIL;
goto error;
}
if (ret < 0) {
ret = LTTCOMM_START_FAIL;
goto error;
}
+ ret = LTTCOMM_OK;
+
error:
return ret;
}
error:
return ret;
}
@@
-188,25
+192,27
@@
error:
* Stop a trace. This trace, identified by the pid, must be
* in the current session ust_traces list.
*/
* Stop a trace. This trace, identified by the pid, must be
* in the current session ust_traces list.
*/
-int ust_stop_trace(
int sock, pid_t pid
)
+int ust_stop_trace(
struct command_ctx *cmd_ctx
)
{
int ret;
struct ltt_ust_trace *trace;
{
int ret;
struct ltt_ust_trace *trace;
- DBG("Stopping trace for pid %d", pid);
+ DBG("Stopping trace for pid %d",
cmd_ctx->lsm->
pid);
- trace = find_session_ust_trace_by_pid(c
urrent_session,
pid);
+ trace = find_session_ust_trace_by_pid(c
md_ctx->session, cmd_ctx->lsm->
pid);
if (trace == NULL) {
ret = LTTCOMM_NO_TRACE;
goto error;
}
if (trace == NULL) {
ret = LTTCOMM_NO_TRACE;
goto error;
}
- ret = ustctl_stop_trace(sock, trace->name);
+ ret = ustctl_stop_trace(
cmd_ctx->ust_
sock, trace->name);
if (ret < 0) {
ret = LTTCOMM_STOP_FAIL;
goto error;
}
if (ret < 0) {
ret = LTTCOMM_STOP_FAIL;
goto error;
}
+ ret = LTTCOMM_OK;
+
error:
return ret;
}
error:
return ret;
}
This page took
0.026017 seconds
and
4
git commands to generate.