int *sock_error)
{
int ret = LTTNG_OK;
- int need_tracing_session = 1;
- int need_domain;
+ bool need_tracing_session = true;
+ bool need_domain;
+ bool need_consumerd;
DBG("Processing client command %d", cmd_ctx->lsm.cmd_type);
case LTTNG_SET_SESSION_SHM_PATH:
case LTTNG_REGENERATE_METADATA:
case LTTNG_REGENERATE_STATEDUMP:
- case LTTNG_REGISTER_TRIGGER:
- case LTTNG_UNREGISTER_TRIGGER:
case LTTNG_ROTATE_SESSION:
case LTTNG_ROTATION_GET_INFO:
case LTTNG_ROTATION_SET_SCHEDULE:
case LTTNG_SESSION_LIST_ROTATION_SCHEDULES:
case LTTNG_CLEAR_SESSION:
case LTTNG_LIST_TRIGGERS:
- need_domain = 0;
+ need_domain = false;
+ break;
+ default:
+ need_domain = true;
+ }
+
+ /* Needs a functioning consumerd? */
+ switch (cmd_ctx->lsm.cmd_type) {
+ case LTTNG_REGISTER_TRIGGER:
+ case LTTNG_UNREGISTER_TRIGGER:
+ need_consumerd = false;
break;
default:
- need_domain = 1;
+ need_consumerd = true;
+ break;
}
if (config.no_kernel && need_domain
case LTTNG_DATA_PENDING:
case LTTNG_ROTATE_SESSION:
case LTTNG_ROTATION_GET_INFO:
+ case LTTNG_REGISTER_TRIGGER:
case LTTNG_LIST_TRIGGERS:
break;
default:
case LTTNG_REGISTER_TRIGGER:
case LTTNG_UNREGISTER_TRIGGER:
case LTTNG_LIST_TRIGGERS:
- need_tracing_session = 0;
+ need_tracing_session = false;
break;
default:
DBG("Getting session %s by name", cmd_ctx->lsm.session.name);
}
/* Consumer is in an ERROR state. Report back to client */
- if (uatomic_read(&kernel_consumerd_state) == CONSUMER_ERROR) {
+ if (need_consumerd && uatomic_read(&kernel_consumerd_state) ==
+ CONSUMER_ERROR) {
ret = LTTNG_ERR_NO_KERNCONSUMERD;
goto error;
}
ret = LTTNG_ERR_NO_UST;
goto error;
}
+
/* Consumer is in an ERROR state. Report back to client */
- if (uatomic_read(&ust_consumerd_state) == CONSUMER_ERROR) {
+ if (need_consumerd && uatomic_read(&ust_consumerd_state) ==
+ CONSUMER_ERROR) {
ret = LTTNG_ERR_NO_USTCONSUMERD;
goto error;
}
struct lttng_payload message;
struct lttng_payload reply;
struct lttng_trigger *reply_trigger = NULL;
+ enum lttng_domain_type domain_type;
const struct lttng_credentials user_creds = {
.uid = LTTNG_OPTIONAL_INIT_VALUE(geteuid()),
.gid = LTTNG_OPTIONAL_INIT_UNSET,
goto end;
}
+ domain_type = lttng_trigger_get_underlying_domain_type_restriction(
+ trigger);
+
+ lsm.domain.type = domain_type;
+
ret = lttng_dynamic_buffer_append(&message.buffer, &lsm, sizeof(lsm));
if (ret) {
ret = -LTTNG_ERR_NOMEM;