summaryrefslogblamecommitdiffstats
path: root/linux/signals.c
blob: 7d7f8681e7355c078922a53baa66dc6628752d18 (plain) (tree)

































































































































                                                                                                                  
/* See LICENSE file for copyright and license details. */

/* This file is included from ../libsyscalls_get_signals.c */


#include "../generated/linux-signals.h"

static enum libsyscalls_error
get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_number **sigs_out, size_t *nsigs_out)
{
#define CASE(ARCH)\
	*sigs_out = linux_signals_for_##ARCH;\
	*nsigs_out = sizeof(linux_signals_for_##ARCH) / sizeof(*linux_signals_for_##ARCH);\
	goto out

	switch ((int)arch) {
	case LIBSYSCALLS_ARCH_ALPHA:
#ifdef LIST_LINUX_SIGNALS_FOR_ALPHA
		CASE(alpha);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_AMD64:
	case LIBSYSCALLS_ARCH_AMD64_X32:
	case LIBSYSCALLS_ARCH_I386:
#ifdef LIST_LINUX_SIGNALS_FOR_X86
		CASE(x86);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_ARM_OABI:
	case LIBSYSCALLS_ARCH_ARM_EABI:
#ifdef LIST_LINUX_SIGNALS_FOR_ARM
		CASE(arm);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_IA64:
#ifdef LIST_LINUX_SIGNALS_FOR_IA64
		CASE(ia64);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_M68K:
#ifdef LIST_LINUX_SIGNALS_FOR_M68K
		CASE(m68k);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_MICROBLAZE:
#ifdef LIST_LINUX_SIGNALS_FOR_MICROBLAZE
		CASE(microblaze);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_MIPS_O32:
	case LIBSYSCALLS_ARCH_MIPS_N32:
	case LIBSYSCALLS_ARCH_MIPS_N64:
#ifdef LIST_LINUX_SIGNALS_FOR_MIPS
		CASE(mips);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_PARISC_32:
	case LIBSYSCALLS_ARCH_PARISC_64:
#ifdef LIST_LINUX_SIGNALS_FOR_PARISC
		CASE(parisc);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_POWERPC_32:
	case LIBSYSCALLS_ARCH_POWERPC_64:
	case LIBSYSCALLS_ARCH_POWERPC_NOSPU:
	case LIBSYSCALLS_ARCH_POWERPC_SPU:
#ifdef LIST_LINUX_SIGNALS_FOR_POWERPC
		CASE(powerpc);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_S390_32:
	case LIBSYSCALLS_ARCH_S390_64:
#ifdef LIST_LINUX_SIGNALS_FOR_S390
		CASE(s390);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_SH:
#ifdef LIST_LINUX_SIGNALS_FOR_SH
		CASE(sh);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_SPARC_32:
	case LIBSYSCALLS_ARCH_SPARC_64:
#ifdef LIST_LINUX_SIGNALS_FOR_SPARC
		CASE(sparc);
#else
		break;
#endif

	case LIBSYSCALLS_ARCH_XTENSA:
#ifdef LIST_LINUX_SIGNALS_FOR_XTENSA
		CASE(xtensa);
#else
		break;
#endif

	default:
		return LIBSYSCALLS_E_ARCHNOSUP;
	}

	*sigs_out = linux_signals_for_generic;
	*nsigs_out = sizeof(linux_signals_for_generic) / sizeof(*linux_signals_for_generic);

out:
	return LIBSYSCALLS_E_OK;

#undef CASE
}