projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'github/pr/1952'
[collectd.git]
/
src
/
ntpd.c
diff --git
a/src/ntpd.c
b/src/ntpd.c
index
e075a20
..
7f6f982
100644
(file)
--- a/
src/ntpd.c
+++ b/
src/ntpd.c
@@
-28,9
+28,9
@@
#define _BSD_SOURCE /* For NI_MAXHOST */
#include "collectd.h"
#define _BSD_SOURCE /* For NI_MAXHOST */
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
-#include "configfile.h"
#if HAVE_STDINT_H
# include <stdint.h>
#if HAVE_STDINT_H
# include <stdint.h>
@@
-313,16
+313,11
@@
static int ntpd_config (const char *key, const char *value)
static void ntpd_submit (const char *type, const char *type_inst, gauge_t value)
{
static void ntpd_submit (const char *type, const char *type_inst, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin));
sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
@@
-347,7
+342,6
@@
static int ntpd_connect (void)
const char *port;
struct addrinfo *ai_list;
const char *port;
struct addrinfo *ai_list;
- struct addrinfo *ai_ptr;
int status;
if (sock_descr >= 0)
int status;
if (sock_descr >= 0)
@@
-364,7
+358,7
@@
static int ntpd_connect (void)
port = NTPD_DEFAULT_PORT;
struct addrinfo ai_hints = {
port = NTPD_DEFAULT_PORT;
struct addrinfo ai_hints = {
- .ai_family =
P
F_UNSPEC,
+ .ai_family =
A
F_UNSPEC,
.ai_flags = AI_ADDRCONFIG,
.ai_protocol = IPPROTO_UDP,
.ai_socktype = SOCK_DGRAM
.ai_flags = AI_ADDRCONFIG,
.ai_protocol = IPPROTO_UDP,
.ai_socktype = SOCK_DGRAM
@@
-381,7
+375,7
@@
static int ntpd_connect (void)
return (-1);
}
return (-1);
}
- for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
+ for (
struct addrinfo *
ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
{
/* create our socket descriptor */
if ((sock_descr = socket (ai_ptr->ai_family,
{
/* create our socket descriptor */
if ((sock_descr = socket (ai_ptr->ai_family,
@@
-419,7
+413,6
@@
static int ntpd_receive_response (int *res_items, int *res_size,
struct resp_pkt res;
int status;
int done;
struct resp_pkt res;
int status;
int done;
- int i;
char *items;
size_t items_num;
char *items;
size_t items_num;
@@
-673,7
+666,7
@@
static int ntpd_receive_response (int *res_items, int *res_size,
items_num += pkt_item_num;
*res_data = items;
items_num += pkt_item_num;
*res_data = items;
- for (i = 0; i < pkt_item_num; i++)
+ for (i
nt i
= 0; i < pkt_item_num; i++)
{
/* dst: There are already `*res_items' items with
* res_item_size bytes each in in `*res_data'. Set
{
/* dst: There are already `*res_items' items with
* res_item_size bytes each in in `*res_data'. Set
@@
-902,7
+895,6
@@
static int ntpd_read (void)
gauge_t offset_error;
int status;
gauge_t offset_error;
int status;
- int i;
/* On Linux, if the STA_NANO bit is set in ik->status, then ik->offset
* is is nanoseconds, otherwise it's microseconds. */
/* On Linux, if the STA_NANO bit is set in ik->status, then ik->offset
* is is nanoseconds, otherwise it's microseconds. */
@@
-970,7
+962,7
@@
static int ntpd_read (void)
return (-1);
}
return (-1);
}
- for (i = 0; i < ps_num; i++)
+ for (i
nt i
= 0; i < ps_num; i++)
{
struct info_peer_summary *ptr;
double offset;
{
struct info_peer_summary *ptr;
double offset;