projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lttng-view: clean-up: remove unneeded empty line
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
view.c
diff --git
a/src/bin/lttng/commands/view.c
b/src/bin/lttng/commands/view.c
index c9a5fdc3e09b0f356096a25a051c55d730ea86c8..a13cb352510da0e3f2b60cc9a8c74f2b62f66870 100644
(file)
--- a/
src/bin/lttng/commands/view.c
+++ b/
src/bin/lttng/commands/view.c
@@
-30,7
+30,6
@@
static char *opt_session_name;
static char *opt_viewer;
static char *opt_trace_path;
static const char *babeltrace_bin = CONFIG_BABELTRACE_BIN;
static char *opt_viewer;
static char *opt_trace_path;
static const char *babeltrace_bin = CONFIG_BABELTRACE_BIN;
-//static const char *lttv_gui_bin = CONFIG_LTTV_GUI_BIN;
#ifdef LTTNG_EMBED_HELP
static const char help_msg[] =
#ifdef LTTNG_EMBED_HELP
static const char help_msg[] =
@@
-56,7
+55,6
@@
static struct poptOption long_options[] = {
* This is needed for each viewer since we are using execvp().
*/
static const char *babeltrace_opts[] = { "babeltrace" };
* This is needed for each viewer since we are using execvp().
*/
static const char *babeltrace_opts[] = { "babeltrace" };
-//static const char *lttv_gui_opts[] = { "lttv-gui", "-t", };
/*
* Type is also use as the index in the viewers array. So please, make sure
/*
* Type is also use as the index in the viewers array. So please, make sure
@@
-64,27
+62,25
@@
static const char *babeltrace_opts[] = { "babeltrace" };
*/
enum viewer_type {
VIEWER_BABELTRACE = 0,
*/
enum viewer_type {
VIEWER_BABELTRACE = 0,
- VIEWER_LTTV_GUI = 1,
- VIEWER_USER_DEFINED = 2,
+ VIEWER_USER_DEFINED = 1,
};
/*
* NOTE: "lttv" is a shell command and it's not working for exec() family
* functions so we might think of removing this wrapper or using bash.
*/
};
/*
* NOTE: "lttv" is a shell command and it's not working for exec() family
* functions so we might think of removing this wrapper or using bash.
*/
-static struct viewers {
+static
const
struct viewers {
const char *exec_name;
enum viewer_type type;
} viewers[] = {
{ "babeltrace", VIEWER_BABELTRACE },
const char *exec_name;
enum viewer_type type;
} viewers[] = {
{ "babeltrace", VIEWER_BABELTRACE },
- { "lttv-gui", VIEWER_LTTV_GUI },
{ NULL, VIEWER_USER_DEFINED },
};
/* Is the session we are trying to view is in live mode. */
static int session_live_mode;
{ NULL, VIEWER_USER_DEFINED },
};
/* Is the session we are trying to view is in live mode. */
static int session_live_mode;
-static struct viewers *parse_options(void)
+static
const
struct viewers *parse_options(void)
{
if (opt_viewer == NULL) {
/* Default is babeltrace */
{
if (opt_viewer == NULL) {
/* Default is babeltrace */
@@
-169,7
+165,6
@@
static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len,
char **argv;
size_t size, mem_len;
char **argv;
size_t size, mem_len;
-
/* Add one for the NULL terminating element. */
mem_len = opts_len + 1;
if (session_live_mode) {
/* Add one for the NULL terminating element. */
mem_len = opts_len + 1;
if (session_live_mode) {
@@
-188,7
+183,7
@@
static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len,
goto error;
}
goto error;
}
- memcpy(argv, opts, size);
+ memcpy(argv, opts, size
of(char *) * opts_len
);
if (session_live_mode) {
argv[opts_len] = "-i";
if (session_live_mode) {
argv[opts_len] = "-i";
@@
-212,7
+207,7
@@
static int spawn_viewer(const char *trace_path)
int ret = 0;
struct stat status;
const char *viewer_bin = NULL;
int ret = 0;
struct stat status;
const char *viewer_bin = NULL;
- struct viewers *viewer;
+
const
struct viewers *viewer;
char **argv = NULL;
/* Check for --viewer options */
char **argv = NULL;
/* Check for --viewer options */
@@
-302,6
+297,7
@@
static int view_trace(void)
int ret;
char *session_name, *trace_path = NULL;
struct lttng_session *sessions = NULL;
int ret;
char *session_name, *trace_path = NULL;
struct lttng_session *sessions = NULL;
+ bool free_trace_path = false;
/*
* Safety net. If lttng is suid at some point for *any* useless reasons,
/*
* Safety net. If lttng is suid at some point for *any* useless reasons,
@@
-379,6
+375,7
@@
static int view_trace(void)
ret = CMD_ERROR;
goto free_sessions;
}
ret = CMD_ERROR;
goto free_sessions;
}
+ free_trace_path = true;
} else {
/* Get file system session path. */
trace_path = sessions[i].path;
} else {
/* Get file system session path. */
trace_path = sessions[i].path;
@@
-396,7
+393,7
@@
static int view_trace(void)
}
free_sessions:
}
free_sessions:
- if (session_live_mode) {
+ if (session_live_mode
&& free_trace_path
) {
free(trace_path);
}
free(sessions);
free(trace_path);
}
free(sessions);
@@
-415,6
+412,7
@@
int cmd_view(int argc, const char **argv)
{
int opt, ret = CMD_SUCCESS;
static poptContext pc;
{
int opt, ret = CMD_SUCCESS;
static poptContext pc;
+ const char *leftover = NULL;
pc = poptGetContext(NULL, argc, argv, long_options, 0);
poptReadDefaultConfig(pc, 0);
pc = poptGetContext(NULL, argc, argv, long_options, 0);
poptReadDefaultConfig(pc, 0);
@@
-439,6
+437,13
@@
int cmd_view(int argc, const char **argv)
opt_session_name = (char*) poptGetArg(pc);
opt_session_name = (char*) poptGetArg(pc);
+ leftover = poptGetArg(pc);
+ if (leftover) {
+ ERR("Unknown argument: %s", leftover);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
ret = view_trace();
end:
ret = view_trace();
end:
This page took
0.028407 seconds
and
4
git commands to generate.