projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Makes kprobe attribute specific to kernel
[lttng-tools.git]
/
lttng
/
commands
/
create.c
diff --git
a/lttng/commands/create.c
b/lttng/commands/create.c
index 522ebc9c3aa3a6a3eff33015aa06d33dd3a95da6..4a64d8a76f87bec5f0aea945602765d7b16d90b1 100644
(file)
--- a/
lttng/commands/create.c
+++ b/
lttng/commands/create.c
@@
-27,7
+27,8
@@
#include <unistd.h>
#include "cmd.h"
#include <unistd.h>
#include "cmd.h"
-#include "config.h"
+#include "conf.h"
+#include "utils.h"
static char *opt_output_path;
static char *opt_session_name;
static char *opt_output_path;
static char *opt_session_name;
@@
-51,7
+52,7
@@
static void usage(FILE *ofp)
fprintf(ofp, "usage: lttng create [options] [NAME]\n");
fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
fprintf(ofp, "usage: lttng create [options] [NAME]\n");
fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
- fprintf(ofp, " -o, --output PATH Specify output path\n");
+ fprintf(ofp, " -o, --output PATH Specify output path
for traces
\n");
fprintf(ofp, "\n");
}
fprintf(ofp, "\n");
}
@@
-65,7
+66,7
@@
static int create_session()
{
int ret;
char name[NAME_MAX];
{
int ret;
char name[NAME_MAX];
- char *session_name, *
path = NULL, *alloc_path
;
+ char *session_name, *
traces_path = NULL, *alloc_path = NULL
;
time_t rawtime;
struct tm *timeinfo;
time_t rawtime;
struct tm *timeinfo;
@@
-82,39
+83,36
@@
static int create_session()
/* Auto output path */
if (opt_output_path == NULL) {
/* Auto output path */
if (opt_output_path == NULL) {
- alloc_path =
config_get_default_path(
);
+ alloc_path =
strdup(config_get_default_path()
);
if (alloc_path == NULL) {
if (alloc_path == NULL) {
+ ERR("Home path not found.\n \
+ Please specify an output path using -o, --output PATH");
ret = CMD_FATAL;
goto error;
}
ret = CMD_FATAL;
goto error;
}
- } else {
- alloc_path = opt_output_path;
- }
-
- path = config_generate_dir_path(alloc_path);
- if (path == NULL) {
- ret = CMD_FATAL;
- goto error;
- }
- /* Init lttng session config */
- ret = config_init(path);
- if (ret < 0) {
- goto error;
+ ret = asprintf(&traces_path, "%s/" LTTNG_DEFAULT_TRACE_DIR_NAME, alloc_path);
+ if (ret < 0) {
+ perror("asprintf trace dir name");
+ goto error;
+ }
+ } else {
+ traces_path = opt_output_path;
}
}
- ret =
config_add_session_name(path, session_name
);
+ ret =
lttng_create_session(session_name, traces_path
);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
- ret = lttng_create_session(session_name, path);
+ /* Init lttng session config */
+ ret = config_init(session_name);
if (ret < 0) {
goto error;
}
MSG("Session %s created.", session_name);
if (ret < 0) {
goto error;
}
MSG("Session %s created.", session_name);
- MSG("
Working directory of created session is %s",
path);
+ MSG("
Traces will be written in %s ", traces_
path);
ret = CMD_SUCCESS;
ret = CMD_SUCCESS;
@@
-123,8
+121,8
@@
error:
free(alloc_path);
}
free(alloc_path);
}
- if (path) {
- free(path);
+ if (
traces_
path) {
+ free(
traces_
path);
}
return ret;
}
}
return ret;
}
This page took
0.032897 seconds
and
4
git commands to generate.