X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcollectd.c;h=1b9c3747a629fb6027460a3d1e88cb379c96ec4b;hb=681a607a4b1a95df1d53d3e6922ec70bd52f87cf;hp=eb5404f8fda21a148d3a6091fbd67814d63fd733;hpb=4e0e3d48dc921f9499f5e90400adb9a61b4406f5;p=collectd.git diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index eb5404f8..1b9c3747 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -308,7 +308,11 @@ static int do_init (void) #endif #if HAVE_LIBSTATGRAB - if (sg_init ()) + if (sg_init ( +# if HAVE_LIBSTATGRAB_0_90 + 0 +# endif + )) { ERROR ("sg_init: %s", sg_str_error (sg_get_error ())); return (-1); @@ -410,6 +414,7 @@ static int pidfile_remove (void) } /* static int pidfile_remove (const char *file) */ #endif /* COLLECT_DAEMON */ +#ifdef KERNEL_LINUX int notify_upstart (void) { const char *upstart_job = getenv("UPSTART_JOB"); @@ -475,6 +480,7 @@ int notify_systemd (void) close(fd); return 1; } +#endif /* KERNEL_LINUX */ int main (int argc, char **argv) { @@ -594,9 +600,13 @@ int main (int argc, char **argv) /* * Only daemonize if we're not being supervised - * by upstart or systemd. + * by upstart or systemd (when using Linux). */ - if (daemonize && notify_upstart() == 0 && notify_systemd() == 0) + if (daemonize +#ifdef KERNEL_LINUX + && notify_upstart() == 0 && notify_systemd() == 0 +#endif + ) { if ((pid = fork ()) == -1) {