| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-only |
| 3 | * |
| 4 | * Copyright (C) 2005-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | * |
| 6 | * This contains the core definitions for the Linux Trace Toolkit. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _LTTNG_TRACER_CORE_H |
| 10 | #define _LTTNG_TRACER_CORE_H |
| 11 | |
| 12 | #include <stddef.h> |
| 13 | #include <urcu/arch.h> |
| 14 | #include <urcu/list.h> |
| 15 | #include <lttng/ust-tracer.h> |
| 16 | #include <lttng/bug.h> |
| 17 | #include <lttng/ringbuffer-config.h> |
| 18 | #include <usterr-signal-safe.h> |
| 19 | #include <ust-helper.h> |
| 20 | |
| 21 | /* |
| 22 | * The longuest possible namespace proc path is with the cgroup ns |
| 23 | * and the maximum theoretical linux pid of 536870912 : |
| 24 | * |
| 25 | * /proc/self/task/536870912/ns/cgroup |
| 26 | */ |
| 27 | #define LTTNG_PROC_NS_PATH_MAX 40 |
| 28 | |
| 29 | struct lttng_session; |
| 30 | struct lttng_channel; |
| 31 | struct lttng_event; |
| 32 | struct lttng_ctx_field; |
| 33 | struct lttng_ust_lib_ring_buffer_ctx; |
| 34 | struct lttng_ctx_value; |
| 35 | struct lttng_event_notifier; |
| 36 | |
| 37 | int ust_lock(void) __attribute__ ((warn_unused_result)); |
| 38 | void ust_lock_nocheck(void); |
| 39 | void ust_unlock(void); |
| 40 | |
| 41 | void lttng_fixup_event_tls(void); |
| 42 | void lttng_fixup_vtid_tls(void); |
| 43 | void lttng_fixup_procname_tls(void); |
| 44 | void lttng_fixup_cgroup_ns_tls(void); |
| 45 | void lttng_fixup_ipc_ns_tls(void); |
| 46 | void lttng_fixup_net_ns_tls(void); |
| 47 | LTTNG_HIDDEN |
| 48 | void lttng_fixup_time_ns_tls(void); |
| 49 | void lttng_fixup_uts_ns_tls(void); |
| 50 | |
| 51 | const char *lttng_ust_obj_get_name(int id); |
| 52 | |
| 53 | int lttng_get_notify_socket(void *owner); |
| 54 | |
| 55 | LTTNG_HIDDEN |
| 56 | char* lttng_ust_sockinfo_get_procname(void *owner); |
| 57 | |
| 58 | void lttng_ust_sockinfo_session_enabled(void *owner); |
| 59 | |
| 60 | void lttng_ust_malloc_wrapper_init(void); |
| 61 | |
| 62 | ssize_t lttng_ust_read(int fd, void *buf, size_t len); |
| 63 | |
| 64 | size_t lttng_ust_dummy_get_size(struct lttng_ctx_field *field, size_t offset); |
| 65 | void lttng_ust_dummy_record(struct lttng_ctx_field *field, |
| 66 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
| 67 | struct lttng_channel *chan); |
| 68 | void lttng_ust_dummy_get_value(struct lttng_ctx_field *field, |
| 69 | struct lttng_ctx_value *value); |
| 70 | int lttng_context_is_app(const char *name); |
| 71 | void lttng_ust_fixup_tls(void); |
| 72 | |
| 73 | extern void (*lttng_ust_liburcu_bp_before_fork)(void); |
| 74 | extern void (*lttng_ust_liburcu_bp_after_fork_parent)(void); |
| 75 | extern void (*lttng_ust_liburcu_bp_after_fork_child)(void); |
| 76 | |
| 77 | LTTNG_HIDDEN |
| 78 | void lttng_event_notifier_notification_send( |
| 79 | struct lttng_event_notifier *event_notifier, |
| 80 | const char *stack_data); |
| 81 | |
| 82 | LTTNG_HIDDEN |
| 83 | struct lttng_counter_transport *lttng_counter_transport_find(const char *name); |
| 84 | LTTNG_HIDDEN |
| 85 | void lttng_counter_transport_register(struct lttng_counter_transport *transport); |
| 86 | LTTNG_HIDDEN |
| 87 | void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); |
| 88 | |
| 89 | #ifdef HAVE_PERF_EVENT |
| 90 | void lttng_ust_fixup_perf_counter_tls(void); |
| 91 | void lttng_perf_lock(void); |
| 92 | void lttng_perf_unlock(void); |
| 93 | #else /* #ifdef HAVE_PERF_EVENT */ |
| 94 | static inline |
| 95 | void lttng_ust_fixup_perf_counter_tls(void) |
| 96 | { |
| 97 | } |
| 98 | static inline |
| 99 | void lttng_perf_lock(void) |
| 100 | { |
| 101 | } |
| 102 | static inline |
| 103 | void lttng_perf_unlock(void) |
| 104 | { |
| 105 | } |
| 106 | #endif /* #else #ifdef HAVE_PERF_EVENT */ |
| 107 | |
| 108 | #endif /* _LTTNG_TRACER_CORE_H */ |