# include <poll.h>
#endif
-static data_source_t seconds_dsrc[1] =
-{
- {"seconds", DS_TYPE_GAUGE, -1000000.0, 1000000.0}
-};
-
-static data_set_t time_offset_ds =
-{
- "time_offset", 1, seconds_dsrc
-};
-
-static data_set_t time_dispersion_ds =
-{
- "time_dispersion", 1, seconds_dsrc
-};
-
-static data_set_t delay_ds =
-{
- "delay", 1, seconds_dsrc
-};
-
-static data_source_t ppm_dsrc[1] =
-{
- {"ppm", DS_TYPE_GAUGE, -1000000.0, 1000000.0}
-};
-
-static data_set_t frequency_offset_ds =
-{
- "frequency_offset", 1, ppm_dsrc
-};
-
static const char *config_keys[] =
{
"Host",
if ((status = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
- DEBUG ("getaddrinfo (%s, %s): %s",
- host, port,
- status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
+ char errbuf[1024];
ERROR ("ntpd plugin: getaddrinfo (%s, %s): %s",
host, port,
- status == EAI_SYSTEM ? strerror (errno) : gai_strerror (status));
+ (status == EAI_SYSTEM)
+ ? sstrerror (errno, errbuf, sizeof (errbuf))
+ : gai_strerror (status));
return (-1);
}
if (gettimeofday (&time_end, NULL) < 0)
{
+ char errbuf[1024];
ERROR ("ntpd plugin: gettimeofday failed: %s",
- strerror (errno));
+ sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
time_end.tv_sec++; /* wait for a most one second */
{
if (gettimeofday (&time_now, NULL) < 0)
{
+ char errbuf[1024];
ERROR ("ntpd plugin: gettimeofday failed: %s",
- strerror (errno));
+ sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
if (status < 0)
{
- DEBUG ("poll failed: %s", strerror (errno));
+ char errbuf[1024];
ERROR ("ntpd plugin: poll failed: %s",
- strerror (errno));
+ sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
if (status < 0)
{
- DEBUG ("recv(2) failed: %s", strerror (errno));
+ char errbuf[1024];
+ DEBUG ("recv(2) failed: %s",
+ sstrerror (errno, errbuf, sizeof (errbuf)));
DEBUG ("Closing socket #%i", sd);
close (sd);
sock_descr = sd = -1;
NULL, 0, 0 /* no flags */);
if (status != 0)
{
+ char errbuf[1024];
ERROR ("ntpd plugin: getnameinfo failed: %s",
- status == EAI_SYSTEM
- ? strerror (errno)
+ (status == EAI_SYSTEM)
+ ? sstrerror (errno, errbuf, sizeof (errbuf))
: gai_strerror (status));
continue;
}
void module_register (void)
{
- plugin_register_data_set (&time_offset_ds);
- plugin_register_data_set (&time_dispersion_ds);
- plugin_register_data_set (&delay_ds);
- plugin_register_data_set (&frequency_offset_ds);
-
#if NTPD_HAVE_READ
- plugin_register_config ("ntpd", ntpd_config, config_keys, config_keys_num);
+ plugin_register_config ("ntpd", ntpd_config,
+ config_keys, config_keys_num);
plugin_register_read ("ntpd", ntpd_read);
#endif /* NTPD_HAVE_READ */
-}
+} /* void module_register */