18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * include/asm-generic/seccomp.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014 Linaro Limited
68c2ecf20Sopenharmony_ci * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef _ASM_GENERIC_SECCOMP_H
98c2ecf20Sopenharmony_ci#define _ASM_GENERIC_SECCOMP_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/unistd.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#if defined(CONFIG_COMPAT) && !defined(__NR_seccomp_read_32)
148c2ecf20Sopenharmony_ci#define __NR_seccomp_read_32		__NR_read
158c2ecf20Sopenharmony_ci#define __NR_seccomp_write_32		__NR_write
168c2ecf20Sopenharmony_ci#define __NR_seccomp_exit_32		__NR_exit
178c2ecf20Sopenharmony_ci#ifndef __NR_seccomp_sigreturn_32
188c2ecf20Sopenharmony_ci#define __NR_seccomp_sigreturn_32	__NR_rt_sigreturn
198c2ecf20Sopenharmony_ci#endif
208c2ecf20Sopenharmony_ci#endif /* CONFIG_COMPAT && ! already defined */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define __NR_seccomp_read		__NR_read
238c2ecf20Sopenharmony_ci#define __NR_seccomp_write		__NR_write
248c2ecf20Sopenharmony_ci#define __NR_seccomp_exit		__NR_exit
258c2ecf20Sopenharmony_ci#ifndef __NR_seccomp_sigreturn
268c2ecf20Sopenharmony_ci#define __NR_seccomp_sigreturn		__NR_rt_sigreturn
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
308c2ecf20Sopenharmony_ci#ifndef get_compat_mode1_syscalls
318c2ecf20Sopenharmony_cistatic inline const int *get_compat_mode1_syscalls(void)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	static const int mode1_syscalls_32[] = {
348c2ecf20Sopenharmony_ci		__NR_seccomp_read_32, __NR_seccomp_write_32,
358c2ecf20Sopenharmony_ci		__NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,
368c2ecf20Sopenharmony_ci		-1, /* negative terminated */
378c2ecf20Sopenharmony_ci	};
388c2ecf20Sopenharmony_ci	return mode1_syscalls_32;
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ci#endif /* CONFIG_COMPAT */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#endif /* _ASM_GENERIC_SECCOMP_H */
44