Tests: Add test to check shared-memory FD leaks after relayd dies
[lttng-tools.git] / src / bin / lttng-sessiond / ust-registry-event.hpp
CommitLineData
d7bfb9b0
JG
1/*
2 * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8#ifndef LTTNG_UST_REGISTRY_EVENT_H
9#define LTTNG_UST_REGISTRY_EVENT_H
10
11#include "event-class.hpp"
12#include "field.hpp"
13
14#include <common/format.hpp>
15#include <common/hashtable/hashtable.hpp>
28f23191 16
d7bfb9b0
JG
17#include <vendor/optional.hpp>
18
19#include <typeinfo>
20
21namespace lttng {
22namespace sessiond {
23namespace ust {
24
25/*
26 * Event registered from a UST tracer sent to the session daemon. This is
27 * indexed and matched by <event_name/signature>.
28 */
29class registry_event : public lttng::sessiond::trace::event_class {
30public:
31 registry_event(unsigned int id,
28f23191
JG
32 unsigned int stream_class_id,
33 int session_objd,
34 int channel_objd,
35 std::string name,
36 std::string signature,
37 std::vector<lttng::sessiond::trace::field::cuptr> fields,
38 int loglevel_value,
39 nonstd::optional<std::string> model_emf_uri);
cd9adb8b 40 ~registry_event() override = default;
9d89db29
JG
41 registry_event(const registry_event&) = delete;
42 registry_event(registry_event&&) = delete;
43 registry_event& operator=(registry_event&&) = delete;
44 registry_event& operator=(const registry_event&) = delete;
d7bfb9b0
JG
45
46 /* Both objd are set by the tracer. */
47 const int session_objd;
48 const int channel_objd;
49 const std::string signature;
50
51 /*
52 * Flag for this channel if the metadata was dumped once during
53 * registration.
54 */
55 bool _metadata_dumped;
56
57 /*
58 * Node in the ust-registry hash table. The event name is used to
59 * initialize the node and the event_name/signature for the match function.
60 */
f139a4f9
JG
61 struct cds_lfht_node _node;
62 struct rcu_head _head;
d7bfb9b0
JG
63};
64
65void registry_event_destroy(registry_event *event);
66
67} /* namespace ust */
68} /* namespace sessiond */
69} /* namespace lttng */
70
11bcbf89
JG
71/*
72 * Due to a bug in g++ < 7.1, this specialization must be enclosed in the fmt namespace,
73 * see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480.
74 */
e2c2bec2 75namespace fmt {
d7bfb9b0 76template <>
e2c2bec2 77struct formatter<lttng::sessiond::ust::registry_event> : formatter<std::string> {
31375c42 78 template <typename FormatContextType>
28f23191
JG
79 typename FormatContextType::iterator
80 format(const lttng::sessiond::ust::registry_event& event, FormatContextType& ctx)
d7bfb9b0 81 {
28f23191
JG
82 return format_to(
83 ctx.out(),
84 "{{ name = `{}`, signature = `{}`, id = {}, session objd = {}, channel objd = {} }}",
85 event.name,
86 event.signature,
87 event.id,
88 event.session_objd,
89 event.channel_objd);
d7bfb9b0
JG
90 }
91};
e2c2bec2 92} /* namespace fmt */
d7bfb9b0
JG
93
94#endif /* LTTNG_UST_REGISTRY_EVENT_H */
This page took 0.041075 seconds and 4 git commands to generate.