- if (ext_header->filter_len) {
- *filter_expression = ((const char *) (ext_header)) +
- sizeof(*ext_header);
- } else {
- *filter_expression = NULL;
- }
-
-end:
- return ret;
-}
-
-int lttng_event_get_exclusion_name_count(struct lttng_event *event)
-{
- int ret;
- struct lttcomm_event_extended_header *ext_header;
-
- if (!event) {
- ret = -LTTNG_ERR_INVALID;
- goto end;
- }
-
- ext_header = event->extended.ptr;
- if (!ext_header) {
- /*
- * This can happen since the lttng_event structure is
- * used for other tasks where this pointer is never set.
- */
- ret = 0;
- goto end;
- }
-
- if (ext_header->nb_exclusions > INT_MAX) {
- ret = -LTTNG_ERR_OVERFLOW;
- goto end;
- }
- ret = (int) ext_header->nb_exclusions;
-end:
- return ret;
-}
-
-int lttng_event_get_exclusion_name(struct lttng_event *event,
- size_t index, const char **exclusion_name)
-{
- int ret = 0;
- struct lttcomm_event_extended_header *ext_header;
- void *at;
-
- if (!event || !exclusion_name) {
- ret = -LTTNG_ERR_INVALID;
- goto end;
- }
-
- ext_header = event->extended.ptr;
- if (!ext_header) {
- ret = -LTTNG_ERR_INVALID;
- goto end;
- }
-
- if (index >= ext_header->nb_exclusions) {
- ret = -LTTNG_ERR_INVALID;
- goto end;
- }
-
- at = (void *) ext_header + sizeof(*ext_header);
- at += ext_header->filter_len;
- at += index * LTTNG_SYMBOL_NAME_LEN;
- *exclusion_name = at;
-
+ comm_ext_at = reception_buffer +
+ (nb_events * sizeof(struct lttng_event));
+ listing_at = listing +
+ (nb_events * sizeof(struct lttng_event));
+ for (i = 0; i < nb_events; i++) {
+ struct lttng_event *event = (struct lttng_event *)
+ (listing + (sizeof(struct lttng_event) * i));
+ struct lttcomm_event_extended_header *ext_comm =
+ (struct lttcomm_event_extended_header *) comm_ext_at;
+ struct lttng_event_extended *event_extended =
+ (struct lttng_event_extended *) listing_at;
+
+ event->extended.ptr = event_extended;
+ listing_at += sizeof(*event_extended);
+ comm_ext_at += sizeof(*ext_comm);
+
+ /* Copy filter expression. */
+ memcpy(listing_at, comm_ext_at, ext_comm->filter_len);
+ event_extended->filter_expression = listing_at;
+ comm_ext_at += ext_comm->filter_len;
+ listing_at += ext_comm->filter_len;
+
+ /* Copy exclusions. */
+ event_extended->exclusions.count = ext_comm->nb_exclusions;
+ event_extended->exclusions.strings = listing_at;
+ memcpy(listing_at, comm_ext_at,
+ ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN);
+ listing_at += ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN;
+ comm_ext_at += ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN;
+
+ listing_at += ((uintptr_t) listing_at) % 8;
+ }
+
+ *events = (struct lttng_event *) listing;
+ listing = NULL;
+ ret = (int) nb_events;