+static void update_lttng_msg(struct command_ctx *cmd_ctx, size_t cmd_header_len,
+ size_t payload_len)
+{
+ const size_t header_len = sizeof(struct lttcomm_lttng_msg);
+ const size_t total_msg_size = header_len + cmd_header_len + payload_len;
+ const struct lttcomm_lttng_msg llm = {
+ .cmd_type = cmd_ctx->lsm.cmd_type,
+ .pid = cmd_ctx->lsm.domain.attr.pid,
+ .cmd_header_size = cmd_header_len,
+ .data_size = payload_len,
+ };
+ struct lttcomm_lttng_msg *p_llm;
+
+ assert(cmd_ctx->reply_payload.buffer.size >= sizeof(llm));
+
+ p_llm = (typeof(p_llm)) cmd_ctx->reply_payload.buffer.data;
+
+ /* Update existing header. */
+ memcpy(p_llm, &llm, sizeof(llm));
+
+ cmd_ctx->lttng_msg_size = total_msg_size;
+}
+