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;
goto error;
}
+ if (ret == LTTNG_OK && attr->attr.output != LTTNG_EVENT_MMAP) {
+ session->has_non_mmap_channel = true;
+ }
error:
rcu_read_unlock();
end:
/* Flag session that trace should start automatically */
if (usess) {
- /*
- * Even though the start trace might fail, flag this session active so
- * other application coming in are started by default.
- */
- usess->active = 1;
-
ret = ust_app_start_trace_all(usess);
if (ret < 0) {
ret = LTTNG_ERR_UST_START_FAIL;
}
if (usess && usess->active) {
- /*
- * Even though the stop trace might fail, flag this session inactive so
- * other application coming in are not started by default.
- */
- usess->active = 0;
-
ret = ust_app_stop_trace_all(usess);
if (ret < 0) {
ret = LTTNG_ERR_UST_STOP_FAIL;
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;
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;
}
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;
}
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;