summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-07-07 19:46:34 +0200
committerHarald Welte <laforge@gnumonks.org>2011-07-18 17:00:07 +0200
commit39c0243d9b208a5d480be2e5cf538b3eac87860d (patch)
treedc267c4fc3ef6747bf289dfbee9cecf0f851201e
parentec4f160e2d51c8396f5fafff009fef93a1eeb113 (diff)
signal: reserve signal subsystems >= INT_MAX/2 for libraries
The first range (from 0 to INT_MAX/2) of signal subsystems can be used by client applications while the second range (from INT_MAX) is reserved for libraries. This is useful to support signals defined in libraries that may be used by different client applications.
-rw-r--r--include/osmocom/core/signal.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/osmocom/core/signal.h b/include/osmocom/core/signal.h
index 535fd185..7c32c778 100644
--- a/include/osmocom/core/signal.h
+++ b/include/osmocom/core/signal.h
@@ -1,6 +1,29 @@
#ifndef OSMO_SIGNAL_H
#define OSMO_SIGNAL_H
+#include <stdint.h>
+
+/* subsystem signaling numbers: we split the numberspace for applications and
+ * libraries: from 0 to UINT_MAX/2 for applications, from UINT_MAX/2 to
+ * UINT_MAX for libraries. */
+#define OSMO_SIGNAL_SS_APPS 0
+#define OSMO_SIGNAL_SS_RESERVED 2147483648
+
+/* signal subsystems. */
+enum {
+ SS_GLOBAL = OSMO_SIGNAL_SS_RESERVED,
+ SS_INPUT,
+};
+
+/* application-defined signal types. */
+#define OSMO_SIGNAL_T_APPS 0
+#define OSMO_SIGNAL_T_RESERVED 2147483648
+
+/* signal types. */
+enum {
+ S_GLOBAL_SHUTDOWN = OSMO_SIGNAL_T_RESERVED,
+};
+
typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data);