- struct lttng_ctx_field *field;
-
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vtid")) {
- lttng_remove_context_field(ctx, field);
- return -EEXIST;
+ value->u.s64 = wrapper_getvtid();
+}
+
+static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
+ lttng_ust_static_event_field("vtid",
+ lttng_ust_static_type_integer(sizeof(pid_t) * CHAR_BIT,
+ lttng_ust_rb_alignof(pid_t) * CHAR_BIT,
+ lttng_ust_is_signed_type(pid_t),
+ BYTE_ORDER, 10),
+ false, false),
+ vtid_get_size,
+ vtid_record,
+ vtid_get_value,
+ NULL, NULL);
+
+int lttng_add_vtid_to_ctx(struct lttng_ust_ctx **ctx)
+{
+ int ret;
+
+ if (lttng_find_context(*ctx, ctx_field->event_field->name)) {
+ ret = -EEXIST;
+ goto error_find_context;