X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=7bc713a35be7935250a0f96a63c480419c840706;hp=2cad0b2ab44b8bdd8ece486521e62f6654677e4d;hb=1ae5e83e58569f50b38fde0afe3f2aa08010f354;hpb=512eb1488340c4c3c0c29e6cde9d489e858fdd6c diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index 2cad0b2ab..7bc713a35 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -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: