X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=8ca8e46effc4e16c4dca3c54fb3697172f47b966;hp=a1e10f25e82176393f92206c2779d09355c063e6;hb=bff988fac4f8d1ffab3f85f0eec9546c76e57706;hpb=491d15395b58df09f8a3e7ba7404eb1f46392b79 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index a1e10f25e..8ca8e46ef 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -887,12 +887,6 @@ static int generate_filter(char *filter_expression, ret = -LTTNG_ERR_FILTER_INVAL; goto parse_error; } - ret = filter_visitor_set_parent(ctx); - if (ret) { - fprintf(stderr, "Set parent error\n"); - ret = -LTTNG_ERR_FILTER_INVAL; - goto parse_error; - } if (print_xml) { ret = filter_visitor_print_xml(ctx, stdout, 0); if (ret) { @@ -2485,9 +2479,22 @@ int lttng_create_session_snapshot(const char *name, const char *snapshot_url) lsm.u.uri.size = size; + /* + * If the user does not specify a custom subdir, use the session name. + */ + if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { + ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s", name); + if (ret < 0) { + PERROR("snprintf uri subdir"); + ret = -LTTNG_ERR_FATAL; + goto error; + } + } + ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, uris, sizeof(struct lttng_uri) * size, NULL); +error: free(uris); return ret; } @@ -2743,6 +2750,50 @@ end: return ret; } +int lttng_session_get_current_archive_location(const char *session_name, + char **chunk_path) +{ + struct lttcomm_session_msg lsm; + struct lttng_session_get_current_output_return *output_return = NULL; + int ret; + size_t path_len; + + memset(&lsm, 0, sizeof(lsm)); + lsm.cmd_type = LTTNG_SESSION_GET_CURRENT_OUTPUT; + ret = lttng_strncpy(lsm.session.name, session_name, + sizeof(lsm.session.name)); + if (ret) { + ret = -LTTNG_ERR_INVALID; + goto end; + } + + ret = lttng_ctl_ask_sessiond(&lsm, (void **) &output_return); + if (ret < 0) { + ret = -1; + goto end; + } + + path_len = lttng_strnlen(output_return->path, + sizeof(output_return->path)); + if (path_len == 0 || path_len == sizeof(output_return->path)) { + ret = -LTTNG_ERR_NO_SESSION_OUTPUT; + goto end; + } + + *chunk_path = zmalloc(path_len + 1); + if (!*chunk_path) { + ret = -1; + goto end; + } + memcpy(*chunk_path, output_return->path, path_len); + + ret = 0; + +end: + free(output_return); + return ret; +} + /* * lib constructor. */