X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=c6238e11c81e17b746553725d2d062d67a22d2d3;hp=edaebf59c8654515ac7872d0888e4a84dd6ab0ad;hb=c8f59ee5fc11492ef472dc5cfd2fd2c4926b1787;hpb=2f70b271351fe2b7befc4e327503f7c13a57dcd5 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index edaebf59c..c6238e11c 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1590,6 +1590,38 @@ int _lttng_create_session_ext(const char *name, const char *url, NULL); } +/* + * For a given session name, this call checks if the data is ready to be read + * or is still being extracted by the consumer(s) hence not ready to be used by + * any readers. + */ +int lttng_data_available(const char *session_name) +{ + int ret; + struct lttcomm_session_msg lsm; + + if (session_name == NULL) { + return -LTTNG_ERR_INVALID; + } + + lsm.cmd_type = LTTNG_DATA_AVAILABLE; + + copy_string(lsm.session.name, session_name, sizeof(lsm.session.name)); + + ret = ask_sessiond(&lsm, NULL); + + /* + * The ask_sessiond function negate the return code if it's not LTTNG_OK so + * getting -1 means that the reply ret_code was 1 thus meaning that the + * data is available. Yes it is hackish but for now this is the only way. + */ + if (ret == -1) { + ret = 1; + } + + return ret; +} + /* * lib constructor */