X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=20bb8c6fa0d358c966ebfd3a9cd2e0a836330f3e;hb=3e230f922d67f7a47b66631f7a8cf458002b3727;hp=67c5972191016d8eafbf74d1e34faea0e8221e7f;hpb=38ee087f699718e57d1bc5614c2f79c3c30ccca9;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 67c597219..20bb8c6fa 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -708,7 +708,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait) /* Check for data availability */ do { - data_ret = lttng_data_available(session_name); + data_ret = lttng_data_pending(session_name); if (data_ret < 0) { /* Return the data available call error. */ ret = data_ret; @@ -719,11 +719,11 @@ static int _lttng_stop_tracing(const char *session_name, int wait) * Data sleep time before retrying (in usec). Don't sleep if the call * returned value indicates availability. */ - if (!data_ret) { + if (data_ret) { usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME); _MSG("."); } - } while (data_ret != 1); + } while (data_ret != 0); MSG(""); @@ -1344,7 +1344,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER; attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER; - attr->subbuf_size = DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE; + attr->subbuf_size = default_get_kernel_channel_subbuf_size(); attr->num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM; attr->output = DEFAULT_KERNEL_CHANNEL_OUTPUT; break; @@ -1358,7 +1358,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER; attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER; - attr->subbuf_size = DEFAULT_UST_CHANNEL_SUBBUF_SIZE; + attr->subbuf_size = default_get_ust_channel_subbuf_size(); attr->num_subbuf = DEFAULT_UST_CHANNEL_SUBBUF_NUM; attr->output = DEFAULT_UST_CHANNEL_OUTPUT; break; @@ -1606,16 +1606,7 @@ int _lttng_create_session_ext(const char *name, const char *url, memset(&lsm, 0, sizeof(lsm)); lsm.cmd_type = LTTNG_CREATE_SESSION; - if (!strncmp(name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME))) { - ret = snprintf(lsm.session.name, sizeof(lsm.session.name), "%s-%s", - name, datetime); - if (ret < 0) { - PERROR("snprintf session name datetime"); - return -LTTNG_ERR_FATAL; - } - } else { - copy_string(lsm.session.name, name, sizeof(lsm.session.name)); - } + copy_string(lsm.session.name, name, sizeof(lsm.session.name)); /* There should never be a data URL */ size = parse_str_urls_to_uri(url, NULL, &uris); @@ -1625,7 +1616,7 @@ int _lttng_create_session_ext(const char *name, const char *url, lsm.u.uri.size = size; - if (uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { + if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s", name, datetime); if (ret < 0) { @@ -1643,7 +1634,7 @@ int _lttng_create_session_ext(const char *name, const char *url, * 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 lttng_data_pending(const char *session_name) { int ret; struct lttcomm_session_msg lsm; @@ -1652,7 +1643,7 @@ int lttng_data_available(const char *session_name) return -LTTNG_ERR_INVALID; } - lsm.cmd_type = LTTNG_DATA_AVAILABLE; + lsm.cmd_type = LTTNG_DATA_PENDING; copy_string(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -1680,3 +1671,11 @@ static void __attribute__((constructor)) init() /* Set socket for health check */ (void) set_health_socket_path(); } + +/* + * lib destructor + */ +static void __attribute__((destructor)) lttng_ctl_exit() +{ + free(tracing_group); +}