Mike Frysinger | 50e31fa | 2018-01-19 18:59:49 -0500 | [diff] [blame] | 1 | /* Copyright 2016 The Chromium OS Authors. All rights reserved. |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. |
Jorge Lucangeli Obes | 1365061 | 2016-09-02 11:27:29 -0400 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include "syscall_wrapper.h" |
| 7 | |
| 8 | #define _GNU_SOURCE |
| 9 | #include <sys/syscall.h> |
| 10 | #include <unistd.h> |
| 11 | |
Mike Frysinger | 8022e14 | 2018-01-25 00:31:45 -0500 | [diff] [blame] | 12 | /* |
| 13 | * Older glibc builds predate seccomp inclusion. These arches are the ones |
| 14 | * AOSP needs and doesn't provide anything newer. All other targets can upgrade |
| 15 | * their kernel headers. |
| 16 | */ |
| 17 | #ifndef SYS_seccomp |
| 18 | # if defined(__x86_64__) |
| 19 | # define SYS_seccomp 317 |
| 20 | # elif defined(__i386__) |
| 21 | # define SYS_seccomp 354 |
| 22 | # elif defined(__aarch64__) |
| 23 | # define SYS_seccomp 277 |
| 24 | # elif defined(__arm__) |
| 25 | # define SYS_seccomp 383 |
| 26 | # else |
| 27 | # error "Update your kernel headers" |
| 28 | # endif |
| 29 | #endif |
| 30 | |
Jorge Lucangeli Obes | 1365061 | 2016-09-02 11:27:29 -0400 | [diff] [blame] | 31 | int sys_seccomp(unsigned int operation, unsigned int flags, void *args) |
| 32 | { |
| 33 | return syscall(SYS_seccomp, operation, flags, args); |
| 34 | } |