]> mj.ucw.cz Git - libucw.git/commitdiff
Daemon: Preliminary documentation
authorMartin Mares <mj@ucw.cz>
Thu, 12 Jul 2012 16:44:57 +0000 (18:44 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 12 Jul 2012 16:44:57 +0000 (18:44 +0200)
ucw/daemon.h
ucw/doc/Makefile
ucw/doc/daemon.txt [new file with mode: 0644]

index 13f8c37a144df01711d3a953ab50b33bdc24a888..c00f00d1a5762d5e79b1729bc685ed352e03f503 100644 (file)
@@ -30,10 +30,24 @@ enum daemon_flags {
   DAEMON_FLAG_PRESERVE_CWD = 1,                // Skip chdir("/")
 };
 
+/**
+ * Daemon initialization. Should be run after parsing of options.
+ * It resolves the UID and GID to run with and locks the PID file.
+ * Upon error, it calls @die().
+ **/
 void daemon_init(struct daemon_params *dp);
 
+/**
+ * Run the daemon. Should be run when everything is initialized. It forks off
+ * a new process and does all necessary setup. Inside the new process, it calls
+ * @body (and when it returns, it exits the process). In the original process, it writes
+ * the PID file and returns.
+ **/
 void daemon_run(struct daemon_params *dp, void (*body)(struct daemon_params *dp));
 
+/**
+ * Clean up when the daemon is about to exit. It removes the PID file.
+ **/
 void daemon_exit(struct daemon_params *dp);
 
 #endif
index c386f4a0a370024910ae15b252bf65ae297e8d6c..92561d5088e5bf268ceb58ac3b9fcb59be83bb2e 100644 (file)
@@ -2,7 +2,7 @@
 
 DIRS+=ucw/doc
 
-UCW_DOCS=basics log fastbuf index config configure install basecode hash docsys conf mempool eltpool mainloop generic growbuf unaligned lists chartype unicode prime binsearch heap binheap compress sort hashtable relnotes trans string time
+UCW_DOCS=basics log fastbuf index config configure install basecode hash docsys conf mempool eltpool mainloop generic growbuf unaligned lists chartype unicode prime binsearch heap binheap compress sort hashtable relnotes trans string time daemon
 UCW_INDEX=$(o)/ucw/doc/def_index.html
 UCW_DOCS_HTML=$(addprefix $(o)/ucw/doc/,$(addsuffix .html,$(UCW_DOCS)))
 
diff --git a/ucw/doc/daemon.txt b/ucw/doc/daemon.txt
new file mode 100644 (file)
index 0000000..a5a23dc
--- /dev/null
@@ -0,0 +1,6 @@
+Daemonization helper
+====================
+
+FIXME: Add general description
+
+!!ucw/daemon.h