- field->destroy = lttng_destroy_perf_counter_field;
-
- field->event_field.name = name_alloc;
- field->event_field.type.atype = atype_integer;
- field->event_field.type.u.integer.size = sizeof(uint64_t) * CHAR_BIT;
- field->event_field.type.u.integer.alignment = lttng_alignof(uint64_t) * CHAR_BIT;
- field->event_field.type.u.integer.signedness = lttng_is_signed_type(uint64_t);
- field->event_field.type.u.integer.reverse_byte_order = 0;
- field->event_field.type.u.integer.base = 10;
- field->event_field.type.u.integer.encoding = lttng_encode_none;
- field->get_size = perf_counter_get_size;
- field->record = perf_counter_record;
- field->u.perf_counter = perf_field;
- lttng_context_update(*ctx);
-
- wrapper_vmalloc_sync_mappings();
+ ret = lttng_kernel_context_append(ctx, &ctx_field);
+ if (ret) {
+ ret = -ENOMEM;
+ goto append_context_error;
+ }