*/
static struct ltt_session_list *session_list_ptr;
+int ust_consumer_fd;
+
/*
* Create a poll set with O_CLOEXEC and add the thread quit pipe to the set.
*/
buf_size = size;
- cmd_ctx->llm = malloc(sizeof(struct lttcomm_lttng_msg) + buf_size);
+ cmd_ctx->llm = zmalloc(sizeof(struct lttcomm_lttng_msg) + buf_size);
if (cmd_ctx->llm == NULL) {
- perror("malloc");
+ perror("zmalloc");
ret = -ENOMEM;
goto error;
}
}
/* Create UST registration command for enqueuing */
- ust_cmd = malloc(sizeof(struct ust_command));
+ ust_cmd = zmalloc(sizeof(struct ust_command));
if (ust_cmd == NULL) {
- perror("ust command malloc");
+ perror("ust command zmalloc");
goto error;
}
cds_lfht_for_each_entry(uchan->events, &iter, uevent, node) {
strncpy(tmp[i].name, uevent->attr.name, LTTNG_SYMBOL_NAME_LEN);
tmp[i].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
+ tmp[i].enabled = uevent->enabled;
switch (uevent->attr.instrumentation) {
case LTTNG_UST_TRACEPOINT:
tmp[i].type = LTTNG_EVENT_TRACEPOINT;
ret = LTTCOMM_UST_CHAN_FAIL;
goto error;
}
+
rcu_read_lock();
hashtable_add_unique(usess->domain_global.channels, &uchan->node);
rcu_read_unlock();
}
/* Add channel to all registered applications */
- ret = ust_app_add_channel_all(usess, uchan);
+ ret = ust_app_create_channel_all(usess, uchan);
if (ret != 0) {
goto error;
}
+ uchan->enabled = 1;
+
break;
}
case LTTNG_DOMAIN_UST_PID:
ret = LTTCOMM_FATAL;
goto error;
}
+
}
- ret = ust_app_add_event_all(usess, uchan, uevent);
+ ret = ust_app_create_event_all(usess, uchan, uevent);
if (ret < 0) {
ret = LTTCOMM_UST_ENABLE_FAIL;
goto error;
}
+ /* Add ltt ust event to channel */
rcu_read_lock();
hashtable_add_unique(uchan->events, &uevent->node);
rcu_read_unlock();
+
+ uevent->enabled = 1;
+
+ DBG3("UST ltt event %s added to channel %s", uevent->attr.name,
+ uchan->name);
break;
}
case LTTNG_DOMAIN_UST_EXEC_NAME:
goto error;
}
- cmd_ctx->session->ust_session->consumer_fd =
- ustconsumer_data.cmd_sock;
+ ust_consumer_fd = ustconsumer_data.cmd_sock;
}
pthread_mutex_unlock(&ustconsumer_data.pid_mutex);
}
}
/* Allocate context command to process the client request */
- cmd_ctx = malloc(sizeof(struct command_ctx));
+ cmd_ctx = zmalloc(sizeof(struct command_ctx));
if (cmd_ctx == NULL) {
- perror("malloc cmd_ctx");
+ perror("zmalloc cmd_ctx");
goto error;
}
/* Allocate data buffer for reception */
- cmd_ctx->lsm = malloc(sizeof(struct lttcomm_session_msg));
+ cmd_ctx->lsm = zmalloc(sizeof(struct lttcomm_session_msg));
if (cmd_ctx->lsm == NULL) {
- perror("malloc cmd_ctx->lsm");
+ perror("zmalloc cmd_ctx->lsm");
goto error;
}
if (ret < 0) {
/*
* TODO: Inform client somehow of the fatal error. At
- * this point, ret < 0 means that a malloc failed
+ * this point, ret < 0 means that a zmalloc failed
* (ENOMEM). Error detected but still accept command.
*/
clean_command_ctx(&cmd_ctx);