Implement PID tracking for kernel tracing
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index c542179371327b951d71255902b949c789f265fd..21b4cf326bd49e48f0f2a1b2caeee34554578981 100644 (file)
@@ -2766,6 +2766,9 @@ static int create_ust_session(struct ltt_session *session,
        lus->live_timer_interval = session->live_timer;
        session->ust_session = lus;
        if (session->shm_path[0]) {
+               strncpy(lus->root_shm_path, session->shm_path,
+                       sizeof(lus->root_shm_path));
+               lus->root_shm_path[sizeof(lus->root_shm_path) - 1] = '\0';
                strncpy(lus->shm_path, session->shm_path,
                        sizeof(lus->shm_path));
                lus->shm_path[sizeof(lus->shm_path) - 1] = '\0';
@@ -3249,6 +3252,20 @@ skip_domain:
                                &cmd_ctx->lsm->u.channel.chan, kernel_poll_pipe[1]);
                break;
        }
+       case LTTNG_TRACK_PID:
+       {
+               ret = cmd_track_pid(cmd_ctx->session,
+                               cmd_ctx->lsm->domain.type,
+                               cmd_ctx->lsm->u.pid_tracker.pid);
+               break;
+       }
+       case LTTNG_UNTRACK_PID:
+       {
+               ret = cmd_untrack_pid(cmd_ctx->session,
+                               cmd_ctx->lsm->domain.type,
+                               cmd_ctx->lsm->u.pid_tracker.pid);
+               break;
+       }
        case LTTNG_ENABLE_EVENT:
        {
                struct lttng_event_exclusion *exclusion = NULL;
@@ -4609,6 +4626,10 @@ static int set_option(int opt, const char *arg, const char *optname)
                } else {
                        unsigned long v;
 
+                       if (!arg) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
                        errno = 0;
                        v = strtoul(arg, NULL, 0);
                        if (errno != 0 || !isdigit(arg[0])) {
This page took 0.024614 seconds and 4 git commands to generate.