summaryrefslogtreecommitdiffstats
path: root/libsyscalls_get_signals.c
blob: 9c497605ec6df958f373826c861bba3c21b2395c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
}