X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-metadata.c;h=f4f273b16cc7021e2f4869e52b42dfd7f14799dd;hb=00a620843422e5c972aee0ada2181b811fc81b92;hp=f430ae1f1e8ed390df410b71370f1771286afc66;hpb=8c645bb0c85b560355bf01337ca82dd4904a0ff3;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c index f430ae1f1..f4f273b16 100644 --- a/src/bin/lttng-sessiond/ust-metadata.c +++ b/src/bin/lttng-sessiond/ust-metadata.c @@ -20,6 +20,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -119,6 +120,23 @@ ssize_t metadata_reserve(struct ust_registry_session *session, size_t len) return ret; } +static +int metadata_file_append(struct ust_registry_session *session, + const char *str, size_t len) +{ + ssize_t written; + + if (session->metadata_fd < 0) { + return 0; + } + /* Write to metadata file */ + written = lttng_write(session->metadata_fd, str, len); + if (written != len) { + return -1; + } + return 0; +} + /* * We have exclusive access to our metadata buffer (protected by the * ust_lock), so we can do racy operations such as looking for @@ -148,6 +166,11 @@ int lttng_metadata_printf(struct ust_registry_session *session, goto end; } memcpy(&session->metadata[offset], str, len); + ret = metadata_file_append(session, str, len); + if (ret) { + PERROR("Error appending to metadata file"); + goto end; + } DBG3("Append to metadata: \"%s\"", str); ret = 0; @@ -574,6 +597,15 @@ int ust_metadata_session_statedump(struct ust_registry_session *session, uuid_c[8], uuid_c[9], uuid_c[10], uuid_c[11], uuid_c[12], uuid_c[13], uuid_c[14], uuid_c[15]); + /* For crash ABI */ + ret = lttng_metadata_printf(session, + "/* CTF %u.%u */\n\n", + CTF_SPEC_MAJOR, + CTF_SPEC_MINOR); + if (ret) { + goto end; + } + ret = lttng_metadata_printf(session, "typealias integer { size = 8; align = %u; signed = false; } := uint8_t;\n" "typealias integer { size = 16; align = %u; signed = false; } := uint16_t;\n"