Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
int *shm_fd, int *wait_fd,
uint64_t *memory_map_size);
int *shm_fd, int *wait_fd,
uint64_t *memory_map_size);
-struct ltt_event *ltt_event_create(struct ltt_channel *chan,
- struct lttng_ust_event *event_param,
- void *filter);
+int ltt_event_create(struct ltt_channel *chan,
+ struct lttng_ust_event *event_param,
+ void *filter,
+ struct ltt_event **event);
int ltt_channel_enable(struct ltt_channel *channel);
int ltt_channel_disable(struct ltt_channel *channel);
int ltt_channel_enable(struct ltt_channel *channel);
int ltt_channel_disable(struct ltt_channel *channel);
/*
* Supports event creation while tracing session is active.
*/
/*
* Supports event creation while tracing session is active.
*/
-struct ltt_event *ltt_event_create(struct ltt_channel *chan,
- struct lttng_ust_event *event_param,
- void *filter)
+int ltt_event_create(struct ltt_channel *chan,
+ struct lttng_ust_event *event_param,
+ void *filter,
+ struct ltt_event **_event)
{
struct ltt_event *event;
{
struct ltt_event *event;
- if (chan->used_event_id == -1UL)
+ if (chan->used_event_id == -1UL) {
+ ret = -ENOMEM;
/*
* This is O(n^2) (for each event, the loop is called at event
* creation). Might require a hash if we have lots of events.
*/
/*
* This is O(n^2) (for each event, the loop is called at event
* creation). Might require a hash if we have lots of events.
*/
- cds_list_for_each_entry(event, &chan->session->events, list)
- if (event->desc && !strcmp(event->desc->name, event_param->name))
+ cds_list_for_each_entry(event, &chan->session->events, list) {
+ if (event->desc && !strcmp(event->desc->name, event_param->name)) {
+ ret = -EEXIST;
event = zmalloc(sizeof(struct ltt_event));
event = zmalloc(sizeof(struct ltt_event));
+ if (!event) {
+ ret = -ENOMEM;
event->chan = chan;
event->filter = filter;
/*
event->chan = chan;
event->filter = filter;
/*
goto statedump_error;
}
cds_list_add(&event->list, &chan->session->events);
goto statedump_error;
}
cds_list_add(&event->list, &chan->session->events);
+ *_event = event;
+ return 0;
statedump_error:
if (event->desc) {
statedump_error:
if (event->desc) {
cache_error:
exist:
full:
cache_error:
exist:
full:
.name = "lttng_ust:metadata",
};
struct ltt_event *event;
.name = "lttng_ust:metadata",
};
struct ltt_event *event;
/*
* We tolerate no failure path after event creation. It will stay
* invariant for the rest of the session.
*/
/*
* We tolerate no failure path after event creation. It will stay
* invariant for the rest of the session.
*/
- event = ltt_event_create(channel, &metadata_params, NULL);
- if (!event) {
+ ret = ltt_event_create(channel, &metadata_params, NULL, &event);
+ if (ret < 0) {
goto create_error;
}
return;
goto create_error;
}
return;
* We tolerate no failure path after event creation. It will stay
* invariant for the rest of the session.
*/
* We tolerate no failure path after event creation. It will stay
* invariant for the rest of the session.
*/
- event = ltt_event_create(channel, event_param, NULL);
- if (!event) {
- ret = -EINVAL;
+ ret = ltt_event_create(channel, event_param, NULL, &event);
+ if (ret < 0) {
goto event_error;
}
objd_set_private(event_objd, event);
goto event_error;
}
objd_set_private(event_objd, event);