projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't fail if syslog loglevel doesn't match
[collectd.git]
/
src
/
daemon
/
collectd.c
diff --git
a/src/daemon/collectd.c
b/src/daemon/collectd.c
index
0149f40
..
78d410c
100644
(file)
--- a/
src/daemon/collectd.c
+++ b/
src/daemon/collectd.c
@@
-28,9
+28,9
@@
#include "cmd.h"
#include "collectd.h"
#include "cmd.h"
#include "collectd.h"
-#include "common.h"
#include "configfile.h"
#include "plugin.h"
#include "configfile.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <netdb.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/types.h>
@@
-51,6
+51,14
@@
#define COLLECTD_LOCALE "C"
#endif
#define COLLECTD_LOCALE "C"
#endif
+#ifdef WIN32
+#undef COLLECT_DAEMON
+#include <unistd.h>
+#undef gethostname
+#include <locale.h>
+#include <winsock2.h>
+#endif
+
static int loop;
static int init_hostname(void) {
static int loop;
static int init_hostname(void) {
@@
-60,10
+68,14
@@
static int init_hostname(void) {
return 0;
}
return 0;
}
+#ifdef WIN32
+ long hostname_len = NI_MAXHOST;
+#else
long hostname_len = sysconf(_SC_HOST_NAME_MAX);
if (hostname_len == -1) {
hostname_len = NI_MAXHOST;
}
long hostname_len = sysconf(_SC_HOST_NAME_MAX);
if (hostname_len == -1) {
hostname_len = NI_MAXHOST;
}
+#endif /* WIN32 */
char hostname[hostname_len];
if (gethostname(hostname, hostname_len) != 0) {
char hostname[hostname_len];
if (gethostname(hostname, hostname_len) != 0) {
@@
-295,11
+307,12
@@
static int do_shutdown(void) {
static void read_cmdline(int argc, char **argv, struct cmdline_config *config) {
/* read options */
while (1) {
static void read_cmdline(int argc, char **argv, struct cmdline_config *config) {
/* read options */
while (1) {
- int c = getopt(argc, argv, "BhtTC:"
+ int c = getopt(argc, argv,
+ "BhtTC:"
#if COLLECT_DAEMON
#if COLLECT_DAEMON
-
"fP:"
+ "fP:"
#endif
#endif
-
);
+ );
if (c == -1)
break;
if (c == -1)
break;
@@
-345,8
+358,7
@@
static int configure_collectd(struct cmdline_config *config) {
* Also, this will automatically load modules.
*/
if (cf_read(config->configfile)) {
* Also, this will automatically load modules.
*/
if (cf_read(config->configfile)) {
- fprintf(stderr, "Error: Reading the config file failed!\n"
- "Read the logs for details.\n");
+ fprintf(stderr, "Error: Parsing the config file failed!\n");
return 1;
}
return 1;
}
@@
-380,7
+392,9
@@
void stop_collectd(void) { loop++; }
struct cmdline_config init_config(int argc, char **argv) {
struct cmdline_config config = {
struct cmdline_config init_config(int argc, char **argv) {
struct cmdline_config config = {
- .daemonize = true, .create_basedir = true, .configfile = CONFIGFILE,
+ .daemonize = true,
+ .create_basedir = true,
+ .configfile = CONFIGFILE,
};
read_cmdline(argc, argv, &config);
};
read_cmdline(argc, argv, &config);