+ return 0;
+}
+
+struct lttng_ust_ctx_field *lttng_append_context(struct lttng_ust_ctx **ctx_p)
+{
+ struct lttng_ust_ctx_field *field;
+ int ret;
+
+ field = zmalloc(sizeof(struct lttng_ust_ctx_field));
+ if (!field)
+ goto error_alloc_field;
+ field->struct_size = sizeof(struct lttng_ust_ctx_field);
+ field->event_field = zmalloc(sizeof(struct lttng_ust_event_field));
+ if (!field->event_field)
+ goto error_alloc_event_field;
+ field->event_field->struct_size = sizeof(struct lttng_ust_event_field);
+
+ ret = lttng_add_context(ctx_p);
+ if (ret)
+ goto error_add_context;
+ (*ctx_p)->fields[(*ctx_p)->nr_fields - 1] = field;