xref: /aosp_15_r20/external/sandboxed-api/android/sandboxed_api_glibc_compat.h (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1 //
2 // Copyright (C) 2023 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 #pragma once
16 
17 // Typo in old glibc
18 #define PTRACE_EVENT_SECCOMP PTRAVE_EVENT_SECCOMP
19 
20 // From aosp/599933
21 /*
22  * Older glibc builds predate seccomp inclusion.  These arches are the ones
23  * AOSP needs and doesn't provide anything newer.  All other targets can upgrade
24  * their kernel headers.
25  */
26 #ifndef SYS_seccomp
27 # if defined(__x86_64__)
28 #  define SYS_seccomp 317
29 # elif defined(__i386__)
30 #  define SYS_seccomp 354
31 # elif defined(__aarch64__)
32 #  define SYS_seccomp 277
33 # elif defined(__arm__)
34 #  define SYS_seccomp 383
35 # else
36 #  error "Update your kernel headers"
37 # endif
38 #endif
39 
40 #ifndef PTRACE_O_EXITKILL
41 #define PTRACE_O_EXITKILL (1 << 20)
42 #endif
43