Change kernel traces output directory
authorDavid Goulet <david.goulet@polymtl.ca>
Fri, 12 Aug 2011 14:51:32 +0000 (10:51 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Fri, 12 Aug 2011 14:51:32 +0000 (10:51 -0400)
Adds the kernel/ directory level for kernel traces.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/main.c
ltt-sessiond/trace.h

index b1dbc8f97f6fff2b73a961c6a79c1f48e841b1a5..891436fb0ce8576b10033d2d93408d90db1671fe 100644 (file)
@@ -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;
index 3b86160f8f2d73c226f3f16d9586513421e36fcf..591af85730299c8c0832d11ab303236d4aeaed6d 100644 (file)
@@ -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;
 };
This page took 0.039854 seconds and 4 git commands to generate.