X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommand.h;h=05c51663b90e011d3174100e04915593a365f8d2;hp=7965f55cee5063475aaa0fe78a6eed371b379ebe;hb=4ba92f185fb1d0b112cbc804a261939f5f81dc34;hpb=57f272edb1b4ccb8869e3f5b69eb5461bcb56101 diff --git a/src/bin/lttng/command.h b/src/bin/lttng/command.h index 7965f55ce..05c51663b 100644 --- a/src/bin/lttng/command.h +++ b/src/bin/lttng/command.h @@ -25,6 +25,19 @@ #include "conf.h" #include "utils.h" +#define DECL_COMMAND(_name) \ + extern int cmd_##_name(int, const char **) + +#define SHOW_HELP() \ + do { \ + ret = show_cmd_man_page(argv[0]); \ + \ + if (ret) { \ + ERR("Cannot view man page lttng-%s(1)", argv[0]); \ + perror("exec"); \ + } \ + } while (0) + enum cmd_error_code { CMD_SUCCESS = 0, CMD_ERROR, @@ -39,22 +52,28 @@ struct cmd_struct { int (*func)(int argc, const char **argv); }; -extern int cmd_list(int argc, const char **argv); -extern int cmd_create(int argc, const char **argv); -extern int cmd_destroy(int argc, const char **argv); -extern int cmd_start(int argc, const char **argv); -extern int cmd_stop(int argc, const char **argv); -extern int cmd_enable_events(int argc, const char **argv); -extern int cmd_disable_events(int argc, const char **argv); -extern int cmd_enable_channels(int argc, const char **argv); -extern int cmd_disable_channels(int argc, const char **argv); -extern int cmd_add_context(int argc, const char **argv); -extern int cmd_set_session(int argc, const char **argv); -extern int cmd_version(int argc, const char **argv); -extern int cmd_calibrate(int argc, const char **argv); -extern int cmd_view(int argc, const char **argv); -extern int cmd_enable_consumer(int argc, const char **argv); -extern int cmd_disable_consumer(int argc, const char **argv); -extern int cmd_snapshot(int argc, const char **argv); +DECL_COMMAND(list); +DECL_COMMAND(status); +DECL_COMMAND(create); +DECL_COMMAND(destroy); +DECL_COMMAND(start); +DECL_COMMAND(stop); +DECL_COMMAND(enable_events); +DECL_COMMAND(disable_events); +DECL_COMMAND(enable_channels); +DECL_COMMAND(disable_channels); +DECL_COMMAND(add_context); +DECL_COMMAND(set_session); +DECL_COMMAND(version); +DECL_COMMAND(calibrate); +DECL_COMMAND(view); +DECL_COMMAND(enable_consumer); +DECL_COMMAND(disable_consumer); +DECL_COMMAND(snapshot); +DECL_COMMAND(save); +DECL_COMMAND(load); +DECL_COMMAND(track); +DECL_COMMAND(untrack); +DECL_COMMAND(metadata); #endif /* _LTTNG_CMD_H */