projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Common stuff now builds as a library.
[collectd.git]
/
src
/
daemon
/
collectd.c
diff --git
a/src/daemon/collectd.c
b/src/daemon/collectd.c
index
af8fb56
..
9ab929b
100644
(file)
--- a/
src/daemon/collectd.c
+++ b/
src/daemon/collectd.c
@@
-47,16
+47,6
@@
#define COLLECTD_LOCALE "C"
#endif
#define COLLECTD_LOCALE "C"
#endif
-/*
- * Global variables
- */
-char hostname_g[DATA_MAX_NAME_LEN];
-cdtime_t interval_g;
-int timeout_g;
-#if HAVE_LIBKSTAT
-kstat_ctl_t *kc;
-#endif /* HAVE_LIBKSTAT */
-
static int loop = 0;
static void *do_flush(void __attribute__((unused)) * arg) {
static int loop = 0;
static void *do_flush(void __attribute__((unused)) * arg) {
@@
-93,11
+83,11
@@
static int init_hostname(void) {
str = global_option_get("Hostname");
if ((str != NULL) && (str[0] != 0)) {
str = global_option_get("Hostname");
if ((str != NULL) && (str[0] != 0)) {
- sstrncpy(hostname_g, str,
sizeof(hostname_g)
);
+ sstrncpy(hostname_g, str,
hostname_g_size
);
return 0;
}
return 0;
}
- if (gethostname(hostname_g,
sizeof(hostname_g)
) != 0) {
+ if (gethostname(hostname_g,
hostname_g_size
) != 0) {
fprintf(stderr, "`gethostname' failed and no "
"hostname was configured.\n");
return -1;
fprintf(stderr, "`gethostname' failed and no "
"hostname was configured.\n");
return -1;
@@
-125,7
+115,7
@@
static int init_hostname(void) {
if (ai_ptr->ai_canonname == NULL)
continue;
if (ai_ptr->ai_canonname == NULL)
continue;
- sstrncpy(hostname_g, ai_ptr->ai_canonname,
sizeof(hostname_g)
);
+ sstrncpy(hostname_g, ai_ptr->ai_canonname,
hostname_g_size
);
break;
}
break;
}
@@
-617,7
+607,7
@@
int main(int argc, char **argv) {
status);
return 1;
}
status);
return 1;
}
- } /* if (daemonize) */
+ } /* if (
config.
daemonize) */
#endif /* COLLECT_DAEMON */
struct sigaction sig_pipe_action = {.sa_handler = SIG_IGN};
#endif /* COLLECT_DAEMON */
struct sigaction sig_pipe_action = {.sa_handler = SIG_IGN};
@@
-681,7
+671,7
@@
int main(int argc, char **argv) {
}
#if COLLECT_DAEMON
}
#if COLLECT_DAEMON
- if (daemonize)
+ if (
config.
daemonize)
pidfile_remove();
#endif /* COLLECT_DAEMON */
pidfile_remove();
#endif /* COLLECT_DAEMON */