aboutsummaryrefslogtreecommitdiff
path: root/src/daemon.h
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2009-07-19 08:18:23 +0200
committerMax Kellermann <max@duempel.org>2009-07-19 08:18:23 +0200
commit809c96b53f265fd59e9f660bac1990bf19089ba2 (patch)
treec493841244b085413f0db6c15e0d24f9c0e4fd81 /src/daemon.h
parent03e43356ce886eb359c0aac1a24aac56fbb0c59a (diff)
daemon: Moved empty Windows version functions to header file
On Windows only daemonize_close_stdin() function does something. Other functions are either empty or generate an error. Those have been moved to header file and declared static inline so compiler can remove the call all together.
Diffstat (limited to 'src/daemon.h')
-rw-r--r--src/daemon.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/daemon.h b/src/daemon.h
index 46a4c4f7..1332eaf4 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -22,18 +22,36 @@
#include <stdbool.h>
+#ifndef WIN32
void
daemonize_init(const char *user, const char *group, const char *pidfile);
+#else
+static inline void
+daemonize_init(const char *user, const char *group, const char *pidfile)
+{ (void)user; (void)group; (void)pidfile; }
+#endif
+#ifndef WIN32
void
daemonize_finish(void);
+#else
+static inline void
+daemonize_finish(void)
+{ /* nop */ }
+#endif
/**
* Kill the MPD which is currently running, pid determined from the
* pid file.
*/
+#ifndef WIN32
void
daemonize_kill(void);
+#else
+static inline void
+daemonize_kill(void)
+{ g_error("--kill is not available on WIN32"); }
+#endif
/**
* Close stdin (fd 0) and re-open it as /dev/null.
@@ -44,10 +62,22 @@ daemonize_close_stdin(void);
/**
* Change to the configured Unix user.
*/
+#ifndef WIN32
void
daemonize_set_user(void);
+#else
+static inline void
+daemonize_set_user(void)
+{ /* nop */ }
+#endif
+#ifndef WIN32
void
daemonize(bool detach);
+#else
+static inline void
+daemonize(bool detach)
+{ (void)detach; }
+#endif
#endif