main.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_MAIN_H
  3. #define NETDATA_MAIN_H 1
  4. #include "common.h"
  5. extern struct config netdata_config;
  6. #define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES
  7. #define NETDATA_MAIN_THREAD_EXITING (CONFIG_BOOLEAN_YES + 1)
  8. #define NETDATA_MAIN_THREAD_EXITED CONFIG_BOOLEAN_NO
  9. /**
  10. * This struct contains information about command line options.
  11. */
  12. struct option_def {
  13. /** The option character */
  14. const char val;
  15. /** The name of the long option. */
  16. const char *description;
  17. /** Short description what the option does */
  18. /** Name of the argument displayed in SYNOPSIS */
  19. const char *arg_name;
  20. /** Default value if not set */
  21. const char *default_value;
  22. };
  23. struct netdata_static_thread {
  24. char *name; // the name of the thread as it should appear in the logs
  25. char *config_section; // the section of netdata.conf to check if this is enabled or not
  26. char *config_name; // the name of the config option to check if it is true or false
  27. volatile sig_atomic_t enabled; // the current status of the thread
  28. netdata_thread_t *thread; // internal use, to maintain a pointer to the created thread
  29. void (*init_routine) (void); // an initialization function to run before spawning the thread
  30. void *(*start_routine) (void *); // the threaded worker
  31. };
  32. extern void cancel_main_threads(void);
  33. extern int killpid(pid_t pid);
  34. extern void netdata_cleanup_and_exit(int ret) NORETURN;
  35. extern void send_statistics(const char *action, const char *action_result, const char *action_data);
  36. #endif /* NETDATA_MAIN_H */