lttng: enable-event: wrap mi_writer use in a unique_ptr
[lttng-tools.git] / src / bin / lttng / command.hpp
... / ...
CommitLineData
1/*
2 * Copyright (C) 2011 EfficiOS Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8#ifndef _LTTNG_CMD_H
9#define _LTTNG_CMD_H
10
11#include "conf.hpp"
12#include "utils.hpp"
13
14#include <common/common.hpp>
15#include <common/defaults.hpp>
16
17#include <lttng/lttng.h>
18
19#define DECL_COMMAND(_name) extern int cmd_##_name(int, const char **)
20
21#ifdef LTTNG_EMBED_HELP
22#define HELP_MSG_NAME help_msg
23#define SHOW_HELP_ERROR_LINE ERR("Cannot show --help for `lttng-%s`", argv[0]);
24#else
25#define HELP_MSG_NAME NULL
26#define SHOW_HELP_ERROR_LINE ;
27#endif
28
29#define SHOW_HELP() \
30 do { \
31 ret = show_cmd_help(argv[0], HELP_MSG_NAME); \
32 \
33 if (ret) { \
34 SHOW_HELP_ERROR_LINE \
35 ret = CMD_ERROR; \
36 } \
37 } while (0)
38
39enum cmd_error_code {
40 CMD_SUCCESS = 0,
41 CMD_ERROR,
42 CMD_UNDEFINED,
43 CMD_FATAL,
44 CMD_WARNING,
45 CMD_UNSUPPORTED,
46};
47
48struct cmd_struct {
49 const char *name;
50 int (*func)(int argc, const char **argv);
51};
52
53DECL_COMMAND(list);
54DECL_COMMAND(status);
55DECL_COMMAND(create);
56DECL_COMMAND(destroy);
57DECL_COMMAND(start);
58DECL_COMMAND(stop);
59DECL_COMMAND(enable_events);
60DECL_COMMAND(disable_events);
61DECL_COMMAND(enable_channels);
62DECL_COMMAND(disable_channels);
63DECL_COMMAND(add_context);
64DECL_COMMAND(set_session);
65DECL_COMMAND(version);
66DECL_COMMAND(view);
67DECL_COMMAND(enable_consumer);
68DECL_COMMAND(disable_consumer);
69DECL_COMMAND(snapshot);
70DECL_COMMAND(save);
71DECL_COMMAND(load);
72DECL_COMMAND(track);
73DECL_COMMAND(untrack);
74DECL_COMMAND(metadata);
75DECL_COMMAND(regenerate);
76DECL_COMMAND(rotate);
77DECL_COMMAND(enable_rotation);
78DECL_COMMAND(disable_rotation);
79DECL_COMMAND(clear);
80DECL_COMMAND(add_trigger);
81DECL_COMMAND(list_triggers);
82DECL_COMMAND(remove_trigger);
83
84extern int cmd_help(int argc, const char **argv, const struct cmd_struct commands[]);
85
86#endif /* _LTTNG_CMD_H */
This page took 0.037032 seconds and 4 git commands to generate.