X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=9cbadc6dde53fd16afde8b7a31cd6c4b15ac39cf;hp=d3c8376be1a01cf691f4a02be1ffe93c09c4a6b0;hb=3b33e9e731f2091e8aa13ea035c295ed6f101eac;hpb=bb2452c85ee39c793838f637f830620b0603dc7d diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index d3c8376be..9cbadc6dd 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1523,6 +1523,11 @@ int cmd_enable_channel(struct ltt_session *session, kchan = trace_kernel_get_channel_by_name(attr->name, session->kernel_session); if (kchan == NULL) { + if (session->snapshot.nb_output > 0 || + session->snapshot_mode) { + /* Enforce mmap output for snapshot sessions. */ + attr->attr.output = LTTNG_EVENT_MMAP; + } ret = channel_kernel_create(session->kernel_session, attr, wpipe); if (attr->name[0] != '\0') { session->kernel_session->has_non_default_channel = 1; @@ -1591,6 +1596,9 @@ int cmd_enable_channel(struct ltt_session *session, goto error; } + if (ret == LTTNG_OK && attr->attr.output != LTTNG_EVENT_MMAP) { + session->has_non_mmap_channel = true; + } error: rcu_read_unlock(); end: @@ -3548,6 +3556,11 @@ int cmd_snapshot_add_output(struct ltt_session *session, goto error; } + if (session->has_non_mmap_channel) { + ret = LTTNG_ERR_SNAPSHOT_UNSUPPORTED; + goto error; + } + /* Only one output is allowed until we have the "tee" feature. */ if (session->snapshot.nb_output == 1) { ret = LTTNG_ERR_SNAPSHOT_OUTPUT_EXIST; @@ -4179,10 +4192,13 @@ static enum lttng_error_code record_ust_snapshot(struct ltt_ust_session *usess, goto error_snapshot; } + goto end; + error_snapshot: /* Clean up copied sockets so this output can use some other later on. */ consumer_destroy_output_sockets(output->consumer); error: +end: return status; } @@ -4496,8 +4512,7 @@ int cmd_rotate_session(struct ltt_session *session, goto end; } - if (session->live_timer || session->snapshot_mode || - !session->output_traces) { + if (session->live_timer || !session->output_traces) { cmd_ret = LTTNG_ERR_ROTATION_NOT_AVAILABLE; goto end; } @@ -4846,8 +4861,7 @@ int cmd_rotation_set_schedule(struct ltt_session *session, DBG("Cmd rotate set schedule session %s", session->name); - if (session->live_timer || session->snapshot_mode || - !session->output_traces) { + if (session->live_timer || !session->output_traces) { DBG("Failing ROTATION_SET_SCHEDULE command as the rotation feature is not available for this session"); ret = LTTNG_ERR_ROTATION_NOT_AVAILABLE; goto end;