X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=325ffd2cf14f6ec3e320e402e8db17a6dac71adc;hb=6faa26cafc21ce8d5b8f20ae4d2682092fd74b03;hp=86c3c765c8dfb2173137894a4fceffb156515ce9;hpb=62a0c2d4933fd52b78c896cf40a935e42ea94360;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 86c3c765c..325ffd2cf 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2748,64 +2748,6 @@ int cmd_destroy_session(struct ltt_session *session, int wpipe) return ret; } -/* - * Command LTTNG_CALIBRATE processed by the client thread. - */ -int cmd_calibrate(enum lttng_domain_type domain, - struct lttng_calibrate *calibrate) -{ - int ret; - - switch (domain) { - case LTTNG_DOMAIN_KERNEL: - { - struct lttng_kernel_calibrate kcalibrate; - - switch (calibrate->type) { - case LTTNG_CALIBRATE_FUNCTION: - default: - /* Default and only possible calibrate option. */ - kcalibrate.type = LTTNG_KERNEL_CALIBRATE_KRETPROBE; - break; - } - - ret = kernel_calibrate(kernel_tracer_fd, &kcalibrate); - if (ret < 0) { - ret = LTTNG_ERR_KERN_ENABLE_FAIL; - goto error; - } - break; - } - case LTTNG_DOMAIN_UST: - { - struct lttng_ust_calibrate ucalibrate; - - switch (calibrate->type) { - case LTTNG_CALIBRATE_FUNCTION: - default: - /* Default and only possible calibrate option. */ - ucalibrate.type = LTTNG_UST_CALIBRATE_TRACEPOINT; - break; - } - - ret = ust_app_calibrate_glb(&ucalibrate); - if (ret < 0) { - ret = LTTNG_ERR_UST_CALIBRATE_FAIL; - goto error; - } - break; - } - default: - ret = LTTNG_ERR_UND; - goto error; - } - - ret = LTTNG_OK; - -error: - return ret; -} - /* * Command LTTNG_REGISTER_CONSUMER processed by the client thread. */ @@ -3207,11 +3149,10 @@ int cmd_snapshot_add_output(struct ltt_session *session, DBG("Cmd snapshot add output for session %s", session->name); /* - * Permission denied to create an output if the session is not - * set in no output mode. + * Can't create an output if the session is not set in no-output mode. */ if (session->output_traces) { - ret = LTTNG_ERR_EPERM; + ret = LTTNG_ERR_NOT_SNAPSHOT_SESSION; goto error; } @@ -3275,7 +3216,7 @@ int cmd_snapshot_del_output(struct ltt_session *session, * set in no output mode. */ if (session->output_traces) { - ret = LTTNG_ERR_EPERM; + ret = LTTNG_ERR_NOT_SNAPSHOT_SESSION; goto error; } @@ -3327,19 +3268,19 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, * set in no output mode. */ if (session->output_traces) { - ret = -LTTNG_ERR_EPERM; - goto error; + ret = -LTTNG_ERR_NOT_SNAPSHOT_SESSION; + goto end; } if (session->snapshot.nb_output == 0) { ret = 0; - goto error; + goto end; } list = zmalloc(session->snapshot.nb_output * sizeof(*list)); if (!list) { ret = -LTTNG_ERR_NOMEM; - goto error; + goto end; } /* Copy list from session to the new list object. */ @@ -3352,14 +3293,14 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, if (lttng_strncpy(list[idx].name, output->name, sizeof(list[idx].name))) { ret = -LTTNG_ERR_INVALID; - goto error_unlock; + goto error; } if (output->consumer->type == CONSUMER_DST_LOCAL) { if (lttng_strncpy(list[idx].ctrl_url, output->consumer->dst.trace_path, sizeof(list[idx].ctrl_url))) { ret = -LTTNG_ERR_INVALID; - goto error_unlock; + goto error; } } else { /* Control URI. */ @@ -3367,7 +3308,7 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, list[idx].ctrl_url, sizeof(list[idx].ctrl_url)); if (ret < 0) { ret = -LTTNG_ERR_NOMEM; - goto error_unlock; + goto error; } /* Data URI. */ @@ -3375,7 +3316,7 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, list[idx].data_url, sizeof(list[idx].data_url)); if (ret < 0) { ret = -LTTNG_ERR_NOMEM; - goto error_unlock; + goto error; } } idx++; @@ -3384,10 +3325,10 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session, *outputs = list; list = NULL; ret = session->snapshot.nb_output; -error_unlock: - rcu_read_unlock(); error: + rcu_read_unlock(); free(list); +end: return ret; } @@ -3861,7 +3802,7 @@ int cmd_snapshot_record(struct ltt_session *session, * set in no output mode. */ if (session->output_traces) { - ret = LTTNG_ERR_EPERM; + ret = LTTNG_ERR_NOT_SNAPSHOT_SESSION; goto error; }