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