ua_sess->handle = -1;
ua_sess->channels = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
- pthread_mutex_init(&ua_sess->lock, NULL);
-
- /* Set default metadata channel attribute. */
- ua_sess->metadata_attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
- ua_sess->metadata_attr.subbuf_size = default_get_metadata_subbuf_size();
- ua_sess->metadata_attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
- ua_sess->metadata_attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
- ua_sess->metadata_attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
- ua_sess->metadata_attr.output = LTTNG_UST_MMAP;
ua_sess->metadata_attr.type = LTTNG_UST_CHAN_METADATA;
+ pthread_mutex_init(&ua_sess->lock, NULL);
return ua_sess;
}
/* If event not enabled, disable it on the tracer */
- if (ua_event->enabled == 0) {
+ if (ua_event->enabled) {
+ /*
+ * We now need to explicitly enable the event, since it
+ * is now disabled at creation.
+ */
+ ret = enable_ust_event(app, ua_sess, ua_event);
+ if (ret < 0) {
+ /*
+ * If we hit an EPERM, something is wrong with our enable call. If
+ * we get an EEXIST, there is a problem on the tracer side since we
+ * just created it.
+ */
+ switch (ret) {
+ case -LTTNG_UST_ERR_PERM:
+ /* Code flow problem */
+ assert(0);
+ case -LTTNG_UST_ERR_EXIST:
+ /* It's OK for our use case. */
+ ret = 0;
+ break;
+ default:
+ break;
+ }
+ goto error;
+ }
+ } else {
ret = disable_ust_event(app, ua_sess, ua_event);
if (ret < 0) {
/*
ua_sess->consumer = usess->consumer;
ua_sess->output_traces = usess->output_traces;
ua_sess->live_timer_interval = usess->live_timer_interval;
+ copy_channel_attr_to_ustctl(&ua_sess->metadata_attr,
+ &usess->metadata_attr);
switch (ua_sess->buffer_type) {
case LTTNG_BUFFER_PER_PID: