162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * include/asm-generic/seccomp.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2014 Linaro Limited
662306a36Sopenharmony_ci * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef _ASM_GENERIC_SECCOMP_H
962306a36Sopenharmony_ci#define _ASM_GENERIC_SECCOMP_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/unistd.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#if defined(CONFIG_COMPAT) && !defined(__NR_seccomp_read_32)
1462306a36Sopenharmony_ci#define __NR_seccomp_read_32		__NR_read
1562306a36Sopenharmony_ci#define __NR_seccomp_write_32		__NR_write
1662306a36Sopenharmony_ci#define __NR_seccomp_exit_32		__NR_exit
1762306a36Sopenharmony_ci#ifndef __NR_seccomp_sigreturn_32
1862306a36Sopenharmony_ci#define __NR_seccomp_sigreturn_32	__NR_rt_sigreturn
1962306a36Sopenharmony_ci#endif
2062306a36Sopenharmony_ci#endif /* CONFIG_COMPAT && ! already defined */
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define __NR_seccomp_read		__NR_read
2362306a36Sopenharmony_ci#define __NR_seccomp_write		__NR_write
2462306a36Sopenharmony_ci#define __NR_seccomp_exit		__NR_exit
2562306a36Sopenharmony_ci#ifndef __NR_seccomp_sigreturn
2662306a36Sopenharmony_ci#define __NR_seccomp_sigreturn		__NR_rt_sigreturn
2762306a36Sopenharmony_ci#endif
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#ifdef CONFIG_COMPAT
3062306a36Sopenharmony_ci#ifndef get_compat_mode1_syscalls
3162306a36Sopenharmony_cistatic inline const int *get_compat_mode1_syscalls(void)
3262306a36Sopenharmony_ci{
3362306a36Sopenharmony_ci	static const int mode1_syscalls_32[] = {
3462306a36Sopenharmony_ci		__NR_seccomp_read_32, __NR_seccomp_write_32,
3562306a36Sopenharmony_ci		__NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,
3662306a36Sopenharmony_ci		-1, /* negative terminated */
3762306a36Sopenharmony_ci	};
3862306a36Sopenharmony_ci	return mode1_syscalls_32;
3962306a36Sopenharmony_ci}
4062306a36Sopenharmony_ci#endif
4162306a36Sopenharmony_ci#endif /* CONFIG_COMPAT */
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#endif /* _ASM_GENERIC_SECCOMP_H */
44