summaryrefslogtreecommitdiffstats
path: root/libsyscalls_get_signals.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libsyscalls_get_signals.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libsyscalls_get_signals.c b/libsyscalls_get_signals.c
new file mode 100644
index 0000000..9c49760
--- /dev/null
+++ b/libsyscalls_get_signals.c
@@ -0,0 +1,32 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+#include "generated/signals.c"
+
+enum libsyscalls_error
+libsyscalls_get_signals(enum libsyscalls_os os, enum libsyscalls_arch arch,
+ const struct libsyscalls_named_number **signals_out, size_t *num_signals_out)
+{
+ const struct libsyscalls_named_number *discard_signals;
+ size_t discard_num_signals;
+
+ if (!signals_out) signals_out = &discard_signals;
+ if (!num_signals_out) num_signals_out = &discard_num_signals;
+
+#define CASE(UPPERCASE, LOWERCASE)\
+ case LIBSYSCALLS_OS_##UPPERCASE:\
+ return get_##LOWERCASE##_signals(arch, signals_out, num_signals_out)
+
+ switch ((int)os) {
+ LIST_OSES(CASE, ;);
+
+ /* if OS is known but does not have named numerical signal,
+ * get_##LOWERCASE##_signals shall return LIBSYSCALLS_E_NOSIGNALS */
+
+ default:
+ return LIBSYSCALLS_E_OSNOSUP;
+ }
+
+#undef CASE
+}