projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
amqp, write_graphite and write_kafka plugins: Implement the "[Graphite]PreserveSepara...
[collectd.git]
/
src
/
uptime.c
diff --git
a/src/uptime.c
b/src/uptime.c
index
345128d
..
f0e1a6f
100644
(file)
--- a/
src/uptime.c
+++ b/
src/uptime.c
@@
-20,6
+20,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
@@
-57,17
+58,13
@@
static time_t boottime;
extern kstat_ctl_t *kc;
#endif /* #endif HAVE_LIBKSTAT */
extern kstat_ctl_t *kc;
#endif /* #endif HAVE_LIBKSTAT */
-static void uptime_submit (gauge_t
uptim
e)
+static void uptime_submit (gauge_t
valu
e)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = uptime;
-
- 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, "uptime", sizeof (vl.plugin));
sstrncpy (vl.type, "uptime", sizeof (vl.type));
sstrncpy (vl.plugin, "uptime", sizeof (vl.plugin));
sstrncpy (vl.type, "uptime", sizeof (vl.type));
@@
-179,17
+176,13
@@
static int uptime_init (void) /* {{{ */
/* #endif HAVE_LIBKSTAT */
# elif HAVE_SYS_SYSCTL_H
/* #endif HAVE_LIBKSTAT */
# elif HAVE_SYS_SYSCTL_H
- struct timeval boottv;
+ struct timeval boottv
= { 0 }
;
size_t boottv_len;
int status;
size_t boottv_len;
int status;
- int mib[2];
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_BOOTTIME;
+ int mib[] = { CTL_KERN, KERN_BOOTTIME };
boottv_len = sizeof (boottv);
boottv_len = sizeof (boottv);
- memset (&boottv, 0, boottv_len);
status = sysctl (mib, STATIC_ARRAY_SIZE (mib), &boottv, &boottv_len,
/* new_value = */ NULL, /* new_length = */ 0);
status = sysctl (mib, STATIC_ARRAY_SIZE (mib), &boottv, &boottv_len,
/* new_value = */ NULL, /* new_length = */ 0);