X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommand.h;h=72cf4e0ff0334ab5add1bf629b0b6aec4f3b8992;hb=01f55be4d700e2241e96f50794d7f887024744c2;hp=a4f06d446011809783f4613bf083edb608ff567d;hpb=ccf10263bcd2ca4667b9e1fc4dab64a3c8d8c4d8;p=lttng-tools.git diff --git a/src/bin/lttng/command.h b/src/bin/lttng/command.h index a4f06d446..72cf4e0ff 100644 --- a/src/bin/lttng/command.h +++ b/src/bin/lttng/command.h @@ -25,6 +25,20 @@ #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"); \ + ret = CMD_ERROR; \ + } \ + } while (0) + enum cmd_error_code { CMD_SUCCESS = 0, CMD_ERROR, @@ -39,26 +53,31 @@ 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); -extern int cmd_save(int argc, const char **argv); -extern int cmd_load(int argc, const char **argv); -extern int cmd_track(int argc, const char **argv); -extern int cmd_untrack(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); + +extern int cmd_help(int argc, const char **argv, + const struct cmd_struct commands[]); #endif /* _LTTNG_CMD_H */