/* libhw/host_util.c - Utilities for GNU/Linux hosts
 *
 * 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_util.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;
}