X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-registry-session.cpp;h=3c4cbed162fbbf538dbf0dd6a84dda5cd68b53fa;hb=058a22419ad53e80927878b10012fd000ddeb48c;hp=5bb8e6094e43726d93f7dc503e3a66dd39415de8;hpb=49830ece650265237f42277abe337d181ff9a025;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-registry-session.cpp b/src/bin/lttng-sessiond/ust-registry-session.cpp index 5bb8e6094..3c4cbed16 100644 --- a/src/bin/lttng-sessiond/ust-registry-session.cpp +++ b/src/bin/lttng-sessiond/ust-registry-session.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -240,14 +241,14 @@ lsu::registry_session::registry_session(const struct lst::abi& in_abi, lst::trace_class(in_abi, generate_uuid_or_throw()), _root_shm_path{root_shm_path ? root_shm_path : ""}, _shm_path{shm_path ? shm_path : ""}, - _metadata_path{_shm_path.size() > 0 ? - fmt::format("{}/metadata", _shm_path) : std::string("")}, + _metadata_path{_shm_path.size() > 0 ? fmt::format("{}/metadata", _shm_path) : + std::string("")}, _uid{euid}, _gid{egid}, _app_tracer_version{.major = major, .minor = minor}, _tracing_id{tracing_id}, - _metadata_generating_visitor{lttng::make_unique(abi, - [this](const std::string& fragment) { + _metadata_generating_visitor{lttng::make_unique( + abi, [this](const std::string& fragment) { _append_metadata_fragment(fragment); })} { @@ -389,7 +390,7 @@ void lsu::registry_session::add_channel(uint64_t key) } auto chan = new lsu::registry_channel( - _get_next_channel_id(), + _get_next_channel_id(), abi, _clock.name, /* Registered channel listener. */ [this](const lsu::registry_channel& registered_channel) { /* @@ -660,6 +661,39 @@ lsu::registry_session::get_enumeration(const char *enum_name, uint64_t enum_id) return lsu::registry_enum::const_rcu_protected_reference{*reg_enum, std::move(rcu_lock)}; } +lst::type::cuptr lsu::registry_session::get_packet_header() const +{ + lst::structure_type::fields packet_header_fields; + + /* uint32_t magic */ + packet_header_fields.emplace_back(lttng::make_unique("magic", + lttng::make_unique(abi.uint32_t_alignment, + abi.byte_order, 32, lst::integer_type::signedness::UNSIGNED, + lst::integer_type::base::HEXADECIMAL, + std::initializer_list({lst::integer_type::role::PACKET_MAGIC_NUMBER})))); + + /* uuid */ + packet_header_fields.emplace_back(lttng::make_unique("uuid", + lttng::make_unique(0, 16, + std::initializer_list({lst::static_length_blob_type::role::TRACE_CLASS_UUID})))); + + /* uint32_t stream_id */ + packet_header_fields.emplace_back(lttng::make_unique("stream_id", + lttng::make_unique(abi.uint32_t_alignment, + abi.byte_order, 32, lst::integer_type::signedness::UNSIGNED, + lst::integer_type::base::DECIMAL, + std::initializer_list({lst::integer_type::role::DATA_STREAM_CLASS_ID})))); + + /* uint64_t stream_instance_id */ + packet_header_fields.emplace_back(lttng::make_unique("stream_instance_id", + lttng::make_unique(abi.uint64_t_alignment, + abi.byte_order, 64, lst::integer_type::signedness::UNSIGNED, + lst::integer_type::base::DECIMAL, + std::initializer_list({lst::integer_type::role::DATA_STREAM_ID})))); + + return lttng::make_unique(0, std::move(packet_header_fields)); +} + /* * Lookup enumeration by name and comparing enumeration entries. * Needs to be called from RCU read-side critical section.