projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CLI: Implement lttng clear session command
[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 40d2a77d94b48b9d8435948c2c2b557ade3792ed..d2741c37309239697ab9d7b30fed98ee5011f2c9 100644
(file)
--- a/
src/bin/lttng/commands/create.c
+++ b/
src/bin/lttng/commands/create.c
@@
-49,7
+49,13
@@
static char *opt_shm_path;
static int opt_no_consumer;
static int opt_no_output;
static int opt_snapshot;
static int opt_no_consumer;
static int opt_no_output;
static int opt_snapshot;
-static unsigned int opt_live_timer;
+static uint32_t opt_live_timer;
+
+#ifdef LTTNG_EMBED_HELP
+static const char help_msg[] =
+#include <lttng-create.1.h>
+;
+#endif
enum {
OPT_HELP = 1,
enum {
OPT_HELP = 1,
@@
-436,7
+442,7
@@
static int create_session(void)
MSG("Traces will be written in %s", print_str_url);
if (opt_live_timer) {
MSG("Traces will be written in %s", print_str_url);
if (opt_live_timer) {
- MSG("Live timer set to %u
usec", opt_live_timer
);
+ MSG("Live timer set to %u
%s", opt_live_timer, USEC_UNIT
);
}
} else if (opt_snapshot) {
if (print_str_url) {
}
} else if (opt_snapshot) {
if (print_str_url) {
@@
-619,6
+625,7
@@
int cmd_create(int argc, const char **argv)
{
int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
char *opt_arg = NULL;
{
int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
char *opt_arg = NULL;
+ const char *leftover = NULL;
static poptContext pc;
pc = poptGetContext(NULL, argc, argv, long_options, 0);
static poptContext pc;
pc = poptGetContext(NULL, argc, argv, long_options, 0);
@@
-634,7
+641,7
@@
int cmd_create(int argc, const char **argv)
goto end;
case OPT_LIVE_TIMER:
{
goto end;
case OPT_LIVE_TIMER:
{
- u
nsigned long
v;
+ u
int64_t
v;
errno = 0;
opt_arg = poptGetOptArg(pc);
errno = 0;
opt_arg = poptGetOptArg(pc);
@@
-646,22
+653,24
@@
int cmd_create(int argc, const char **argv)
break;
}
break;
}
- v = strtoul(opt_arg, NULL, 0);
- if (errno != 0 || !isdigit(opt_arg[0])) {
- ERR("Wrong value in --live parameter: %s", opt_arg);
+ if (utils_parse_time_suffix(opt_arg, &v) < 0) {
+ ERR("Wrong value for --live parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
ret = CMD_ERROR;
goto end;
}
+
if (v != (uint32_t) v) {
ERR("32-bit overflow in --live parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
if (v != (uint32_t) v) {
ERR("32-bit overflow in --live parameter: %s", opt_arg);
ret = CMD_ERROR;
goto end;
}
+
if (v == 0) {
ERR("Live timer interval must be greater than zero");
ret = CMD_ERROR;
goto end;
}
if (v == 0) {
ERR("Live timer interval must be greater than zero");
ret = CMD_ERROR;
goto end;
}
+
opt_live_timer = (uint32_t) v;
DBG("Session live timer interval set to %d", opt_live_timer);
break;
opt_live_timer = (uint32_t) v;
DBG("Session live timer interval set to %d", opt_live_timer);
break;
@@
-713,6
+722,13
@@
int cmd_create(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;
+ }
+
command_ret = create_session();
if (command_ret) {
success = 0;
command_ret = create_session();
if (command_ret) {
success = 0;
This page took
0.026545 seconds
and
5
git commands to generate.