2 * (C) Copyright 2009-2011 -
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * Dual LGPL v2.1/GPL v2 license.
10 #include <linux/module.h>
11 #include <linux/slab.h>
12 #include <linux/sched.h>
13 #include <linux/syscalls.h>
14 #include "lttng-events.h"
15 #include "wrapper/ringbuffer/frontend_types.h"
16 #include "wrapper/vmalloc.h"
17 #include "lttng-tracer.h"
20 size_t vppid_get_size(size_t offset
)
24 size
+= lib_ring_buffer_align(offset
, lttng_alignof(pid_t
));
25 size
+= sizeof(pid_t
);
30 void vppid_record(struct lttng_ctx_field
*field
,
31 struct lib_ring_buffer_ctx
*ctx
,
32 struct lttng_channel
*chan
)
34 struct task_struct
*parent
;
38 * nsproxy can be NULL when scheduled out of exit.
41 parent
= rcu_dereference(current
->real_parent
);
45 vppid
= task_tgid_vnr(parent
);
47 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(vppid
));
48 chan
->ops
->event_write(ctx
, &vppid
, sizeof(vppid
));
51 int lttng_add_vppid_to_ctx(struct lttng_ctx
**ctx
)
53 struct lttng_ctx_field
*field
;
55 field
= lttng_append_context(ctx
);
58 if (lttng_find_context(*ctx
, "vppid")) {
59 lttng_remove_context_field(ctx
, field
);
62 field
->event_field
.name
= "vppid";
63 field
->event_field
.type
.atype
= atype_integer
;
64 field
->event_field
.type
.u
.basic
.integer
.size
= sizeof(pid_t
) * CHAR_BIT
;
65 field
->event_field
.type
.u
.basic
.integer
.alignment
= lttng_alignof(pid_t
) * CHAR_BIT
;
66 field
->event_field
.type
.u
.basic
.integer
.signedness
= is_signed_type(pid_t
);
67 field
->event_field
.type
.u
.basic
.integer
.reverse_byte_order
= 0;
68 field
->event_field
.type
.u
.basic
.integer
.base
= 10;
69 field
->event_field
.type
.u
.basic
.integer
.encoding
= lttng_encode_none
;
70 field
->get_size
= vppid_get_size
;
71 field
->record
= vppid_record
;
72 wrapper_vmalloc_sync_all();
75 EXPORT_SYMBOL_GPL(lttng_add_vppid_to_ctx
);
77 MODULE_LICENSE("GPL and additional rights");
78 MODULE_AUTHOR("Mathieu Desnoyers");
79 MODULE_DESCRIPTION("Linux Trace Toolkit vPPID Context");
This page took 0.030478 seconds and 4 git commands to generate.