aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-base.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-11 05:47:10 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-11 05:47:10 +0200
commit4f8ac368dbead32aaa30684c29df3afa0a8ba17f (patch)
tree60a1007dba7a0f2456c44f7152e68b274f4bb3f2 /src/mds-base.h
parentm (diff)
downloadmds-4f8ac368dbead32aaa30684c29df3afa0a8ba17f.tar.gz
mds-4f8ac368dbead32aaa30684c29df3afa0a8ba17f.tar.bz2
mds-4f8ac368dbead32aaa30684c29df3afa0a8ba17f.tar.xz
add fork_for_safety option + beginning of kernel-based keyboard
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-base.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/mds-base.h b/src/mds-base.h
index edc42fa..68feb32 100644
--- a/src/mds-base.h
+++ b/src/mds-base.h
@@ -54,6 +54,16 @@ typedef struct server_characteristics
*/
unsigned sanity_check_argc : 1;
+ /**
+ * Setting this to non-zero will cause the server to place
+ * itself in a fork of itself when initialised. This can be
+ * used to let the server clean up fatal stuff after itself
+ * if it crashes. When the child exits, no matter how it
+ * exits, the parent will call `fork_cleanup` and then
+ * die it the same manner as the child.
+ */
+ unsigned fork_for_safety : 1;
+
} __attribute__((packed)) server_characteristics_t;
@@ -154,8 +164,10 @@ int connect_to_display(void); /* __attribute__((weak)) */
* This function should be called when the server has
* been properly initialised but before initialisation
* of anything that is removed at forking is initialised
+ *
+ * @return Zero on success, -1 on error
*/
-void server_initialised(void); /* __attribute__((weak)) */
+int server_initialised(void); /* __attribute__((weak)) */
/**
@@ -277,6 +289,19 @@ extern int reexec_failure_recover(void);
*/
extern int master_loop(void);
+/**
+ * This function should be implemented by the actual server implementation
+ * if the server has set `server_characteristics.fork_for_safety` to be
+ * true
+ *
+ * This function is called by the parent server process when the
+ * child server process exits, if the server has completed its
+ * initialisation
+ *
+ * @param status The status the child died with
+ */
+void fork_cleanup(int status); /* __attribute__((weak)) */
+
#endif