switch (consumer_data->type) {
case LTTNG_CONSUMER_KERNEL:
/*
- * Find out which consumerd to execute. We will first
- * try the 64-bit path, then the 32-bit one, then
- * fallback on sessiond's installation directory.
+ * Find out which consumerd to execute. We will
+ * first try the 64-bit path, then the
+ * sessiond's installation directory, and
+ * fallback on the 32-bit one,
*/
if (stat(consumerd64_bin, &st) == 0) {
consumer_to_use = consumerd64_bin;
- } else if (stat(consumerd32_bin, &st) == 0) {
- consumer_to_use = consumerd32_bin;
} else if (stat(INSTALL_BIN_PATH "/" CONSUMERD_FILE, &st) == 0) {
consumer_to_use = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
+ } else if (stat(consumerd32_bin, &st) == 0) {
+ consumer_to_use = consumerd32_bin;
} else {
break;
}
tmp[i].type = LTTNG_EVENT_FUNCTION;
break;
case LTTNG_UST_TRACEPOINT_LOGLEVEL:
- /* TODO */
- ret = -LTTCOMM_NOT_IMPLEMENTED;
- goto error;
+ tmp[i].type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
break;
}
i++;
}
case LTTNG_DOMAIN_UST:
{
- struct ltt_ust_session *usess;
struct ltt_ust_channel *uchan;
- struct ltt_ust_event *uevent;
+ struct ltt_ust_session *usess;
usess = session->ust_session;
goto error;
}
- uevent = trace_ust_find_event_by_name(uchan->events, event_name);
- if (uevent == NULL) {
- ret = LTTCOMM_UST_EVENT_NOT_FOUND;
- goto error;
- }
-
- ret = ust_app_disable_event_glb(usess, uchan, uevent);
- if (ret < 0) {
- ret = LTTCOMM_UST_DISABLE_FAIL;
+ ret = event_ust_disable_tracepoint(usess, domain, uchan, event_name);
+ if (ret != LTTCOMM_OK) {
goto error;
}
- uevent->enabled = 0;
-
- DBG2("Disable UST event %s in channel %s completed", event_name,
+ DBG3("Disable UST event %s in channel %s completed", event_name,
channel_name);
-
break;
}
case LTTNG_DOMAIN_UST_EXEC_NAME:
goto error;
}
- ret = ust_app_disable_all_event_glb(usess, uchan);
- if (ret < 0) {
- ret = LTTCOMM_UST_DISABLE_FAIL;
+ ret = event_ust_disable_all_tracepoints(usess, domain, uchan);
+ if (ret != 0) {
goto error;
}
- DBG2("Disable all UST event in channel %s completed", channel_name);
+ DBG3("Disable all UST events in channel %s completed", channel_name);
break;
}
/*
* Command LTTNG_ENABLE_EVENT processed by the client thread.
+ *
+ * TODO: currently, both events and loglevels are kept within the same
+ * namespace for UST global registry/app registery, so if an event
+ * happen to have the same name as the loglevel (very unlikely though),
+ * and an attempt is made to enable/disable both in the same session,
+ * the first to be created will be the only one allowed to exist.
*/
static int cmd_enable_event(struct ltt_session *session, int domain,
char *channel_name, struct lttng_event *event)
}
switch (event_type) {
- case LTTNG_KERNEL_SYSCALL:
+ case LTTNG_EVENT_SYSCALL:
ret = event_kernel_enable_all_syscalls(session->kernel_session,
kchan, kernel_tracer_fd);
break;
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_EVENT_TRACEPOINT:
/*
* This call enables all LTTNG_KERNEL_TRACEPOINTS and
* events already registered to the channel.
ret = event_kernel_enable_all_tracepoints(session->kernel_session,
kchan, kernel_tracer_fd);
break;
- case LTTNG_KERNEL_ALL:
+ case LTTNG_EVENT_ALL:
/* Enable syscalls and tracepoints */
ret = event_kernel_enable_all(session->kernel_session,
kchan, kernel_tracer_fd);
kernel_wait_quiescent(kernel_tracer_fd);
break;
+ case LTTNG_DOMAIN_UST:
+ {
+ struct lttng_channel *attr;
+ struct ltt_ust_channel *uchan;
+ struct ltt_ust_session *usess = session->ust_session;
+
+ /* Get channel from global UST domain */
+ uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
+ channel_name);
+ if (uchan == NULL) {
+ /* Create default channel */
+ attr = channel_new_default_attr(domain);
+ if (attr == NULL) {
+ ret = LTTCOMM_FATAL;
+ goto error;
+ }
+ snprintf(attr->name, NAME_MAX, "%s", channel_name);
+ attr->name[NAME_MAX - 1] = '\0';
+
+ /* Use the internal command enable channel */
+ ret = cmd_enable_channel(session, domain, attr);
+ if (ret != LTTCOMM_OK) {
+ free(attr);
+ goto error;
+ }
+ free(attr);
+
+ /* Get the newly created channel reference back */
+ uchan = trace_ust_find_channel_by_name(
+ usess->domain_global.channels, channel_name);
+ if (uchan == NULL) {
+ /* Something is really wrong */
+ ret = LTTCOMM_FATAL;
+ goto error;
+ }
+ }
+
+ /* At this point, the session and channel exist on the tracer */
+
+ switch (event_type) {
+ case LTTNG_EVENT_ALL:
+ case LTTNG_EVENT_TRACEPOINT:
+ ret = event_ust_enable_all_tracepoints(usess, domain, uchan);
+ if (ret != LTTCOMM_OK) {
+ goto error;
+ }
+ break;
+ default:
+ ret = LTTCOMM_UST_ENABLE_FAIL;
+ goto error;
+ }
+
+ /* Manage return value */
+ if (ret != LTTCOMM_OK) {
+ goto error;
+ }
+
+ break;
+ }
+ case LTTNG_DOMAIN_UST_EXEC_NAME:
+ case LTTNG_DOMAIN_UST_PID:
+ case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
default:
- /* TODO: Userspace tracing */
ret = LTTCOMM_NOT_IMPLEMENTED;
goto error;
}