summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e7b862)
raw | patch | inline | side by side (parent: 2e7b862)
author | octo <octo> | |
Sun, 18 Dec 2005 22:04:43 +0000 (22:04 +0000) | ||
committer | octo <octo> | |
Sun, 18 Dec 2005 22:04:43 +0000 (22:04 +0000) |
src/collectd.c | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index 069fb1ecad2bb03b6800fa288712913bc2187d30..9794577512452b2346c22ff5d23ed317c5bcc16c 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
*/
time_t curtime;
-#ifdef HAVE_LIBRRD
+#if HAVE_LIBRRD
int operating_mode;
#endif
-void sigIntHandler (int signal)
+static void sigIntHandler (int signal)
{
loop++;
}
-int change_basedir (char *dir)
+static int change_basedir (char *dir)
{
int dirlen = strlen (dir);
}
return (0);
-}
+} /* static int start_server (void) */
#endif /* HAVE_LIBRRD */
-int pidfile_create (char *file)
+#if COLLECT_DAEMON
+static int pidfile_create (const char *file)
{
FILE *fh;
fclose(fh);
return (0);
-}
+} /* static int pidfile_create (const char *file) */
+#endif /* COLLECT_DAEMON */
-int pidfile_remove (void)
+#if COLLECT_DAEMON
+static int pidfile_remove (const char *file)
{
- return (unlink (PIDFILE));
-}
+ if (file == NULL) {
+ file = PIDFILE;
+ }
+ return (unlink (file));
+} /* static int pidfile_remove (const char *file) */
+#endif /* COLLECT_DAEMON */
int main (int argc, char **argv)
{
int daemonize = 1;
-#ifdef HAVE_LIBRRD
+#if HAVE_LIBRRD
operating_mode = MODE_LOCAL;
#endif
-
+
/* open syslog */
openlog (PACKAGE, LOG_CONS | LOG_PID, LOG_DAEMON);
/*
* run the actual loops
*/
-#ifdef HAVE_LIBRRD
+#if HAVE_LIBRRD
if (operating_mode == MODE_SERVER)
start_server ();
else /* if (operating_mode == MODE_CLIENT || operating_mode == MODE_LOCAL) */
syslog (LOG_INFO, "Exiting normally");
closelog ();
+#if COLLECT_DAEMON
if (daemonize)
- pidfile_remove();
+ pidfile_remove(pidfile);
+#endif /* COLLECT_DAEMON */
return (0);
-}
+} /* int main (int argc, char **argv) */