1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
7 * Copyright (C) 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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 <lttng/events-internal.h>
16 #include <ringbuffer/frontend_types.h>
17 #include <wrapper/vmalloc.h>
18 #include <lttng/tracer.h>
21 size_t ppid_get_size(void *priv
, struct lttng_probe_ctx
*probe_ctx
, size_t offset
)
25 size
+= lib_ring_buffer_align(offset
, lttng_alignof(pid_t
));
26 size
+= sizeof(pid_t
);
31 void ppid_record(void *priv
, struct lttng_probe_ctx
*probe_ctx
,
32 struct lib_ring_buffer_ctx
*ctx
,
33 struct lttng_channel
*chan
)
38 * TODO: when we eventually add RCU subsystem instrumentation,
39 * taking the rcu read lock here will trigger RCU tracing
40 * recursively. We should modify the kernel synchronization so
41 * it synchronizes both for RCU and RCU sched, and rely on
42 * rcu_read_lock_sched_notrace.
45 ppid
= task_tgid_nr(current
->real_parent
);
47 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(ppid
));
48 chan
->ops
->event_write(ctx
, &ppid
, sizeof(ppid
));
52 void ppid_get_value(void *priv
,
53 struct lttng_probe_ctx
*lttng_probe_ctx
,
54 struct lttng_ctx_value
*value
)
59 * TODO: when we eventually add RCU subsystem instrumentation,
60 * taking the rcu read lock here will trigger RCU tracing
61 * recursively. We should modify the kernel synchronization so
62 * it synchronizes both for RCU and RCU sched, and rely on
63 * rcu_read_lock_sched_notrace.
66 ppid
= task_tgid_nr(current
->real_parent
);
71 static const struct lttng_kernel_ctx_field
*ctx_field
= lttng_kernel_static_ctx_field(
72 lttng_kernel_static_event_field("ppid",
73 lttng_kernel_static_type_integer_from_type(pid_t
, __BYTE_ORDER
, 10),
80 int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx
**ctx
)
84 if (lttng_kernel_find_context(*ctx
, ctx_field
->event_field
->name
))
86 ret
= lttng_kernel_context_append(ctx
, ctx_field
);
87 wrapper_vmalloc_sync_mappings();
90 EXPORT_SYMBOL_GPL(lttng_add_ppid_to_ctx
);
This page took 0.05772 seconds and 4 git commands to generate.