summaryrefslogtreecommitdiff
path: root/libhw/host_sigrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhw/host_sigrt.c')
-rw-r--r--libhw/host_sigrt.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libhw/host_sigrt.c b/libhw/host_sigrt.c
new file mode 100644
index 0000000..66041fc
--- /dev/null
+++ b/libhw/host_sigrt.c
@@ -0,0 +1,21 @@
+/* libhw/host_sigrt.c - Manage glibc realtime signals
+ *
+ * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+#include <error.h> /* for error(3gnu) */
+#include <signal.h> /* for SIGRTMIN, SIGRTMAX */
+
+#include "host_sigrt.h"
+
+int host_alloc_sigrt(void) {
+ static int next = 0;
+
+ if (!next)
+ next = SIGRTMIN;
+ int ret = next++;
+ if (ret > SIGRTMAX)
+ error(1, 0, "SIGRTMAX exceeded");
+ return ret;
+}