Contexts for RT debugging
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
index 2cad0b2ab44b8bdd8ece486521e62f6654677e4d..7bc713a35be7935250a0f96a63c480419c840706 100644 (file)
@@ -49,17 +49,24 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
        DBG("Adding context to channel %s", chan->channel->name);
        ret = kernctl_add_context(chan->fd, &ctx->ctx);
        if (ret < 0) {
-               if (errno != EEXIST) {
-                       PERROR("add context ioctl");
-               } else {
+               switch (errno) {
+               case ENOSYS:
+                       /* Exists but not available for this kernel */
+                       ret = LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE;
+                       goto error;
+               case EEXIST:
                        /* If EEXIST, we just ignore the error */
                        ret = 0;
+                       goto end;
+               default:
+                       PERROR("add context ioctl");
+                       ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
+                       goto error;
                }
-               goto error;
        }
 
+end:
        cds_list_add_tail(&ctx->list, &chan->ctx_list);
-
        return 0;
 
 error:
This page took 0.023019 seconds and 4 git commands to generate.