projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4c763ee
)
Tidy up formatting with clang-format.
author
campbellsean@google.com
<campbellsean@google.com>
Wed, 18 Oct 2017 20:39:29 +0000
(16:39 -0400)
committer
campbellsean@google.com
<campbellsean@google.com>
Wed, 18 Oct 2017 20:39:29 +0000
(16:39 -0400)
src/daemon/collectd.c
patch
|
blob
|
history
src/daemon/configfile.c
patch
|
blob
|
history
src/daemon/globals.c
patch
|
blob
|
history
src/daemon/globals.h
patch
|
blob
|
history
src/daemon/plugin.h
patch
|
blob
|
history
src/perl.c
patch
|
blob
|
history
diff --git
a/src/daemon/collectd.c
b/src/daemon/collectd.c
index
2784539
..
791199f
100644
(file)
--- a/
src/daemon/collectd.c
+++ b/
src/daemon/collectd.c
@@
-464,11
+464,12
@@
void read_cmdline(int argc, char **argv, struct cmdline_config *config) {
/* read options */
while (1) {
int c;
/* read options */
while (1) {
int c;
- c = getopt(argc, argv, "htTC:"
+ c = getopt(argc, argv,
+ "htTC:"
#if COLLECT_DAEMON
#if COLLECT_DAEMON
-
"fP:"
+ "fP:"
#endif
#endif
-
);
+ );
if (c == -1)
break;
if (c == -1)
break;
@@
-553,7
+554,9
@@
int main(int argc, char **argv) {
int exit_status = 0;
struct cmdline_config config = {
int exit_status = 0;
struct cmdline_config config = {
- .daemonize = 1, .create_basedir = 1, .configfile = CONFIGFILE,
+ .daemonize = 1,
+ .create_basedir = 1,
+ .configfile = CONFIGFILE,
};
read_cmdline(argc, argv, &config);
};
read_cmdline(argc, argv, &config);
@@
-586,7
+589,7
@@
int main(int argc, char **argv) {
#ifdef KERNEL_LINUX
&& notify_upstart() == 0 && notify_systemd() == 0
#endif
#ifdef KERNEL_LINUX
&& notify_upstart() == 0 && notify_systemd() == 0
#endif
-
) {
+ ) {
int status;
if ((pid = fork()) == -1) {
int status;
if ((pid = fork()) == -1) {
diff --git
a/src/daemon/configfile.c
b/src/daemon/configfile.c
index
eb6f413
..
83e44b7
100644
(file)
--- a/
src/daemon/configfile.c
+++ b/
src/daemon/configfile.c
@@
-874,7
+874,8
@@
const char *global_option_get(const char *option) {
return NULL;
}
return NULL;
}
- return (cf_global_options[i].value != NULL) ? cf_global_options[i].value : cf_global_options[i].def;
+ return (cf_global_options[i].value != NULL) ? cf_global_options[i].value
+ : cf_global_options[i].def;
} /* char *global_option_get */
long global_option_get_long(const char *option, long default_value) {
} /* char *global_option_get */
long global_option_get_long(const char *option, long default_value) {
diff --git
a/src/daemon/globals.c
b/src/daemon/globals.c
index
9b0aec7
..
3d3c7ab
100644
(file)
--- a/
src/daemon/globals.c
+++ b/
src/daemon/globals.c
@@
-21,8
+21,8
@@
* DEALINGS IN THE SOFTWARE.
**/
* DEALINGS IN THE SOFTWARE.
**/
-#include "common.h"
#include "globals.h"
#include "globals.h"
+#include "common.h"
#if HAVE_KSTAT_H
#include <kstat.h>
#if HAVE_KSTAT_H
#include <kstat.h>
@@
-33,17
+33,16
@@
*/
char *hostname_g;
cdtime_t interval_g;
*/
char *hostname_g;
cdtime_t interval_g;
-int
timeout_g;
+int timeout_g;
#if HAVE_KSTAT_H
kstat_ctl_t *kc;
#endif
void hostname_set(char const *hostname) {
#if HAVE_KSTAT_H
kstat_ctl_t *kc;
#endif
void hostname_set(char const *hostname) {
-
char *h = strdup(hostname);
-
if (h == NULL)
-
return;
+ char *h = strdup(hostname);
+ if (h == NULL)
+ return;
-
free(hostname_g);
-
hostname_g = h;
+ free(hostname_g);
+ hostname_g = h;
}
}
-
diff --git
a/src/daemon/globals.h
b/src/daemon/globals.h
index
587b223
..
bc11d6b
100644
(file)
--- a/
src/daemon/globals.h
+++ b/
src/daemon/globals.h
@@
-36,8
+36,8
@@
typedef uint64_t cdtime_t;
/* hostname_set updates hostname_g */
void hostname_set(char const *hostname);
/* hostname_set updates hostname_g */
void hostname_set(char const *hostname);
-extern char
*hostname_g;
-extern cdtime_t
interval_g;
-extern int
pidfile_from_cli;
-extern int
timeout_g;
+extern char *hostname_g;
+extern cdtime_t interval_g;
+extern int pidfile_from_cli;
+extern int timeout_g;
#endif /* GLOBALS_H */
#endif /* GLOBALS_H */
diff --git
a/src/daemon/plugin.h
b/src/daemon/plugin.h
index
095d662
..
a9ee72d
100644
(file)
--- a/
src/daemon/plugin.h
+++ b/
src/daemon/plugin.h
@@
-42,13
+42,13
@@
#define DS_TYPE_ABSOLUTE 3
#define DS_TYPE_TO_STRING(t) \
#define DS_TYPE_ABSOLUTE 3
#define DS_TYPE_TO_STRING(t) \
- (t == DS_TYPE_COUNTER)
? "counter" : (t == DS_TYPE_GAUGE)
\
-
? "gauge"
\
-
: (t == DS_TYPE_DERIVE)
\
-
? "derive"
\
-
: (t == DS_TYPE_ABSOLUTE)
\
-
? "absolute"
\
-
: "unknown"
+ (t == DS_TYPE_COUNTER)
\
+
? "counter"
\
+
: (t == DS_TYPE_GAUGE)
\
+
? "gauge"
\
+
: (t == DS_TYPE_DERIVE)
\
+
? "derive"
\
+
: (t == DS_TYPE_ABSOLUTE) ? "absolute"
: "unknown"
#ifndef LOG_ERR
#define LOG_ERR 3
#ifndef LOG_ERR
#define LOG_ERR 3
diff --git
a/src/perl.c
b/src/perl.c
index
9268086
..
671d1f3
100644
(file)
--- a/
src/perl.c
+++ b/
src/perl.c
@@
-2093,7
+2093,7
@@
static int perl_init(void) {
/* Lock the base thread to avoid race conditions with c_ithread_create().
* See https://github.com/collectd/collectd/issues/9 and
* https://github.com/collectd/collectd/issues/1706 for details.
/* Lock the base thread to avoid race conditions with c_ithread_create().
* See https://github.com/collectd/collectd/issues/9 and
* https://github.com/collectd/collectd/issues/1706 for details.
- */
+
*/
assert(aTHX == perl_threads->head->interp);
pthread_mutex_lock(&perl_threads->mutex);
assert(aTHX == perl_threads->head->interp);
pthread_mutex_lock(&perl_threads->mutex);
@@
-2184,7
+2184,7
@@
static void perl_log(int level, const char *msg, user_data_t *user_data) {
/* Lock the base thread if this is not called from one of the read threads
* to avoid race conditions with c_ithread_create(). See
* https://github.com/collectd/collectd/issues/9 for details.
/* Lock the base thread if this is not called from one of the read threads
* to avoid race conditions with c_ithread_create(). See
* https://github.com/collectd/collectd/issues/9 for details.
- */
+
*/
if (aTHX == perl_threads->head->interp)
pthread_mutex_lock(&perl_threads->mutex);
if (aTHX == perl_threads->head->interp)
pthread_mutex_lock(&perl_threads->mutex);
@@
-2343,14
+2343,25
@@
static int g_interval_set(pTHX_ SV *var, MAGIC *mg) {
return 0;
} /* static int g_interval_set (pTHX_ SV *, MAGIC *) */
return 0;
} /* static int g_interval_set (pTHX_ SV *, MAGIC *) */
-static MGVTBL g_pv_vtbl = {g_pv_get, g_pv_set, NULL, NULL, NULL, NULL, NULL
+static MGVTBL g_pv_vtbl = {g_pv_get,
+ g_pv_set,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
,
NULL
#endif
};
#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
,
NULL
#endif
};
-static MGVTBL g_interval_vtbl = {g_interval_get, g_interval_set, NULL, NULL,
- NULL, NULL, NULL
+static MGVTBL g_interval_vtbl = {g_interval_get,
+ g_interval_set,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
,
NULL
#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
,
NULL
@@
-2385,8
+2396,8
@@
static void xs_init(pTHX) {
* tie() in Perl) */
/* global strings */
struct {
* tie() in Perl) */
/* global strings */
struct {
-
char name[64];
-
char *var;
+ char name[64];
+ char *var;
} g_strings[] = {{"Collectd::hostname_g", hostname_g}, {"", NULL}};
for (int i = 0; '\0' != g_strings[i].name[0]; ++i) {
} g_strings[] = {{"Collectd::hostname_g", hostname_g}, {"", NULL}};
for (int i = 0; '\0' != g_strings[i].name[0]; ++i) {