summaryrefslogblamecommitdiffstats
path: root/libsyscalls_get_signals.c
blob: 51574577a7375cbc53901541a7f687113f45b786 (plain) (tree)
1
2
3
4
5
6
7
8
9
10







                                                                           

                                                                            


                                                               
                               


                                                                     
                                                                   


                                         
                                                                                                    












                                                                            
/* 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, int *are_signed_out)
{
	const struct libsyscalls_named_number *discard_signals;
	size_t discard_num_signals;
	int discard_are_signed;

	if (!signals_out)     signals_out     = &discard_signals;
	if (!num_signals_out) num_signals_out = &discard_num_signals;
	if (!are_signed_out)  are_signed_out = &discard_are_signed;

#define CASE(UPPERCASE, LOWERCASE)\
	case LIBSYSCALLS_OS_##UPPERCASE:\
		return get_##LOWERCASE##_signals(arch, signals_out, num_signals_out, are_signed_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
}