X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng-context-vpid.c;h=6fa1c00d2c76be529d7e146b6cbb157d913d4ec2;hb=79150a4903b5f31695fcd1d9655555ba6dc4bfa4;hp=0b498b40265a2a337ba5799e6df2d0f76aa8d707;hpb=13ab8b0a749053960f81a4924a3ed27775518f94;p=lttng-modules.git diff --git a/lttng-context-vpid.c b/lttng-context-vpid.c index 0b498b40..6fa1c00d 100644 --- a/lttng-context-vpid.c +++ b/lttng-context-vpid.c @@ -56,6 +56,23 @@ void vpid_record(struct lttng_ctx_field *field, chan->ops->event_write(ctx, &vpid, sizeof(vpid)); } +static +void vpid_get_value(struct lttng_ctx_field *field, + struct lttng_probe_ctx *lttng_probe_ctx, + union lttng_ctx_value *value) +{ + pid_t vpid; + + /* + * nsproxy can be NULL when scheduled out of exit. + */ + if (!current->nsproxy) + vpid = 0; + else + vpid = task_tgid_vnr(current); + value->s64 = vpid; +} + int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx) { struct lttng_ctx_field *field; @@ -77,6 +94,8 @@ int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx) field->event_field.type.u.basic.integer.encoding = lttng_encode_none; field->get_size = vpid_get_size; field->record = vpid_record; + field->get_value = vpid_get_value; + lttng_context_update(*ctx); wrapper_vmalloc_sync_all(); return 0; }