X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=a57afe2c3016be26e9b378d9f42996bbc6cd7545;hp=bd63389ee94b510986c545644017607a35106152;hb=c25613651ac7525a16b9877230a682fc1a64e036;hpb=1eceaef161370ab5f8a8ad65c4df9272afcab577 diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index bd63389ee..a57afe2c3 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -3539,6 +3539,61 @@ end: return ret; } +/* + * Command LTTNG_REGENERATE_STATEDUMP from the lttng-ctl library. + * + * Ask the tracer to regenerate a new statedump. + * + * Return 0 on success or else a LTTNG_ERR code. + */ +int cmd_regenerate_statedump(struct ltt_session *session) +{ + int ret; + + assert(session); + + if (!session->active) { + ret = LTTNG_ERR_SESSION_NOT_STARTED; + goto end; + } + ret = 0; + + if (session->kernel_session) { + ret = kernctl_session_regenerate_statedump( + session->kernel_session->fd); + /* + * Currently, the statedump in kernel can only fail if out + * of memory. + */ + if (ret < 0) { + if (ret == -ENOMEM) { + ret = LTTNG_ERR_REGEN_STATEDUMP_NOMEM; + } else { + ret = LTTNG_ERR_REGEN_STATEDUMP_FAIL; + } + ERR("Failed to regenerate the kernel statedump"); + goto end; + } + } + + if (session->ust_session) { + ret = ust_app_regenerate_statedump_all(session->ust_session); + /* + * Currently, the statedump in UST always returns 0. + */ + if (ret < 0) { + ret = LTTNG_ERR_REGEN_STATEDUMP_FAIL; + ERR("Failed to regenerate the UST statedump"); + goto end; + } + } + DBG("Cmd regenerate statedump for session %s", session->name); + ret = LTTNG_OK; + +end: + return ret; +} + /* * Send relayd sockets from snapshot output to consumer. Ignore request if the * snapshot output is *not* set with a remote destination.