X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=bff522201233db0a5e6551e160becfb78a0e1260;hb=ecc48a904cc7c419fd1400afaa9ccb93be490cdd;hp=033a28105ef6744f464434c32ad0f01b2ada889c;hpb=850767541647c102a299d7fbc39c97555ac70224;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 033a28105..bff522201 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -574,6 +574,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait) } _MSG("Waiting for data availability"); + fflush(stdout); /* Check for data availability */ do { @@ -591,6 +592,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait) if (data_ret) { usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME); _MSG("."); + fflush(stdout); } } while (data_ret != 0); @@ -1594,6 +1596,51 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url) return ret; } +/* + * Create a session exclusively used for live. + * + * Returns LTTNG_OK on success or a negative error code. + */ +int lttng_create_session_live(const char *name, const char *url, + unsigned int timer_interval) +{ + int ret; + ssize_t size; + struct lttcomm_session_msg lsm; + struct lttng_uri *uris = NULL; + + if (name == NULL) { + return -LTTNG_ERR_INVALID; + } + + memset(&lsm, 0, sizeof(lsm)); + + lsm.cmd_type = LTTNG_CREATE_SESSION_LIVE; + lttng_ctl_copy_string(lsm.session.name, name, sizeof(lsm.session.name)); + + size = uri_parse_str_urls(url, NULL, &uris); + if (size < 0) { + ret = -LTTNG_ERR_INVALID; + goto end; + } + + /* file:// is not accepted for live session. */ + if (uris[0].dtype == LTTNG_DST_PATH) { + ret = -LTTNG_ERR_INVALID; + goto end; + } + + lsm.u.session_live.nb_uri = size; + lsm.u.session_live.timer_interval = timer_interval; + + ret = lttng_ctl_ask_sessiond_varlen(&lsm, uris, + sizeof(struct lttng_uri) * size, NULL); + +end: + free(uris); + return ret; +} + /* * lib constructor */