projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Using LTTNG_HOME environment variable if exists, with fallback to HOME
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
create.c
diff --git
a/src/bin/lttng/commands/create.c
b/src/bin/lttng/commands/create.c
index b14b45cd6e1fd31435612590f34e8e07d3f97a28..ddd2983e238208a0888a90638c539bda692111cf 100644
(file)
--- a/
src/bin/lttng/commands/create.c
+++ b/
src/bin/lttng/commands/create.c
@@
-91,11
+91,6
@@
static void usage(FILE *ofp)
fprintf(ofp, " You can change it with the enable-consumer cmd\n");
fprintf(ofp, " -C, --ctrl-url=URL Set control path URL. (Must use -D also)\n");
fprintf(ofp, " -D, --data-url=URL Set data path URL. (Must use -C also)\n");
fprintf(ofp, " You can change it with the enable-consumer cmd\n");
fprintf(ofp, " -C, --ctrl-url=URL Set control path URL. (Must use -D also)\n");
fprintf(ofp, " -D, --data-url=URL Set data path URL. (Must use -C also)\n");
- fprintf(ofp, " --no-consumer Don't activate a consumer for this session.\n");
- fprintf(ofp, " OBSELETE\n");
- fprintf(ofp, " --disable-consumer\n");
- fprintf(ofp, " Disable consumer for this session.\n");
- fprintf(ofp, " OBSELETE\n");
fprintf(ofp, "\n");
fprintf(ofp, "Please refer to the man page (lttng(1)) for more information on network\n");
fprintf(ofp, "streaming mechanisms and explanation of the control and data port\n");
fprintf(ofp, "\n");
fprintf(ofp, "Please refer to the man page (lttng(1)) for more information on network\n");
fprintf(ofp, "streaming mechanisms and explanation of the control and data port\n");
@@
-253,9
+248,9
@@
static int create_session(void)
} else if (opt_url) { /* Handling URL (-U opt) */
url = opt_url;
print_str_url = url;
} else if (opt_url) { /* Handling URL (-U opt) */
url = opt_url;
print_str_url = url;
- } else
if (opt_ctrl_url == NULL && opt_data_url == NULL)
{
+ } else {
/* Auto output path */
/* Auto output path */
- alloc_path =
config_get_default_path
();
+ alloc_path =
utils_get_home_dir
();
if (alloc_path == NULL) {
ERR("HOME path not found.\n \
Please specify an output path using -o, --output PATH");
if (alloc_path == NULL) {
ERR("HOME path not found.\n \
Please specify an output path using -o, --output PATH");
@@
-274,10
+269,16
@@
static int create_session(void)
}
url = alloc_url;
}
url = alloc_url;
- print_str_url = alloc_url + strlen("file://");
+ if (!opt_data_url && !opt_ctrl_url) {
+ print_str_url = alloc_url + strlen("file://");
+ }
}
}
- assert(url);
+ if ((!opt_ctrl_url && opt_data_url) || (opt_ctrl_url && !opt_data_url)) {
+ ERR("You need both control and data URL.");
+ ret = CMD_ERROR;
+ goto error;
+ }
ret = _lttng_create_session_ext(session_name, url, datetime);
if (ret < 0) {
ret = _lttng_create_session_ext(session_name, url, datetime);
if (ret < 0) {
@@
-287,28
+288,24
@@
static int create_session(void)
WARN("Session %s already exists", session_name);
break;
default:
WARN("Session %s already exists", session_name);
break;
default:
- ERR("%s", lttng_strerror(ret));
break;
}
goto error;
}
break;
}
goto error;
}
- MSG("Session %s created.", session_name);
- if (print_str_url) {
- MSG("Traces will be written in %s", print_str_url);
- }
-
if (opt_ctrl_url && opt_data_url) {
/* Setting up control URI (-C or/and -D opt) */
ret = set_consumer_url(session_name, opt_ctrl_url, opt_data_url);
if (ret < 0) {
if (opt_ctrl_url && opt_data_url) {
/* Setting up control URI (-C or/and -D opt) */
ret = set_consumer_url(session_name, opt_ctrl_url, opt_data_url);
if (ret < 0) {
+ /* Destroy created session because the URL are not valid. */
+ lttng_destroy_session(session_name);
goto error;
}
goto error;
}
- }
else if ((!opt_ctrl_url && opt_data_url) ||
- (opt_ctrl_url && !opt_data_url)) {
-
ERR("You need both control and data URL."
);
- ret = CMD_ERROR;
-
goto error
;
+ }
+
+
MSG("Session %s created.", session_name
);
+ if (print_str_url) {
+
MSG("Traces will be written in %s", print_str_url)
;
}
/* Init lttng session config */
}
/* Init lttng session config */
@@
-318,7
+315,6
@@
static int create_session(void)
goto error;
}
goto error;
}
-
ret = CMD_SUCCESS;
error:
ret = CMD_SUCCESS;
error:
This page took
0.024681 seconds
and
4
git commands to generate.