X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng-context-vpid.c;h=6fa1c00d2c76be529d7e146b6cbb157d913d4ec2;hb=dcb93448766003b5d8d19a57e2dd44efa8ea0035;hp=ccb2023d3329b1050d0e87f0068a586a4b7c0e00;hpb=a9dd15dadd7d58f58cfd19d2503d3b6b541723bc;p=lttng-modules.git diff --git a/lttng-context-vpid.c b/lttng-context-vpid.c index ccb2023d..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,7 @@ 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;