aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmdsserver')
-rw-r--r--src/libmdsserver/macros.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 89db22f..f17da94 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -752,5 +752,22 @@
#endif
+/**
+ * Normal signal handlers should place this macro
+ * at the top of the function
+ */
+#define SIGHANDLER_START \
+ int sighandler_saved_errno = errno
+
+
+/**
+ * Normal signal handlers should place this macro
+ * at the bottom of the function, or just before
+ * any `return`
+ */
+#define SIGHANDLER_END \
+ (errno = sighandler_saved_errno)
+
+
#endif