Do not declare struct meant for internal usage (#16951)
vkalintiris committed
Feb 6, 2024 at 22:00 UTC
c7f60b17882a3c9b2480f5e7d0a1896f65971db6
2 files changed
+19
-30
src/daemon/main.c
+19
-15
@@ -734,21 +734,25 @@ void cancel_main_threads() {
734
freez(static_threads);
735
}
736
737
-struct option_def option_definitions[] = {
738
- // opt description arg name default value
739
- { 'c', "Configuration file to load.", "filename", CONFIG_DIR "/" CONFIG_FILENAME},
740
- { 'D', "Do not fork. Run in the foreground.", NULL, "run in the background"},
741
- { 'd', "Fork. Run in the background.", NULL, "run in the background"},
742
- { 'h', "Display this help message.", NULL, NULL},
743
- { 'P', "File to save a pid while running.", "filename", "do not save pid to a file"},
744
- { 'i', "The IP address to listen to.", "IP", "all IP addresses IPv4 and IPv6"},
745
- { 'p', "API/Web port to use.", "port", "19999"},
746
- { 's', "Prefix for /proc and /sys (for containers).", "path", "no prefix"},
747
- { 't', "The internal clock of netdata.", "seconds", "1"},
748
- { 'u', "Run as user.", "username", "netdata"},
749
- { 'v', "Print netdata version and exit.", NULL, NULL},
750
- { 'V', "Print netdata version and exit.", NULL, NULL},
751
- { 'W', "See Advanced options below.", "options", NULL},
737
+static const struct option_def {
738
+ const char val;
739
+ const char *description;
740
+ const char *arg_name;
741
+ const char *default_value;
742
+} option_definitions[] = {
743
+ {'c', "Configuration file to load.", "filename", CONFIG_DIR "/" CONFIG_FILENAME},
744
+ {'D', "Do not fork. Run in the foreground.", NULL, "run in the background"},
745
+ {'d', "Fork. Run in the background.", NULL, "run in the background"},
746
+ {'h', "Display this help message.", NULL, NULL},
747
+ {'P', "File to save a pid while running.", "filename", "do not save pid to a file"},
748
+ {'i', "The IP address to listen to.", "IP", "all IP addresses IPv4 and IPv6"},
749
+ {'p', "API/Web port to use.", "port", "19999"},
750
+ {'s', "Prefix for /proc and /sys (for containers).", "path", "no prefix"},
751
+ {'t', "The internal clock of netdata.", "seconds", "1"},
752
+ {'u', "Run as user.", "username", "netdata"},
753
+ {'v', "Print netdata version and exit.", NULL, NULL},
754
+ {'V', "Print netdata version and exit.", NULL, NULL},
755
+ {'W', "See Advanced options below.", "options", NULL},
756
};
757
758
int help(int exitcode) {
src/daemon/main.h
-15
@@ -7,21 +7,6 @@
7
8
extern struct config netdata_config;
9
10
-/**
11
- * This struct contains information about command line options.
12
- */
13
-struct option_def {
14
- /** The option character */
15
- const char val;
16
- /** The name of the long option. */
17
- const char *description;
18
- /** Short description what the option does */
19
- /** Name of the argument displayed in SYNOPSIS */
20
- const char *arg_name;
21
- /** Default value if not set */
22
- const char *default_value;
23
-};
24
-
10
void cancel_main_threads(void);
11
int killpid(pid_t pid);
12