summaryrefslogtreecommitdiff
path: root/libhw/host_sigrt.c
blob: 6dcb96316dcfe13b44a906c677e4e349a2523c44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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_sigrt_alloc(void) {
	static int next = 0;

	if (!next)
		next = SIGRTMIN;
	int ret = next++;
	if (ret > SIGRTMAX)
		error(1, 0, "SIGRTMAX exceeded");
	return ret;
}