summaryrefslogtreecommitdiff
path: root/src/daemon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon.h')
-rw-r--r--src/daemon.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/daemon.h b/src/daemon.h
new file mode 100644
index 0000000..d060cb8
--- /dev/null
+++ b/src/daemon.h
@@ -0,0 +1,36 @@
+#ifndef __DAEMON_H
+#define __DAEMON_H
+
+#include "errors.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int daemon_parent_pipe[2];
+extern int daemon_signal_pipe[2];
+
+typedef struct daemon_t *daemon_p;
+
+typedef struct daemon_params_t {
+ const char *daemon_name; /**< name of the daemon (used for setproctitle,
+ default name of the pidfile, logfile) */
+ const char *pid_filename; /**< name of the pid/lock file */
+ const char *group_name; /**< group of the effective user */
+ const char *user_name; /**< name of the effective user */
+} daemon_params_t;
+
+daemon_p daemon_new( daemon_params_t params,
+ error_t *error );
+
+void daemon_free( daemon_p demon );
+
+error_t daemon_start( daemon_p demon );
+
+void daemon_exit( daemon_p demon );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef __DAEMON_H */