From: David Goulet Date: Fri, 12 Aug 2011 14:51:32 +0000 (-0400) Subject: Change kernel traces output directory X-Git-Tag: v2.0-pre11~6 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=63053e7cec6930a85d4d4c7ac851a1c554179c8a Change kernel traces output directory Adds the kernel/ directory level for kernel traces. Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index b1dbc8f97..891436fb0 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -1245,8 +1245,15 @@ static int create_kernel_session(struct ltt_session *session) goto error; } - ret = mkdir_recursive(session->path, S_IRWXU | S_IRWXG, - geteuid(), allowed_group()); + ret = asprintf(&session->kernel_session->trace_path, "%s/kernel", + session->path); + if (ret < 0) { + perror("asprintf kernel traces path"); + goto error; + } + + ret = mkdir_recursive(session->kernel_session->trace_path, + S_IRWXU | S_IRWXG, geteuid(), allowed_group()); if (ret < 0) { if (ret != -EEXIST) { ERR("Trace directory creation error"); @@ -1360,7 +1367,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) DBG("Processing client command %d", cmd_ctx->lsm->cmd_type); - /* Listing commands don't need a session */ + /* + * Commands that DO NOT need a session. + */ switch (cmd_ctx->lsm->cmd_type) { case LTTNG_CREATE_SESSION: case LTTNG_LIST_SESSIONS: @@ -1609,7 +1618,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx) DBG("Creating kernel channel"); ret = kernel_create_channel(cmd_ctx->session->kernel_session, - &cmd_ctx->lsm->u.channel.chan, cmd_ctx->session->path); + &cmd_ctx->lsm->u.channel.chan, + cmd_ctx->session->kernel_session->trace_path); if (ret < 0) { ret = LTTCOMM_KERN_CHAN_FAIL; goto error; @@ -1672,7 +1682,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx) } ret = kernel_create_channel(cmd_ctx->session->kernel_session, - chan, cmd_ctx->session->path); + chan, cmd_ctx->session->kernel_session->trace_path); if (ret < 0) { ret = LTTCOMM_KERN_CHAN_FAIL; goto error; @@ -1744,7 +1754,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx) } ret = kernel_create_channel(cmd_ctx->session->kernel_session, - chan, cmd_ctx->session->path); + chan, cmd_ctx->session->kernel_session->trace_path); if (ret < 0) { ret = LTTCOMM_KERN_CHAN_FAIL; goto error; @@ -1849,7 +1859,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx) if (cmd_ctx->session->kernel_session->metadata == NULL) { DBG("Open kernel metadata"); ret = kernel_open_metadata(cmd_ctx->session->kernel_session, - cmd_ctx->session->path); + cmd_ctx->session->kernel_session->trace_path); if (ret < 0) { ret = LTTCOMM_KERN_META_FAIL; goto error; diff --git a/ltt-sessiond/trace.h b/ltt-sessiond/trace.h index 3b86160f8..591af8573 100644 --- a/ltt-sessiond/trace.h +++ b/ltt-sessiond/trace.h @@ -86,6 +86,7 @@ struct ltt_kernel_session { int kconsumer_fds_sent; unsigned int channel_count; unsigned int stream_count_global; + char *trace_path; struct ltt_kernel_metadata *metadata; struct ltt_kernel_channel_list channel_list; };