+ /* Create the default tracepoint. */
+ memset(&uevent, 0, sizeof(uevent));
+ uevent.type = LTTNG_EVENT_TRACEPOINT;
+ uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
+ default_event_name = event_get_default_agent_ust_name(domain->type);
+ if (!default_event_name) {
+ ret = -LTTNG_ERR_FATAL;
+ goto error;
+ }
+ strncpy(uevent.name, default_event_name, sizeof(uevent.name));
+ uevent.name[sizeof(uevent.name) - 1] = '\0';
+
+ /*
+ * The domain type is changed because we are about to enable the
+ * default channel and event for the JUL domain that are hardcoded.
+ * This happens in the UST domain.
+ */
+ memcpy(&tmp_dom, domain, sizeof(tmp_dom));
+ tmp_dom.type = LTTNG_DOMAIN_UST;
+
+ switch (domain->type) {
+ case LTTNG_DOMAIN_LOG4J:
+ default_chan_name = DEFAULT_LOG4J_CHANNEL_NAME;
+ break;
+ case LTTNG_DOMAIN_JUL:
+ default_chan_name = DEFAULT_JUL_CHANNEL_NAME;
+ break;
+ case LTTNG_DOMAIN_PYTHON:
+ default_chan_name = DEFAULT_PYTHON_CHANNEL_NAME;
+ break;
+ default:
+ /* The switch/case we are in should avoid this else big problem */
+ assert(0);
+ }
+
+ {
+ struct lttng_filter_bytecode *filter_copy = NULL;
+
+ if (filter) {
+ filter_copy = zmalloc(
+ sizeof(struct lttng_filter_bytecode)
+ + filter->len);
+ if (!filter_copy) {
+ goto error;
+ }
+
+ memcpy(filter_copy, filter,
+ sizeof(struct lttng_filter_bytecode)
+ + filter->len);
+ }
+
+ ret = cmd_enable_event_internal(session, &tmp_dom,
+ (char *) default_chan_name,
+ &uevent, filter_expression, filter_copy,
+ NULL, wpipe);
+ /* We have passed ownership */
+ filter_expression = NULL;
+ }
+
+ if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
+ goto error;
+ }
+
+ /* The wild card * means that everything should be enabled. */
+ if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) {
+ ret = event_agent_enable_all(usess, agt, event, filter);
+ filter = NULL;
+ } else {
+ ret = event_agent_enable(usess, agt, event, filter);
+ filter = NULL;
+ }
+ if (ret != LTTNG_OK) {