X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-registry-session.cpp;fp=src%2Fbin%2Flttng-sessiond%2Fust-registry-session.cpp;h=03a87e2868f98d4f36848e0f2f45d9f3a88e41c4;hb=0267b5278de7bf4ee1ec11f2270dec4b44e80f36;hp=48983f2b21d8d4f3347ae63d784c766c9597160f;hpb=a57c248ad6c2dc246335330f41f9aae9d18fa17e;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 48983f2b2..03a87e286 100644 --- a/src/bin/lttng-sessiond/ust-registry-session.cpp +++ b/src/bin/lttng-sessiond/ust-registry-session.cpp @@ -251,7 +251,8 @@ lsu::registry_session::registry_session(const struct lst::abi& in_abi, _metadata_generating_visitor{lttng::make_unique( abi, [this](const std::string& fragment) { _append_metadata_fragment(fragment); - })} + })}, + _packet_header{_create_packet_header()} { pthread_mutex_init(&_lock, NULL); if (_shm_path.size() > 0) { @@ -287,6 +288,44 @@ lsu::registry_session::registry_session(const struct lst::abi& in_abi, } } +lst::type::cuptr lsu::registry_session::_create_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)); +} + +const lst::type *lsu::registry_session::get_packet_header() const noexcept +{ + return _packet_header.get(); +} + /* * For a given enumeration in a registry, delete the entry and destroy * the enumeration. @@ -665,39 +704,6 @@ 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.