Fix: lttng: -Wshadow error in cmd_snapshot
[lttng-tools.git] / src / bin / lttng / command.h
CommitLineData
f3ed775e 1/*
ab5be9fa 2 * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
f3ed775e 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
f3ed775e 5 *
f3ed775e
DG
6 */
7
8#ifndef _LTTNG_CMD_H
9#define _LTTNG_CMD_H
10
11#include <lttng/lttng.h>
990570ed
DG
12#include <common/common.h>
13#include <common/defaults.h>
f3ed775e 14
c399183f
DG
15#include "conf.h"
16#include "utils.h"
17
5e71a0e8
PP
18#define DECL_COMMAND(_name) \
19 extern int cmd_##_name(int, const char **)
20
4fc83d94
PP
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
4ba92f18
PP
29#define SHOW_HELP() \
30 do { \
4fc83d94 31 ret = show_cmd_help(argv[0], HELP_MSG_NAME); \
4ba92f18
PP
32 \
33 if (ret) { \
4fc83d94 34 SHOW_HELP_ERROR_LINE \
960afba4 35 ret = CMD_ERROR; \
4ba92f18
PP
36 } \
37 } while (0)
38
f3ed775e 39enum cmd_error_code {
42224349 40 CMD_SUCCESS = 0,
f3ed775e
DG
41 CMD_ERROR,
42 CMD_UNDEFINED,
f3ed775e 43 CMD_FATAL,
d16c1a4c 44 CMD_WARNING,
4ce78777 45 CMD_UNSUPPORTED,
f3ed775e
DG
46};
47
48struct cmd_struct {
49 const char *name;
50 int (*func)(int argc, const char **argv);
51};
52
5e71a0e8 53DECL_COMMAND(list);
54a0adbf 54DECL_COMMAND(status);
5e71a0e8
PP
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);
5e71a0e8
PP
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);
93ec662e 74DECL_COMMAND(metadata);
eded6438 75DECL_COMMAND(regenerate);
d68c9a04 76DECL_COMMAND(rotate);
259c2674
JD
77DECL_COMMAND(enable_rotation);
78DECL_COMMAND(disable_rotation);
511ed4e2 79DECL_COMMAND(clear);
4624dad0 80DECL_COMMAND(add_trigger);
0de2479d 81DECL_COMMAND(list_triggers);
b61776fb 82DECL_COMMAND(remove_trigger);
f3ed775e 83
960afba4
PP
84extern int cmd_help(int argc, const char **argv,
85 const struct cmd_struct commands[]);
86
f3ed775e 87#endif /* _LTTNG_CMD_H */
This page took 0.060557 seconds and 4 git commands to generate.