#include "common.h"
#ifdef __APPLE__
#define INHERIT_NONE 0
#endif /* __APPLE__ */
#if defined(__FreeBSD__) || defined(__APPLE__)
# define O_NOATIME 0
# define MADV_DONTFORK INHERIT_NONE
#endif /* __FreeBSD__ || __APPLE__*/
char *netdata_configured_hostname = NULL;
char *netdata_configured_config_dir = NULL;
char *netdata_configured_log_dir = NULL;
char *netdata_configured_plugins_dir = NULL;
char *netdata_configured_web_dir = NULL;
char *netdata_configured_cache_dir = NULL;
char *netdata_configured_varlib_dir = NULL;
char *netdata_configured_home_dir = NULL;
char *netdata_configured_host_prefix = NULL;
int enable_ksm = 1;
volatile sig_atomic_t netdata_exit = 0;
const char *os_type = NETDATA_OS_TYPE;
const char *program_version = VERSION;
// ----------------------------------------------------------------------------
// memory allocation functions that handle failures
// although netdata does not use memory allocations too often (netdata tries to
// maintain its memory footprint stable during runtime, i.e. all buffers are
// allocated during initialization and are adapted to current use throughout
// its lifetime), these can be used to override the default system allocation
// routines.
#ifdef NETDATA_LOG_ALLOCATIONS
static struct memory_statistics {
volatile size_t malloc_calls_made;
volatile size_t calloc_calls_made;
volatile size_t realloc_calls_made;
volatile size_t strdup_calls_made;
volatile size_t free_calls_made;
volatile size_t memory_calls_made;
volatile size_t allocated_memory;
volatile size_t mmapped_memory;
} memory_statistics;
static inline void print_allocations(const char *file, const char *function, const unsigned long line) {
static struct