Merge changes I7718b1ba,I648adc35
* changes:
Only initialize the global stack protector once.
Make getpid work before TLS has been initialized.
diff --git a/Android.soong.mk b/Android.mk
similarity index 100%
rename from Android.soong.mk
rename to Android.mk
diff --git a/README.md b/README.md
index 7fd903a..0b3dcaa 100644
--- a/README.md
+++ b/README.md
@@ -211,6 +211,11 @@
$ adb shell \
/data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static64
+Note that we use our own custom gtest runner that offers a superset of the
+options documented at
+<https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-test-programs-advanced-options>,
+in particular for test isolation and parallelism (both on by default).
+
### Host tests
The host tests require that you have `lunch`ed either an x86 or x86_64 target.
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp
new file mode 100644
index 0000000..12f4940
--- /dev/null
+++ b/benchmarks/Android.bp
@@ -0,0 +1,64 @@
+//
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "bionic-benchmarks-defaults",
+ cflags: [
+ "-O2",
+ "-fno-builtin",
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wunused",
+ ],
+ srcs: [
+ "math_benchmark.cpp",
+ "property_benchmark.cpp",
+ "pthread_benchmark.cpp",
+ "semaphore_benchmark.cpp",
+ "stdio_benchmark.cpp",
+ "string_benchmark.cpp",
+ "time_benchmark.cpp",
+ "unistd_benchmark.cpp",
+ ],
+}
+
+// Build benchmarks for the device (with bionic's .so). Run with:
+// adb shell bionic-benchmarks32
+// adb shell bionic-benchmarks64
+cc_benchmark {
+ name: "bionic-benchmarks",
+ defaults: ["bionic-benchmarks-defaults"],
+}
+
+// We don't build a static benchmark executable because it's not usually
+// useful. If you're trying to run the current benchmarks on an older
+// release, it's (so far at least) always because you want to measure the
+// performance of the old release's libc, and a static benchmark isn't
+// going to let you do that.
+
+// Build benchmarks for the host (against glibc!). Run with:
+cc_benchmark_host {
+ name: "bionic-benchmarks-glibc",
+ defaults: ["bionic-benchmarks-defaults"],
+ host_ldlibs: ["-lrt"],
+ target: {
+ darwin: {
+ // Only supported on linux systems.
+ enabled: false,
+ },
+ },
+}
diff --git a/benchmarks/Android.mk b/benchmarks/Android.mk
deleted file mode 100644
index 6f2651e..0000000
--- a/benchmarks/Android.mk
+++ /dev/null
@@ -1,94 +0,0 @@
-#
-# Copyright (C) 2013 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-benchmark_cflags := \
- -O2 \
- -fno-builtin \
- -Wall \
- -Wextra \
- -Werror \
- -Wunused \
-
-benchmark_cppflags := \
-
-benchmark_src_files := \
- math_benchmark.cpp \
- property_benchmark.cpp \
- pthread_benchmark.cpp \
- semaphore_benchmark.cpp \
- stdio_benchmark.cpp \
- string_benchmark.cpp \
- time_benchmark.cpp \
- unistd_benchmark.cpp \
-
-# Build benchmarks for the device (with bionic's .so). Run with:
-# adb shell bionic-benchmarks32
-# adb shell bionic-benchmarks64
-include $(CLEAR_VARS)
-LOCAL_MODULE := bionic-benchmarks
-LOCAL_MODULE_STEM_32 := bionic-benchmarks32
-LOCAL_MODULE_STEM_64 := bionic-benchmarks64
-LOCAL_MULTILIB := both
-LOCAL_CFLAGS := $(benchmark_cflags)
-LOCAL_CPPFLAGS := $(benchmark_cppflags)
-LOCAL_SRC_FILES := $(benchmark_src_files)
-include $(BUILD_NATIVE_BENCHMARK)
-
-# We don't build a static benchmark executable because it's not usually
-# useful. If you're trying to run the current benchmarks on an older
-# release, it's (so far at least) always because you want to measure the
-# performance of the old release's libc, and a static benchmark isn't
-# going to let you do that.
-
-# Only supported on linux systems.
-ifeq ($(HOST_OS),linux)
-
-# Build benchmarks for the host (against glibc!). Run with:
-include $(CLEAR_VARS)
-LOCAL_MODULE := bionic-benchmarks-glibc
-LOCAL_MODULE_STEM_32 := bionic-benchmarks-glibc32
-LOCAL_MODULE_STEM_64 := bionic-benchmarks-glibc64
-LOCAL_MULTILIB := both
-LOCAL_CFLAGS := $(benchmark_cflags)
-LOCAL_CPPFLAGS := $(benchmark_cppflags)
-LOCAL_LDFLAGS := -lrt
-LOCAL_SRC_FILES := $(benchmark_src_files)
-LOCAL_STATIC_LIBRARIES := libgoogle-benchmark
-# TODO: BUILD_HOST_NATIVE_BENCHMARK
-include $(BUILD_HOST_EXECUTABLE)
-
-endif
-
-ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
-include $(LOCAL_PATH)/../build/run-on-host.mk
-
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
-bionic-benchmarks-run-on-host32: bionic-benchmarks bionic-prepare-run-on-host
- ANDROID_DATA=$(TARGET_OUT_DATA) \
- ANDROID_ROOT=$(TARGET_OUT) \
- $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks32 $(BIONIC_BENCHMARKS_FLAGS)
-endif
-
-ifeq ($(TARGET_IS_64_BIT),true)
-bionic-benchmarks-run-on-host64: bionic-benchmarks bionic-prepare-run-on-host
- ANDROID_DATA=$(TARGET_OUT_DATA) \
- ANDROID_ROOT=$(TARGET_OUT) \
- $(TARGET_OUT_EXECUTABLES)/bionic-benchmarks64 $(BIONIC_BENCHMARKS_FLAGS)
-endif
-
-endif
diff --git a/benchmarks/run-on-host.sh b/benchmarks/run-on-host.sh
new file mode 100755
index 0000000..bc63628
--- /dev/null
+++ b/benchmarks/run-on-host.sh
@@ -0,0 +1,33 @@
+#!/bin/bash -e
+
+. $(dirname $0)/../build/run-on-host.sh
+
+if [ "$1" = glibc ]; then
+ m -j bionic-benchmarks-glibc
+ (
+ cd ${ANDROID_BUILD_TOP}
+ export ANDROID_DATA=${TARGET_OUT_DATA}
+ export ANDROID_ROOT=${TARGET_OUT}
+ ${HOST_OUT}/nativetest64/bionic-benchmarks-glibc/bionic-benchmarks-glibc $@
+ )
+ exit 0
+elif [ "$1" != 32 -a "$1" != 64 ]; then
+ echo "Usage: $0 [ 32 | 64 | glibc ] [gtest flags]"
+ exit 1
+fi
+
+if [ ${HOST_OS}-${HOST_ARCH} = linux-x86 -o ${HOST_OS}-${HOST_ARCH} = linux-x86_64 ]; then
+
+ prepare $1 bionic-benchmarks
+
+ if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then
+ (
+ cd ${ANDROID_BUILD_TOP}
+ export ANDROID_DATA=${TARGET_OUT_DATA}
+ export ANDROID_ROOT=${TARGET_OUT}
+ ${NATIVETEST}/bionic-benchmarks/bionic-benchmarks $@
+ )
+ else
+ echo "$0 not supported on TARGET_ARCH=$TARGET_ARCH"
+ fi
+fi
diff --git a/build/run-on-host.mk b/build/run-on-host.mk
deleted file mode 100644
index dc7e5d5..0000000
--- a/build/run-on-host.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Include once
-ifneq ($(bionic_run_on_host_mk_included),true)
-bionic_run_on_host_mk_included:=true
-
-ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
-LINKER = linker64
-else
-LINKER = linker
-endif
-
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
-# gtest needs ANDROID_DATA/local/tmp for death test output.
-# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
-# bionic itself should always work relative to ANDROID_DATA or ANDROID_ROOT.
-bionic-prepare-run-on-host: $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT)/etc/hosts $(TARGET_OUT_EXECUTABLES)/sh
- if [ ! -d /system ]; then \
- echo "Attempting to create /system"; \
- sudo mkdir -p -m 0777 /system; \
- fi
- mkdir -p $(TARGET_OUT_DATA)/local/tmp
- ln -fs `realpath $(TARGET_OUT)/bin` /system/
- ln -fs `realpath $(TARGET_OUT)/etc` /system/
- ln -fs `realpath $(TARGET_OUT)/lib` /system/
- if [ -d "$(TARGET_OUT)/lib64" ]; then \
- ln -fs `realpath $(TARGET_OUT)/lib64` /system/; \
- fi
-endif
-endif
diff --git a/build/run-on-host.sh b/build/run-on-host.sh
new file mode 100644
index 0000000..c3a2751
--- /dev/null
+++ b/build/run-on-host.sh
@@ -0,0 +1,47 @@
+#!/bin/bash -e
+
+source ${ANDROID_BUILD_TOP}/build/envsetup.sh
+
+TARGET_ARCH=$(get_build_var TARGET_ARCH)
+TARGET_OUT=$(get_build_var TARGET_OUT)
+TARGET_OUT_EXECUTABLES=$(get_build_var TARGET_OUT_EXECUTABLES)
+TARGET_OUT_DATA=$(get_build_var TARGET_OUT_DATA)
+HOST_OS=$(get_build_var HOST_OS)
+HOST_ARCH=$(get_build_var HOST_ARCH)
+HOST_OUT=$(get_build_var HOST_OUT)
+
+function prepare()
+{
+ BITS=$1
+ shift
+
+ NATIVETEST=${TARGET_OUT_DATA}/nativetest
+ if [ "${BITS}" = 64 ]; then
+ NATIVETEST=${NATIVETEST}64
+ fi
+
+ if [ ${TARGET_ARCH} = arm -o ${TARGET_ARCH} = mips -o ${TARGET_ARCH} = x86 ]; then
+ LINKER=${TARGET_OUT_EXECUTABLES}/linker
+ else
+ LINKER="${TARGET_OUT_EXECUTABLES}/linker64 ${TARGET_OUT_EXECUTABLES}/linker"
+ fi
+
+ if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then
+ m -j ${LINKER} ${TARGET_OUT}/etc/hosts ${TARGET_OUT_EXECUTABLES}/sh $@
+
+ if [ ! -d /system ]; then
+ echo "Attempting to create /system";
+ sudo mkdir -p -m 0777 /system;
+ fi
+ (
+ cd ${ANDROID_BUILD_TOP}
+ mkdir -p ${TARGET_OUT_DATA}/local/tmp
+ ln -fs `realpath ${TARGET_OUT}/bin` /system/
+ ln -fs `realpath ${TARGET_OUT}/etc` /system/
+ ln -fs `realpath ${TARGET_OUT}/lib` /system/
+ if [ -d "${TARGET_OUT}/lib64" ]; then
+ ln -fs `realpath ${TARGET_OUT}/lib64` /system/;
+ fi
+ )
+ fi
+}
diff --git a/libc/Android.bp b/libc/Android.bp
index c7201cb..b1d37b4 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -143,7 +143,6 @@
],
cflags: [
- "-fvisibility=hidden",
"-Wno-unused-parameter",
// Don't use ridiculous amounts of stack.
"-DALL_STATE",
@@ -747,7 +746,6 @@
cflags: [
"-Wno-sign-compare",
"-Wno-uninitialized",
- "-fvisibility=hidden",
"-include openbsd-compat.h",
],
@@ -1082,8 +1080,6 @@
"arch-mips/string/mips_strlen.c",
],
},
- // http://b/29771478 - disable integrated-as for Mips
- asflags: ["-fno-integrated-as"],
},
mips64: {
srcs: [
@@ -1460,8 +1456,6 @@
},
mips: {
srcs: ["arch-mips/syscalls/**/*.S"],
- // http://b/29771478 - disable integrated-as for Mips
- asflags: ["-fno-integrated-as"],
},
mips64: {
srcs: ["arch-mips64/syscalls/**/*.S"],
@@ -2010,3 +2004,5 @@
defaults: ["crt_defaults"],
}
+
+subdirs = ["malloc_debug"]
diff --git a/libc/Android.soong.mk b/libc/Android.mk
similarity index 100%
rename from libc/Android.soong.mk
rename to libc/Android.mk
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 0c59c92..5188b6d 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -350,7 +350,7 @@
int __set_thread_area:set_thread_area(void*) x86
# vdso stuff.
-int clock_gettime(clockid_t, timespec*) arm,mips,mips64
-int __clock_gettime:clock_gettime(clockid_t, timespec*) arm64,x86,x86_64
-int gettimeofday(timeval*, timezone*) arm,mips,mips64
-int __gettimeofday:gettimeofday(timeval*, timezone*) arm64,x86,x86_64
+int clock_gettime(clockid_t, timespec*) mips,mips64
+int __clock_gettime:clock_gettime(clockid_t, timespec*) arm,arm64,x86,x86_64
+int gettimeofday(timeval*, timezone*) mips,mips64
+int __gettimeofday:gettimeofday(timeval*, timezone*) arm,arm64,x86,x86_64
diff --git a/libc/arch-arm/syscalls/clock_gettime.S b/libc/arch-arm/syscalls/__clock_gettime.S
similarity index 87%
rename from libc/arch-arm/syscalls/clock_gettime.S
rename to libc/arch-arm/syscalls/__clock_gettime.S
index 61a95dd..30eff03 100644
--- a/libc/arch-arm/syscalls/clock_gettime.S
+++ b/libc/arch-arm/syscalls/__clock_gettime.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(clock_gettime)
+ENTRY(__clock_gettime)
mov ip, r7
.cfi_register r7, ip
ldr r7, =__NR_clock_gettime
@@ -13,4 +13,4 @@
bxls lr
neg r0, r0
b __set_errno_internal
-END(clock_gettime)
+END(__clock_gettime)
diff --git a/libc/arch-arm/syscalls/gettimeofday.S b/libc/arch-arm/syscalls/__gettimeofday.S
similarity index 88%
rename from libc/arch-arm/syscalls/gettimeofday.S
rename to libc/arch-arm/syscalls/__gettimeofday.S
index f5ed674..de0eca5 100644
--- a/libc/arch-arm/syscalls/gettimeofday.S
+++ b/libc/arch-arm/syscalls/__gettimeofday.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(gettimeofday)
+ENTRY(__gettimeofday)
mov ip, r7
.cfi_register r7, ip
ldr r7, =__NR_gettimeofday
@@ -13,4 +13,4 @@
bxls lr
neg r0, r0
b __set_errno_internal
-END(gettimeofday)
+END(__gettimeofday)
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 224cd41..1c6c845 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -45,6 +45,7 @@
#include <unistd.h>
#include <wchar.h>
+#include "private/bionic_macros.h"
#include "private/libc_logging.h"
extern "C" {
diff --git a/libc/bionic/pthread_cond.cpp b/libc/bionic/pthread_cond.cpp
index d36426c..c35d9f1 100644
--- a/libc/bionic/pthread_cond.cpp
+++ b/libc/bionic/pthread_cond.cpp
@@ -224,16 +224,18 @@
return pthread_cond_timedwait_monotonic(cond_interface, mutex, abs_timeout);
}
+// Force this function using CLOCK_MONOTONIC because it was always using
+// CLOCK_MONOTONIC in history.
extern "C" int pthread_cond_timedwait_relative_np(pthread_cond_t* cond_interface,
pthread_mutex_t* mutex,
const timespec* rel_timeout) {
timespec ts;
timespec* abs_timeout = nullptr;
if (rel_timeout != nullptr) {
- absolute_timespec_from_timespec(ts, *rel_timeout, CLOCK_REALTIME);
+ absolute_timespec_from_timespec(ts, *rel_timeout, CLOCK_MONOTONIC);
abs_timeout = &ts;
}
- return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, true, abs_timeout);
+ return __pthread_cond_timedwait(__get_internal_cond(cond_interface), mutex, false, abs_timeout);
}
extern "C" int pthread_cond_timeout_np(pthread_cond_t* cond_interface,
diff --git a/libc/bionic/vdso.cpp b/libc/bionic/vdso.cpp
index 029c148..f3d95ca 100644
--- a/libc/bionic/vdso.cpp
+++ b/libc/bionic/vdso.cpp
@@ -17,7 +17,7 @@
#include "private/bionic_globals.h"
#include "private/bionic_vdso.h"
-#if defined(__aarch64__) || defined(__x86_64__) || defined (__i386__)
+#if defined(__aarch64__) || defined(__arm__) || defined(__i386__) || defined(__x86_64__)
#include <limits.h>
#include <link.h>
@@ -28,6 +28,8 @@
#include <unistd.h>
#include "private/KernelArgumentBlock.h"
+#define AT_SYSINFO_EHDR 33 /* until we have new enough uapi headers... */
+
int clock_gettime(int clock_id, timespec* tp) {
auto vdso_clock_gettime = reinterpret_cast<decltype(&clock_gettime)>(
__libc_globals->vdso[VDSO_CLOCK_GETTIME].fn);
diff --git a/libc/dns/include/nsswitch.h b/libc/dns/include/nsswitch.h
index addbfc8..a0ae83b 100644
--- a/libc/dns/include/nsswitch.h
+++ b/libc/dns/include/nsswitch.h
@@ -202,7 +202,7 @@
__BEGIN_DECLS
int nsdispatch(void *, const ns_dtab [], const char *,
- const char *, const ns_src [], ...) __LIBC_ABI_PUBLIC__;
+ const char *, const ns_src [], ...);
#ifdef _NS_PRIVATE
int _nsdbtaddsrc(ns_dbt *, const ns_src *);
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index 26887b1..48e20a2 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -1,1759 +1,1225 @@
/* Generated by gensyscalls.py. Do not edit. */
-#ifndef _BIONIC_GLIBC_SYSCALLS_H_
-#define _BIONIC_GLIBC_SYSCALLS_H_
-#if defined(__aarch64__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_alarm __NR_alarm
-#define SYS_arch_specific_syscall __NR_arch_specific_syscall
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fadvise64_64 __NR_fadvise64_64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#define SYS_fcntl64 __NR_fcntl64
-#define SYS_fdatasync __NR_fdatasync
-#define SYS_fgetxattr __NR_fgetxattr
-#define SYS_finit_module __NR_finit_module
-#define SYS_flistxattr __NR_flistxattr
-#define SYS_flock __NR_flock
-#define SYS_fork __NR_fork
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_geteuid __NR_geteuid
-#define SYS_getgid __NR_getgid
-#define SYS_getgroups __NR_getgroups
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresuid __NR_getresuid
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getxattr __NR_getxattr
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioprio_get __NR_ioprio_get
-#define SYS_ioprio_set __NR_ioprio_set
-#define SYS_kcmp __NR_kcmp
-#define SYS_kexec_load __NR_kexec_load
-#define SYS_keyctl __NR_keyctl
-#define SYS_kill __NR_kill
-#define SYS_lchown __NR_lchown
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_llseek __NR_llseek
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_newfstatat __NR_newfstatat
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_oldwait4 __NR_oldwait4
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#define SYS_pread64 __NR_pread64
-#define SYS_preadv __NR_preadv
-#define SYS_prlimit64 __NR_prlimit64
-#define SYS_process_vm_readv __NR_process_vm_readv
-#define SYS_process_vm_writev __NR_process_vm_writev
-#define SYS_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recv __NR_recv
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_select __NR_select
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_send __NR_send
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setgid __NR_setgid
-#define SYS_setgroups __NR_setgroups
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresuid __NR_setresuid
-#define SYS_setreuid __NR_setreuid
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setxattr __NR_setxattr
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_socket __NR_socket
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_sync_file_range2 __NR_sync_file_range2
-#define SYS_syncfs __NR_syncfs
-#define SYS_syscalls __NR_syscalls
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__arm__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_alarm __NR_alarm
-#define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64
-#define SYS_arm_sync_file_range __NR_arm_sync_file_range
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chown32 __NR_chown32
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchown32 __NR_fchown32
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#define SYS_fcntl64 __NR_fcntl64
-#define SYS_fdatasync __NR_fdatasync
-#define SYS_fgetxattr __NR_fgetxattr
-#define SYS_finit_module __NR_finit_module
-#define SYS_flistxattr __NR_flistxattr
-#define SYS_flock __NR_flock
-#define SYS_fork __NR_fork
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_getegid32 __NR_getegid32
-#define SYS_geteuid __NR_geteuid
-#define SYS_geteuid32 __NR_geteuid32
-#define SYS_getgid __NR_getgid
-#define SYS_getgid32 __NR_getgid32
-#define SYS_getgroups __NR_getgroups
-#define SYS_getgroups32 __NR_getgroups32
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresgid32 __NR_getresgid32
-#define SYS_getresuid __NR_getresuid
-#define SYS_getresuid32 __NR_getresuid32
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getuid32 __NR_getuid32
-#define SYS_getxattr __NR_getxattr
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioprio_get __NR_ioprio_get
-#define SYS_ioprio_set __NR_ioprio_set
-#define SYS_ipc __NR_ipc
-#define SYS_kcmp __NR_kcmp
-#define SYS_kexec_load __NR_kexec_load
-#define SYS_keyctl __NR_keyctl
-#define SYS_kill __NR_kill
-#define SYS_lchown __NR_lchown
-#define SYS_lchown32 __NR_lchown32
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_nice __NR_nice
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_pciconfig_iobase __NR_pciconfig_iobase
-#define SYS_pciconfig_read __NR_pciconfig_read
-#define SYS_pciconfig_write __NR_pciconfig_write
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#define SYS_pread64 __NR_pread64
-#define SYS_preadv __NR_preadv
-#define SYS_prlimit64 __NR_prlimit64
-#define SYS_process_vm_readv __NR_process_vm_readv
-#define SYS_process_vm_writev __NR_process_vm_writev
-#define SYS_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readdir __NR_readdir
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recv __NR_recv
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_select __NR_select
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_send __NR_send
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsgid32 __NR_setfsgid32
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setfsuid32 __NR_setfsuid32
-#define SYS_setgid __NR_setgid
-#define SYS_setgid32 __NR_setgid32
-#define SYS_setgroups __NR_setgroups
-#define SYS_setgroups32 __NR_setgroups32
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setregid32 __NR_setregid32
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresgid32 __NR_setresgid32
-#define SYS_setresuid __NR_setresuid
-#define SYS_setresuid32 __NR_setresuid32
-#define SYS_setreuid __NR_setreuid
-#define SYS_setreuid32 __NR_setreuid32
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setuid32 __NR_setuid32
-#define SYS_setxattr __NR_setxattr
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaction __NR_sigaction
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_sigpending __NR_sigpending
-#define SYS_sigprocmask __NR_sigprocmask
-#define SYS_sigreturn __NR_sigreturn
-#define SYS_sigsuspend __NR_sigsuspend
-#define SYS_socket __NR_socket
-#define SYS_socketcall __NR_socketcall
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_stime __NR_stime
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range2 __NR_sync_file_range2
-#define SYS_syncfs __NR_syncfs
-#define SYS_syscall __NR_syscall
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_ugetrlimit __NR_ugetrlimit
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__mips__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_afs_syscall __NR_afs_syscall
-#define SYS_alarm __NR_alarm
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_break __NR_break
-#define SYS_brk __NR_brk
-#define SYS_cachectl __NR_cachectl
-#define SYS_cacheflush __NR_cacheflush
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_create_module __NR_create_module
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#define SYS_fcntl64 __NR_fcntl64
-#define SYS_fdatasync __NR_fdatasync
-#define SYS_fgetxattr __NR_fgetxattr
-#define SYS_finit_module __NR_finit_module
-#define SYS_flistxattr __NR_flistxattr
-#define SYS_flock __NR_flock
-#define SYS_fork __NR_fork
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftime __NR_ftime
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_kernel_syms __NR_get_kernel_syms
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_geteuid __NR_geteuid
-#define SYS_getgid __NR_getgid
-#define SYS_getgroups __NR_getgroups
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getpmsg __NR_getpmsg
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresuid __NR_getresuid
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getxattr __NR_getxattr
-#define SYS_gtty __NR_gtty
-#define SYS_idle __NR_idle
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioperm __NR_ioperm
-#define SYS_iopl __NR_iopl
-#define SYS_ioprio_get __NR_ioprio_get
-#define SYS_ioprio_set __NR_ioprio_set
-#define SYS_ipc __NR_ipc
-#define SYS_kcmp __NR_kcmp
-#define SYS_kexec_load __NR_kexec_load
-#define SYS_keyctl __NR_keyctl
-#define SYS_kill __NR_kill
-#define SYS_lchown __NR_lchown
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lock __NR_lock
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_modify_ldt __NR_modify_ldt
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mpx __NR_mpx
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_newfstatat __NR_newfstatat
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_nice __NR_nice
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#define SYS_pread64 __NR_pread64
-#define SYS_preadv __NR_preadv
-#define SYS_prlimit64 __NR_prlimit64
-#define SYS_process_vm_readv __NR_process_vm_readv
-#define SYS_process_vm_writev __NR_process_vm_writev
-#define SYS_prof __NR_prof
-#define SYS_profil __NR_profil
-#define SYS_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_putpmsg __NR_putpmsg
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_query_module __NR_query_module
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readdir __NR_readdir
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recv __NR_recv
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_reserved177 __NR_reserved177
-#define SYS_reserved193 __NR_reserved193
-#define SYS_reserved221 __NR_reserved221
-#define SYS_reserved82 __NR_reserved82
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_send __NR_send
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_thread_area __NR_set_thread_area
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setgid __NR_setgid
-#define SYS_setgroups __NR_setgroups
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresuid __NR_setresuid
-#define SYS_setreuid __NR_setreuid
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setxattr __NR_setxattr
-#define SYS_sgetmask __NR_sgetmask
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaction __NR_sigaction
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signal __NR_signal
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_sigpending __NR_sigpending
-#define SYS_sigprocmask __NR_sigprocmask
-#define SYS_sigreturn __NR_sigreturn
-#define SYS_sigsuspend __NR_sigsuspend
-#define SYS_socket __NR_socket
-#define SYS_socketcall __NR_socketcall
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_ssetmask __NR_ssetmask
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_stime __NR_stime
-#define SYS_stty __NR_stty
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_syncfs __NR_syncfs
-#define SYS_syscall __NR_syscall
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_sysmips __NR_sysmips
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd __NR_timerfd
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_ulimit __NR_ulimit
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_unused109 __NR_unused109
-#define SYS_unused150 __NR_unused150
-#define SYS_unused18 __NR_unused18
-#define SYS_unused28 __NR_unused28
-#define SYS_unused59 __NR_unused59
-#define SYS_unused84 __NR_unused84
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vhangup __NR_vhangup
-#define SYS_vm86 __NR_vm86
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_waitpid __NR_waitpid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__i386__)
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_afs_syscall __NR_afs_syscall
-#define SYS_alarm __NR_alarm
-#define SYS_bdflush __NR_bdflush
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_break __NR_break
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chown32 __NR_chown32
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_create_module __NR_create_module
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fadvise64_64 __NR_fadvise64_64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchown32 __NR_fchown32
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#define SYS_fcntl64 __NR_fcntl64
-#define SYS_fdatasync __NR_fdatasync
-#define SYS_fgetxattr __NR_fgetxattr
-#define SYS_finit_module __NR_finit_module
-#define SYS_flistxattr __NR_flistxattr
-#define SYS_flock __NR_flock
-#define SYS_fork __NR_fork
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstat64 __NR_fstat64
-#define SYS_fstatat64 __NR_fstatat64
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fstatfs64 __NR_fstatfs64
-#define SYS_fsync __NR_fsync
-#define SYS_ftime __NR_ftime
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_ftruncate64 __NR_ftruncate64
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_kernel_syms __NR_get_kernel_syms
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_get_thread_area __NR_get_thread_area
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_getegid32 __NR_getegid32
-#define SYS_geteuid __NR_geteuid
-#define SYS_geteuid32 __NR_geteuid32
-#define SYS_getgid __NR_getgid
-#define SYS_getgid32 __NR_getgid32
-#define SYS_getgroups __NR_getgroups
-#define SYS_getgroups32 __NR_getgroups32
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getpmsg __NR_getpmsg
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresgid32 __NR_getresgid32
-#define SYS_getresuid __NR_getresuid
-#define SYS_getresuid32 __NR_getresuid32
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getuid32 __NR_getuid32
-#define SYS_getxattr __NR_getxattr
-#define SYS_gtty __NR_gtty
-#define SYS_idle __NR_idle
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioperm __NR_ioperm
-#define SYS_iopl __NR_iopl
-#define SYS_ioprio_get __NR_ioprio_get
-#define SYS_ioprio_set __NR_ioprio_set
-#define SYS_ipc __NR_ipc
-#define SYS_kcmp __NR_kcmp
-#define SYS_kexec_load __NR_kexec_load
-#define SYS_keyctl __NR_keyctl
-#define SYS_kill __NR_kill
-#define SYS_lchown __NR_lchown
-#define SYS_lchown32 __NR_lchown32
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lock __NR_lock
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_lstat64 __NR_lstat64
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_mmap2 __NR_mmap2
-#define SYS_modify_ldt __NR_modify_ldt
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mpx __NR_mpx
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_nice __NR_nice
-#define SYS_oldfstat __NR_oldfstat
-#define SYS_oldlstat __NR_oldlstat
-#define SYS_oldolduname __NR_oldolduname
-#define SYS_oldstat __NR_oldstat
-#define SYS_olduname __NR_olduname
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#define SYS_pread64 __NR_pread64
-#define SYS_preadv __NR_preadv
-#define SYS_prlimit64 __NR_prlimit64
-#define SYS_process_vm_readv __NR_process_vm_readv
-#define SYS_process_vm_writev __NR_process_vm_writev
-#define SYS_prof __NR_prof
-#define SYS_profil __NR_profil
-#define SYS_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_putpmsg __NR_putpmsg
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_query_module __NR_query_module
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readdir __NR_readdir
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_select __NR_select
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendfile64 __NR_sendfile64
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_thread_area __NR_set_thread_area
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsgid32 __NR_setfsgid32
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setfsuid32 __NR_setfsuid32
-#define SYS_setgid __NR_setgid
-#define SYS_setgid32 __NR_setgid32
-#define SYS_setgroups __NR_setgroups
-#define SYS_setgroups32 __NR_setgroups32
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setregid32 __NR_setregid32
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresgid32 __NR_setresgid32
-#define SYS_setresuid __NR_setresuid
-#define SYS_setresuid32 __NR_setresuid32
-#define SYS_setreuid __NR_setreuid
-#define SYS_setreuid32 __NR_setreuid32
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setuid32 __NR_setuid32
-#define SYS_setxattr __NR_setxattr
-#define SYS_sgetmask __NR_sgetmask
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaction __NR_sigaction
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signal __NR_signal
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_sigpending __NR_sigpending
-#define SYS_sigprocmask __NR_sigprocmask
-#define SYS_sigreturn __NR_sigreturn
-#define SYS_sigsuspend __NR_sigsuspend
-#define SYS_socket __NR_socket
-#define SYS_socketcall __NR_socketcall
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_ssetmask __NR_ssetmask
-#define SYS_stat __NR_stat
-#define SYS_stat64 __NR_stat64
-#define SYS_statfs __NR_statfs
-#define SYS_statfs64 __NR_statfs64
-#define SYS_stime __NR_stime
-#define SYS_stty __NR_stty
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_syncfs __NR_syncfs
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_truncate64 __NR_truncate64
-#define SYS_ugetrlimit __NR_ugetrlimit
-#define SYS_ulimit __NR_ulimit
-#define SYS_umask __NR_umask
-#define SYS_umount __NR_umount
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vm86 __NR_vm86
-#define SYS_vm86old __NR_vm86old
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_waitpid __NR_waitpid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
-#elif defined(__x86_64__)
-#define SYS_accept __NR_accept
-#define SYS_accept4 __NR_accept4
-#define SYS_access __NR_access
-#define SYS_acct __NR_acct
-#define SYS_add_key __NR_add_key
-#define SYS_adjtimex __NR_adjtimex
-#define SYS_afs_syscall __NR_afs_syscall
-#define SYS_alarm __NR_alarm
-#define SYS_arch_prctl __NR_arch_prctl
-#define SYS_bind __NR_bind
-#define SYS_bpf __NR_bpf
-#define SYS_brk __NR_brk
-#define SYS_capget __NR_capget
-#define SYS_capset __NR_capset
-#define SYS_chdir __NR_chdir
-#define SYS_chmod __NR_chmod
-#define SYS_chown __NR_chown
-#define SYS_chroot __NR_chroot
-#define SYS_clock_adjtime __NR_clock_adjtime
-#define SYS_clock_getres __NR_clock_getres
-#define SYS_clock_gettime __NR_clock_gettime
-#define SYS_clock_nanosleep __NR_clock_nanosleep
-#define SYS_clock_settime __NR_clock_settime
-#define SYS_clone __NR_clone
-#define SYS_close __NR_close
-#define SYS_connect __NR_connect
-#define SYS_creat __NR_creat
-#define SYS_create_module __NR_create_module
-#define SYS_delete_module __NR_delete_module
-#define SYS_dup __NR_dup
-#define SYS_dup2 __NR_dup2
-#define SYS_dup3 __NR_dup3
-#define SYS_epoll_create __NR_epoll_create
-#define SYS_epoll_create1 __NR_epoll_create1
-#define SYS_epoll_ctl __NR_epoll_ctl
-#define SYS_epoll_ctl_old __NR_epoll_ctl_old
-#define SYS_epoll_pwait __NR_epoll_pwait
-#define SYS_epoll_wait __NR_epoll_wait
-#define SYS_epoll_wait_old __NR_epoll_wait_old
-#define SYS_eventfd __NR_eventfd
-#define SYS_eventfd2 __NR_eventfd2
-#define SYS_execve __NR_execve
-#define SYS_execveat __NR_execveat
-#define SYS_exit __NR_exit
-#define SYS_exit_group __NR_exit_group
-#define SYS_faccessat __NR_faccessat
-#define SYS_fadvise64 __NR_fadvise64
-#define SYS_fallocate __NR_fallocate
-#define SYS_fanotify_init __NR_fanotify_init
-#define SYS_fanotify_mark __NR_fanotify_mark
-#define SYS_fchdir __NR_fchdir
-#define SYS_fchmod __NR_fchmod
-#define SYS_fchmodat __NR_fchmodat
-#define SYS_fchown __NR_fchown
-#define SYS_fchownat __NR_fchownat
-#define SYS_fcntl __NR_fcntl
-#define SYS_fdatasync __NR_fdatasync
-#define SYS_fgetxattr __NR_fgetxattr
-#define SYS_finit_module __NR_finit_module
-#define SYS_flistxattr __NR_flistxattr
-#define SYS_flock __NR_flock
-#define SYS_fork __NR_fork
-#define SYS_fremovexattr __NR_fremovexattr
-#define SYS_fsetxattr __NR_fsetxattr
-#define SYS_fstat __NR_fstat
-#define SYS_fstatfs __NR_fstatfs
-#define SYS_fsync __NR_fsync
-#define SYS_ftruncate __NR_ftruncate
-#define SYS_futex __NR_futex
-#define SYS_futimesat __NR_futimesat
-#define SYS_get_kernel_syms __NR_get_kernel_syms
-#define SYS_get_mempolicy __NR_get_mempolicy
-#define SYS_get_robust_list __NR_get_robust_list
-#define SYS_get_thread_area __NR_get_thread_area
-#define SYS_getcpu __NR_getcpu
-#define SYS_getcwd __NR_getcwd
-#define SYS_getdents __NR_getdents
-#define SYS_getdents64 __NR_getdents64
-#define SYS_getegid __NR_getegid
-#define SYS_geteuid __NR_geteuid
-#define SYS_getgid __NR_getgid
-#define SYS_getgroups __NR_getgroups
-#define SYS_getitimer __NR_getitimer
-#define SYS_getpeername __NR_getpeername
-#define SYS_getpgid __NR_getpgid
-#define SYS_getpgrp __NR_getpgrp
-#define SYS_getpid __NR_getpid
-#define SYS_getpmsg __NR_getpmsg
-#define SYS_getppid __NR_getppid
-#define SYS_getpriority __NR_getpriority
-#define SYS_getrandom __NR_getrandom
-#define SYS_getresgid __NR_getresgid
-#define SYS_getresuid __NR_getresuid
-#define SYS_getrlimit __NR_getrlimit
-#define SYS_getrusage __NR_getrusage
-#define SYS_getsid __NR_getsid
-#define SYS_getsockname __NR_getsockname
-#define SYS_getsockopt __NR_getsockopt
-#define SYS_gettid __NR_gettid
-#define SYS_gettimeofday __NR_gettimeofday
-#define SYS_getuid __NR_getuid
-#define SYS_getxattr __NR_getxattr
-#define SYS_init_module __NR_init_module
-#define SYS_inotify_add_watch __NR_inotify_add_watch
-#define SYS_inotify_init __NR_inotify_init
-#define SYS_inotify_init1 __NR_inotify_init1
-#define SYS_inotify_rm_watch __NR_inotify_rm_watch
-#define SYS_io_cancel __NR_io_cancel
-#define SYS_io_destroy __NR_io_destroy
-#define SYS_io_getevents __NR_io_getevents
-#define SYS_io_setup __NR_io_setup
-#define SYS_io_submit __NR_io_submit
-#define SYS_ioctl __NR_ioctl
-#define SYS_ioperm __NR_ioperm
-#define SYS_iopl __NR_iopl
-#define SYS_ioprio_get __NR_ioprio_get
-#define SYS_ioprio_set __NR_ioprio_set
-#define SYS_kcmp __NR_kcmp
-#define SYS_kexec_file_load __NR_kexec_file_load
-#define SYS_kexec_load __NR_kexec_load
-#define SYS_keyctl __NR_keyctl
-#define SYS_kill __NR_kill
-#define SYS_lchown __NR_lchown
-#define SYS_lgetxattr __NR_lgetxattr
-#define SYS_link __NR_link
-#define SYS_linkat __NR_linkat
-#define SYS_listen __NR_listen
-#define SYS_listxattr __NR_listxattr
-#define SYS_llistxattr __NR_llistxattr
-#define SYS_lookup_dcookie __NR_lookup_dcookie
-#define SYS_lremovexattr __NR_lremovexattr
-#define SYS_lseek __NR_lseek
-#define SYS_lsetxattr __NR_lsetxattr
-#define SYS_lstat __NR_lstat
-#define SYS_madvise __NR_madvise
-#define SYS_mbind __NR_mbind
-#define SYS_membarrier __NR_membarrier
-#define SYS_memfd_create __NR_memfd_create
-#define SYS_migrate_pages __NR_migrate_pages
-#define SYS_mincore __NR_mincore
-#define SYS_mkdir __NR_mkdir
-#define SYS_mkdirat __NR_mkdirat
-#define SYS_mknod __NR_mknod
-#define SYS_mknodat __NR_mknodat
-#define SYS_mlock __NR_mlock
-#define SYS_mlock2 __NR_mlock2
-#define SYS_mlockall __NR_mlockall
-#define SYS_mmap __NR_mmap
-#define SYS_modify_ldt __NR_modify_ldt
-#define SYS_mount __NR_mount
-#define SYS_move_pages __NR_move_pages
-#define SYS_mprotect __NR_mprotect
-#define SYS_mq_getsetattr __NR_mq_getsetattr
-#define SYS_mq_notify __NR_mq_notify
-#define SYS_mq_open __NR_mq_open
-#define SYS_mq_timedreceive __NR_mq_timedreceive
-#define SYS_mq_timedsend __NR_mq_timedsend
-#define SYS_mq_unlink __NR_mq_unlink
-#define SYS_mremap __NR_mremap
-#define SYS_msgctl __NR_msgctl
-#define SYS_msgget __NR_msgget
-#define SYS_msgrcv __NR_msgrcv
-#define SYS_msgsnd __NR_msgsnd
-#define SYS_msync __NR_msync
-#define SYS_munlock __NR_munlock
-#define SYS_munlockall __NR_munlockall
-#define SYS_munmap __NR_munmap
-#define SYS_name_to_handle_at __NR_name_to_handle_at
-#define SYS_nanosleep __NR_nanosleep
-#define SYS_newfstatat __NR_newfstatat
-#define SYS_nfsservctl __NR_nfsservctl
-#define SYS_open __NR_open
-#define SYS_open_by_handle_at __NR_open_by_handle_at
-#define SYS_openat __NR_openat
-#define SYS_pause __NR_pause
-#define SYS_perf_event_open __NR_perf_event_open
-#define SYS_personality __NR_personality
-#define SYS_pipe __NR_pipe
-#define SYS_pipe2 __NR_pipe2
-#define SYS_pivot_root __NR_pivot_root
-#define SYS_poll __NR_poll
-#define SYS_ppoll __NR_ppoll
-#define SYS_prctl __NR_prctl
-#define SYS_pread64 __NR_pread64
-#define SYS_preadv __NR_preadv
-#define SYS_prlimit64 __NR_prlimit64
-#define SYS_process_vm_readv __NR_process_vm_readv
-#define SYS_process_vm_writev __NR_process_vm_writev
-#define SYS_pselect6 __NR_pselect6
-#define SYS_ptrace __NR_ptrace
-#define SYS_putpmsg __NR_putpmsg
-#define SYS_pwrite64 __NR_pwrite64
-#define SYS_pwritev __NR_pwritev
-#define SYS_query_module __NR_query_module
-#define SYS_quotactl __NR_quotactl
-#define SYS_read __NR_read
-#define SYS_readahead __NR_readahead
-#define SYS_readlink __NR_readlink
-#define SYS_readlinkat __NR_readlinkat
-#define SYS_readv __NR_readv
-#define SYS_reboot __NR_reboot
-#define SYS_recvfrom __NR_recvfrom
-#define SYS_recvmmsg __NR_recvmmsg
-#define SYS_recvmsg __NR_recvmsg
-#define SYS_remap_file_pages __NR_remap_file_pages
-#define SYS_removexattr __NR_removexattr
-#define SYS_rename __NR_rename
-#define SYS_renameat __NR_renameat
-#define SYS_renameat2 __NR_renameat2
-#define SYS_request_key __NR_request_key
-#define SYS_restart_syscall __NR_restart_syscall
-#define SYS_rmdir __NR_rmdir
-#define SYS_rt_sigaction __NR_rt_sigaction
-#define SYS_rt_sigpending __NR_rt_sigpending
-#define SYS_rt_sigprocmask __NR_rt_sigprocmask
-#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
-#define SYS_rt_sigreturn __NR_rt_sigreturn
-#define SYS_rt_sigsuspend __NR_rt_sigsuspend
-#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#define SYS_sched_get_priority_max __NR_sched_get_priority_max
-#define SYS_sched_get_priority_min __NR_sched_get_priority_min
-#define SYS_sched_getaffinity __NR_sched_getaffinity
-#define SYS_sched_getattr __NR_sched_getattr
-#define SYS_sched_getparam __NR_sched_getparam
-#define SYS_sched_getscheduler __NR_sched_getscheduler
-#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
-#define SYS_sched_setaffinity __NR_sched_setaffinity
-#define SYS_sched_setattr __NR_sched_setattr
-#define SYS_sched_setparam __NR_sched_setparam
-#define SYS_sched_setscheduler __NR_sched_setscheduler
-#define SYS_sched_yield __NR_sched_yield
-#define SYS_seccomp __NR_seccomp
-#define SYS_security __NR_security
-#define SYS_select __NR_select
-#define SYS_semctl __NR_semctl
-#define SYS_semget __NR_semget
-#define SYS_semop __NR_semop
-#define SYS_semtimedop __NR_semtimedop
-#define SYS_sendfile __NR_sendfile
-#define SYS_sendmmsg __NR_sendmmsg
-#define SYS_sendmsg __NR_sendmsg
-#define SYS_sendto __NR_sendto
-#define SYS_set_mempolicy __NR_set_mempolicy
-#define SYS_set_robust_list __NR_set_robust_list
-#define SYS_set_thread_area __NR_set_thread_area
-#define SYS_set_tid_address __NR_set_tid_address
-#define SYS_setdomainname __NR_setdomainname
-#define SYS_setfsgid __NR_setfsgid
-#define SYS_setfsuid __NR_setfsuid
-#define SYS_setgid __NR_setgid
-#define SYS_setgroups __NR_setgroups
-#define SYS_sethostname __NR_sethostname
-#define SYS_setitimer __NR_setitimer
-#define SYS_setns __NR_setns
-#define SYS_setpgid __NR_setpgid
-#define SYS_setpriority __NR_setpriority
-#define SYS_setregid __NR_setregid
-#define SYS_setresgid __NR_setresgid
-#define SYS_setresuid __NR_setresuid
-#define SYS_setreuid __NR_setreuid
-#define SYS_setrlimit __NR_setrlimit
-#define SYS_setsid __NR_setsid
-#define SYS_setsockopt __NR_setsockopt
-#define SYS_settimeofday __NR_settimeofday
-#define SYS_setuid __NR_setuid
-#define SYS_setxattr __NR_setxattr
-#define SYS_shmat __NR_shmat
-#define SYS_shmctl __NR_shmctl
-#define SYS_shmdt __NR_shmdt
-#define SYS_shmget __NR_shmget
-#define SYS_shutdown __NR_shutdown
-#define SYS_sigaltstack __NR_sigaltstack
-#define SYS_signalfd __NR_signalfd
-#define SYS_signalfd4 __NR_signalfd4
-#define SYS_socket __NR_socket
-#define SYS_socketpair __NR_socketpair
-#define SYS_splice __NR_splice
-#define SYS_stat __NR_stat
-#define SYS_statfs __NR_statfs
-#define SYS_swapoff __NR_swapoff
-#define SYS_swapon __NR_swapon
-#define SYS_symlink __NR_symlink
-#define SYS_symlinkat __NR_symlinkat
-#define SYS_sync __NR_sync
-#define SYS_sync_file_range __NR_sync_file_range
-#define SYS_syncfs __NR_syncfs
-#define SYS_sysfs __NR_sysfs
-#define SYS_sysinfo __NR_sysinfo
-#define SYS_syslog __NR_syslog
-#define SYS_tee __NR_tee
-#define SYS_tgkill __NR_tgkill
-#define SYS_time __NR_time
-#define SYS_timer_create __NR_timer_create
-#define SYS_timer_delete __NR_timer_delete
-#define SYS_timer_getoverrun __NR_timer_getoverrun
-#define SYS_timer_gettime __NR_timer_gettime
-#define SYS_timer_settime __NR_timer_settime
-#define SYS_timerfd_create __NR_timerfd_create
-#define SYS_timerfd_gettime __NR_timerfd_gettime
-#define SYS_timerfd_settime __NR_timerfd_settime
-#define SYS_times __NR_times
-#define SYS_tkill __NR_tkill
-#define SYS_truncate __NR_truncate
-#define SYS_tuxcall __NR_tuxcall
-#define SYS_umask __NR_umask
-#define SYS_umount2 __NR_umount2
-#define SYS_uname __NR_uname
-#define SYS_unlink __NR_unlink
-#define SYS_unlinkat __NR_unlinkat
-#define SYS_unshare __NR_unshare
-#define SYS_uselib __NR_uselib
-#define SYS_userfaultfd __NR_userfaultfd
-#define SYS_ustat __NR_ustat
-#define SYS_utime __NR_utime
-#define SYS_utimensat __NR_utimensat
-#define SYS_utimes __NR_utimes
-#define SYS_vfork __NR_vfork
-#define SYS_vhangup __NR_vhangup
-#define SYS_vmsplice __NR_vmsplice
-#define SYS_vserver __NR_vserver
-#define SYS_wait4 __NR_wait4
-#define SYS_waitid __NR_waitid
-#define SYS_write __NR_write
-#define SYS_writev __NR_writev
+#ifndef _BIONIC_BITS_GLIBC_SYSCALLS_H_
+#define _BIONIC_BITS_GLIBC_SYSCALLS_H_
+#if defined(__NR_accept)
+ #define SYS_accept __NR_accept
#endif
-#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */
+#if defined(__NR_accept4)
+ #define SYS_accept4 __NR_accept4
+#endif
+#if defined(__NR_access)
+ #define SYS_access __NR_access
+#endif
+#if defined(__NR_acct)
+ #define SYS_acct __NR_acct
+#endif
+#if defined(__NR_add_key)
+ #define SYS_add_key __NR_add_key
+#endif
+#if defined(__NR_adjtimex)
+ #define SYS_adjtimex __NR_adjtimex
+#endif
+#if defined(__NR_afs_syscall)
+ #define SYS_afs_syscall __NR_afs_syscall
+#endif
+#if defined(__NR_alarm)
+ #define SYS_alarm __NR_alarm
+#endif
+#if defined(__NR_arch_prctl)
+ #define SYS_arch_prctl __NR_arch_prctl
+#endif
+#if defined(__NR_arch_specific_syscall)
+ #define SYS_arch_specific_syscall __NR_arch_specific_syscall
+#endif
+#if defined(__NR_arm_fadvise64_64)
+ #define SYS_arm_fadvise64_64 __NR_arm_fadvise64_64
+#endif
+#if defined(__NR_arm_sync_file_range)
+ #define SYS_arm_sync_file_range __NR_arm_sync_file_range
+#endif
+#if defined(__NR_bdflush)
+ #define SYS_bdflush __NR_bdflush
+#endif
+#if defined(__NR_bind)
+ #define SYS_bind __NR_bind
+#endif
+#if defined(__NR_bpf)
+ #define SYS_bpf __NR_bpf
+#endif
+#if defined(__NR_break)
+ #define SYS_break __NR_break
+#endif
+#if defined(__NR_brk)
+ #define SYS_brk __NR_brk
+#endif
+#if defined(__NR_cachectl)
+ #define SYS_cachectl __NR_cachectl
+#endif
+#if defined(__NR_cacheflush)
+ #define SYS_cacheflush __NR_cacheflush
+#endif
+#if defined(__NR_capget)
+ #define SYS_capget __NR_capget
+#endif
+#if defined(__NR_capset)
+ #define SYS_capset __NR_capset
+#endif
+#if defined(__NR_chdir)
+ #define SYS_chdir __NR_chdir
+#endif
+#if defined(__NR_chmod)
+ #define SYS_chmod __NR_chmod
+#endif
+#if defined(__NR_chown)
+ #define SYS_chown __NR_chown
+#endif
+#if defined(__NR_chown32)
+ #define SYS_chown32 __NR_chown32
+#endif
+#if defined(__NR_chroot)
+ #define SYS_chroot __NR_chroot
+#endif
+#if defined(__NR_clock_adjtime)
+ #define SYS_clock_adjtime __NR_clock_adjtime
+#endif
+#if defined(__NR_clock_getres)
+ #define SYS_clock_getres __NR_clock_getres
+#endif
+#if defined(__NR_clock_gettime)
+ #define SYS_clock_gettime __NR_clock_gettime
+#endif
+#if defined(__NR_clock_nanosleep)
+ #define SYS_clock_nanosleep __NR_clock_nanosleep
+#endif
+#if defined(__NR_clock_settime)
+ #define SYS_clock_settime __NR_clock_settime
+#endif
+#if defined(__NR_clone)
+ #define SYS_clone __NR_clone
+#endif
+#if defined(__NR_close)
+ #define SYS_close __NR_close
+#endif
+#if defined(__NR_connect)
+ #define SYS_connect __NR_connect
+#endif
+#if defined(__NR_creat)
+ #define SYS_creat __NR_creat
+#endif
+#if defined(__NR_create_module)
+ #define SYS_create_module __NR_create_module
+#endif
+#if defined(__NR_delete_module)
+ #define SYS_delete_module __NR_delete_module
+#endif
+#if defined(__NR_dup)
+ #define SYS_dup __NR_dup
+#endif
+#if defined(__NR_dup2)
+ #define SYS_dup2 __NR_dup2
+#endif
+#if defined(__NR_dup3)
+ #define SYS_dup3 __NR_dup3
+#endif
+#if defined(__NR_epoll_create)
+ #define SYS_epoll_create __NR_epoll_create
+#endif
+#if defined(__NR_epoll_create1)
+ #define SYS_epoll_create1 __NR_epoll_create1
+#endif
+#if defined(__NR_epoll_ctl)
+ #define SYS_epoll_ctl __NR_epoll_ctl
+#endif
+#if defined(__NR_epoll_ctl_old)
+ #define SYS_epoll_ctl_old __NR_epoll_ctl_old
+#endif
+#if defined(__NR_epoll_pwait)
+ #define SYS_epoll_pwait __NR_epoll_pwait
+#endif
+#if defined(__NR_epoll_wait)
+ #define SYS_epoll_wait __NR_epoll_wait
+#endif
+#if defined(__NR_epoll_wait_old)
+ #define SYS_epoll_wait_old __NR_epoll_wait_old
+#endif
+#if defined(__NR_eventfd)
+ #define SYS_eventfd __NR_eventfd
+#endif
+#if defined(__NR_eventfd2)
+ #define SYS_eventfd2 __NR_eventfd2
+#endif
+#if defined(__NR_execve)
+ #define SYS_execve __NR_execve
+#endif
+#if defined(__NR_execveat)
+ #define SYS_execveat __NR_execveat
+#endif
+#if defined(__NR_exit)
+ #define SYS_exit __NR_exit
+#endif
+#if defined(__NR_exit_group)
+ #define SYS_exit_group __NR_exit_group
+#endif
+#if defined(__NR_faccessat)
+ #define SYS_faccessat __NR_faccessat
+#endif
+#if defined(__NR_fadvise64)
+ #define SYS_fadvise64 __NR_fadvise64
+#endif
+#if defined(__NR_fadvise64_64)
+ #define SYS_fadvise64_64 __NR_fadvise64_64
+#endif
+#if defined(__NR_fallocate)
+ #define SYS_fallocate __NR_fallocate
+#endif
+#if defined(__NR_fanotify_init)
+ #define SYS_fanotify_init __NR_fanotify_init
+#endif
+#if defined(__NR_fanotify_mark)
+ #define SYS_fanotify_mark __NR_fanotify_mark
+#endif
+#if defined(__NR_fchdir)
+ #define SYS_fchdir __NR_fchdir
+#endif
+#if defined(__NR_fchmod)
+ #define SYS_fchmod __NR_fchmod
+#endif
+#if defined(__NR_fchmodat)
+ #define SYS_fchmodat __NR_fchmodat
+#endif
+#if defined(__NR_fchown)
+ #define SYS_fchown __NR_fchown
+#endif
+#if defined(__NR_fchown32)
+ #define SYS_fchown32 __NR_fchown32
+#endif
+#if defined(__NR_fchownat)
+ #define SYS_fchownat __NR_fchownat
+#endif
+#if defined(__NR_fcntl)
+ #define SYS_fcntl __NR_fcntl
+#endif
+#if defined(__NR_fcntl64)
+ #define SYS_fcntl64 __NR_fcntl64
+#endif
+#if defined(__NR_fdatasync)
+ #define SYS_fdatasync __NR_fdatasync
+#endif
+#if defined(__NR_fgetxattr)
+ #define SYS_fgetxattr __NR_fgetxattr
+#endif
+#if defined(__NR_finit_module)
+ #define SYS_finit_module __NR_finit_module
+#endif
+#if defined(__NR_flistxattr)
+ #define SYS_flistxattr __NR_flistxattr
+#endif
+#if defined(__NR_flock)
+ #define SYS_flock __NR_flock
+#endif
+#if defined(__NR_fork)
+ #define SYS_fork __NR_fork
+#endif
+#if defined(__NR_fremovexattr)
+ #define SYS_fremovexattr __NR_fremovexattr
+#endif
+#if defined(__NR_fsetxattr)
+ #define SYS_fsetxattr __NR_fsetxattr
+#endif
+#if defined(__NR_fstat)
+ #define SYS_fstat __NR_fstat
+#endif
+#if defined(__NR_fstat64)
+ #define SYS_fstat64 __NR_fstat64
+#endif
+#if defined(__NR_fstatat64)
+ #define SYS_fstatat64 __NR_fstatat64
+#endif
+#if defined(__NR_fstatfs)
+ #define SYS_fstatfs __NR_fstatfs
+#endif
+#if defined(__NR_fstatfs64)
+ #define SYS_fstatfs64 __NR_fstatfs64
+#endif
+#if defined(__NR_fsync)
+ #define SYS_fsync __NR_fsync
+#endif
+#if defined(__NR_ftime)
+ #define SYS_ftime __NR_ftime
+#endif
+#if defined(__NR_ftruncate)
+ #define SYS_ftruncate __NR_ftruncate
+#endif
+#if defined(__NR_ftruncate64)
+ #define SYS_ftruncate64 __NR_ftruncate64
+#endif
+#if defined(__NR_futex)
+ #define SYS_futex __NR_futex
+#endif
+#if defined(__NR_futimesat)
+ #define SYS_futimesat __NR_futimesat
+#endif
+#if defined(__NR_get_kernel_syms)
+ #define SYS_get_kernel_syms __NR_get_kernel_syms
+#endif
+#if defined(__NR_get_mempolicy)
+ #define SYS_get_mempolicy __NR_get_mempolicy
+#endif
+#if defined(__NR_get_robust_list)
+ #define SYS_get_robust_list __NR_get_robust_list
+#endif
+#if defined(__NR_get_thread_area)
+ #define SYS_get_thread_area __NR_get_thread_area
+#endif
+#if defined(__NR_getcpu)
+ #define SYS_getcpu __NR_getcpu
+#endif
+#if defined(__NR_getcwd)
+ #define SYS_getcwd __NR_getcwd
+#endif
+#if defined(__NR_getdents)
+ #define SYS_getdents __NR_getdents
+#endif
+#if defined(__NR_getdents64)
+ #define SYS_getdents64 __NR_getdents64
+#endif
+#if defined(__NR_getegid)
+ #define SYS_getegid __NR_getegid
+#endif
+#if defined(__NR_getegid32)
+ #define SYS_getegid32 __NR_getegid32
+#endif
+#if defined(__NR_geteuid)
+ #define SYS_geteuid __NR_geteuid
+#endif
+#if defined(__NR_geteuid32)
+ #define SYS_geteuid32 __NR_geteuid32
+#endif
+#if defined(__NR_getgid)
+ #define SYS_getgid __NR_getgid
+#endif
+#if defined(__NR_getgid32)
+ #define SYS_getgid32 __NR_getgid32
+#endif
+#if defined(__NR_getgroups)
+ #define SYS_getgroups __NR_getgroups
+#endif
+#if defined(__NR_getgroups32)
+ #define SYS_getgroups32 __NR_getgroups32
+#endif
+#if defined(__NR_getitimer)
+ #define SYS_getitimer __NR_getitimer
+#endif
+#if defined(__NR_getpeername)
+ #define SYS_getpeername __NR_getpeername
+#endif
+#if defined(__NR_getpgid)
+ #define SYS_getpgid __NR_getpgid
+#endif
+#if defined(__NR_getpgrp)
+ #define SYS_getpgrp __NR_getpgrp
+#endif
+#if defined(__NR_getpid)
+ #define SYS_getpid __NR_getpid
+#endif
+#if defined(__NR_getpmsg)
+ #define SYS_getpmsg __NR_getpmsg
+#endif
+#if defined(__NR_getppid)
+ #define SYS_getppid __NR_getppid
+#endif
+#if defined(__NR_getpriority)
+ #define SYS_getpriority __NR_getpriority
+#endif
+#if defined(__NR_getrandom)
+ #define SYS_getrandom __NR_getrandom
+#endif
+#if defined(__NR_getresgid)
+ #define SYS_getresgid __NR_getresgid
+#endif
+#if defined(__NR_getresgid32)
+ #define SYS_getresgid32 __NR_getresgid32
+#endif
+#if defined(__NR_getresuid)
+ #define SYS_getresuid __NR_getresuid
+#endif
+#if defined(__NR_getresuid32)
+ #define SYS_getresuid32 __NR_getresuid32
+#endif
+#if defined(__NR_getrlimit)
+ #define SYS_getrlimit __NR_getrlimit
+#endif
+#if defined(__NR_getrusage)
+ #define SYS_getrusage __NR_getrusage
+#endif
+#if defined(__NR_getsid)
+ #define SYS_getsid __NR_getsid
+#endif
+#if defined(__NR_getsockname)
+ #define SYS_getsockname __NR_getsockname
+#endif
+#if defined(__NR_getsockopt)
+ #define SYS_getsockopt __NR_getsockopt
+#endif
+#if defined(__NR_gettid)
+ #define SYS_gettid __NR_gettid
+#endif
+#if defined(__NR_gettimeofday)
+ #define SYS_gettimeofday __NR_gettimeofday
+#endif
+#if defined(__NR_getuid)
+ #define SYS_getuid __NR_getuid
+#endif
+#if defined(__NR_getuid32)
+ #define SYS_getuid32 __NR_getuid32
+#endif
+#if defined(__NR_getxattr)
+ #define SYS_getxattr __NR_getxattr
+#endif
+#if defined(__NR_gtty)
+ #define SYS_gtty __NR_gtty
+#endif
+#if defined(__NR_idle)
+ #define SYS_idle __NR_idle
+#endif
+#if defined(__NR_init_module)
+ #define SYS_init_module __NR_init_module
+#endif
+#if defined(__NR_inotify_add_watch)
+ #define SYS_inotify_add_watch __NR_inotify_add_watch
+#endif
+#if defined(__NR_inotify_init)
+ #define SYS_inotify_init __NR_inotify_init
+#endif
+#if defined(__NR_inotify_init1)
+ #define SYS_inotify_init1 __NR_inotify_init1
+#endif
+#if defined(__NR_inotify_rm_watch)
+ #define SYS_inotify_rm_watch __NR_inotify_rm_watch
+#endif
+#if defined(__NR_io_cancel)
+ #define SYS_io_cancel __NR_io_cancel
+#endif
+#if defined(__NR_io_destroy)
+ #define SYS_io_destroy __NR_io_destroy
+#endif
+#if defined(__NR_io_getevents)
+ #define SYS_io_getevents __NR_io_getevents
+#endif
+#if defined(__NR_io_setup)
+ #define SYS_io_setup __NR_io_setup
+#endif
+#if defined(__NR_io_submit)
+ #define SYS_io_submit __NR_io_submit
+#endif
+#if defined(__NR_ioctl)
+ #define SYS_ioctl __NR_ioctl
+#endif
+#if defined(__NR_ioperm)
+ #define SYS_ioperm __NR_ioperm
+#endif
+#if defined(__NR_iopl)
+ #define SYS_iopl __NR_iopl
+#endif
+#if defined(__NR_ioprio_get)
+ #define SYS_ioprio_get __NR_ioprio_get
+#endif
+#if defined(__NR_ioprio_set)
+ #define SYS_ioprio_set __NR_ioprio_set
+#endif
+#if defined(__NR_ipc)
+ #define SYS_ipc __NR_ipc
+#endif
+#if defined(__NR_kcmp)
+ #define SYS_kcmp __NR_kcmp
+#endif
+#if defined(__NR_kexec_file_load)
+ #define SYS_kexec_file_load __NR_kexec_file_load
+#endif
+#if defined(__NR_kexec_load)
+ #define SYS_kexec_load __NR_kexec_load
+#endif
+#if defined(__NR_keyctl)
+ #define SYS_keyctl __NR_keyctl
+#endif
+#if defined(__NR_kill)
+ #define SYS_kill __NR_kill
+#endif
+#if defined(__NR_lchown)
+ #define SYS_lchown __NR_lchown
+#endif
+#if defined(__NR_lchown32)
+ #define SYS_lchown32 __NR_lchown32
+#endif
+#if defined(__NR_lgetxattr)
+ #define SYS_lgetxattr __NR_lgetxattr
+#endif
+#if defined(__NR_link)
+ #define SYS_link __NR_link
+#endif
+#if defined(__NR_linkat)
+ #define SYS_linkat __NR_linkat
+#endif
+#if defined(__NR_listen)
+ #define SYS_listen __NR_listen
+#endif
+#if defined(__NR_listxattr)
+ #define SYS_listxattr __NR_listxattr
+#endif
+#if defined(__NR_llistxattr)
+ #define SYS_llistxattr __NR_llistxattr
+#endif
+#if defined(__NR_llseek)
+ #define SYS_llseek __NR_llseek
+#endif
+#if defined(__NR_lock)
+ #define SYS_lock __NR_lock
+#endif
+#if defined(__NR_lookup_dcookie)
+ #define SYS_lookup_dcookie __NR_lookup_dcookie
+#endif
+#if defined(__NR_lremovexattr)
+ #define SYS_lremovexattr __NR_lremovexattr
+#endif
+#if defined(__NR_lseek)
+ #define SYS_lseek __NR_lseek
+#endif
+#if defined(__NR_lsetxattr)
+ #define SYS_lsetxattr __NR_lsetxattr
+#endif
+#if defined(__NR_lstat)
+ #define SYS_lstat __NR_lstat
+#endif
+#if defined(__NR_lstat64)
+ #define SYS_lstat64 __NR_lstat64
+#endif
+#if defined(__NR_madvise)
+ #define SYS_madvise __NR_madvise
+#endif
+#if defined(__NR_mbind)
+ #define SYS_mbind __NR_mbind
+#endif
+#if defined(__NR_membarrier)
+ #define SYS_membarrier __NR_membarrier
+#endif
+#if defined(__NR_memfd_create)
+ #define SYS_memfd_create __NR_memfd_create
+#endif
+#if defined(__NR_migrate_pages)
+ #define SYS_migrate_pages __NR_migrate_pages
+#endif
+#if defined(__NR_mincore)
+ #define SYS_mincore __NR_mincore
+#endif
+#if defined(__NR_mkdir)
+ #define SYS_mkdir __NR_mkdir
+#endif
+#if defined(__NR_mkdirat)
+ #define SYS_mkdirat __NR_mkdirat
+#endif
+#if defined(__NR_mknod)
+ #define SYS_mknod __NR_mknod
+#endif
+#if defined(__NR_mknodat)
+ #define SYS_mknodat __NR_mknodat
+#endif
+#if defined(__NR_mlock)
+ #define SYS_mlock __NR_mlock
+#endif
+#if defined(__NR_mlock2)
+ #define SYS_mlock2 __NR_mlock2
+#endif
+#if defined(__NR_mlockall)
+ #define SYS_mlockall __NR_mlockall
+#endif
+#if defined(__NR_mmap)
+ #define SYS_mmap __NR_mmap
+#endif
+#if defined(__NR_mmap2)
+ #define SYS_mmap2 __NR_mmap2
+#endif
+#if defined(__NR_modify_ldt)
+ #define SYS_modify_ldt __NR_modify_ldt
+#endif
+#if defined(__NR_mount)
+ #define SYS_mount __NR_mount
+#endif
+#if defined(__NR_move_pages)
+ #define SYS_move_pages __NR_move_pages
+#endif
+#if defined(__NR_mprotect)
+ #define SYS_mprotect __NR_mprotect
+#endif
+#if defined(__NR_mpx)
+ #define SYS_mpx __NR_mpx
+#endif
+#if defined(__NR_mq_getsetattr)
+ #define SYS_mq_getsetattr __NR_mq_getsetattr
+#endif
+#if defined(__NR_mq_notify)
+ #define SYS_mq_notify __NR_mq_notify
+#endif
+#if defined(__NR_mq_open)
+ #define SYS_mq_open __NR_mq_open
+#endif
+#if defined(__NR_mq_timedreceive)
+ #define SYS_mq_timedreceive __NR_mq_timedreceive
+#endif
+#if defined(__NR_mq_timedsend)
+ #define SYS_mq_timedsend __NR_mq_timedsend
+#endif
+#if defined(__NR_mq_unlink)
+ #define SYS_mq_unlink __NR_mq_unlink
+#endif
+#if defined(__NR_mremap)
+ #define SYS_mremap __NR_mremap
+#endif
+#if defined(__NR_msgctl)
+ #define SYS_msgctl __NR_msgctl
+#endif
+#if defined(__NR_msgget)
+ #define SYS_msgget __NR_msgget
+#endif
+#if defined(__NR_msgrcv)
+ #define SYS_msgrcv __NR_msgrcv
+#endif
+#if defined(__NR_msgsnd)
+ #define SYS_msgsnd __NR_msgsnd
+#endif
+#if defined(__NR_msync)
+ #define SYS_msync __NR_msync
+#endif
+#if defined(__NR_munlock)
+ #define SYS_munlock __NR_munlock
+#endif
+#if defined(__NR_munlockall)
+ #define SYS_munlockall __NR_munlockall
+#endif
+#if defined(__NR_munmap)
+ #define SYS_munmap __NR_munmap
+#endif
+#if defined(__NR_name_to_handle_at)
+ #define SYS_name_to_handle_at __NR_name_to_handle_at
+#endif
+#if defined(__NR_nanosleep)
+ #define SYS_nanosleep __NR_nanosleep
+#endif
+#if defined(__NR_newfstatat)
+ #define SYS_newfstatat __NR_newfstatat
+#endif
+#if defined(__NR_nfsservctl)
+ #define SYS_nfsservctl __NR_nfsservctl
+#endif
+#if defined(__NR_nice)
+ #define SYS_nice __NR_nice
+#endif
+#if defined(__NR_oldfstat)
+ #define SYS_oldfstat __NR_oldfstat
+#endif
+#if defined(__NR_oldlstat)
+ #define SYS_oldlstat __NR_oldlstat
+#endif
+#if defined(__NR_oldolduname)
+ #define SYS_oldolduname __NR_oldolduname
+#endif
+#if defined(__NR_oldstat)
+ #define SYS_oldstat __NR_oldstat
+#endif
+#if defined(__NR_olduname)
+ #define SYS_olduname __NR_olduname
+#endif
+#if defined(__NR_oldwait4)
+ #define SYS_oldwait4 __NR_oldwait4
+#endif
+#if defined(__NR_open)
+ #define SYS_open __NR_open
+#endif
+#if defined(__NR_open_by_handle_at)
+ #define SYS_open_by_handle_at __NR_open_by_handle_at
+#endif
+#if defined(__NR_openat)
+ #define SYS_openat __NR_openat
+#endif
+#if defined(__NR_pause)
+ #define SYS_pause __NR_pause
+#endif
+#if defined(__NR_pciconfig_iobase)
+ #define SYS_pciconfig_iobase __NR_pciconfig_iobase
+#endif
+#if defined(__NR_pciconfig_read)
+ #define SYS_pciconfig_read __NR_pciconfig_read
+#endif
+#if defined(__NR_pciconfig_write)
+ #define SYS_pciconfig_write __NR_pciconfig_write
+#endif
+#if defined(__NR_perf_event_open)
+ #define SYS_perf_event_open __NR_perf_event_open
+#endif
+#if defined(__NR_personality)
+ #define SYS_personality __NR_personality
+#endif
+#if defined(__NR_pipe)
+ #define SYS_pipe __NR_pipe
+#endif
+#if defined(__NR_pipe2)
+ #define SYS_pipe2 __NR_pipe2
+#endif
+#if defined(__NR_pivot_root)
+ #define SYS_pivot_root __NR_pivot_root
+#endif
+#if defined(__NR_poll)
+ #define SYS_poll __NR_poll
+#endif
+#if defined(__NR_ppoll)
+ #define SYS_ppoll __NR_ppoll
+#endif
+#if defined(__NR_prctl)
+ #define SYS_prctl __NR_prctl
+#endif
+#if defined(__NR_pread64)
+ #define SYS_pread64 __NR_pread64
+#endif
+#if defined(__NR_preadv)
+ #define SYS_preadv __NR_preadv
+#endif
+#if defined(__NR_prlimit64)
+ #define SYS_prlimit64 __NR_prlimit64
+#endif
+#if defined(__NR_process_vm_readv)
+ #define SYS_process_vm_readv __NR_process_vm_readv
+#endif
+#if defined(__NR_process_vm_writev)
+ #define SYS_process_vm_writev __NR_process_vm_writev
+#endif
+#if defined(__NR_prof)
+ #define SYS_prof __NR_prof
+#endif
+#if defined(__NR_profil)
+ #define SYS_profil __NR_profil
+#endif
+#if defined(__NR_pselect6)
+ #define SYS_pselect6 __NR_pselect6
+#endif
+#if defined(__NR_ptrace)
+ #define SYS_ptrace __NR_ptrace
+#endif
+#if defined(__NR_putpmsg)
+ #define SYS_putpmsg __NR_putpmsg
+#endif
+#if defined(__NR_pwrite64)
+ #define SYS_pwrite64 __NR_pwrite64
+#endif
+#if defined(__NR_pwritev)
+ #define SYS_pwritev __NR_pwritev
+#endif
+#if defined(__NR_query_module)
+ #define SYS_query_module __NR_query_module
+#endif
+#if defined(__NR_quotactl)
+ #define SYS_quotactl __NR_quotactl
+#endif
+#if defined(__NR_read)
+ #define SYS_read __NR_read
+#endif
+#if defined(__NR_readahead)
+ #define SYS_readahead __NR_readahead
+#endif
+#if defined(__NR_readdir)
+ #define SYS_readdir __NR_readdir
+#endif
+#if defined(__NR_readlink)
+ #define SYS_readlink __NR_readlink
+#endif
+#if defined(__NR_readlinkat)
+ #define SYS_readlinkat __NR_readlinkat
+#endif
+#if defined(__NR_readv)
+ #define SYS_readv __NR_readv
+#endif
+#if defined(__NR_reboot)
+ #define SYS_reboot __NR_reboot
+#endif
+#if defined(__NR_recv)
+ #define SYS_recv __NR_recv
+#endif
+#if defined(__NR_recvfrom)
+ #define SYS_recvfrom __NR_recvfrom
+#endif
+#if defined(__NR_recvmmsg)
+ #define SYS_recvmmsg __NR_recvmmsg
+#endif
+#if defined(__NR_recvmsg)
+ #define SYS_recvmsg __NR_recvmsg
+#endif
+#if defined(__NR_remap_file_pages)
+ #define SYS_remap_file_pages __NR_remap_file_pages
+#endif
+#if defined(__NR_removexattr)
+ #define SYS_removexattr __NR_removexattr
+#endif
+#if defined(__NR_rename)
+ #define SYS_rename __NR_rename
+#endif
+#if defined(__NR_renameat)
+ #define SYS_renameat __NR_renameat
+#endif
+#if defined(__NR_renameat2)
+ #define SYS_renameat2 __NR_renameat2
+#endif
+#if defined(__NR_request_key)
+ #define SYS_request_key __NR_request_key
+#endif
+#if defined(__NR_restart_syscall)
+ #define SYS_restart_syscall __NR_restart_syscall
+#endif
+#if defined(__NR_rmdir)
+ #define SYS_rmdir __NR_rmdir
+#endif
+#if defined(__NR_rt_sigaction)
+ #define SYS_rt_sigaction __NR_rt_sigaction
+#endif
+#if defined(__NR_rt_sigpending)
+ #define SYS_rt_sigpending __NR_rt_sigpending
+#endif
+#if defined(__NR_rt_sigprocmask)
+ #define SYS_rt_sigprocmask __NR_rt_sigprocmask
+#endif
+#if defined(__NR_rt_sigqueueinfo)
+ #define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
+#endif
+#if defined(__NR_rt_sigreturn)
+ #define SYS_rt_sigreturn __NR_rt_sigreturn
+#endif
+#if defined(__NR_rt_sigsuspend)
+ #define SYS_rt_sigsuspend __NR_rt_sigsuspend
+#endif
+#if defined(__NR_rt_sigtimedwait)
+ #define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
+#endif
+#if defined(__NR_rt_tgsigqueueinfo)
+ #define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
+#endif
+#if defined(__NR_sched_get_priority_max)
+ #define SYS_sched_get_priority_max __NR_sched_get_priority_max
+#endif
+#if defined(__NR_sched_get_priority_min)
+ #define SYS_sched_get_priority_min __NR_sched_get_priority_min
+#endif
+#if defined(__NR_sched_getaffinity)
+ #define SYS_sched_getaffinity __NR_sched_getaffinity
+#endif
+#if defined(__NR_sched_getattr)
+ #define SYS_sched_getattr __NR_sched_getattr
+#endif
+#if defined(__NR_sched_getparam)
+ #define SYS_sched_getparam __NR_sched_getparam
+#endif
+#if defined(__NR_sched_getscheduler)
+ #define SYS_sched_getscheduler __NR_sched_getscheduler
+#endif
+#if defined(__NR_sched_rr_get_interval)
+ #define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
+#endif
+#if defined(__NR_sched_setaffinity)
+ #define SYS_sched_setaffinity __NR_sched_setaffinity
+#endif
+#if defined(__NR_sched_setattr)
+ #define SYS_sched_setattr __NR_sched_setattr
+#endif
+#if defined(__NR_sched_setparam)
+ #define SYS_sched_setparam __NR_sched_setparam
+#endif
+#if defined(__NR_sched_setscheduler)
+ #define SYS_sched_setscheduler __NR_sched_setscheduler
+#endif
+#if defined(__NR_sched_yield)
+ #define SYS_sched_yield __NR_sched_yield
+#endif
+#if defined(__NR_seccomp)
+ #define SYS_seccomp __NR_seccomp
+#endif
+#if defined(__NR_security)
+ #define SYS_security __NR_security
+#endif
+#if defined(__NR_select)
+ #define SYS_select __NR_select
+#endif
+#if defined(__NR_semctl)
+ #define SYS_semctl __NR_semctl
+#endif
+#if defined(__NR_semget)
+ #define SYS_semget __NR_semget
+#endif
+#if defined(__NR_semop)
+ #define SYS_semop __NR_semop
+#endif
+#if defined(__NR_semtimedop)
+ #define SYS_semtimedop __NR_semtimedop
+#endif
+#if defined(__NR_send)
+ #define SYS_send __NR_send
+#endif
+#if defined(__NR_sendfile)
+ #define SYS_sendfile __NR_sendfile
+#endif
+#if defined(__NR_sendfile64)
+ #define SYS_sendfile64 __NR_sendfile64
+#endif
+#if defined(__NR_sendmmsg)
+ #define SYS_sendmmsg __NR_sendmmsg
+#endif
+#if defined(__NR_sendmsg)
+ #define SYS_sendmsg __NR_sendmsg
+#endif
+#if defined(__NR_sendto)
+ #define SYS_sendto __NR_sendto
+#endif
+#if defined(__NR_set_mempolicy)
+ #define SYS_set_mempolicy __NR_set_mempolicy
+#endif
+#if defined(__NR_set_robust_list)
+ #define SYS_set_robust_list __NR_set_robust_list
+#endif
+#if defined(__NR_set_thread_area)
+ #define SYS_set_thread_area __NR_set_thread_area
+#endif
+#if defined(__NR_set_tid_address)
+ #define SYS_set_tid_address __NR_set_tid_address
+#endif
+#if defined(__NR_setdomainname)
+ #define SYS_setdomainname __NR_setdomainname
+#endif
+#if defined(__NR_setfsgid)
+ #define SYS_setfsgid __NR_setfsgid
+#endif
+#if defined(__NR_setfsgid32)
+ #define SYS_setfsgid32 __NR_setfsgid32
+#endif
+#if defined(__NR_setfsuid)
+ #define SYS_setfsuid __NR_setfsuid
+#endif
+#if defined(__NR_setfsuid32)
+ #define SYS_setfsuid32 __NR_setfsuid32
+#endif
+#if defined(__NR_setgid)
+ #define SYS_setgid __NR_setgid
+#endif
+#if defined(__NR_setgid32)
+ #define SYS_setgid32 __NR_setgid32
+#endif
+#if defined(__NR_setgroups)
+ #define SYS_setgroups __NR_setgroups
+#endif
+#if defined(__NR_setgroups32)
+ #define SYS_setgroups32 __NR_setgroups32
+#endif
+#if defined(__NR_sethostname)
+ #define SYS_sethostname __NR_sethostname
+#endif
+#if defined(__NR_setitimer)
+ #define SYS_setitimer __NR_setitimer
+#endif
+#if defined(__NR_setns)
+ #define SYS_setns __NR_setns
+#endif
+#if defined(__NR_setpgid)
+ #define SYS_setpgid __NR_setpgid
+#endif
+#if defined(__NR_setpriority)
+ #define SYS_setpriority __NR_setpriority
+#endif
+#if defined(__NR_setregid)
+ #define SYS_setregid __NR_setregid
+#endif
+#if defined(__NR_setregid32)
+ #define SYS_setregid32 __NR_setregid32
+#endif
+#if defined(__NR_setresgid)
+ #define SYS_setresgid __NR_setresgid
+#endif
+#if defined(__NR_setresgid32)
+ #define SYS_setresgid32 __NR_setresgid32
+#endif
+#if defined(__NR_setresuid)
+ #define SYS_setresuid __NR_setresuid
+#endif
+#if defined(__NR_setresuid32)
+ #define SYS_setresuid32 __NR_setresuid32
+#endif
+#if defined(__NR_setreuid)
+ #define SYS_setreuid __NR_setreuid
+#endif
+#if defined(__NR_setreuid32)
+ #define SYS_setreuid32 __NR_setreuid32
+#endif
+#if defined(__NR_setrlimit)
+ #define SYS_setrlimit __NR_setrlimit
+#endif
+#if defined(__NR_setsid)
+ #define SYS_setsid __NR_setsid
+#endif
+#if defined(__NR_setsockopt)
+ #define SYS_setsockopt __NR_setsockopt
+#endif
+#if defined(__NR_settimeofday)
+ #define SYS_settimeofday __NR_settimeofday
+#endif
+#if defined(__NR_setuid)
+ #define SYS_setuid __NR_setuid
+#endif
+#if defined(__NR_setuid32)
+ #define SYS_setuid32 __NR_setuid32
+#endif
+#if defined(__NR_setxattr)
+ #define SYS_setxattr __NR_setxattr
+#endif
+#if defined(__NR_sgetmask)
+ #define SYS_sgetmask __NR_sgetmask
+#endif
+#if defined(__NR_shmat)
+ #define SYS_shmat __NR_shmat
+#endif
+#if defined(__NR_shmctl)
+ #define SYS_shmctl __NR_shmctl
+#endif
+#if defined(__NR_shmdt)
+ #define SYS_shmdt __NR_shmdt
+#endif
+#if defined(__NR_shmget)
+ #define SYS_shmget __NR_shmget
+#endif
+#if defined(__NR_shutdown)
+ #define SYS_shutdown __NR_shutdown
+#endif
+#if defined(__NR_sigaction)
+ #define SYS_sigaction __NR_sigaction
+#endif
+#if defined(__NR_sigaltstack)
+ #define SYS_sigaltstack __NR_sigaltstack
+#endif
+#if defined(__NR_signal)
+ #define SYS_signal __NR_signal
+#endif
+#if defined(__NR_signalfd)
+ #define SYS_signalfd __NR_signalfd
+#endif
+#if defined(__NR_signalfd4)
+ #define SYS_signalfd4 __NR_signalfd4
+#endif
+#if defined(__NR_sigpending)
+ #define SYS_sigpending __NR_sigpending
+#endif
+#if defined(__NR_sigprocmask)
+ #define SYS_sigprocmask __NR_sigprocmask
+#endif
+#if defined(__NR_sigreturn)
+ #define SYS_sigreturn __NR_sigreturn
+#endif
+#if defined(__NR_sigsuspend)
+ #define SYS_sigsuspend __NR_sigsuspend
+#endif
+#if defined(__NR_socket)
+ #define SYS_socket __NR_socket
+#endif
+#if defined(__NR_socketcall)
+ #define SYS_socketcall __NR_socketcall
+#endif
+#if defined(__NR_socketpair)
+ #define SYS_socketpair __NR_socketpair
+#endif
+#if defined(__NR_splice)
+ #define SYS_splice __NR_splice
+#endif
+#if defined(__NR_ssetmask)
+ #define SYS_ssetmask __NR_ssetmask
+#endif
+#if defined(__NR_stat)
+ #define SYS_stat __NR_stat
+#endif
+#if defined(__NR_stat64)
+ #define SYS_stat64 __NR_stat64
+#endif
+#if defined(__NR_statfs)
+ #define SYS_statfs __NR_statfs
+#endif
+#if defined(__NR_statfs64)
+ #define SYS_statfs64 __NR_statfs64
+#endif
+#if defined(__NR_stime)
+ #define SYS_stime __NR_stime
+#endif
+#if defined(__NR_stty)
+ #define SYS_stty __NR_stty
+#endif
+#if defined(__NR_swapoff)
+ #define SYS_swapoff __NR_swapoff
+#endif
+#if defined(__NR_swapon)
+ #define SYS_swapon __NR_swapon
+#endif
+#if defined(__NR_symlink)
+ #define SYS_symlink __NR_symlink
+#endif
+#if defined(__NR_symlinkat)
+ #define SYS_symlinkat __NR_symlinkat
+#endif
+#if defined(__NR_sync)
+ #define SYS_sync __NR_sync
+#endif
+#if defined(__NR_sync_file_range)
+ #define SYS_sync_file_range __NR_sync_file_range
+#endif
+#if defined(__NR_sync_file_range2)
+ #define SYS_sync_file_range2 __NR_sync_file_range2
+#endif
+#if defined(__NR_syncfs)
+ #define SYS_syncfs __NR_syncfs
+#endif
+#if defined(__NR_syscall)
+ #define SYS_syscall __NR_syscall
+#endif
+#if defined(__NR_syscalls)
+ #define SYS_syscalls __NR_syscalls
+#endif
+#if defined(__NR_sysfs)
+ #define SYS_sysfs __NR_sysfs
+#endif
+#if defined(__NR_sysinfo)
+ #define SYS_sysinfo __NR_sysinfo
+#endif
+#if defined(__NR_syslog)
+ #define SYS_syslog __NR_syslog
+#endif
+#if defined(__NR_sysmips)
+ #define SYS_sysmips __NR_sysmips
+#endif
+#if defined(__NR_tee)
+ #define SYS_tee __NR_tee
+#endif
+#if defined(__NR_tgkill)
+ #define SYS_tgkill __NR_tgkill
+#endif
+#if defined(__NR_time)
+ #define SYS_time __NR_time
+#endif
+#if defined(__NR_timer_create)
+ #define SYS_timer_create __NR_timer_create
+#endif
+#if defined(__NR_timer_delete)
+ #define SYS_timer_delete __NR_timer_delete
+#endif
+#if defined(__NR_timer_getoverrun)
+ #define SYS_timer_getoverrun __NR_timer_getoverrun
+#endif
+#if defined(__NR_timer_gettime)
+ #define SYS_timer_gettime __NR_timer_gettime
+#endif
+#if defined(__NR_timer_settime)
+ #define SYS_timer_settime __NR_timer_settime
+#endif
+#if defined(__NR_timerfd)
+ #define SYS_timerfd __NR_timerfd
+#endif
+#if defined(__NR_timerfd_create)
+ #define SYS_timerfd_create __NR_timerfd_create
+#endif
+#if defined(__NR_timerfd_gettime)
+ #define SYS_timerfd_gettime __NR_timerfd_gettime
+#endif
+#if defined(__NR_timerfd_settime)
+ #define SYS_timerfd_settime __NR_timerfd_settime
+#endif
+#if defined(__NR_times)
+ #define SYS_times __NR_times
+#endif
+#if defined(__NR_tkill)
+ #define SYS_tkill __NR_tkill
+#endif
+#if defined(__NR_truncate)
+ #define SYS_truncate __NR_truncate
+#endif
+#if defined(__NR_truncate64)
+ #define SYS_truncate64 __NR_truncate64
+#endif
+#if defined(__NR_tuxcall)
+ #define SYS_tuxcall __NR_tuxcall
+#endif
+#if defined(__NR_ugetrlimit)
+ #define SYS_ugetrlimit __NR_ugetrlimit
+#endif
+#if defined(__NR_ulimit)
+ #define SYS_ulimit __NR_ulimit
+#endif
+#if defined(__NR_umask)
+ #define SYS_umask __NR_umask
+#endif
+#if defined(__NR_umount)
+ #define SYS_umount __NR_umount
+#endif
+#if defined(__NR_umount2)
+ #define SYS_umount2 __NR_umount2
+#endif
+#if defined(__NR_uname)
+ #define SYS_uname __NR_uname
+#endif
+#if defined(__NR_unlink)
+ #define SYS_unlink __NR_unlink
+#endif
+#if defined(__NR_unlinkat)
+ #define SYS_unlinkat __NR_unlinkat
+#endif
+#if defined(__NR_unshare)
+ #define SYS_unshare __NR_unshare
+#endif
+#if defined(__NR_uselib)
+ #define SYS_uselib __NR_uselib
+#endif
+#if defined(__NR_userfaultfd)
+ #define SYS_userfaultfd __NR_userfaultfd
+#endif
+#if defined(__NR_ustat)
+ #define SYS_ustat __NR_ustat
+#endif
+#if defined(__NR_utime)
+ #define SYS_utime __NR_utime
+#endif
+#if defined(__NR_utimensat)
+ #define SYS_utimensat __NR_utimensat
+#endif
+#if defined(__NR_utimes)
+ #define SYS_utimes __NR_utimes
+#endif
+#if defined(__NR_vfork)
+ #define SYS_vfork __NR_vfork
+#endif
+#if defined(__NR_vhangup)
+ #define SYS_vhangup __NR_vhangup
+#endif
+#if defined(__NR_vm86)
+ #define SYS_vm86 __NR_vm86
+#endif
+#if defined(__NR_vm86old)
+ #define SYS_vm86old __NR_vm86old
+#endif
+#if defined(__NR_vmsplice)
+ #define SYS_vmsplice __NR_vmsplice
+#endif
+#if defined(__NR_vserver)
+ #define SYS_vserver __NR_vserver
+#endif
+#if defined(__NR_wait4)
+ #define SYS_wait4 __NR_wait4
+#endif
+#if defined(__NR_waitid)
+ #define SYS_waitid __NR_waitid
+#endif
+#if defined(__NR_waitpid)
+ #define SYS_waitpid __NR_waitpid
+#endif
+#if defined(__NR_write)
+ #define SYS_write __NR_write
+#endif
+#if defined(__NR_writev)
+ #define SYS_writev __NR_writev
+#endif
+#endif /* _BIONIC_BITS_GLIBC_SYSCALLS_H_ */
diff --git a/libc/include/bits/sa_family_t.h b/libc/include/bits/sa_family_t.h
new file mode 100644
index 0000000..51ea51f
--- /dev/null
+++ b/libc/include/bits/sa_family_t.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _BITS_SA_FAMILY_T_H_
+#define _BITS_SA_FAMILY_T_H_
+
+typedef unsigned short sa_family_t;
+
+#endif
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
index 302a88e..a07f9c8 100644
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -54,6 +54,9 @@
#define _CTYPE_R (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_D|_CTYPE_B)
#define _CTYPE_A (_CTYPE_L|_CTYPE_U)
+/* _CTYPE_N was added to NDK r10 and is expected by gnu-libstdc++ */
+#define _CTYPE_N _CTYPE_D
+
__BEGIN_DECLS
extern const char* _ctype_;
diff --git a/libc/include/error.h b/libc/include/error.h
index 205890f..18ce379 100644
--- a/libc/include/error.h
+++ b/libc/include/error.h
@@ -33,8 +33,8 @@
__BEGIN_DECLS
-void error(int, int, const char*, ...) __printflike(3, 4) __INTRODUCED_IN(23);
-void error_at_line(int, int, const char*, unsigned int, const char*, ...) __printflike(5, 6)
+void error(int, int, const char* _Nonnull, ...) __printflike(3, 4) __INTRODUCED_IN(23);
+void error_at_line(int, int, const char*, unsigned int, const char* _Nonnull, ...) __printflike(5, 6)
__INTRODUCED_IN(23);
extern void (*error_print_progname)(void) __INTRODUCED_IN(23);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index ef660d8..621caa8 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -55,13 +55,23 @@
struct __sFILE;
typedef struct __sFILE FILE;
+#if __ANDROID_API__ >= 23
extern FILE* stdin __INTRODUCED_IN(23);
extern FILE* stdout __INTRODUCED_IN(23);
extern FILE* stderr __INTRODUCED_IN(23);
+
/* C99 and earlier plus current C++ standards say these must be macros. */
#define stdin stdin
#define stdout stdout
#define stderr stderr
+#else
+/* Before M the actual symbols for stdin and friends had different names. */
+extern FILE* __sF[] __REMOVED_IN(23);
+
+#define stdin __sF[0]
+#define stdout __sF[1]
+#define stderr __sF[2]
+#endif
/*
* The following three definitions are for ANSI C, which took them
@@ -105,13 +115,11 @@
int fflush(FILE *);
int fgetc(FILE *);
char *fgets(char * __restrict, int, FILE * __restrict);
-int fprintf(FILE * __restrict , const char * __restrict, ...)
- __printflike(2, 3);
+int fprintf(FILE * __restrict , const char * __restrict _Nonnull, ...) __printflike(2, 3);
int fputc(int, FILE *);
int fputs(const char * __restrict, FILE * __restrict);
size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
-int fscanf(FILE * __restrict, const char * __restrict, ...)
- __scanflike(2, 3);
+int fscanf(FILE * __restrict, const char * __restrict _Nonnull, ...) __scanflike(2, 3);
size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
int getc(FILE *);
int getchar(void);
@@ -119,35 +127,28 @@
ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict) __INTRODUCED_IN(18);
void perror(const char *);
-int printf(const char * __restrict, ...)
- __printflike(1, 2);
+int printf(const char * __restrict _Nonnull, ...) __printflike(1, 2);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
void rewind(FILE *);
-int scanf(const char * __restrict, ...)
- __scanflike(1, 2);
+int scanf(const char * __restrict _Nonnull, ...) __scanflike(1, 2);
void setbuf(FILE * __restrict, char * __restrict);
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
-int sscanf(const char * __restrict, const char * __restrict, ...)
- __scanflike(2, 3);
+int sscanf(const char * __restrict, const char * __restrict _Nonnull, ...) __scanflike(2, 3);
int ungetc(int, FILE *);
-int vfprintf(FILE * __restrict, const char * __restrict, __va_list)
- __printflike(2, 0);
-int vprintf(const char * __restrict, __va_list)
- __printflike(1, 0);
+int vfprintf(FILE * __restrict, const char * __restrict _Nonnull, __va_list) __printflike(2, 0);
+int vprintf(const char * __restrict _Nonnull, __va_list) __printflike(1, 0);
-int dprintf(int, const char* __restrict, ...) __printflike(2, 3) __INTRODUCED_IN(21);
-int vdprintf(int, const char* __restrict, __va_list) __printflike(2, 0) __INTRODUCED_IN(21);
+int dprintf(int, const char* __restrict _Nonnull, ...) __printflike(2, 3) __INTRODUCED_IN(21);
+int vdprintf(int, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __INTRODUCED_IN(21);
#if __STDC_VERSION__ < 201112L
char* gets(char*) __attribute__((deprecated("gets is unsafe, use fgets instead")));
#endif
-int sprintf(char* __restrict, const char* __restrict, ...)
- __printflike(2, 3) __warnattr("sprintf is often misused; please use snprintf");
-int vsprintf(char* __restrict, const char* __restrict, __va_list)
- __printflike(2, 0) __warnattr("vsprintf is often misused; please use vsnprintf");
+int sprintf(char* __restrict, const char* __restrict _Nonnull, ...) __printflike(2, 3) __warnattr("sprintf is often misused; please use snprintf");
+int vsprintf(char* __restrict, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __warnattr("vsprintf is often misused; please use vsnprintf");
char* tmpnam(char*) __attribute__((deprecated("tmpnam is unsafe, use mkstemp or tmpfile instead")));
#if defined(__USE_BSD) || defined(__USE_GNU)
#define P_tmpdir "/tmp/" /* deprecated */
@@ -203,11 +204,11 @@
FILE* tmpfile(void);
FILE* tmpfile64(void) __INTRODUCED_IN(24);
-int snprintf(char* __restrict, size_t, const char* __restrict, ...) __printflike(3, 4);
-int vfscanf(FILE* __restrict, const char* __restrict, __va_list) __scanflike(2, 0);
-int vscanf(const char*, __va_list) __scanflike(1, 0);
-int vsnprintf(char* __restrict, size_t, const char* __restrict, __va_list) __printflike(3, 0);
-int vsscanf(const char* __restrict, const char* __restrict, __va_list) __scanflike(2, 0);
+int snprintf(char* __restrict, size_t, const char* __restrict _Nonnull, ...) __printflike(3, 4);
+int vfscanf(FILE* __restrict, const char* __restrict _Nonnull, __va_list) __scanflike(2, 0);
+int vscanf(const char* _Nonnull , __va_list) __scanflike(1, 0);
+int vsnprintf(char* __restrict, size_t, const char* __restrict _Nonnull, __va_list) __printflike(3, 0);
+int vsscanf(const char* __restrict _Nonnull, const char* __restrict _Nonnull, __va_list) __scanflike(2, 0);
#define L_ctermid 1024 /* size for ctermid() */
char* ctermid(char*) __INTRODUCED_IN_FUTURE;
@@ -228,12 +229,12 @@
FILE* open_memstream(char**, size_t*) __INTRODUCED_IN(23);
#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
-int asprintf(char** __restrict, const char* __restrict, ...) __printflike(2, 3);
+int asprintf(char** __restrict, const char* __restrict _Nonnull, ...) __printflike(2, 3);
char* fgetln(FILE* __restrict, size_t* __restrict);
int fpurge(FILE*);
void setbuffer(FILE*, char*, int);
int setlinebuf(FILE*);
-int vasprintf(char** __restrict, const char* __restrict, __va_list) __printflike(2, 0);
+int vasprintf(char** __restrict, const char* __restrict _Nonnull, __va_list) __printflike(2, 0);
void clearerr_unlocked(FILE*) __INTRODUCED_IN(23);
int feof_unlocked(FILE*) __INTRODUCED_IN(23);
int ferror_unlocked(FILE*) __INTRODUCED_IN(23);
@@ -262,16 +263,12 @@
#if defined(__BIONIC_FORTIFY)
__BIONIC_FORTIFY_INLINE
-__printflike(3, 0)
-int vsnprintf(char *dest, size_t size, const char *format, __va_list ap)
-{
+__printflike(3, 0) int vsnprintf(char* dest, size_t size, const char* _Nonnull format, __va_list ap) {
return __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, ap);
}
__BIONIC_FORTIFY_INLINE
-__printflike(2, 0)
-int vsprintf(char *dest, const char *format, __va_list ap)
-{
+__printflike(2, 0) int vsprintf(char* dest, const char* _Nonnull format, __va_list ap) {
return __builtin___vsprintf_chk(dest, 0, __bos(dest), format, ap);
}
@@ -282,11 +279,8 @@
#endif
#else
__BIONIC_FORTIFY_INLINE
-__printflike(3, 4)
-int snprintf(char *dest, size_t size, const char *format, ...)
-{
- return __builtin___snprintf_chk(dest, size, 0,
- __bos(dest), format, __builtin_va_arg_pack());
+__printflike(3, 4) int snprintf(char* dest, size_t size, const char* _Nonnull format, ...) {
+ return __builtin___snprintf_chk(dest, size, 0, __bos(dest), format, __builtin_va_arg_pack());
}
#endif
@@ -297,11 +291,8 @@
#endif
#else
__BIONIC_FORTIFY_INLINE
-__printflike(2, 3)
-int sprintf(char *dest, const char *format, ...)
-{
- return __builtin___sprintf_chk(dest, 0,
- __bos(dest), format, __builtin_va_arg_pack());
+__printflike(2, 3) int sprintf(char* dest, const char* _Nonnull format, ...) {
+ return __builtin___sprintf_chk(dest, 0, __bos(dest), format, __builtin_va_arg_pack());
}
#endif
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index ffbce10..65b92a6 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -76,15 +76,13 @@
__BIONIC_LEGACY_INLINE double atof(const char*);
-extern double strtod(const char*, char**) __LIBC_ABI_PUBLIC__;
-__BIONIC_LEGACY_INLINE float strtof(const char*, char**) __LIBC_ABI_PUBLIC__;
-extern long double strtold(const char*, char**) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(21);
+extern double strtod(const char*, char**);
+__BIONIC_LEGACY_INLINE float strtof(const char*, char**);
+extern long double strtold(const char*, char**) __INTRODUCED_IN(21);
-extern long double strtold_l(const char*, char**, locale_t) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(21);
-extern long long strtoll_l(const char*, char**, int, locale_t) __LIBC_ABI_PUBLIC__
- __INTRODUCED_IN(21);
-extern unsigned long long strtoull_l(const char*, char**, int, locale_t) __LIBC_ABI_PUBLIC__
- __INTRODUCED_IN(21);
+extern long double strtold_l(const char*, char**, locale_t) __INTRODUCED_IN(21);
+extern long long strtoll_l(const char*, char**, int, locale_t) __INTRODUCED_IN(21);
+extern unsigned long long strtoull_l(const char*, char**, int, locale_t) __INTRODUCED_IN(21);
extern int atoi(const char*) __purefunc;
extern long atol(const char*) __purefunc;
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 8cde1c7..89061b6 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -140,7 +140,7 @@
* // The following null check will be elided because nonnull attribute
* // means that, since we call foo with p, p can be assumed to not be
* // null. Thus this will crash if we are called with a null pointer.
- * if (src != NULL) {
+ * if (p != NULL) {
* return *p;
* }
* return 0;
@@ -156,10 +156,8 @@
#define _Nonnull
#endif
-#define __nonnull(args) __attribute__((__nonnull__ args))
-
-#define __printflike(x, y) __attribute__((__format__(printf, x, y))) __nonnull((x))
-#define __scanflike(x, y) __attribute__((__format__(scanf, x, y))) __nonnull((x))
+#define __printflike(x, y) __attribute__((__format__(printf, x, y)))
+#define __scanflike(x, y) __attribute__((__format__(scanf, x, y)))
/*
* GNU C version 2.96 added explicit branch prediction so that
@@ -283,16 +281,16 @@
/* Used to tag non-static symbols that are private and never exposed by the shared library. */
#define __LIBC_HIDDEN__ __attribute__((visibility("hidden")))
-/* Like __LIBC_HIDDEN__, but preserves binary compatibility for LP32. */
+/*
+ * Used to tag symbols that should be hidden for 64-bit,
+ * but visible to preserve binary compatibility for LP32.
+ */
#ifdef __LP64__
-#define __LIBC32_LEGACY_PUBLIC__ __LIBC_HIDDEN__
+#define __LIBC32_LEGACY_PUBLIC__ __attribute__((visibility("hidden")))
#else
-#define __LIBC32_LEGACY_PUBLIC__ __LIBC_ABI_PUBLIC__
+#define __LIBC32_LEGACY_PUBLIC__ __attribute__((visibility("default")))
#endif
-/* Used to tag non-static symbols that are public and exposed by the shared library. */
-#define __LIBC_ABI_PUBLIC__ __attribute__((visibility ("default")))
-
/* Used to rename functions so that the compiler emits a call to 'x' rather than the function this was applied to. */
#define __RENAME(x) __asm__(#x)
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 85999f3..9736ba8 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -40,10 +40,11 @@
#include <linux/types.h>
#include <linux/compiler.h>
+#include <bits/sa_family_t.h>
+
__BEGIN_DECLS
#define sockaddr_storage __kernel_sockaddr_storage
-typedef unsigned short sa_family_t;
struct timespec;
diff --git a/libc/include/sys/un.h b/libc/include/sys/un.h
index 65ffbdcf..421b900 100644
--- a/libc/include/sys/un.h
+++ b/libc/include/sys/un.h
@@ -25,11 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _SYS_UN_H_
#define _SYS_UN_H_
-typedef unsigned short sa_family_t;
-
+#include <bits/sa_family_t.h>
#include <linux/un.h>
-#endif /* _SYS_UN_H_ */
+#endif
diff --git a/libc/include/syslog.h b/libc/include/syslog.h
index 8000f03..d51c9f2 100644
--- a/libc/include/syslog.h
+++ b/libc/include/syslog.h
@@ -88,8 +88,8 @@
void closelog(void);
void openlog(const char*, int, int);
int setlogmask(int);
-void syslog(int, const char*, ...) __printflike(2, 3);
-void vsyslog(int, const char*, va_list) __printflike(2, 0);
+void syslog(int, const char* _Nonnull, ...) __printflike(2, 3);
+void vsyslog(int, const char* _Nonnull, va_list) __printflike(2, 0);
__END_DECLS
diff --git a/libc/include/time.h b/libc/include/time.h
index ef4ac2f..ca4c708 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -37,9 +37,9 @@
#define CLOCKS_PER_SEC 1000000
-extern char* tzname[] __LIBC_ABI_PUBLIC__;
-extern int daylight __LIBC_ABI_PUBLIC__;
-extern long int timezone __LIBC_ABI_PUBLIC__;
+extern char* tzname[];
+extern int daylight;
+extern long int timezone;
struct sigevent;
@@ -59,49 +59,48 @@
#define TM_ZONE tm_zone
-extern time_t time(time_t*) __LIBC_ABI_PUBLIC__;
-extern int nanosleep(const struct timespec*, struct timespec*) __LIBC_ABI_PUBLIC__;
+extern time_t time(time_t*);
+extern int nanosleep(const struct timespec*, struct timespec*);
-extern char* asctime(const struct tm*) __LIBC_ABI_PUBLIC__;
-extern char* asctime_r(const struct tm*, char*) __LIBC_ABI_PUBLIC__;
+extern char* asctime(const struct tm*);
+extern char* asctime_r(const struct tm*, char*);
-extern double difftime(time_t, time_t) __LIBC_ABI_PUBLIC__;
-extern time_t mktime(struct tm*) __LIBC_ABI_PUBLIC__;
+extern double difftime(time_t, time_t);
+extern time_t mktime(struct tm*);
-extern struct tm* localtime(const time_t*) __LIBC_ABI_PUBLIC__;
-extern struct tm* localtime_r(const time_t*, struct tm*) __LIBC_ABI_PUBLIC__;
+extern struct tm* localtime(const time_t*);
+extern struct tm* localtime_r(const time_t*, struct tm*);
-extern struct tm* gmtime(const time_t*) __LIBC_ABI_PUBLIC__;
-extern struct tm* gmtime_r(const time_t*, struct tm*) __LIBC_ABI_PUBLIC__;
+extern struct tm* gmtime(const time_t*);
+extern struct tm* gmtime_r(const time_t*, struct tm*);
-extern char* strptime(const char*, const char*, struct tm*) __LIBC_ABI_PUBLIC__;
-extern size_t strftime(char*, size_t, const char*, const struct tm*) __LIBC_ABI_PUBLIC__;
-extern size_t strftime_l(char*, size_t, const char*, const struct tm*, locale_t) __LIBC_ABI_PUBLIC__
- __INTRODUCED_IN(21);
+extern char* strptime(const char*, const char*, struct tm*);
+extern size_t strftime(char*, size_t, const char*, const struct tm*);
+extern size_t strftime_l(char*, size_t, const char*, const struct tm*, locale_t) __INTRODUCED_IN(21);
-extern char* ctime(const time_t*) __LIBC_ABI_PUBLIC__;
-extern char* ctime_r(const time_t*, char*) __LIBC_ABI_PUBLIC__;
+extern char* ctime(const time_t*);
+extern char* ctime_r(const time_t*, char*);
-extern void tzset(void) __LIBC_ABI_PUBLIC__;
+extern void tzset(void);
-extern clock_t clock(void) __LIBC_ABI_PUBLIC__;
+extern clock_t clock(void);
-extern int clock_getcpuclockid(pid_t, clockid_t*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(23);
+extern int clock_getcpuclockid(pid_t, clockid_t*) __INTRODUCED_IN(23);
-extern int clock_getres(clockid_t, struct timespec*) __LIBC_ABI_PUBLIC__;
-extern int clock_gettime(clockid_t, struct timespec*) __LIBC_ABI_PUBLIC__;
-extern int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*) __LIBC_ABI_PUBLIC__;
-extern int clock_settime(clockid_t, const struct timespec*) __LIBC_ABI_PUBLIC__;
+extern int clock_getres(clockid_t, struct timespec*);
+extern int clock_gettime(clockid_t, struct timespec*);
+extern int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*);
+extern int clock_settime(clockid_t, const struct timespec*);
-extern int timer_create(int, struct sigevent*, timer_t*) __LIBC_ABI_PUBLIC__;
-extern int timer_delete(timer_t) __LIBC_ABI_PUBLIC__;
-extern int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) __LIBC_ABI_PUBLIC__;
-extern int timer_gettime(timer_t, struct itimerspec*) __LIBC_ABI_PUBLIC__;
-extern int timer_getoverrun(timer_t) __LIBC_ABI_PUBLIC__;
+extern int timer_create(int, struct sigevent*, timer_t*);
+extern int timer_delete(timer_t);
+extern int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*);
+extern int timer_gettime(timer_t, struct itimerspec*);
+extern int timer_getoverrun(timer_t);
/* Non-standard extensions that are in the BSDs and glibc. */
-extern time_t timelocal(struct tm*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(12);
-extern time_t timegm(struct tm*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(12);
+extern time_t timelocal(struct tm*) __INTRODUCED_IN(12);
+extern time_t timegm(struct tm*) __INTRODUCED_IN(12);
__END_DECLS
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index 7a1fc07..fbea851 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -104,7 +104,7 @@
extern int wcscoll(const wchar_t *, const wchar_t *);
extern wchar_t *wcscpy(wchar_t *, const wchar_t *);
extern size_t wcscspn(const wchar_t *, const wchar_t *);
-extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *) __LIBC_ABI_PUBLIC__;
+extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
extern size_t wcslen(const wchar_t *);
extern int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
extern int wcsncasecmp_l(const wchar_t*, const wchar_t*, size_t, locale_t) __INTRODUCED_IN(23);
diff --git a/libc/kernel/README.TXT b/libc/kernel/README.TXT
index e7312ef..313dc0d 100644
--- a/libc/kernel/README.TXT
+++ b/libc/kernel/README.TXT
@@ -1,3 +1,6 @@
+Bionic Kernel Header Files
+==========================
+
Bionic comes with a processed set of all of the uapi Linux kernel headers that
can safely be included by userland applications and libraries.
@@ -43,19 +46,34 @@
Automatically update all clean headers from the content of
'external/kernel-headers/original'.
-
-HOW TO UPDATE THE HEADERS WHEN NEEDED:
-======================================
+How To Update The Headers
+=========================
IMPORTANT IMPORTANT:
- WHEN UPDATING THE HEADERS, ALWAYS CHECK THAT THE NEW CLEAN HEADERS DO
- NOT BREAK THE KERNEL <-> USER ABI, FOR EXAMPLE BY CHANGING THE SIZE
- OF A GIVEN TYPE. THIS TASK CANNOT BE EASILY AUTOMATED AT THE MOMENT
+WHEN UPDATING THE HEADERS, ALWAYS CHECK THAT THE NEW CLEAN HEADERS DO
+NOT BREAK THE KERNEL <-> USER ABI, FOR EXAMPLE BY CHANGING THE SIZE
+OF A GIVEN TYPE. THIS TASK CANNOT BE EASILY AUTOMATED AT THE MOMENT.
-Grab the latest headers from the android kernel by running this command:
+Download the Linux kernel source code:
- bionic/libc/kernel/tools/generate_uapi_headers.sh --download-kernel
+ > mkdir kernel_src
+ > cd kernel_src
+ kernel_src> git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
+
+Then checkout the stable tag for the new kernel headers to import:
+
+ kernel_src> cd linux-stable
+ kernel_src/linux-stable> git checkout tags/vXXX
+
+Before running the command to import the headers, make sure that you have
+done a lunch TARGET. The script uses a variable set by the lunch command
+to determine which directory to use as the destination directory.
+
+After running lunch, run this command to import the headers into the android
+source tree:
+
+ bionic/libc/kernel/tools/generate_uapi_headers.sh --use-kernel-dir kernel_src
Next, run this command to copy the parsed files to bionic/libc/kernel/uapi:
diff --git a/libc/kernel/android/README.TXT b/libc/kernel/android/README.TXT
new file mode 100644
index 0000000..dab5f42
--- /dev/null
+++ b/libc/kernel/android/README.TXT
@@ -0,0 +1,6 @@
+The files under this directory are android kernel uapi header files that
+exist in android kernels, but have not been upstreamed into the regular
+kernel.
+
+None of these files will get updated automatically, and are frozen at their
+current value.
diff --git a/libc/kernel/uapi/linux/compiler.h b/libc/kernel/android/uapi/linux/compiler.h
similarity index 100%
rename from libc/kernel/uapi/linux/compiler.h
rename to libc/kernel/android/uapi/linux/compiler.h
diff --git a/libc/kernel/uapi/linux/keychord.h b/libc/kernel/android/uapi/linux/keychord.h
similarity index 100%
rename from libc/kernel/uapi/linux/keychord.h
rename to libc/kernel/android/uapi/linux/keychord.h
diff --git a/libc/kernel/uapi/linux/netfilter_ipv4/ipt_ULOG.h b/libc/kernel/android/uapi/linux/netfilter_ipv4/ipt_ULOG.h
similarity index 100%
rename from libc/kernel/uapi/linux/netfilter_ipv4/ipt_ULOG.h
rename to libc/kernel/android/uapi/linux/netfilter_ipv4/ipt_ULOG.h
diff --git a/libc/kernel/uapi/linux/usb/f_accessory.h b/libc/kernel/android/uapi/linux/usb/f_accessory.h
similarity index 100%
rename from libc/kernel/uapi/linux/usb/f_accessory.h
rename to libc/kernel/android/uapi/linux/usb/f_accessory.h
diff --git a/libc/kernel/uapi/linux/usb/f_mtp.h b/libc/kernel/android/uapi/linux/usb/f_mtp.h
similarity index 100%
rename from libc/kernel/uapi/linux/usb/f_mtp.h
rename to libc/kernel/android/uapi/linux/usb/f_mtp.h
diff --git a/libc/kernel/uapi/video/adf.h b/libc/kernel/android/uapi/video/adf.h
similarity index 100%
rename from libc/kernel/uapi/video/adf.h
rename to libc/kernel/android/uapi/video/adf.h
diff --git a/libc/kernel/uapi/asm-arm/asm/a.out.h b/libc/kernel/uapi/asm-arm/asm/a.out.h
deleted file mode 100644
index 3d51506..0000000
--- a/libc/kernel/uapi/asm-arm/asm/a.out.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ARM_A_OUT_H__
-#define __ARM_A_OUT_H__
-#include <linux/personality.h>
-#include <linux/types.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct exec {
- __u32 a_info;
- __u32 a_text;
- __u32 a_data;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 a_bss;
- __u32 a_syms;
- __u32 a_entry;
- __u32 a_trsize;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 a_drsize;
-};
-#define N_TXTADDR(a) (0x00008000)
-#define N_TRSIZE(a) ((a).a_trsize)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-#define M_ARM 103
-#ifndef LIBRARY_START_TEXT
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define LIBRARY_START_TEXT (0x00c00000)
-#endif
-#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/msr-index.h b/libc/kernel/uapi/asm-x86/asm/msr-index.h
deleted file mode 100644
index 221cec2..0000000
--- a/libc/kernel/uapi/asm-x86/asm/msr-index.h
+++ /dev/null
@@ -1,601 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_X86_MSR_INDEX_H
-#define _ASM_X86_MSR_INDEX_H
-#define MSR_EFER 0xc0000080
-#define MSR_STAR 0xc0000081
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_LSTAR 0xc0000082
-#define MSR_CSTAR 0xc0000083
-#define MSR_SYSCALL_MASK 0xc0000084
-#define MSR_FS_BASE 0xc0000100
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_GS_BASE 0xc0000101
-#define MSR_KERNEL_GS_BASE 0xc0000102
-#define MSR_TSC_AUX 0xc0000103
-#define _EFER_SCE 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define _EFER_LME 8
-#define _EFER_LMA 10
-#define _EFER_NX 11
-#define _EFER_SVME 12
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define _EFER_LMSLE 13
-#define _EFER_FFXSR 14
-#define EFER_SCE (1 << _EFER_SCE)
-#define EFER_LME (1 << _EFER_LME)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define EFER_LMA (1 << _EFER_LMA)
-#define EFER_NX (1 << _EFER_NX)
-#define EFER_SVME (1 << _EFER_SVME)
-#define EFER_LMSLE (1 << _EFER_LMSLE)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define EFER_FFXSR (1 << _EFER_FFXSR)
-#define MSR_IA32_PERFCTR0 0x000000c1
-#define MSR_IA32_PERFCTR1 0x000000c2
-#define MSR_FSB_FREQ 0x000000cd
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_NHM_PLATFORM_INFO 0x000000ce
-#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2
-#define NHM_C3_AUTO_DEMOTE (1UL << 25)
-#define NHM_C1_AUTO_DEMOTE (1UL << 26)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ATM_LNC_C6_AUTO_DEMOTE (1UL << 25)
-#define SNB_C1_AUTO_UNDEMOTE (1UL << 27)
-#define SNB_C3_AUTO_UNDEMOTE (1UL << 28)
-#define MSR_PLATFORM_INFO 0x000000ce
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_MTRRcap 0x000000fe
-#define MSR_IA32_BBL_CR_CTL 0x00000119
-#define MSR_IA32_BBL_CR_CTL3 0x0000011e
-#define MSR_IA32_SYSENTER_CS 0x00000174
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_SYSENTER_ESP 0x00000175
-#define MSR_IA32_SYSENTER_EIP 0x00000176
-#define MSR_IA32_MCG_CAP 0x00000179
-#define MSR_IA32_MCG_STATUS 0x0000017a
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MCG_CTL 0x0000017b
-#define MSR_OFFCORE_RSP_0 0x000001a6
-#define MSR_OFFCORE_RSP_1 0x000001a7
-#define MSR_NHM_TURBO_RATIO_LIMIT 0x000001ad
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IVT_TURBO_RATIO_LIMIT 0x000001ae
-#define MSR_LBR_SELECT 0x000001c8
-#define MSR_LBR_TOS 0x000001c9
-#define MSR_LBR_NHM_FROM 0x00000680
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_LBR_NHM_TO 0x000006c0
-#define MSR_LBR_CORE_FROM 0x00000040
-#define MSR_LBR_CORE_TO 0x00000060
-#define MSR_IA32_PEBS_ENABLE 0x000003f1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_DS_AREA 0x00000600
-#define MSR_IA32_PERF_CAPABILITIES 0x00000345
-#define MSR_PEBS_LD_LAT_THRESHOLD 0x000003f6
-#define MSR_MTRRfix64K_00000 0x00000250
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_MTRRfix16K_80000 0x00000258
-#define MSR_MTRRfix16K_A0000 0x00000259
-#define MSR_MTRRfix4K_C0000 0x00000268
-#define MSR_MTRRfix4K_C8000 0x00000269
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_MTRRfix4K_D0000 0x0000026a
-#define MSR_MTRRfix4K_D8000 0x0000026b
-#define MSR_MTRRfix4K_E0000 0x0000026c
-#define MSR_MTRRfix4K_E8000 0x0000026d
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_MTRRfix4K_F0000 0x0000026e
-#define MSR_MTRRfix4K_F8000 0x0000026f
-#define MSR_MTRRdefType 0x000002ff
-#define MSR_IA32_CR_PAT 0x00000277
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_DEBUGCTLMSR 0x000001d9
-#define MSR_IA32_LASTBRANCHFROMIP 0x000001db
-#define MSR_IA32_LASTBRANCHTOIP 0x000001dc
-#define MSR_IA32_LASTINTFROMIP 0x000001dd
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_LASTINTTOIP 0x000001de
-#define DEBUGCTLMSR_LBR (1UL << 0)
-#define DEBUGCTLMSR_BTF (1UL << 1)
-#define DEBUGCTLMSR_TR (1UL << 6)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define DEBUGCTLMSR_BTS (1UL << 7)
-#define DEBUGCTLMSR_BTINT (1UL << 8)
-#define DEBUGCTLMSR_BTS_OFF_OS (1UL << 9)
-#define DEBUGCTLMSR_BTS_OFF_USR (1UL << 10)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11)
-#define MSR_IA32_POWER_CTL 0x000001fc
-#define MSR_IA32_MC0_CTL 0x00000400
-#define MSR_IA32_MC0_STATUS 0x00000401
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MC0_ADDR 0x00000402
-#define MSR_IA32_MC0_MISC 0x00000403
-#define MSR_PKG_C3_RESIDENCY 0x000003f8
-#define MSR_PKG_C6_RESIDENCY 0x000003f9
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_PKG_C7_RESIDENCY 0x000003fa
-#define MSR_CORE_C3_RESIDENCY 0x000003fc
-#define MSR_CORE_C6_RESIDENCY 0x000003fd
-#define MSR_CORE_C7_RESIDENCY 0x000003fe
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_PKG_C2_RESIDENCY 0x0000060d
-#define MSR_PKG_C8_RESIDENCY 0x00000630
-#define MSR_PKG_C9_RESIDENCY 0x00000631
-#define MSR_PKG_C10_RESIDENCY 0x00000632
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_RAPL_POWER_UNIT 0x00000606
-#define MSR_PKG_POWER_LIMIT 0x00000610
-#define MSR_PKG_ENERGY_STATUS 0x00000611
-#define MSR_PKG_PERF_STATUS 0x00000613
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_PKG_POWER_INFO 0x00000614
-#define MSR_DRAM_POWER_LIMIT 0x00000618
-#define MSR_DRAM_ENERGY_STATUS 0x00000619
-#define MSR_DRAM_PERF_STATUS 0x0000061b
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_DRAM_POWER_INFO 0x0000061c
-#define MSR_PP0_POWER_LIMIT 0x00000638
-#define MSR_PP0_ENERGY_STATUS 0x00000639
-#define MSR_PP0_POLICY 0x0000063a
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_PP0_PERF_STATUS 0x0000063b
-#define MSR_PP1_POWER_LIMIT 0x00000640
-#define MSR_PP1_ENERGY_STATUS 0x00000641
-#define MSR_PP1_POLICY 0x00000642
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_CORE_C1_RES 0x00000660
-#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668
-#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669
-#define MSR_AMD64_MC0_MASK 0xc0010044
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4 * (x))
-#define MSR_IA32_MCx_STATUS(x) (MSR_IA32_MC0_STATUS + 4 * (x))
-#define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4 * (x))
-#define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4 * (x))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x))
-#define MSR_IA32_MC0_CTL2 0x00000280
-#define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x))
-#define MSR_P6_PERFCTR0 0x000000c1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P6_PERFCTR1 0x000000c2
-#define MSR_P6_EVNTSEL0 0x00000186
-#define MSR_P6_EVNTSEL1 0x00000187
-#define MSR_KNC_PERFCTR0 0x00000020
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_KNC_PERFCTR1 0x00000021
-#define MSR_KNC_EVNTSEL0 0x00000028
-#define MSR_KNC_EVNTSEL1 0x00000029
-#define MSR_IA32_PMC0 0x000004c1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_PATCH_LEVEL 0x0000008b
-#define MSR_AMD64_TSC_RATIO 0xc0000104
-#define MSR_AMD64_NB_CFG 0xc001001f
-#define MSR_AMD64_PATCH_LOADER 0xc0010020
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_OSVW_ID_LENGTH 0xc0010140
-#define MSR_AMD64_OSVW_STATUS 0xc0010141
-#define MSR_AMD64_LS_CFG 0xc0011020
-#define MSR_AMD64_DC_CFG 0xc0011022
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_BU_CFG2 0xc001102a
-#define MSR_AMD64_IBSFETCHCTL 0xc0011030
-#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
-#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_IBSFETCH_REG_COUNT 3
-#define MSR_AMD64_IBSFETCH_REG_MASK ((1UL << MSR_AMD64_IBSFETCH_REG_COUNT) - 1)
-#define MSR_AMD64_IBSOPCTL 0xc0011033
-#define MSR_AMD64_IBSOPRIP 0xc0011034
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_IBSOPDATA 0xc0011035
-#define MSR_AMD64_IBSOPDATA2 0xc0011036
-#define MSR_AMD64_IBSOPDATA3 0xc0011037
-#define MSR_AMD64_IBSDCLINAD 0xc0011038
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_IBSDCPHYSAD 0xc0011039
-#define MSR_AMD64_IBSOP_REG_COUNT 7
-#define MSR_AMD64_IBSOP_REG_MASK ((1UL << MSR_AMD64_IBSOP_REG_COUNT) - 1)
-#define MSR_AMD64_IBSCTL 0xc001103a
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_AMD64_IBSBRTARGET 0xc001103b
-#define MSR_AMD64_IBS_REG_COUNT_MAX 8
-#define MSR_F16H_L2I_PERF_CTL 0xc0010230
-#define MSR_F16H_L2I_PERF_CTR 0xc0010231
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_F15H_PERF_CTL 0xc0010200
-#define MSR_F15H_PERF_CTR 0xc0010201
-#define MSR_F15H_NB_PERF_CTL 0xc0010240
-#define MSR_F15H_NB_PERF_CTR 0xc0010241
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058
-#define FAM10H_MMIO_CONF_ENABLE (1 << 0)
-#define FAM10H_MMIO_CONF_BUSRANGE_MASK 0xf
-#define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define FAM10H_MMIO_CONF_BASE_MASK 0xfffffffULL
-#define FAM10H_MMIO_CONF_BASE_SHIFT 20
-#define MSR_FAM10H_NODE_ID 0xc001100c
-#define MSR_K8_TOP_MEM1 0xc001001a
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K8_TOP_MEM2 0xc001001d
-#define MSR_K8_SYSCFG 0xc0010010
-#define MSR_K8_INT_PENDING_MSG 0xc0010055
-#define K8_INTP_C1E_ACTIVE_MASK 0x18000000
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K8_TSEG_ADDR 0xc0010112
-#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000
-#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000
-#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K7_EVNTSEL0 0xc0010000
-#define MSR_K7_PERFCTR0 0xc0010004
-#define MSR_K7_EVNTSEL1 0xc0010001
-#define MSR_K7_PERFCTR1 0xc0010005
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K7_EVNTSEL2 0xc0010002
-#define MSR_K7_PERFCTR2 0xc0010006
-#define MSR_K7_EVNTSEL3 0xc0010003
-#define MSR_K7_PERFCTR3 0xc0010007
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K7_CLK_CTL 0xc001001b
-#define MSR_K7_HWCR 0xc0010015
-#define MSR_K7_FID_VID_CTL 0xc0010041
-#define MSR_K7_FID_VID_STATUS 0xc0010042
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K6_WHCR 0xc0000082
-#define MSR_K6_UWCCR 0xc0000085
-#define MSR_K6_EPMR 0xc0000086
-#define MSR_K6_PSOR 0xc0000087
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_K6_PFIR 0xc0000088
-#define MSR_IDT_FCR1 0x00000107
-#define MSR_IDT_FCR2 0x00000108
-#define MSR_IDT_FCR3 0x00000109
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IDT_FCR4 0x0000010a
-#define MSR_IDT_MCR0 0x00000110
-#define MSR_IDT_MCR1 0x00000111
-#define MSR_IDT_MCR2 0x00000112
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IDT_MCR3 0x00000113
-#define MSR_IDT_MCR4 0x00000114
-#define MSR_IDT_MCR5 0x00000115
-#define MSR_IDT_MCR6 0x00000116
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IDT_MCR7 0x00000117
-#define MSR_IDT_MCR_CTRL 0x00000120
-#define MSR_VIA_FCR 0x00001107
-#define MSR_VIA_LONGHAUL 0x0000110a
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_VIA_RNG 0x0000110b
-#define MSR_VIA_BCR2 0x00001147
-#define MSR_TMTA_LONGRUN_CTRL 0x80868010
-#define MSR_TMTA_LONGRUN_FLAGS 0x80868011
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_TMTA_LRTI_READOUT 0x80868018
-#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a
-#define MSR_IA32_P5_MC_ADDR 0x00000000
-#define MSR_IA32_P5_MC_TYPE 0x00000001
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_TSC 0x00000010
-#define MSR_IA32_PLATFORM_ID 0x00000017
-#define MSR_IA32_EBL_CR_POWERON 0x0000002a
-#define MSR_EBC_FREQUENCY_ID 0x0000002c
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_SMI_COUNT 0x00000034
-#define MSR_IA32_FEATURE_CONTROL 0x0000003a
-#define MSR_IA32_TSC_ADJUST 0x0000003b
-#define MSR_IA32_BNDCFGS 0x00000d90
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_XSS 0x00000da0
-#define FEATURE_CONTROL_LOCKED (1 << 0)
-#define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX (1 << 1)
-#define FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX (1 << 2)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_APICBASE 0x0000001b
-#define MSR_IA32_APICBASE_BSP (1 << 8)
-#define MSR_IA32_APICBASE_ENABLE (1 << 11)
-#define MSR_IA32_APICBASE_BASE (0xfffff << 12)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_TSCDEADLINE 0x000006e0
-#define MSR_IA32_UCODE_WRITE 0x00000079
-#define MSR_IA32_UCODE_REV 0x0000008b
-#define MSR_IA32_PERF_STATUS 0x00000198
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_PERF_CTL 0x00000199
-#define MSR_AMD_PSTATE_DEF_BASE 0xc0010064
-#define MSR_AMD_PERF_STATUS 0xc0010063
-#define MSR_AMD_PERF_CTL 0xc0010062
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MPERF 0x000000e7
-#define MSR_IA32_APERF 0x000000e8
-#define MSR_IA32_THERM_CONTROL 0x0000019a
-#define MSR_IA32_THERM_INTERRUPT 0x0000019b
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define THERM_INT_HIGH_ENABLE (1 << 0)
-#define THERM_INT_LOW_ENABLE (1 << 1)
-#define THERM_INT_PLN_ENABLE (1 << 24)
-#define MSR_IA32_THERM_STATUS 0x0000019c
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define THERM_STATUS_PROCHOT (1 << 0)
-#define THERM_STATUS_POWER_LIMIT (1 << 10)
-#define MSR_THERM2_CTL 0x0000019d
-#define MSR_THERM2_CTL_TM_SELECT (1ULL << 16)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE 0x000001a0
-#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2
-#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0
-#define ENERGY_PERF_BIAS_PERFORMANCE 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ENERGY_PERF_BIAS_NORMAL 6
-#define ENERGY_PERF_BIAS_POWERSAVE 15
-#define MSR_IA32_PACKAGE_THERM_STATUS 0x000001b1
-#define PACKAGE_THERM_STATUS_PROCHOT (1 << 0)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PACKAGE_THERM_STATUS_POWER_LIMIT (1 << 10)
-#define MSR_IA32_PACKAGE_THERM_INTERRUPT 0x000001b2
-#define PACKAGE_THERM_INT_HIGH_ENABLE (1 << 0)
-#define PACKAGE_THERM_INT_LOW_ENABLE (1 << 1)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PACKAGE_THERM_INT_PLN_ENABLE (1 << 24)
-#define THERM_INT_THRESHOLD0_ENABLE (1 << 15)
-#define THERM_SHIFT_THRESHOLD0 8
-#define THERM_MASK_THRESHOLD0 (0x7f << THERM_SHIFT_THRESHOLD0)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define THERM_INT_THRESHOLD1_ENABLE (1 << 23)
-#define THERM_SHIFT_THRESHOLD1 16
-#define THERM_MASK_THRESHOLD1 (0x7f << THERM_SHIFT_THRESHOLD1)
-#define THERM_STATUS_THRESHOLD0 (1 << 6)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define THERM_LOG_THRESHOLD0 (1 << 7)
-#define THERM_STATUS_THRESHOLD1 (1 << 8)
-#define THERM_LOG_THRESHOLD1 (1 << 9)
-#define MSR_IA32_MISC_ENABLE_FAST_STRING_BIT 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << MSR_IA32_MISC_ENABLE_FAST_STRING_BIT)
-#define MSR_IA32_MISC_ENABLE_TCC_BIT 1
-#define MSR_IA32_MISC_ENABLE_TCC (1ULL << MSR_IA32_MISC_ENABLE_TCC_BIT)
-#define MSR_IA32_MISC_ENABLE_EMON_BIT 7
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_EMON (1ULL << MSR_IA32_MISC_ENABLE_EMON_BIT)
-#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL_BIT 11
-#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << MSR_IA32_MISC_ENABLE_BTS_UNAVAIL_BIT)
-#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL_BIT 12
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL_BIT)
-#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP_BIT 16
-#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP_BIT)
-#define MSR_IA32_MISC_ENABLE_MWAIT_BIT 18
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
-#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT 22
-#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT)
-#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT 23
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT 34
-#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_X87_COMPAT_BIT 2
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_X87_COMPAT (1ULL << MSR_IA32_MISC_ENABLE_X87_COMPAT_BIT)
-#define MSR_IA32_MISC_ENABLE_TM1_BIT 3
-#define MSR_IA32_MISC_ENABLE_TM1 (1ULL << MSR_IA32_MISC_ENABLE_TM1_BIT)
-#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE_BIT 4
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE_BIT 6
-#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK_BIT 8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK_BIT)
-#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT 9
-#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_FERR_BIT 10
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_FERR (1ULL << MSR_IA32_MISC_ENABLE_FERR_BIT)
-#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX_BIT 10
-#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX_BIT)
-#define MSR_IA32_MISC_ENABLE_TM2_BIT 13
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << MSR_IA32_MISC_ENABLE_TM2_BIT)
-#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE_BIT 19
-#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK_BIT 20
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK (1ULL << MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK_BIT)
-#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT_BIT 24
-#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT (1ULL << MSR_IA32_MISC_ENABLE_L1D_CONTEXT_BIT)
-#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE_BIT 37
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE_BIT 38
-#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_TURBO_DISABLE_BIT)
-#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT 39
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT)
-#define MSR_IA32_TSC_DEADLINE 0x000006E0
-#define MSR_IA32_MCG_EAX 0x00000180
-#define MSR_IA32_MCG_EBX 0x00000181
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MCG_ECX 0x00000182
-#define MSR_IA32_MCG_EDX 0x00000183
-#define MSR_IA32_MCG_ESI 0x00000184
-#define MSR_IA32_MCG_EDI 0x00000185
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MCG_EBP 0x00000186
-#define MSR_IA32_MCG_ESP 0x00000187
-#define MSR_IA32_MCG_EFLAGS 0x00000188
-#define MSR_IA32_MCG_EIP 0x00000189
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_MCG_RESERVED 0x0000018a
-#define MSR_P4_BPU_PERFCTR0 0x00000300
-#define MSR_P4_BPU_PERFCTR1 0x00000301
-#define MSR_P4_BPU_PERFCTR2 0x00000302
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_BPU_PERFCTR3 0x00000303
-#define MSR_P4_MS_PERFCTR0 0x00000304
-#define MSR_P4_MS_PERFCTR1 0x00000305
-#define MSR_P4_MS_PERFCTR2 0x00000306
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_MS_PERFCTR3 0x00000307
-#define MSR_P4_FLAME_PERFCTR0 0x00000308
-#define MSR_P4_FLAME_PERFCTR1 0x00000309
-#define MSR_P4_FLAME_PERFCTR2 0x0000030a
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_FLAME_PERFCTR3 0x0000030b
-#define MSR_P4_IQ_PERFCTR0 0x0000030c
-#define MSR_P4_IQ_PERFCTR1 0x0000030d
-#define MSR_P4_IQ_PERFCTR2 0x0000030e
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_IQ_PERFCTR3 0x0000030f
-#define MSR_P4_IQ_PERFCTR4 0x00000310
-#define MSR_P4_IQ_PERFCTR5 0x00000311
-#define MSR_P4_BPU_CCCR0 0x00000360
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_BPU_CCCR1 0x00000361
-#define MSR_P4_BPU_CCCR2 0x00000362
-#define MSR_P4_BPU_CCCR3 0x00000363
-#define MSR_P4_MS_CCCR0 0x00000364
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_MS_CCCR1 0x00000365
-#define MSR_P4_MS_CCCR2 0x00000366
-#define MSR_P4_MS_CCCR3 0x00000367
-#define MSR_P4_FLAME_CCCR0 0x00000368
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_FLAME_CCCR1 0x00000369
-#define MSR_P4_FLAME_CCCR2 0x0000036a
-#define MSR_P4_FLAME_CCCR3 0x0000036b
-#define MSR_P4_IQ_CCCR0 0x0000036c
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_IQ_CCCR1 0x0000036d
-#define MSR_P4_IQ_CCCR2 0x0000036e
-#define MSR_P4_IQ_CCCR3 0x0000036f
-#define MSR_P4_IQ_CCCR4 0x00000370
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_IQ_CCCR5 0x00000371
-#define MSR_P4_ALF_ESCR0 0x000003ca
-#define MSR_P4_ALF_ESCR1 0x000003cb
-#define MSR_P4_BPU_ESCR0 0x000003b2
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_BPU_ESCR1 0x000003b3
-#define MSR_P4_BSU_ESCR0 0x000003a0
-#define MSR_P4_BSU_ESCR1 0x000003a1
-#define MSR_P4_CRU_ESCR0 0x000003b8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_CRU_ESCR1 0x000003b9
-#define MSR_P4_CRU_ESCR2 0x000003cc
-#define MSR_P4_CRU_ESCR3 0x000003cd
-#define MSR_P4_CRU_ESCR4 0x000003e0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_CRU_ESCR5 0x000003e1
-#define MSR_P4_DAC_ESCR0 0x000003a8
-#define MSR_P4_DAC_ESCR1 0x000003a9
-#define MSR_P4_FIRM_ESCR0 0x000003a4
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_FIRM_ESCR1 0x000003a5
-#define MSR_P4_FLAME_ESCR0 0x000003a6
-#define MSR_P4_FLAME_ESCR1 0x000003a7
-#define MSR_P4_FSB_ESCR0 0x000003a2
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_FSB_ESCR1 0x000003a3
-#define MSR_P4_IQ_ESCR0 0x000003ba
-#define MSR_P4_IQ_ESCR1 0x000003bb
-#define MSR_P4_IS_ESCR0 0x000003b4
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_IS_ESCR1 0x000003b5
-#define MSR_P4_ITLB_ESCR0 0x000003b6
-#define MSR_P4_ITLB_ESCR1 0x000003b7
-#define MSR_P4_IX_ESCR0 0x000003c8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_IX_ESCR1 0x000003c9
-#define MSR_P4_MOB_ESCR0 0x000003aa
-#define MSR_P4_MOB_ESCR1 0x000003ab
-#define MSR_P4_MS_ESCR0 0x000003c0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_MS_ESCR1 0x000003c1
-#define MSR_P4_PMH_ESCR0 0x000003ac
-#define MSR_P4_PMH_ESCR1 0x000003ad
-#define MSR_P4_RAT_ESCR0 0x000003bc
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_RAT_ESCR1 0x000003bd
-#define MSR_P4_SAAT_ESCR0 0x000003ae
-#define MSR_P4_SAAT_ESCR1 0x000003af
-#define MSR_P4_SSU_ESCR0 0x000003be
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_SSU_ESCR1 0x000003bf
-#define MSR_P4_TBPU_ESCR0 0x000003c2
-#define MSR_P4_TBPU_ESCR1 0x000003c3
-#define MSR_P4_TC_ESCR0 0x000003c4
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_P4_TC_ESCR1 0x000003c5
-#define MSR_P4_U2L_ESCR0 0x000003b0
-#define MSR_P4_U2L_ESCR1 0x000003b1
-#define MSR_P4_PEBS_MATRIX_VERT 0x000003f2
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_CORE_PERF_FIXED_CTR0 0x00000309
-#define MSR_CORE_PERF_FIXED_CTR1 0x0000030a
-#define MSR_CORE_PERF_FIXED_CTR2 0x0000030b
-#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x0000038d
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_CORE_PERF_GLOBAL_STATUS 0x0000038e
-#define MSR_CORE_PERF_GLOBAL_CTRL 0x0000038f
-#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x00000390
-#define MSR_GEODE_BUSCONT_CONF0 0x00001900
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_VMX_BASIC 0x00000480
-#define MSR_IA32_VMX_PINBASED_CTLS 0x00000481
-#define MSR_IA32_VMX_PROCBASED_CTLS 0x00000482
-#define MSR_IA32_VMX_EXIT_CTLS 0x00000483
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_VMX_ENTRY_CTLS 0x00000484
-#define MSR_IA32_VMX_MISC 0x00000485
-#define MSR_IA32_VMX_CR0_FIXED0 0x00000486
-#define MSR_IA32_VMX_CR0_FIXED1 0x00000487
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_VMX_CR4_FIXED0 0x00000488
-#define MSR_IA32_VMX_CR4_FIXED1 0x00000489
-#define MSR_IA32_VMX_VMCS_ENUM 0x0000048a
-#define MSR_IA32_VMX_PROCBASED_CTLS2 0x0000048b
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_VMX_EPT_VPID_CAP 0x0000048c
-#define MSR_IA32_VMX_TRUE_PINBASED_CTLS 0x0000048d
-#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x0000048e
-#define MSR_IA32_VMX_TRUE_EXIT_CTLS 0x0000048f
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_IA32_VMX_TRUE_ENTRY_CTLS 0x00000490
-#define MSR_IA32_VMX_VMFUNC 0x00000491
-#define VMX_BASIC_VMCS_SIZE_SHIFT 32
-#define VMX_BASIC_TRUE_CTLS (1ULL << 55)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define VMX_BASIC_64 0x0001000000000000LLU
-#define VMX_BASIC_MEM_TYPE_SHIFT 50
-#define VMX_BASIC_MEM_TYPE_MASK 0x003c000000000000LLU
-#define VMX_BASIC_MEM_TYPE_WB 6LLU
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define VMX_BASIC_INOUT 0x0040000000000000LLU
-#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
-#define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE 0x1F
-#define MSR_VM_CR 0xc0010114
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSR_VM_IGNNE 0xc0010115
-#define MSR_VM_HSAVE_PA 0xc0010117
-#endif
diff --git a/libc/kernel/uapi/linux/android_alarm.h b/libc/kernel/uapi/linux/android_alarm.h
deleted file mode 100644
index 801a01e..0000000
--- a/libc/kernel/uapi/linux/android_alarm.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_ANDROID_ALARM_H
-#define _UAPI_LINUX_ANDROID_ALARM_H
-#include <linux/ioctl.h>
-#include <linux/time.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum android_alarm_type {
- ANDROID_ALARM_RTC_WAKEUP,
- ANDROID_ALARM_RTC,
- ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- ANDROID_ALARM_ELAPSED_REALTIME,
- ANDROID_ALARM_SYSTEMTIME,
- ANDROID_ALARM_TYPE_COUNT,
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum android_alarm_return_flags {
- ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP,
- ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC,
- ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK = 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- ANDROID_ALARM_ELAPSED_REALTIME_MASK = 1U << ANDROID_ALARM_ELAPSED_REALTIME,
- ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME,
- ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4))
-#define ANDROID_ALARM_WAIT _IO('a', 1)
-#define ALARM_IOW(c,type,size) _IOW('a', (c) | ((type) << 4), size)
-#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
-#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
-#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
-#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
-#endif
diff --git a/libc/kernel/uapi/linux/binder.h b/libc/kernel/uapi/linux/binder.h
deleted file mode 100644
index af3cea9..0000000
--- a/libc/kernel/uapi/linux/binder.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_BINDER_H
-#define _UAPI_LINUX_BINDER_H
-#include <linux/ioctl.h>
-#define B_PACK_CHARS(c1,c2,c3,c4) ((((c1) << 24)) | (((c2) << 16)) | (((c3) << 8)) | (c4))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define B_TYPE_LARGE 0x85
-enum {
- BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE),
- BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE),
- BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE),
- BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE),
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum {
- FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
- FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#ifdef BINDER_IPC_32BIT
-typedef __u32 binder_size_t;
-typedef __u32 binder_uintptr_t;
-#else
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef __u64 binder_size_t;
-typedef __u64 binder_uintptr_t;
-#endif
-struct flat_binder_object {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 type;
- __u32 flags;
- union {
- binder_uintptr_t binder;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 handle;
- };
- binder_uintptr_t cookie;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct binder_write_read {
- binder_size_t write_size;
- binder_size_t write_consumed;
- binder_uintptr_t write_buffer;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- binder_size_t read_size;
- binder_size_t read_consumed;
- binder_uintptr_t read_buffer;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct binder_version {
- __s32 protocol_version;
-};
-#ifdef BINDER_IPC_32BIT
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define BINDER_CURRENT_PROTOCOL_VERSION 7
-#else
-#define BINDER_CURRENT_PROTOCOL_VERSION 8
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
-#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
-#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
-#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
-#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
-#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
-enum transaction_flags {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- TF_ONE_WAY = 0x01,
- TF_ROOT_OBJECT = 0x04,
- TF_STATUS_CODE = 0x08,
- TF_ACCEPT_FDS = 0x10,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct binder_transaction_data {
- union {
- __u32 handle;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- binder_uintptr_t ptr;
- } target;
- binder_uintptr_t cookie;
- __u32 code;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 flags;
- pid_t sender_pid;
- uid_t sender_euid;
- binder_size_t data_size;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- binder_size_t offsets_size;
- union {
- struct {
- binder_uintptr_t buffer;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- binder_uintptr_t offsets;
- } ptr;
- __u8 buf[8];
- } data;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct binder_ptr_cookie {
- binder_uintptr_t ptr;
- binder_uintptr_t cookie;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct binder_handle_cookie {
- __u32 handle;
- binder_uintptr_t cookie;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-} __packed;
-struct binder_pri_desc {
- __s32 priority;
- __u32 desc;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct binder_pri_ptr_cookie {
- __s32 priority;
- binder_uintptr_t ptr;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- binder_uintptr_t cookie;
-};
-enum binder_driver_return_protocol {
- BR_ERROR = _IOR('r', 0, __s32),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BR_OK = _IO('r', 1),
- BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
- BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
- BR_ACQUIRE_RESULT = _IOR('r', 4, __s32),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BR_DEAD_REPLY = _IO('r', 5),
- BR_TRANSACTION_COMPLETE = _IO('r', 6),
- BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie),
- BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie),
- BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie),
- BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie),
- BR_NOOP = _IO('r', 12),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BR_SPAWN_LOOPER = _IO('r', 13),
- BR_FINISHED = _IO('r', 14),
- BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t),
- BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BR_FAILED_REPLY = _IO('r', 17),
-};
-enum binder_driver_command_protocol {
- BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BC_REPLY = _IOW('c', 1, struct binder_transaction_data),
- BC_ACQUIRE_RESULT = _IOW('c', 2, __s32),
- BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t),
- BC_INCREFS = _IOW('c', 4, __u32),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BC_ACQUIRE = _IOW('c', 5, __u32),
- BC_RELEASE = _IOW('c', 6, __u32),
- BC_DECREFS = _IOW('c', 7, __u32),
- BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie),
- BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc),
- BC_REGISTER_LOOPER = _IO('c', 11),
- BC_ENTER_LOOPER = _IO('c', 12),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- BC_EXIT_LOOPER = _IO('c', 13),
- BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie),
- BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie),
- BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-#endif
diff --git a/libc/kernel/uapi/linux/if_pppolac.h b/libc/kernel/uapi/linux/if_pppolac.h
deleted file mode 100644
index 303a899..0000000
--- a/libc/kernel/uapi/linux/if_pppolac.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_IF_PPPOLAC_H
-#define _UAPI_LINUX_IF_PPPOLAC_H
-#include <linux/socket.h>
-#include <linux/types.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct sockaddr_pppolac {
- sa_family_t sa_family;
- unsigned int sa_protocol;
- int udp_socket;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct __attribute__((packed)) {
- __u16 tunnel, session;
- } local, remote;
-} __attribute__((packed));
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
diff --git a/libc/kernel/uapi/linux/if_pppopns.h b/libc/kernel/uapi/linux/if_pppopns.h
deleted file mode 100644
index bd96e94..0000000
--- a/libc/kernel/uapi/linux/if_pppopns.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_IF_PPPOPNS_H
-#define _UAPI_LINUX_IF_PPPOPNS_H
-#include <linux/socket.h>
-#include <linux/types.h>
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct sockaddr_pppopns {
- sa_family_t sa_family;
- unsigned int sa_protocol;
- int tcp_socket;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u16 local;
- __u16 remote;
-} __attribute__((packed));
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/uapi/linux/ioprio.h b/libc/kernel/uapi/linux/ioprio.h
deleted file mode 100644
index 5886e77..0000000
--- a/libc/kernel/uapi/linux/ioprio.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_IOPRIO_H
-#define _UAPI_LINUX_IOPRIO_H
-#define IOPRIO_BITS (16)
-#define IOPRIO_CLASS_SHIFT (13)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
-#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT)
-#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
-#define IOPRIO_PRIO_VALUE(class,data) (((class) << IOPRIO_CLASS_SHIFT) | data)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE)
-enum {
- IOPRIO_CLASS_NONE,
- IOPRIO_CLASS_RT,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- IOPRIO_CLASS_BE,
- IOPRIO_CLASS_IDLE,
-};
-#define IOPRIO_BE_NR (8)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum {
- IOPRIO_WHO_PROCESS = 1,
- IOPRIO_WHO_PGRP,
- IOPRIO_WHO_USER,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-#define IOPRIO_NORM (4)
-#endif
diff --git a/libc/kernel/uapi/linux/netfilter_bridge/ebt_ulog.h b/libc/kernel/uapi/linux/netfilter_bridge/ebt_ulog.h
deleted file mode 100644
index 029d6b1..0000000
--- a/libc/kernel/uapi/linux/netfilter_bridge/ebt_ulog.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _EBT_ULOG_H
-#define _EBT_ULOG_H
-#include <linux/types.h>
-#define EBT_ULOG_DEFAULT_NLGROUP 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define EBT_ULOG_DEFAULT_QTHRESHOLD 1
-#define EBT_ULOG_MAXNLGROUPS 32
-#define EBT_ULOG_PREFIX_LEN 32
-#define EBT_ULOG_MAX_QLEN 50
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define EBT_ULOG_WATCHER "ulog"
-#define EBT_ULOG_VERSION 1
-struct ebt_ulog_info {
- __u32 nlgroup;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int cprange;
- unsigned int qthreshold;
- char prefix[EBT_ULOG_PREFIX_LEN];
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef struct ebt_ulog_packet_msg {
- int version;
- char indev[IFNAMSIZ];
- char outdev[IFNAMSIZ];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- char physindev[IFNAMSIZ];
- char physoutdev[IFNAMSIZ];
- char prefix[EBT_ULOG_PREFIX_LEN];
- struct timeval stamp;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned long mark;
- unsigned int hook;
- size_t data_len;
- unsigned char data[0] __attribute__((aligned(__alignof__(struct ebt_ulog_info))));
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-} ebt_ulog_packet_msg_t;
-#endif
diff --git a/libc/kernel/uapi/linux/nvme.h b/libc/kernel/uapi/linux/nvme.h
deleted file mode 100644
index 030f01c..0000000
--- a/libc/kernel/uapi/linux/nvme.h
+++ /dev/null
@@ -1,595 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_NVME_H
-#define _UAPI_LINUX_NVME_H
-#include <linux/types.h>
-struct nvme_id_power_state {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 max_power;
- __u8 rsvd2;
- __u8 flags;
- __le32 entry_lat;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 exit_lat;
- __u8 read_tput;
- __u8 read_lat;
- __u8 write_tput;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 write_lat;
- __le16 idle_power;
- __u8 idle_scale;
- __u8 rsvd19;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 active_power;
- __u8 active_work_scale;
- __u8 rsvd23[9];
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum {
- NVME_PS_FLAGS_MAX_POWER_SCALE = 1 << 0,
- NVME_PS_FLAGS_NON_OP_STATE = 1 << 1,
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct nvme_id_ctrl {
- __le16 vid;
- __le16 ssvid;
- char sn[20];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- char mn[40];
- char fr[8];
- __u8 rab;
- __u8 ieee[3];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 mic;
- __u8 mdts;
- __u16 cntlid;
- __u32 ver;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 rsvd84[172];
- __le16 oacs;
- __u8 acl;
- __u8 aerl;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 frmw;
- __u8 lpa;
- __u8 elpe;
- __u8 npss;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 avscc;
- __u8 apsta;
- __le16 wctemp;
- __le16 cctemp;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 rsvd270[242];
- __u8 sqes;
- __u8 cqes;
- __u8 rsvd514[2];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 nn;
- __le16 oncs;
- __le16 fuses;
- __u8 fna;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 vwc;
- __le16 awun;
- __le16 awupf;
- __u8 nvscc;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 rsvd531;
- __le16 acwu;
- __u8 rsvd534[2];
- __le32 sgls;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 rsvd540[1508];
- struct nvme_id_power_state psd[32];
- __u8 vs[1024];
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum {
- NVME_CTRL_ONCS_COMPARE = 1 << 0,
- NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
- NVME_CTRL_ONCS_DSM = 1 << 2,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_CTRL_VWC_PRESENT = 1 << 0,
-};
-struct nvme_lbaf {
- __le16 ms;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 ds;
- __u8 rp;
-};
-struct nvme_id_ns {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le64 nsze;
- __le64 ncap;
- __le64 nuse;
- __u8 nsfeat;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 nlbaf;
- __u8 flbas;
- __u8 mc;
- __u8 dpc;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 dps;
- __u8 nmic;
- __u8 rescap;
- __u8 fpi;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 rsvd33;
- __le16 nawun;
- __le16 nawupf;
- __le16 nacwu;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 rsvd40[80];
- __u8 eui64[8];
- struct nvme_lbaf lbaf[16];
- __u8 rsvd192[192];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 vs[3712];
-};
-enum {
- NVME_NS_FEAT_THIN = 1 << 0,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_LBAF_RP_BEST = 0,
- NVME_LBAF_RP_BETTER = 1,
- NVME_LBAF_RP_GOOD = 2,
- NVME_LBAF_RP_DEGRADED = 3,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct nvme_smart_log {
- __u8 critical_warning;
- __u8 temperature[2];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 avail_spare;
- __u8 spare_thresh;
- __u8 percent_used;
- __u8 rsvd6[26];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 data_units_read[16];
- __u8 data_units_written[16];
- __u8 host_reads[16];
- __u8 host_writes[16];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 ctrl_busy_time[16];
- __u8 power_cycles[16];
- __u8 power_on_hours[16];
- __u8 unsafe_shutdowns[16];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 media_errors[16];
- __u8 num_err_log_entries[16];
- __le32 warning_temp_time;
- __le32 critical_comp_time;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 temp_sensor[8];
- __u8 rsvd216[296];
-};
-enum {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SMART_CRIT_SPARE = 1 << 0,
- NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
- NVME_SMART_CRIT_RELIABILITY = 1 << 2,
- NVME_SMART_CRIT_MEDIA = 1 << 3,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4,
-};
-struct nvme_lba_range_type {
- __u8 type;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 attributes;
- __u8 rsvd2[14];
- __u64 slba;
- __u64 nlb;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 guid[16];
- __u8 rsvd48[16];
-};
-enum {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_LBART_TYPE_FS = 0x01,
- NVME_LBART_TYPE_RAID = 0x02,
- NVME_LBART_TYPE_CACHE = 0x03,
- NVME_LBART_TYPE_SWAP = 0x04,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_LBART_ATTRIB_TEMP = 1 << 0,
- NVME_LBART_ATTRIB_HIDE = 1 << 1,
-};
-enum nvme_opcode {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- nvme_cmd_flush = 0x00,
- nvme_cmd_write = 0x01,
- nvme_cmd_read = 0x02,
- nvme_cmd_write_uncor = 0x04,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- nvme_cmd_compare = 0x05,
- nvme_cmd_dsm = 0x09,
-};
-struct nvme_common_command {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 opcode;
- __u8 flags;
- __u16 command_id;
- __le32 nsid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 cdw2[2];
- __le64 metadata;
- __le64 prp1;
- __le64 prp2;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 cdw10[6];
-};
-struct nvme_rw_command {
- __u8 opcode;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 flags;
- __u16 command_id;
- __le32 nsid;
- __u64 rsvd2;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le64 metadata;
- __le64 prp1;
- __le64 prp2;
- __le64 slba;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 length;
- __le16 control;
- __le32 dsmgmt;
- __le32 reftag;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 apptag;
- __le16 appmask;
-};
-enum {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_RW_LR = 1 << 15,
- NVME_RW_FUA = 1 << 14,
- NVME_RW_DSM_FREQ_UNSPEC = 0,
- NVME_RW_DSM_FREQ_TYPICAL = 1,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_RW_DSM_FREQ_RARE = 2,
- NVME_RW_DSM_FREQ_READS = 3,
- NVME_RW_DSM_FREQ_WRITES = 4,
- NVME_RW_DSM_FREQ_RW = 5,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_RW_DSM_FREQ_ONCE = 6,
- NVME_RW_DSM_FREQ_PREFETCH = 7,
- NVME_RW_DSM_FREQ_TEMP = 8,
- NVME_RW_DSM_LATENCY_NONE = 0 << 4,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
- NVME_RW_DSM_LATENCY_NORM = 2 << 4,
- NVME_RW_DSM_LATENCY_LOW = 3 << 4,
- NVME_RW_DSM_SEQ_REQ = 1 << 6,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_RW_DSM_COMPRESSED = 1 << 7,
-};
-struct nvme_dsm_cmd {
- __u8 opcode;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 flags;
- __u16 command_id;
- __le32 nsid;
- __u64 rsvd2[2];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le64 prp1;
- __le64 prp2;
- __le32 nr;
- __le32 attributes;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 rsvd12[4];
-};
-enum {
- NVME_DSMGMT_IDR = 1 << 0,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_DSMGMT_IDW = 1 << 1,
- NVME_DSMGMT_AD = 1 << 2,
-};
-struct nvme_dsm_range {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 cattr;
- __le32 nlb;
- __le64 slba;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-enum nvme_admin_opcode {
- nvme_admin_delete_sq = 0x00,
- nvme_admin_create_sq = 0x01,
- nvme_admin_get_log_page = 0x02,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- nvme_admin_delete_cq = 0x04,
- nvme_admin_create_cq = 0x05,
- nvme_admin_identify = 0x06,
- nvme_admin_abort_cmd = 0x08,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- nvme_admin_set_features = 0x09,
- nvme_admin_get_features = 0x0a,
- nvme_admin_async_event = 0x0c,
- nvme_admin_activate_fw = 0x10,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- nvme_admin_download_fw = 0x11,
- nvme_admin_format_nvm = 0x80,
- nvme_admin_security_send = 0x81,
- nvme_admin_security_recv = 0x82,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-enum {
- NVME_QUEUE_PHYS_CONTIG = (1 << 0),
- NVME_CQ_IRQ_ENABLED = (1 << 1),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SQ_PRIO_URGENT = (0 << 1),
- NVME_SQ_PRIO_HIGH = (1 << 1),
- NVME_SQ_PRIO_MEDIUM = (2 << 1),
- NVME_SQ_PRIO_LOW = (3 << 1),
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_FEAT_ARBITRATION = 0x01,
- NVME_FEAT_POWER_MGMT = 0x02,
- NVME_FEAT_LBA_RANGE = 0x03,
- NVME_FEAT_TEMP_THRESH = 0x04,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_FEAT_ERR_RECOVERY = 0x05,
- NVME_FEAT_VOLATILE_WC = 0x06,
- NVME_FEAT_NUM_QUEUES = 0x07,
- NVME_FEAT_IRQ_COALESCE = 0x08,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_FEAT_IRQ_CONFIG = 0x09,
- NVME_FEAT_WRITE_ATOMIC = 0x0a,
- NVME_FEAT_ASYNC_EVENT = 0x0b,
- NVME_FEAT_SW_PROGRESS = 0x0c,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_LOG_ERROR = 0x01,
- NVME_LOG_SMART = 0x02,
- NVME_LOG_FW_SLOT = 0x03,
- NVME_LOG_RESERVATION = 0x80,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_FWACT_REPL = (0 << 3),
- NVME_FWACT_REPL_ACTV = (1 << 3),
- NVME_FWACT_ACTV = (2 << 3),
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct nvme_identify {
- __u8 opcode;
- __u8 flags;
- __u16 command_id;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 nsid;
- __u64 rsvd2[2];
- __le64 prp1;
- __le64 prp2;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 cns;
- __u32 rsvd11[5];
-};
-struct nvme_features {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 opcode;
- __u8 flags;
- __u16 command_id;
- __le32 nsid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u64 rsvd2[2];
- __le64 prp1;
- __le64 prp2;
- __le32 fid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 dword11;
- __u32 rsvd12[4];
-};
-struct nvme_create_cq {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 opcode;
- __u8 flags;
- __u16 command_id;
- __u32 rsvd1[5];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le64 prp1;
- __u64 rsvd8;
- __le16 cqid;
- __le16 qsize;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 cq_flags;
- __le16 irq_vector;
- __u32 rsvd12[4];
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct nvme_create_sq {
- __u8 opcode;
- __u8 flags;
- __u16 command_id;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 rsvd1[5];
- __le64 prp1;
- __u64 rsvd8;
- __le16 sqid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 qsize;
- __le16 sq_flags;
- __le16 cqid;
- __u32 rsvd12[4];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct nvme_delete_queue {
- __u8 opcode;
- __u8 flags;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u16 command_id;
- __u32 rsvd1[9];
- __le16 qid;
- __u16 rsvd10;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 rsvd11[5];
-};
-struct nvme_abort_cmd {
- __u8 opcode;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 flags;
- __u16 command_id;
- __u32 rsvd1[9];
- __le16 sqid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u16 cid;
- __u32 rsvd11[5];
-};
-struct nvme_download_firmware {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 opcode;
- __u8 flags;
- __u16 command_id;
- __u32 rsvd1[5];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le64 prp1;
- __le64 prp2;
- __le32 numd;
- __le32 offset;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 rsvd12[4];
-};
-struct nvme_format_cmd {
- __u8 opcode;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 flags;
- __u16 command_id;
- __le32 nsid;
- __u64 rsvd2[4];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le32 cdw10;
- __u32 rsvd11[5];
-};
-struct nvme_command {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- union {
- struct nvme_common_command common;
- struct nvme_rw_command rw;
- struct nvme_identify identify;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct nvme_features features;
- struct nvme_create_cq create_cq;
- struct nvme_create_sq create_sq;
- struct nvme_delete_queue delete_queue;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct nvme_download_firmware dlfw;
- struct nvme_format_cmd format;
- struct nvme_dsm_cmd dsm;
- struct nvme_abort_cmd abort;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- };
-};
-enum {
- NVME_SC_SUCCESS = 0x0,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_INVALID_OPCODE = 0x1,
- NVME_SC_INVALID_FIELD = 0x2,
- NVME_SC_CMDID_CONFLICT = 0x3,
- NVME_SC_DATA_XFER_ERROR = 0x4,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_POWER_LOSS = 0x5,
- NVME_SC_INTERNAL = 0x6,
- NVME_SC_ABORT_REQ = 0x7,
- NVME_SC_ABORT_QUEUE = 0x8,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_FUSED_FAIL = 0x9,
- NVME_SC_FUSED_MISSING = 0xa,
- NVME_SC_INVALID_NS = 0xb,
- NVME_SC_CMD_SEQ_ERROR = 0xc,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_LBA_RANGE = 0x80,
- NVME_SC_CAP_EXCEEDED = 0x81,
- NVME_SC_NS_NOT_READY = 0x82,
- NVME_SC_CQ_INVALID = 0x100,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_QID_INVALID = 0x101,
- NVME_SC_QUEUE_SIZE = 0x102,
- NVME_SC_ABORT_LIMIT = 0x103,
- NVME_SC_ABORT_MISSING = 0x104,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_ASYNC_LIMIT = 0x105,
- NVME_SC_FIRMWARE_SLOT = 0x106,
- NVME_SC_FIRMWARE_IMAGE = 0x107,
- NVME_SC_INVALID_VECTOR = 0x108,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_INVALID_LOG_PAGE = 0x109,
- NVME_SC_INVALID_FORMAT = 0x10a,
- NVME_SC_BAD_ATTRIBUTES = 0x180,
- NVME_SC_WRITE_FAULT = 0x280,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_READ_ERROR = 0x281,
- NVME_SC_GUARD_CHECK = 0x282,
- NVME_SC_APPTAG_CHECK = 0x283,
- NVME_SC_REFTAG_CHECK = 0x284,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- NVME_SC_COMPARE_FAILED = 0x285,
- NVME_SC_ACCESS_DENIED = 0x286,
- NVME_SC_DNR = 0x4000,
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct nvme_completion {
- __le32 result;
- __u32 rsvd;
- __le16 sq_head;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __le16 sq_id;
- __u16 command_id;
- __le16 status;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct nvme_user_io {
- __u8 opcode;
- __u8 flags;
- __u16 control;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u16 nblocks;
- __u16 rsvd;
- __u64 metadata;
- __u64 addr;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u64 slba;
- __u32 dsmgmt;
- __u32 reftag;
- __u16 apptag;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u16 appmask;
-};
-struct nvme_admin_cmd {
- __u8 opcode;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u8 flags;
- __u16 rsvd1;
- __u32 nsid;
- __u32 cdw2;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 cdw3;
- __u64 metadata;
- __u64 addr;
- __u32 metadata_len;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 data_len;
- __u32 cdw10;
- __u32 cdw11;
- __u32 cdw12;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 cdw13;
- __u32 cdw14;
- __u32 cdw15;
- __u32 timeout_ms;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 result;
-};
-#define NVME_IOCTL_ID _IO('N', 0x40)
-#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
-#endif
diff --git a/libc/kernel/uapi/linux/som.h b/libc/kernel/uapi/linux/som.h
deleted file mode 100644
index cb76e70..0000000
--- a/libc/kernel/uapi/linux/som.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_SOM_H
-#define _LINUX_SOM_H
-#include <linux/time.h>
-#define SOM_PAGESIZE 4096
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct som_hdr {
- short system_id;
- short a_magic;
- unsigned int version_id;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct timespec file_time;
- unsigned int entry_space;
- unsigned int entry_subspace;
- unsigned int entry_offset;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int aux_header_location;
- unsigned int aux_header_size;
- unsigned int som_length;
- unsigned int presumed_dp;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int space_location;
- unsigned int space_total;
- unsigned int subspace_location;
- unsigned int subspace_total;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int loader_fixup_location;
- unsigned int loader_fixup_total;
- unsigned int space_strings_location;
- unsigned int space_strings_size;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int init_array_location;
- unsigned int init_array_total;
- unsigned int compiler_location;
- unsigned int compiler_total;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int symbol_location;
- unsigned int symbol_total;
- unsigned int fixup_request_location;
- unsigned int fixup_request_total;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int symbol_strings_location;
- unsigned int symbol_strings_size;
- unsigned int unloadable_sp_location;
- unsigned int unloadable_sp_size;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int checksum;
-};
-#define SOM_SID_PARISC_1_0 0x020b
-#define SOM_SID_PARISC_1_1 0x0210
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOM_SID_PARISC_2_0 0x0214
-#define SOM_LIB_EXEC 0x0104
-#define SOM_RELOCATABLE 0x0106
-#define SOM_EXEC_NONSHARE 0x0107
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOM_EXEC_SHARE 0x0108
-#define SOM_EXEC_DEMAND 0x010B
-#define SOM_LIB_DYN 0x010D
-#define SOM_LIB_SHARE 0x010E
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOM_LIB_RELOC 0x0619
-#define SOM_ID_OLD 85082112
-#define SOM_ID_NEW 87102412
-struct aux_id {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int mandatory : 1;
- unsigned int copy : 1;
- unsigned int append : 1;
- unsigned int ignore : 1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int reserved : 12;
- unsigned int type : 16;
- unsigned int length;
-};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct som_exec_auxhdr {
- struct aux_id som_auxhdr;
- int exec_tsize;
- int exec_tmem;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int exec_tfile;
- int exec_dsize;
- int exec_dmem;
- int exec_dfile;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int exec_bsize;
- int exec_entry;
- int exec_flags;
- int exec_bfill;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-union name_pt {
- char * n_name;
- unsigned int n_strx;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct space_dictionary_record {
- union name_pt name;
- unsigned int is_loadable : 1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int is_defined : 1;
- unsigned int is_private : 1;
- unsigned int has_intermediate_code : 1;
- unsigned int is_tspecific : 1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int reserved : 11;
- unsigned int sort_key : 8;
- unsigned int reserved2 : 8;
- int space_number;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int subspace_index;
- unsigned int subspace_quantity;
- int loader_fix_index;
- unsigned int loader_fix_quantity;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int init_pointer_index;
- unsigned int init_pointer_quantity;
-};
-struct subspace_dictionary_record {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int space_index;
- unsigned int access_control_bits : 7;
- unsigned int memory_resident : 1;
- unsigned int dup_common : 1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int is_common : 1;
- unsigned int quadrant : 2;
- unsigned int initially_frozen : 1;
- unsigned int is_first : 1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int code_only : 1;
- unsigned int sort_key : 8;
- unsigned int replicate_init : 1;
- unsigned int continuation : 1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int is_tspecific : 1;
- unsigned int is_comdat : 1;
- unsigned int reserved : 4;
- int file_loc_init_value;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int initialization_length;
- unsigned int subspace_start;
- unsigned int subspace_length;
- unsigned int reserved2 : 5;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int alignment : 27;
- union name_pt name;
- int fixup_request_index;
- unsigned int fixup_request_quantity;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-#endif
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
new file mode 100644
index 0000000..8ce3ff3
--- /dev/null
+++ b/libc/malloc_debug/Android.bp
@@ -0,0 +1,132 @@
+// ==============================================================
+// libc_malloc_debug_backtrace.a
+// ==============================================================
+// Used by libmemunreachable
+cc_library_static {
+
+ name: "libc_malloc_debug_backtrace",
+
+ srcs: [
+ "backtrace.cpp",
+ "MapData.cpp",
+ ],
+
+ stl: "libc++_static",
+
+ static_libs: ["libc_logging"],
+
+ include_dirs: ["bionic/libc"],
+ export_include_dirs: ["."],
+
+ sanitize: {
+ never: true,
+ },
+ native_coverage: false,
+
+ // -Wno-error=format-zero-length needed for gcc to compile.
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-error=format-zero-length",
+ ],
+
+}
+
+// ==============================================================
+// libc_malloc_debug.so
+// ==============================================================
+cc_library {
+ name: "libc_malloc_debug",
+
+ srcs: [
+ "BacktraceData.cpp",
+ "Config.cpp",
+ "DebugData.cpp",
+ "debug_disable.cpp",
+ "FreeTrackData.cpp",
+ "GuardData.cpp",
+ "malloc_debug.cpp",
+ "RecordData.cpp",
+ "TrackData.cpp",
+ ],
+
+ stl: "libc++_static",
+
+ // Only need this for arm since libc++ uses its own unwind code that
+ // doesn't mix with the other default unwind code.
+ arch: {
+ arm: {
+ static_libs: ["libunwind_llvm"],
+ },
+ },
+
+ static_libs: [
+ "libbase",
+ "libc_malloc_debug_backtrace",
+ "libc_logging",
+ ],
+
+ multilib: {
+ lib32: {
+ version_script: "exported32.map",
+ },
+ lib64: {
+ version_script: "exported64.map",
+ },
+ },
+ allow_undefined_symbols: true,
+ include_dirs: ["bionic/libc"],
+
+ sanitize: {
+ never: true,
+ },
+ native_coverage: false,
+
+ // -Wno-error=format-zero-length needed for gcc to compile.
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-fno-stack-protector",
+ "-Wno-error=format-zero-length",
+ ],
+
+}
+
+// ==============================================================
+// Unit Tests
+// ==============================================================
+cc_test {
+
+ name: "malloc_debug_unit_tests",
+ multilib: {
+ lib32: {
+ suffix: "32",
+ },
+ lib64: {
+ suffix: "64",
+ },
+ },
+
+ srcs: [
+ "tests/backtrace_fake.cpp",
+ "tests/log_fake.cpp",
+ "tests/libc_fake.cpp",
+ "tests/property_fake.cpp",
+ "tests/malloc_debug_config_tests.cpp",
+ "tests/malloc_debug_unit_tests.cpp",
+ ],
+
+ whole_static_libs: ["libc_malloc_debug"],
+
+ local_include_dirs: ["tests"],
+ include_dirs: ["bionic/libc"],
+
+ shared_libs: ["libbase"],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-error=format-zero-length",
+ ],
+
+}
diff --git a/libc/malloc_debug/Android.mk b/libc/malloc_debug/Android.mk
deleted file mode 100644
index 3576611..0000000
--- a/libc/malloc_debug/Android.mk
+++ /dev/null
@@ -1,109 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-libc_malloc_debug_src_files := \
- BacktraceData.cpp \
- Config.cpp \
- DebugData.cpp \
- debug_disable.cpp \
- FreeTrackData.cpp \
- GuardData.cpp \
- malloc_debug.cpp \
- TrackData.cpp \
-
-# ==============================================================
-# libc_malloc_debug_backtrace.a
-# ==============================================================
-# Used by libmemunreachable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libc_malloc_debug_backtrace
-
-LOCAL_SRC_FILES := \
- backtrace.cpp \
- MapData.cpp \
-
-LOCAL_CXX_STL := libc++_static
-
-LOCAL_STATIC_LIBRARIES += \
- libc_logging \
-
-LOCAL_C_INCLUDES += bionic/libc
-LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH)
-
-LOCAL_SANITIZE := never
-LOCAL_NATIVE_COVERAGE := false
-
-# -Wno-error=format-zero-length needed for gcc to compile.
-LOCAL_CFLAGS := \
- -Wall \
- -Werror \
- -Wno-error=format-zero-length \
-
-include $(BUILD_STATIC_LIBRARY)
-
-# ==============================================================
-# libc_malloc_debug.so
-# ==============================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libc_malloc_debug
-
-LOCAL_SRC_FILES := \
- $(libc_malloc_debug_src_files) \
-
-LOCAL_CXX_STL := libc++_static
-
-# Only need this for arm since libc++ uses its own unwind code that
-# doesn't mix with the other default unwind code.
-LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
-
-LOCAL_STATIC_LIBRARIES += \
- libc_malloc_debug_backtrace \
- libc_logging \
-
-LOCAL_LDFLAGS_32 := -Wl,--version-script,$(LOCAL_PATH)/exported32.map
-LOCAL_LDFLAGS_64 := -Wl,--version-script,$(LOCAL_PATH)/exported64.map
-LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
-LOCAL_C_INCLUDES += bionic/libc
-
-LOCAL_SANITIZE := never
-LOCAL_NATIVE_COVERAGE := false
-
-# -Wno-error=format-zero-length needed for gcc to compile.
-LOCAL_CFLAGS := \
- -Wall \
- -Werror \
- -fno-stack-protector \
- -Wno-error=format-zero-length \
-
-include $(BUILD_SHARED_LIBRARY)
-
-# ==============================================================
-# Unit Tests
-# ==============================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := malloc_debug_unit_tests
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-LOCAL_SRC_FILES := \
- tests/backtrace_fake.cpp \
- tests/log_fake.cpp \
- tests/libc_fake.cpp \
- tests/property_fake.cpp \
- tests/malloc_debug_config_tests.cpp \
- tests/malloc_debug_unit_tests.cpp \
- $(libc_malloc_debug_src_files) \
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/tests
-LOCAL_C_INCLUDES += bionic/libc
-
-LOCAL_SHARED_LIBRARIES := libbase
-
-LOCAL_CFLAGS := \
- -Wall \
- -Werror \
- -Wno-error=format-zero-length \
-
-include $(BUILD_NATIVE_TEST)
diff --git a/libc/malloc_debug/Config.cpp b/libc/malloc_debug/Config.cpp
index 6220a23..885542e 100644
--- a/libc/malloc_debug/Config.cpp
+++ b/libc/malloc_debug/Config.cpp
@@ -64,29 +64,126 @@
static constexpr size_t DEFAULT_FREE_TRACK_ALLOCATIONS = 100;
static constexpr size_t MAX_FREE_TRACK_ALLOCATIONS = 16384;
-struct Feature {
- Feature(std::string name, size_t default_value, size_t min_value, size_t max_value,
- uint64_t option, size_t* value, bool* config, bool combo_option)
- : name(name), default_value(default_value), min_value(min_value), max_value(max_value),
- option(option), value(value), config(config), combo_option(combo_option) {}
- std::string name;
- size_t default_value = 0;
- size_t min_value = 0;
- size_t max_value = 0;
+static constexpr size_t DEFAULT_RECORD_ALLOCS = 8000000;
+static constexpr size_t MAX_RECORD_ALLOCS = 50000000;
+static constexpr const char DEFAULT_RECORD_ALLOCS_FILE[] = "/data/local/tmp/record_allocs.txt";
- uint64_t option = 0;
- size_t* value = nullptr;
- bool* config = nullptr;
+struct Option {
+ Option(std::string name, uint64_t option, bool combo_option = false, bool* config = nullptr)
+ : name(name), option(option), combo_option(combo_option), config(config) {}
+ virtual ~Option() = default;
+
+ std::string name;
+
+ uint64_t option;
// If set to true, then all of the options following are set on until
- // for which the combo_option value is set.
+ // the combo_option value is set to false.
bool combo_option = false;
+ bool* config;
+
+ virtual bool ParseValue(const std::string& option_name, const std::string& value) const;
+
+ virtual void SetDefault() const { }
};
+bool Option::ParseValue(const std::string& option_name, const std::string& raw_value) const {
+ if (!raw_value.empty()) {
+ error_log("%s: value set for option '%s' which does not take a value",
+ getprogname(), option_name.c_str());
+ return false;
+ }
+ return true;
+}
+
+struct OptionString : public Option {
+ OptionString(std::string name, uint64_t option, std::string default_value,
+ std::string* value, bool combo_option = false,
+ bool* config = nullptr)
+ : Option(name, option, combo_option, config), default_value(default_value), value(value) {}
+ virtual ~OptionString() = default;
+
+ std::string default_value;
+ std::string* value;
+
+ bool ParseValue(const std::string& option_name, const std::string& value) const override;
+
+ void SetDefault() const override { if (value) *value = default_value; }
+};
+
+bool OptionString::ParseValue(const std::string&, const std::string& raw_value) const {
+ if (!raw_value.empty()) {
+ *value = raw_value;
+ }
+ return true;
+}
+
+struct OptionSizeT : public Option {
+ OptionSizeT(std::string name, size_t default_value, size_t min_value, size_t max_value,
+ uint64_t option, size_t* value, bool combo_option = false, bool* config = nullptr)
+ : Option(name, option, combo_option, config), default_value(default_value),
+ min_value(min_value), max_value(max_value), value(value) {}
+ virtual ~OptionSizeT() = default;
+
+ size_t default_value;
+ size_t min_value;
+ size_t max_value;
+
+ size_t* value;
+
+ bool ParseValue(const std::string& option_name, const std::string& value) const override;
+
+ void SetDefault() const override { if (value) *value = default_value; }
+};
+
+bool OptionSizeT::ParseValue(const std::string& option_name, const std::string& raw_value) const {
+ if (raw_value.empty()) {
+ // Value should have been set by the SetDefault() pass.
+ return true;
+ }
+
+ // Parse the value into a size_t value.
+ errno = 0;
+ char* end;
+ long parsed_value = strtol(raw_value.c_str(), &end, 10);
+ if (errno != 0) {
+ error_log("%s: bad value for option '%s': %s", getprogname(), option_name.c_str(),
+ strerror(errno));
+ return false;
+ }
+ if (end == raw_value.c_str()) {
+ error_log("%s: bad value for option '%s'", getprogname(), option_name.c_str());
+ return false;
+ }
+ if (static_cast<size_t>(end - raw_value.c_str()) != raw_value.size()) {
+ error_log("%s: bad value for option '%s', non space found after option: %s",
+ getprogname(), option_name.c_str(), end);
+ return false;
+ }
+ if (parsed_value < 0) {
+ error_log("%s: bad value for option '%s', value cannot be negative: %ld",
+ getprogname(), option_name.c_str(), parsed_value);
+ return false;
+ }
+
+ if (static_cast<size_t>(parsed_value) < min_value) {
+ error_log("%s: bad value for option '%s', value must be >= %zu: %ld",
+ getprogname(), option_name.c_str(), min_value, parsed_value);
+ return false;
+ }
+ if (static_cast<size_t>(parsed_value) > max_value) {
+ error_log("%s: bad value for option '%s', value must be <= %zu: %ld",
+ getprogname(), option_name.c_str(), max_value, parsed_value);
+ return false;
+ }
+ *value = static_cast<size_t>(parsed_value);
+ return true;
+}
+
class PropertyParser {
public:
explicit PropertyParser(const char* property) : cur_(property) {}
- bool Get(std::string* property, size_t* value, bool* value_set);
+ bool Get(std::string* property, std::string* value);
bool Done() { return done_; }
@@ -100,7 +197,7 @@
DISALLOW_COPY_AND_ASSIGN(PropertyParser);
};
-bool PropertyParser::Get(std::string* property, size_t* value, bool* value_set) {
+bool PropertyParser::Get(std::string* property, std::string* value) {
// Process each property name we can find.
while (isspace(*cur_))
++cur_;
@@ -110,44 +207,30 @@
return false;
}
- const char* property_start = cur_;
+ const char* start = cur_;
while (!isspace(*cur_) && *cur_ != '=' && *cur_ != '\0')
++cur_;
- *property = std::string(property_start, cur_ - property_start);
+ *property = std::string(start, cur_ - start);
// Skip any spaces after the name.
- while (isspace(*cur_) && *cur_ != '=' && *cur_ != '\0')
+ while (isspace(*cur_))
++cur_;
+ value->clear();
if (*cur_ == '=') {
++cur_;
- errno = 0;
- *value_set = true;
- char* end;
- long read_value = strtol(cur_, const_cast<char**>(&end), 10);
- if (errno != 0) {
- error_log("%s: bad value for option '%s': %s", getprogname(), property->c_str(),
- strerror(errno));
- return false;
+ // Skip the space after the equal.
+ while (isspace(*cur_))
+ ++cur_;
+
+ start = cur_;
+ while (!isspace(*cur_) && *cur_ != '\0')
+ ++cur_;
+
+ if (cur_ != start) {
+ *value = std::string(start, cur_ - start);
}
- if (cur_ == end || (!isspace(*end) && *end != '\0')) {
- if (cur_ == end) {
- error_log("%s: bad value for option '%s'", getprogname(), property->c_str());
- } else {
- error_log("%s: bad value for option '%s', non space found after option: %s",
- getprogname(), property->c_str(), end);
- }
- return false;
- } else if (read_value < 0) {
- error_log("%s: bad value for option '%s', value cannot be negative: %ld",
- getprogname(), property->c_str(), read_value);
- return false;
- }
- *value = static_cast<size_t>(read_value);
- cur_ = end;
- } else {
- *value_set = false;
}
return true;
}
@@ -229,34 +312,19 @@
error_log("");
error_log(" leak_track");
error_log(" Enable the leak tracking of memory allocations.");
-}
-
-static bool SetFeature(
- const std::string name, const Feature& feature, size_t value, bool value_set) {
- if (feature.config) {
- *feature.config = true;
- }
- if (feature.value != nullptr) {
- if (value_set) {
- if (value < feature.min_value) {
- error_log("%s: bad value for option '%s', value must be >= %zu: %zu",
- getprogname(), name.c_str(), feature.min_value, value);
- return false;
- } else if (value > feature.max_value) {
- error_log("%s: bad value for option '%s', value must be <= %zu: %zu",
- getprogname(), name.c_str(), feature.max_value, value);
- return false;
- }
- *feature.value = value;
- } else {
- *feature.value = feature.default_value;
- }
- } else if (value_set) {
- error_log("%s: value set for option '%s' which does not take a value",
- getprogname(), name.c_str());
- return false;
- }
- return true;
+ error_log("");
+ error_log(" record_allocs[=XX]");
+ error_log(" Record every single allocation/free call. When a specific signal");
+ error_log(" is sent to the process, the contents of recording are written to");
+ error_log(" a file (%s) and the recording is cleared.", DEFAULT_RECORD_ALLOCS_FILE);
+ error_log(" If XX is set, that is the total number of allocations/frees that can");
+ error_log(" recorded. of frames to capture. The default value is %zu.", DEFAULT_RECORD_ALLOCS);
+ error_log(" If the allocation list fills up, all further allocations are not recorded.");
+ error_log("");
+ error_log(" record_alloc_file[=FILE]");
+ error_log(" This option only has meaning if the record_allocs options has been specified.");
+ error_log(" This is the name of the file to which recording information will be dumped.");
+ error_log(" The default is %s.", DEFAULT_RECORD_ALLOCS_FILE);
}
// This function is designed to be called once. A second call will not
@@ -274,88 +342,123 @@
front_guard_value = DEFAULT_FRONT_GUARD_VALUE;
rear_guard_value = DEFAULT_REAR_GUARD_VALUE;
backtrace_signal = SIGRTMAX - 19;
- free_track_backtrace_num_frames = 16;
+ record_allocs_signal = SIGRTMAX - 18;
+ free_track_backtrace_num_frames = 0;
+ record_allocs_file.clear();
// Parse the options are of the format:
// option_name or option_name=XX
- // Supported features:
- const Feature features[] = {
- Feature("guard", DEFAULT_GUARD_BYTES, 1, MAX_GUARD_BYTES, 0, nullptr, nullptr, true),
- // Enable front guard. Value is the size of the guard.
- Feature("front_guard", DEFAULT_GUARD_BYTES, 1, MAX_GUARD_BYTES, FRONT_GUARD,
- &this->front_guard_bytes, nullptr, true),
- // Enable end guard. Value is the size of the guard.
- Feature("rear_guard", DEFAULT_GUARD_BYTES, 1, MAX_GUARD_BYTES, REAR_GUARD,
- &this->rear_guard_bytes, nullptr, true),
+ // Supported options:
+ const OptionSizeT option_guard(
+ "guard", DEFAULT_GUARD_BYTES, 1, MAX_GUARD_BYTES, 0, nullptr, true);
+ // Enable front guard. Value is the size of the guard.
+ const OptionSizeT option_front_guard(
+ "front_guard", DEFAULT_GUARD_BYTES, 1, MAX_GUARD_BYTES, FRONT_GUARD,
+ &this->front_guard_bytes, true);
+ // Enable end guard. Value is the size of the guard.
+ const OptionSizeT option_rear_guard(
+ "rear_guard", DEFAULT_GUARD_BYTES, 1, MAX_GUARD_BYTES, REAR_GUARD, &this->rear_guard_bytes,
+ true);
- // Enable logging the backtrace on allocation. Value is the total
- // number of frames to log.
- Feature("backtrace", DEFAULT_BACKTRACE_FRAMES, 1, MAX_BACKTRACE_FRAMES,
- BACKTRACE | TRACK_ALLOCS, &this->backtrace_frames, &this->backtrace_enabled, false),
- // Enable gathering backtrace values on a signal.
- Feature("backtrace_enable_on_signal", DEFAULT_BACKTRACE_FRAMES, 1, MAX_BACKTRACE_FRAMES,
- BACKTRACE | TRACK_ALLOCS, &this->backtrace_frames, &this->backtrace_enable_on_signal,
- false),
+ // Enable logging the backtrace on allocation. Value is the total
+ // number of frames to log.
+ const OptionSizeT option_backtrace(
+ "backtrace", DEFAULT_BACKTRACE_FRAMES, 1, MAX_BACKTRACE_FRAMES, BACKTRACE | TRACK_ALLOCS,
+ &this->backtrace_frames, false, &this->backtrace_enabled);
+ // Enable gathering backtrace values on a signal.
+ const OptionSizeT option_backtrace_enable_on_signal(
+ "backtrace_enable_on_signal", DEFAULT_BACKTRACE_FRAMES, 1, MAX_BACKTRACE_FRAMES,
+ BACKTRACE | TRACK_ALLOCS, &this->backtrace_frames, false, &this->backtrace_enable_on_signal);
- Feature("fill", SIZE_MAX, 1, SIZE_MAX, 0, nullptr, nullptr, true),
- // Fill the allocation with an arbitrary pattern on allocation.
- // Value is the number of bytes of the allocation to fill
- // (default entire allocation).
- Feature("fill_on_alloc", SIZE_MAX, 1, SIZE_MAX, FILL_ON_ALLOC, &this->fill_on_alloc_bytes,
- nullptr, true),
- // Fill the allocation with an arbitrary pattern on free.
- // Value is the number of bytes of the allocation to fill
- // (default entire allocation).
- Feature("fill_on_free", SIZE_MAX, 1, SIZE_MAX, FILL_ON_FREE, &this->fill_on_free_bytes, nullptr, true),
+ const OptionSizeT option_fill("fill", SIZE_MAX, 1, SIZE_MAX, 0, nullptr, true);
+ // Fill the allocation with an arbitrary pattern on allocation.
+ // Value is the number of bytes of the allocation to fill
+ // (default entire allocation).
+ const OptionSizeT option_fill_on_alloc(
+ "fill_on_alloc", SIZE_MAX, 1, SIZE_MAX, FILL_ON_ALLOC, &this->fill_on_alloc_bytes, true);
+ // Fill the allocation with an arbitrary pattern on free.
+ // Value is the number of bytes of the allocation to fill
+ // (default entire allocation).
+ const OptionSizeT option_fill_on_free(
+ "fill_on_free", SIZE_MAX, 1, SIZE_MAX, FILL_ON_FREE, &this->fill_on_free_bytes, true);
- // Expand the size of every alloc by this number bytes. Value is
- // the total number of bytes to expand every allocation by.
- Feature ("expand_alloc", DEFAULT_EXPAND_BYTES, 1, MAX_EXPAND_BYTES, EXPAND_ALLOC,
- &this->expand_alloc_bytes, nullptr, false),
+ // Expand the size of every alloc by this number bytes. Value is
+ // the total number of bytes to expand every allocation by.
+ const OptionSizeT option_expand_alloc(
+ "expand_alloc", DEFAULT_EXPAND_BYTES, 1, MAX_EXPAND_BYTES, EXPAND_ALLOC,
+ &this->expand_alloc_bytes);
- // Keep track of the freed allocations and verify at a later date
- // that they have not been used. Turning this on, also turns on
- // fill on free.
- Feature("free_track", DEFAULT_FREE_TRACK_ALLOCATIONS, 1, MAX_FREE_TRACK_ALLOCATIONS,
- FREE_TRACK | FILL_ON_FREE, &this->free_track_allocations, nullptr, false),
- // Number of backtrace frames to keep when free_track is enabled. If this
- // value is set to zero, no backtrace will be kept.
- Feature("free_track_backtrace_num_frames", DEFAULT_BACKTRACE_FRAMES,
- 0, MAX_BACKTRACE_FRAMES, 0, &this->free_track_backtrace_num_frames, nullptr, false),
+ // Keep track of the freed allocations and verify at a later date
+ // that they have not been used. Turning this on, also turns on
+ // fill on free.
+ const OptionSizeT option_free_track(
+ "free_track", DEFAULT_FREE_TRACK_ALLOCATIONS, 1, MAX_FREE_TRACK_ALLOCATIONS,
+ FREE_TRACK | FILL_ON_FREE, &this->free_track_allocations);
+ // Number of backtrace frames to keep when free_track is enabled. If this
+ // value is set to zero, no backtrace will be kept.
+ const OptionSizeT option_free_track_backtrace_num_frames(
+ "free_track_backtrace_num_frames", DEFAULT_BACKTRACE_FRAMES, 0, MAX_BACKTRACE_FRAMES, 0,
+ &this->free_track_backtrace_num_frames);
- // Enable printing leaked allocations.
- Feature("leak_track", 0, 0, 0, LEAK_TRACK | TRACK_ALLOCS, nullptr, nullptr, false),
+ // Enable printing leaked allocations.
+ const Option option_leak_track("leak_track", LEAK_TRACK | TRACK_ALLOCS);
+
+ const OptionSizeT option_record_allocs(
+ "record_allocs", DEFAULT_RECORD_ALLOCS, 1, MAX_RECORD_ALLOCS, RECORD_ALLOCS,
+ &this->record_allocs_num_entries);
+ const OptionString option_record_allocs_file(
+ "record_allocs_file", 0, DEFAULT_RECORD_ALLOCS_FILE, &this->record_allocs_file);
+
+ const Option* option_list[] = {
+ &option_guard, &option_front_guard, &option_rear_guard,
+ &option_backtrace, &option_backtrace_enable_on_signal,
+ &option_fill, &option_fill_on_alloc, &option_fill_on_free,
+ &option_expand_alloc,
+ &option_free_track, &option_free_track_backtrace_num_frames,
+ &option_leak_track,
+ &option_record_allocs, &option_record_allocs_file,
};
+ // Set defaults for all of the options.
+ for (size_t i = 0; i < sizeof(option_list)/sizeof(Option*); i++) {
+ option_list[i]->SetDefault();
+ }
+
// Process each property name we can find.
- std::string property;
- size_t value;
- bool value_set;
PropertyParser parser(property_str);
bool valid = true;
- while (valid && parser.Get(&property, &value, &value_set)) {
+ std::string property;
+ std::string value;
+ while (valid && parser.Get(&property, &value)) {
bool found = false;
- for (size_t i = 0; i < sizeof(features)/sizeof(Feature); i++) {
- if (property == features[i].name) {
- if (features[i].option == 0 && features[i].combo_option) {
+ for (size_t i = 0; i < sizeof(option_list)/sizeof(Option*); i++) {
+ if (property == option_list[i]->name) {
+ if (option_list[i]->option == 0 && option_list[i]->combo_option) {
+ const std::string* option_name = &option_list[i]->name;
i++;
- for (; i < sizeof(features)/sizeof(Feature) && features[i].combo_option; i++) {
- if (!SetFeature(property, features[i], value, value_set)) {
+ for (; i < sizeof(option_list)/sizeof(Option*) && option_list[i]->combo_option; i++) {
+ if (!option_list[i]->ParseValue(*option_name, value)) {
valid = false;
break;
}
- options |= features[i].option;
+ if (option_list[i]->config) {
+ *option_list[i]->config = true;
+ }
+ options |= option_list[i]->option;
}
if (!valid) {
break;
}
} else {
- if (!SetFeature(property, features[i], value, value_set)) {
+ if (!option_list[i]->ParseValue(option_list[i]->name, value)) {
valid = false;
break;
}
- options |= features[i].option;
+ if (option_list[i]->config) {
+ *option_list[i]->config = true;
+ }
+ options |= option_list[i]->option;
}
found = true;
break;
@@ -376,13 +479,6 @@
if (options & FRONT_GUARD) {
front_guard_bytes = BIONIC_ALIGN(front_guard_bytes, MINIMUM_ALIGNMENT_BYTES);
}
-
- // This situation can occur if the free_track option is specified and
- // the fill_on_free option is not. In this case, indicate the whole
- // allocation should be filled.
- if ((options & FILL_ON_FREE) && fill_on_free_bytes == 0) {
- fill_on_free_bytes = SIZE_MAX;
- }
} else {
parser.LogUsage();
}
diff --git a/libc/malloc_debug/Config.h b/libc/malloc_debug/Config.h
index 3ee93b2..ac620ad 100644
--- a/libc/malloc_debug/Config.h
+++ b/libc/malloc_debug/Config.h
@@ -31,6 +31,8 @@
#include <stdint.h>
+#include <string>
+
constexpr uint64_t FRONT_GUARD = 0x1;
constexpr uint64_t REAR_GUARD = 0x2;
constexpr uint64_t BACKTRACE = 0x4;
@@ -40,6 +42,7 @@
constexpr uint64_t FREE_TRACK = 0x40;
constexpr uint64_t TRACK_ALLOCS = 0x80;
constexpr uint64_t LEAK_TRACK = 0x100;
+constexpr uint64_t RECORD_ALLOCS = 0x200;
// In order to guarantee posix compliance, set the minimum alignment
// to 8 bytes for 32 bit systems and 16 bytes for 64 bit systems.
@@ -71,6 +74,10 @@
size_t free_track_allocations = 0;
size_t free_track_backtrace_num_frames = 0;
+ int record_allocs_signal = 0;
+ size_t record_allocs_num_entries = 0;
+ std::string record_allocs_file;
+
uint64_t options = 0;
uint8_t fill_alloc_value;
uint8_t fill_free_value;
diff --git a/libc/malloc_debug/DebugData.cpp b/libc/malloc_debug/DebugData.cpp
index 58cbbcb..fdc2810 100644
--- a/libc/malloc_debug/DebugData.cpp
+++ b/libc/malloc_debug/DebugData.cpp
@@ -77,6 +77,13 @@
}
}
+ if (config_.options & RECORD_ALLOCS) {
+ record.reset(new RecordData());
+ if (!record->Initialize(config_)) {
+ return false;
+ }
+ }
+
if (config_.options & EXPAND_ALLOC) {
extra_bytes_ += config_.expand_alloc_bytes;
}
diff --git a/libc/malloc_debug/DebugData.h b/libc/malloc_debug/DebugData.h
index 7e55512..7e2df0c 100644
--- a/libc/malloc_debug/DebugData.h
+++ b/libc/malloc_debug/DebugData.h
@@ -41,6 +41,7 @@
#include "FreeTrackData.h"
#include "GuardData.h"
#include "malloc_debug.h"
+#include "RecordData.h"
#include "TrackData.h"
class DebugData {
@@ -91,6 +92,7 @@
std::unique_ptr<FrontGuardData> front_guard;
std::unique_ptr<RearGuardData> rear_guard;
std::unique_ptr<FreeTrackData> free_track;
+ std::unique_ptr<RecordData> record;
private:
size_t extra_bytes_ = 0;
diff --git a/libc/malloc_debug/README.md b/libc/malloc_debug/README.md
index b3742cb..984430b 100644
--- a/libc/malloc_debug/README.md
+++ b/libc/malloc_debug/README.md
@@ -224,6 +224,108 @@
04-15 12:35:33.305 7412 7412 E malloc_debug: #02 pc 000a9e38 /system/lib/libc++.so
04-15 12:35:33.305 7412 7412 E malloc_debug: #03 pc 000a28a8 /system/lib/libc++.so
+### record\_allocs[=TOTAL\_ENTRIES]
+Keep track of every allocation/free made on every thread and dump them
+to a file when the signal SIGRTMAX - 18 (which is 46 on most Android devices)
+is received.
+
+If TOTAL\_ENTRIES is set, then it indicates the total number of
+allocation/free records that can be retained. If the number of records
+reaches the TOTAL\_ENTRIES value, then any further allocations/frees are
+not recorded. The default value is 8,000,000 and the maximum value this
+can be set to is 50,000,000.
+
+Once the signal is received, and the current records are written to the
+file, all current records are deleted. Any allocations/frees occuring while
+the data is being dumped to the file are ignored.
+
+**NOTE**: This option is not available until the O release of Android.
+
+The allocation data is written in a human readable format. Every line begins
+with the THREAD\_ID returned by gettid(), which is the thread that is making
+the allocation/free. If a new thread is created, no special line is added
+to the file. However, when a thread completes, a special entry is added to
+the file indicating this.
+
+The thread complete line is:
+
+**THREAD\_ID**: thread\_done 0x0
+
+Example:
+
+ 187: thread_done 0x0
+
+Below is how each type of allocation/free call ends up in the file dump.
+
+pointer = malloc(size)
+
+**THREAD\_ID**: malloc pointer size
+
+Example:
+
+ 186: malloc 0xb6038060 20
+
+free(pointer)
+
+**THREAD\_ID**: free pointer
+
+Example:
+
+ 186: free 0xb6038060
+
+pointer = calloc(nmemb, size)
+
+**THREAD\_ID**: calloc pointer nmemb size
+
+Example:
+
+ 186: calloc 0xb609f080 32 4
+
+new\_pointer = realloc(old\_pointer, size)
+
+**THREAD\_ID**: realloc new\_pointer old\_pointer size
+
+Example:
+
+ 186: realloc 0xb609f080 0xb603e9a0 12
+
+pointer = memalign(alignment, size)
+
+**THREAD\_ID**: memalign pointer alignment size
+
+posix\_memalign(&pointer, alignment, size)
+
+**THREAD\_ID**: memalign pointer alignment size
+
+Example:
+
+ 186: memalign 0x85423660 16 104
+
+pointer = valloc(size)
+
+**THREAD\_ID**: memalign pointer 4096 size
+
+Example:
+
+ 186: memalign 0x85423660 4096 112
+
+pointer = pvalloc(size)
+
+**THREAD\_ID**: memalign pointer 4096 <b>SIZE\_ROUNDED\_UP\_TO\_4096</b>
+
+Example:
+
+ 186: memalign 0x85423660 4096 8192
+
+### record\_allocs\_file[=FILE\_NAME]
+This option only has meaning if record\_allocs is set. It indicates the
+file where the recorded allocations will be found.
+
+If FILE\_NAME is set, then it indicates where the record allocation data
+will be placed.
+
+**NOTE**: This option is not available until the O release of Android.
+
Additional Errors
-----------------
There are a few other error messages that might appear in the log.
diff --git a/libc/malloc_debug/RecordData.cpp b/libc/malloc_debug/RecordData.cpp
new file mode 100644
index 0000000..c0f3486
--- /dev/null
+++ b/libc/malloc_debug/RecordData.cpp
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdatomic.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#include <mutex>
+
+#include <android-base/stringprintf.h>
+
+#include "Config.h"
+#include "debug_disable.h"
+#include "debug_log.h"
+#include "DebugData.h"
+#include "RecordData.h"
+
+RecordEntry::RecordEntry() : tid_(gettid()) {
+}
+
+std::string ThreadCompleteEntry::GetString() const {
+ return android::base::StringPrintf("%d: thread_done 0x0\n", tid_);
+}
+
+AllocEntry::AllocEntry(void* pointer) : pointer_(pointer) {
+}
+
+MallocEntry::MallocEntry(void* pointer, size_t size) : AllocEntry(pointer), size_(size) {
+}
+
+std::string MallocEntry::GetString() const {
+ return android::base::StringPrintf("%d: malloc %p %zu\n", tid_, pointer_, size_);
+}
+
+FreeEntry::FreeEntry(void* pointer) : AllocEntry(pointer) {
+}
+
+std::string FreeEntry::GetString() const {
+ return android::base::StringPrintf("%d: free %p\n", tid_, pointer_);
+}
+
+CallocEntry::CallocEntry(void* pointer, size_t nmemb, size_t size)
+ : MallocEntry(pointer, size), nmemb_(nmemb) {
+}
+
+std::string CallocEntry::GetString() const {
+ return android::base::StringPrintf("%d: calloc %p %zu %zu\n", tid_, pointer_, nmemb_, size_);
+}
+
+ReallocEntry::ReallocEntry(void* pointer, size_t size, void* old_pointer)
+ : MallocEntry(pointer, size), old_pointer_(old_pointer) {
+}
+
+std::string ReallocEntry::GetString() const {
+ return android::base::StringPrintf("%d: realloc %p %p %zu\n", tid_, pointer_,
+ old_pointer_, size_);
+}
+
+// posix_memalign, memalgin, pvalloc, valloc all recorded with this class.
+MemalignEntry::MemalignEntry(void* pointer, size_t size, size_t alignment)
+ : MallocEntry(pointer, size), alignment_(alignment) {
+}
+
+std::string MemalignEntry::GetString() const {
+ return android::base::StringPrintf("%d: memalign %p %zu %zu\n", tid_, pointer_,
+ alignment_, size_);
+}
+
+struct ThreadData {
+ ThreadData(RecordData* record_data, ThreadCompleteEntry* entry) : record_data(record_data), entry(entry) {}
+ RecordData* record_data;
+ ThreadCompleteEntry* entry;
+ size_t count = 0;
+};
+
+static void ThreadKeyDelete(void* data) {
+ ThreadData* thread_data = reinterpret_cast<ThreadData*>(data);
+
+ thread_data->count++;
+
+ // This should be the last time we are called.
+ if (thread_data->count == 4) {
+ ScopedDisableDebugCalls disable;
+
+ thread_data->record_data->AddEntryOnly(thread_data->entry);
+ delete thread_data;
+ } else {
+ pthread_setspecific(thread_data->record_data->key(), data);
+ }
+}
+
+static void RecordDump(int, siginfo_t*, void*) {
+ // It's not necessarily safe to do the dump here, instead wait for the
+ // next allocation call to do the dump.
+ g_debug->record->SetToDump();
+}
+
+void RecordData::Dump() {
+ std::lock_guard<std::mutex> lock(dump_lock_);
+
+ // Make it so that no more entries can be added while dumping.
+ unsigned int last_entry_index = cur_index_.exchange(static_cast<unsigned int>(num_entries_));
+ if (dump_ == false) {
+ // Multiple Dump() calls from different threads, and we lost. Do nothing.
+ return;
+ }
+
+ // cur_index_ keeps getting incremented even if we hit the num_entries_.
+ // If that happens, cap the entries to dump by num_entries_.
+ if (last_entry_index > num_entries_) {
+ last_entry_index = num_entries_;
+ }
+
+ int dump_fd = open(dump_file_.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW,
+ 0755);
+ if (dump_fd != -1) {
+ for (size_t i = 0; i < last_entry_index; i++) {
+ std::string line = entries_[i]->GetString();
+ ssize_t bytes = write(dump_fd, line.c_str(), line.length());
+ if (bytes == -1 || static_cast<size_t>(bytes) != line.length()) {
+ error_log("Failed to write record alloc information: %s", strerror(errno));
+ // Free all of the rest of the errors, we don't have any way
+ // to dump a partial list of the entries.
+ for (i++; i < last_entry_index; i++) {
+ delete entries_[i];
+ entries_[i] = nullptr;
+ }
+ break;
+ }
+ delete entries_[i];
+ entries_[i] = nullptr;
+ }
+ close(dump_fd);
+
+ // Mark the entries dumped.
+ cur_index_ = 0U;
+ } else {
+ error_log("Cannot create record alloc file %s: %s", dump_file_.c_str(), strerror(errno));
+ // Since we couldn't create the file, reset the entries dumped back
+ // to the original value.
+ cur_index_ = last_entry_index;
+ }
+
+ dump_ = false;
+}
+
+RecordData::RecordData() {
+ pthread_key_create(&key_, ThreadKeyDelete);
+}
+
+bool RecordData::Initialize(const Config& config) {
+ struct sigaction dump_act;
+ memset(&dump_act, 0, sizeof(dump_act));
+
+ dump_act.sa_sigaction = RecordDump;
+ dump_act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
+ sigemptyset(&dump_act.sa_mask);
+ if (sigaction(config.record_allocs_signal, &dump_act, nullptr) != 0) {
+ error_log("Unable to set up record dump signal function: %s", strerror(errno));
+ return false;
+ }
+ pthread_setspecific(key_, nullptr);
+
+ info_log("%s: Run: 'kill -%d %d' to dump the allocation records.", getprogname(),
+ config.record_allocs_signal, getpid());
+
+ num_entries_ = config.record_allocs_num_entries;
+ entries_ = new const RecordEntry*[num_entries_];
+ cur_index_ = 0;
+ dump_ = false;
+ dump_file_ = config.record_allocs_file;
+
+ return true;
+}
+
+RecordData::~RecordData() {
+ delete [] entries_;
+ pthread_key_delete(key_);
+}
+
+void RecordData::AddEntryOnly(const RecordEntry* entry) {
+ unsigned int entry_index = cur_index_.fetch_add(1);
+ if (entry_index < num_entries_) {
+ entries_[entry_index] = entry;
+ }
+}
+
+void RecordData::AddEntry(const RecordEntry* entry) {
+ void* data = pthread_getspecific(key_);
+ if (data == nullptr) {
+ ThreadData* thread_data = new ThreadData(this, new ThreadCompleteEntry());
+ pthread_setspecific(key_, thread_data);
+ }
+
+ AddEntryOnly(entry);
+
+ // Check to see if it's time to dump the entries.
+ if (dump_) {
+ Dump();
+ }
+}
diff --git a/libc/malloc_debug/RecordData.h b/libc/malloc_debug/RecordData.h
new file mode 100644
index 0000000..741afd5
--- /dev/null
+++ b/libc/malloc_debug/RecordData.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef DEBUG_MALLOC_RECORDDATA_H
+#define DEBUG_MALLOC_RECORDDATA_H
+
+#include <stdint.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include <atomic>
+#include <mutex>
+#include <string>
+
+#include <private/bionic_macros.h>
+
+class RecordEntry {
+ public:
+ RecordEntry();
+ virtual ~RecordEntry() = default;
+
+ virtual std::string GetString() const = 0;
+
+ protected:
+ pid_t tid_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RecordEntry);
+};
+
+class ThreadCompleteEntry : public RecordEntry {
+ public:
+ ThreadCompleteEntry() = default;
+ virtual ~ThreadCompleteEntry() = default;
+
+ std::string GetString() const override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ThreadCompleteEntry);
+};
+
+class AllocEntry : public RecordEntry {
+ public:
+ AllocEntry(void* pointer);
+ virtual ~AllocEntry() = default;
+
+ protected:
+ void* pointer_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AllocEntry);
+};
+
+class MallocEntry : public AllocEntry {
+ public:
+ MallocEntry(void* pointer, size_t size);
+ virtual ~MallocEntry() = default;
+
+ std::string GetString() const override;
+
+ protected:
+ size_t size_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MallocEntry);
+};
+
+class FreeEntry : public AllocEntry {
+ public:
+ FreeEntry(void* pointer);
+ virtual ~FreeEntry() = default;
+
+ std::string GetString() const override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FreeEntry);
+};
+
+class CallocEntry : public MallocEntry {
+ public:
+ CallocEntry(void* pointer, size_t size, size_t nmemb);
+ virtual ~CallocEntry() = default;
+
+ std::string GetString() const override;
+
+ protected:
+ size_t nmemb_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallocEntry);
+};
+
+class ReallocEntry : public MallocEntry {
+ public:
+ ReallocEntry(void* pointer, size_t size, void* old_pointer);
+ virtual ~ReallocEntry() = default;
+
+ std::string GetString() const override;
+
+ protected:
+ void* old_pointer_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ReallocEntry);
+};
+
+// posix_memalign, memalign, pvalloc, valloc all recorded with this class.
+class MemalignEntry : public MallocEntry {
+ public:
+ MemalignEntry(void* pointer, size_t size, size_t alignment);
+ virtual ~MemalignEntry() = default;
+
+ std::string GetString() const override;
+
+ protected:
+ size_t alignment_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MemalignEntry);
+};
+
+struct Config;
+
+class RecordData {
+ public:
+ RecordData();
+ virtual ~RecordData();
+
+ bool Initialize(const Config& config);
+
+ void AddEntry(const RecordEntry* entry);
+ void AddEntryOnly(const RecordEntry* entry);
+
+ void SetToDump() { dump_ = true; }
+
+ pthread_key_t key() { return key_; }
+
+ private:
+ void Dump();
+
+ std::mutex dump_lock_;
+ pthread_key_t key_;
+ const RecordEntry** entries_ = nullptr;
+ size_t num_entries_ = 0;
+ std::atomic_uint cur_index_;
+ std::atomic_bool dump_;
+ std::string dump_file_;
+
+ DISALLOW_COPY_AND_ASSIGN(RecordData);
+};
+
+#endif // DEBUG_MALLOC_RECORDDATA_H
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index 5da5b88..d2bcf99 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -328,7 +328,13 @@
}
ScopedDisableDebugCalls disable;
- return internal_malloc(size);
+ void* pointer = internal_malloc(size);
+
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new MallocEntry(pointer, size));
+ }
+
+ return pointer;
}
static void internal_free(void* pointer) {
@@ -393,6 +399,10 @@
}
ScopedDisableDebugCalls disable;
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new FreeEntry(pointer));
+ }
+
internal_free(pointer);
}
@@ -461,6 +471,10 @@
memset(pointer, g_debug->config().fill_alloc_value, bytes);
}
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new MemalignEntry(pointer, bytes, alignment));
+ }
+
return pointer;
}
@@ -471,10 +485,18 @@
ScopedDisableDebugCalls disable;
if (pointer == nullptr) {
- return internal_malloc(bytes);
+ pointer = internal_malloc(bytes);
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new ReallocEntry(pointer, bytes, nullptr));
+ }
+ return pointer;
}
if (bytes == 0) {
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new ReallocEntry(nullptr, bytes, pointer));
+ }
+
internal_free(pointer);
return nullptr;
}
@@ -555,6 +577,10 @@
}
}
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new ReallocEntry(new_pointer, bytes, pointer));
+ }
+
return new_pointer;
}
@@ -582,6 +608,7 @@
return nullptr;
}
+ void* pointer;
if (g_debug->need_header()) {
// The above check will guarantee the multiply will not overflow.
if (size > Header::max_size()) {
@@ -596,10 +623,14 @@
return nullptr;
}
memset(header, 0, g_dispatch->malloc_usable_size(header));
- return InitHeader(header, header, size);
+ pointer = InitHeader(header, header, size);
} else {
- return g_dispatch->calloc(1, real_size);
+ pointer = g_dispatch->calloc(1, real_size);
}
+ if (g_debug->config().options & RECORD_ALLOCS) {
+ g_debug->record->AddEntry(new CallocEntry(pointer, bytes, nmemb));
+ }
+ return pointer;
}
struct mallinfo debug_mallinfo() {
diff --git a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
index 85d5cb5..b8cf7cf 100644
--- a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
@@ -113,6 +113,19 @@
"6 malloc_debug \n"
"6 malloc_debug leak_track\n"
"6 malloc_debug Enable the leak tracking of memory allocations.\n"
+ "6 malloc_debug \n"
+ "6 malloc_debug record_allocs[=XX]\n"
+ "6 malloc_debug Record every single allocation/free call. When a specific signal\n"
+ "6 malloc_debug is sent to the process, the contents of recording are written to\n"
+ "6 malloc_debug a file (/data/local/tmp/record_allocs.txt) and the recording is cleared.\n"
+ "6 malloc_debug If XX is set, that is the total number of allocations/frees that can\n"
+ "6 malloc_debug recorded. of frames to capture. The default value is 8000000.\n"
+ "6 malloc_debug If the allocation list fills up, all further allocations are not recorded.\n"
+ "6 malloc_debug \n"
+ "6 malloc_debug record_alloc_file[=FILE]\n"
+ "6 malloc_debug This option only has meaning if the record_allocs options has been specified.\n"
+ "6 malloc_debug This is the name of the file to which recording information will be dumped.\n"
+ "6 malloc_debug The default is /data/local/tmp/record_allocs.txt.\n"
);
TEST_F(MallocDebugConfigTest, unknown_option) {
@@ -190,7 +203,7 @@
}
TEST_F(MallocDebugConfigTest, space_before_equal) {
- ASSERT_TRUE(InitConfig("backtrace =10"));
+ ASSERT_TRUE(InitConfig("backtrace =10")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(10U, config->backtrace_frames);
@@ -199,7 +212,7 @@
}
TEST_F(MallocDebugConfigTest, space_after_equal) {
- ASSERT_TRUE(InitConfig("backtrace= 10"));
+ ASSERT_TRUE(InitConfig("backtrace= 10")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(10U, config->backtrace_frames);
@@ -208,7 +221,7 @@
}
TEST_F(MallocDebugConfigTest, extra_space) {
- ASSERT_TRUE(InitConfig(" backtrace=64 "));
+ ASSERT_TRUE(InitConfig(" backtrace=64 ")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(64U, config->backtrace_frames);
@@ -217,7 +230,7 @@
}
TEST_F(MallocDebugConfigTest, multiple_options) {
- ASSERT_TRUE(InitConfig(" backtrace=64 front_guard=48"));
+ ASSERT_TRUE(InitConfig(" backtrace=64 front_guard=48")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS | FRONT_GUARD, config->options);
ASSERT_EQ(64U, config->backtrace_frames);
ASSERT_EQ(48U, config->front_guard_bytes);
@@ -227,15 +240,15 @@
}
TEST_F(MallocDebugConfigTest, front_guard) {
- ASSERT_TRUE(InitConfig("front_guard=48"));
+ ASSERT_TRUE(InitConfig("front_guard=48")) << getFakeLogPrint();
ASSERT_EQ(FRONT_GUARD, config->options);
ASSERT_EQ(48U, config->front_guard_bytes);
- ASSERT_TRUE(InitConfig("front_guard"));
+ ASSERT_TRUE(InitConfig("front_guard")) << getFakeLogPrint();
ASSERT_EQ(FRONT_GUARD, config->options);
ASSERT_EQ(32U, config->front_guard_bytes);
- ASSERT_TRUE(InitConfig("front_guard=39"));
+ ASSERT_TRUE(InitConfig("front_guard=39")) << getFakeLogPrint();
ASSERT_EQ(FRONT_GUARD, config->options);
#if defined(__LP64__)
ASSERT_EQ(48U, config->front_guard_bytes);
@@ -243,7 +256,7 @@
ASSERT_EQ(40U, config->front_guard_bytes);
#endif
- ASSERT_TRUE(InitConfig("front_guard=41"));
+ ASSERT_TRUE(InitConfig("front_guard=41")) << getFakeLogPrint();
ASSERT_EQ(FRONT_GUARD, config->options);
ASSERT_EQ(48U, config->front_guard_bytes);
@@ -252,11 +265,11 @@
}
TEST_F(MallocDebugConfigTest, rear_guard) {
- ASSERT_TRUE(InitConfig("rear_guard=50"));
+ ASSERT_TRUE(InitConfig("rear_guard=50")) << getFakeLogPrint();
ASSERT_EQ(REAR_GUARD, config->options);
ASSERT_EQ(50U, config->rear_guard_bytes);
- ASSERT_TRUE(InitConfig("rear_guard"));
+ ASSERT_TRUE(InitConfig("rear_guard")) << getFakeLogPrint();
ASSERT_EQ(REAR_GUARD, config->options);
ASSERT_EQ(32U, config->rear_guard_bytes);
@@ -265,12 +278,12 @@
}
TEST_F(MallocDebugConfigTest, guard) {
- ASSERT_TRUE(InitConfig("guard=32"));
+ ASSERT_TRUE(InitConfig("guard=32")) << getFakeLogPrint();
ASSERT_EQ(FRONT_GUARD | REAR_GUARD, config->options);
ASSERT_EQ(32U, config->front_guard_bytes);
ASSERT_EQ(32U, config->rear_guard_bytes);
- ASSERT_TRUE(InitConfig("guard"));
+ ASSERT_TRUE(InitConfig("guard")) << getFakeLogPrint();
ASSERT_EQ(FRONT_GUARD | REAR_GUARD, config->options);
ASSERT_EQ(32U, config->front_guard_bytes);
ASSERT_EQ(32U, config->rear_guard_bytes);
@@ -280,11 +293,11 @@
}
TEST_F(MallocDebugConfigTest, backtrace) {
- ASSERT_TRUE(InitConfig("backtrace=64"));
+ ASSERT_TRUE(InitConfig("backtrace=64")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(64U, config->backtrace_frames);
- ASSERT_TRUE(InitConfig("backtrace"));
+ ASSERT_TRUE(InitConfig("backtrace")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(16U, config->backtrace_frames);
@@ -293,11 +306,11 @@
}
TEST_F(MallocDebugConfigTest, backtrace_enable_on_signal) {
- ASSERT_TRUE(InitConfig("backtrace_enable_on_signal=64"));
+ ASSERT_TRUE(InitConfig("backtrace_enable_on_signal=64")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(64U, config->backtrace_frames);
- ASSERT_TRUE(InitConfig("backtrace_enable_on_signal"));
+ ASSERT_TRUE(InitConfig("backtrace_enable_on_signal")) << getFakeLogPrint();
ASSERT_EQ(BACKTRACE | TRACK_ALLOCS, config->options);
ASSERT_EQ(16U, config->backtrace_frames);
@@ -306,11 +319,11 @@
}
TEST_F(MallocDebugConfigTest, fill_on_alloc) {
- ASSERT_TRUE(InitConfig("fill_on_alloc=64"));
+ ASSERT_TRUE(InitConfig("fill_on_alloc=64")) << getFakeLogPrint();
ASSERT_EQ(FILL_ON_ALLOC, config->options);
ASSERT_EQ(64U, config->fill_on_alloc_bytes);
- ASSERT_TRUE(InitConfig("fill_on_alloc"));
+ ASSERT_TRUE(InitConfig("fill_on_alloc")) << getFakeLogPrint();
ASSERT_EQ(FILL_ON_ALLOC, config->options);
ASSERT_EQ(SIZE_MAX, config->fill_on_alloc_bytes);
@@ -319,11 +332,11 @@
}
TEST_F(MallocDebugConfigTest, fill_on_free) {
- ASSERT_TRUE(InitConfig("fill_on_free=64"));
+ ASSERT_TRUE(InitConfig("fill_on_free=64")) << getFakeLogPrint();
ASSERT_EQ(FILL_ON_FREE, config->options);
ASSERT_EQ(64U, config->fill_on_free_bytes);
- ASSERT_TRUE(InitConfig("fill_on_free"));
+ ASSERT_TRUE(InitConfig("fill_on_free")) << getFakeLogPrint();
ASSERT_EQ(FILL_ON_FREE, config->options);
ASSERT_EQ(SIZE_MAX, config->fill_on_free_bytes);
@@ -332,12 +345,12 @@
}
TEST_F(MallocDebugConfigTest, fill) {
- ASSERT_TRUE(InitConfig("fill=64"));
+ ASSERT_TRUE(InitConfig("fill=64")) << getFakeLogPrint();
ASSERT_EQ(FILL_ON_ALLOC | FILL_ON_FREE, config->options);
ASSERT_EQ(64U, config->fill_on_alloc_bytes);
ASSERT_EQ(64U, config->fill_on_free_bytes);
- ASSERT_TRUE(InitConfig("fill"));
+ ASSERT_TRUE(InitConfig("fill")) << getFakeLogPrint();
ASSERT_EQ(FILL_ON_ALLOC | FILL_ON_FREE, config->options);
ASSERT_EQ(SIZE_MAX, config->fill_on_alloc_bytes);
ASSERT_EQ(SIZE_MAX, config->fill_on_free_bytes);
@@ -347,11 +360,11 @@
}
TEST_F(MallocDebugConfigTest, expand_alloc) {
- ASSERT_TRUE(InitConfig("expand_alloc=1234"));
+ ASSERT_TRUE(InitConfig("expand_alloc=1234")) << getFakeLogPrint();
ASSERT_EQ(EXPAND_ALLOC, config->options);
ASSERT_EQ(1234U, config->expand_alloc_bytes);
- ASSERT_TRUE(InitConfig("expand_alloc"));
+ ASSERT_TRUE(InitConfig("expand_alloc")) << getFakeLogPrint();
ASSERT_EQ(EXPAND_ALLOC, config->options);
ASSERT_EQ(16U, config->expand_alloc_bytes);
@@ -360,13 +373,13 @@
}
TEST_F(MallocDebugConfigTest, free_track) {
- ASSERT_TRUE(InitConfig("free_track=1234"));
+ ASSERT_TRUE(InitConfig("free_track=1234")) << getFakeLogPrint();
ASSERT_EQ(FREE_TRACK | FILL_ON_FREE, config->options);
ASSERT_EQ(1234U, config->free_track_allocations);
ASSERT_EQ(SIZE_MAX, config->fill_on_free_bytes);
ASSERT_EQ(16U, config->free_track_backtrace_num_frames);
- ASSERT_TRUE(InitConfig("free_track"));
+ ASSERT_TRUE(InitConfig("free_track")) << getFakeLogPrint();
ASSERT_EQ(FREE_TRACK | FILL_ON_FREE, config->options);
ASSERT_EQ(100U, config->free_track_allocations);
ASSERT_EQ(SIZE_MAX, config->fill_on_free_bytes);
@@ -377,13 +390,13 @@
}
TEST_F(MallocDebugConfigTest, free_track_and_fill_on_free) {
- ASSERT_TRUE(InitConfig("free_track=1234 fill_on_free=32"));
+ ASSERT_TRUE(InitConfig("free_track=1234 fill_on_free=32")) << getFakeLogPrint();
ASSERT_EQ(FREE_TRACK | FILL_ON_FREE, config->options);
ASSERT_EQ(1234U, config->free_track_allocations);
ASSERT_EQ(32U, config->fill_on_free_bytes);
ASSERT_EQ(16U, config->free_track_backtrace_num_frames);
- ASSERT_TRUE(InitConfig("free_track fill_on_free=60"));
+ ASSERT_TRUE(InitConfig("free_track fill_on_free=60")) << getFakeLogPrint();
ASSERT_EQ(FREE_TRACK | FILL_ON_FREE, config->options);
ASSERT_EQ(100U, config->free_track_allocations);
ASSERT_EQ(60U, config->fill_on_free_bytes);
@@ -394,12 +407,12 @@
}
TEST_F(MallocDebugConfigTest, free_track_backtrace_num_frames) {
- ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames=123"));
+ ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames=123")) << getFakeLogPrint();
ASSERT_EQ(0U, config->options);
ASSERT_EQ(123U, config->free_track_backtrace_num_frames);
- ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames"));
+ ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames")) << getFakeLogPrint();
ASSERT_EQ(0U, config->options);
ASSERT_EQ(16U, config->free_track_backtrace_num_frames);
@@ -408,7 +421,7 @@
}
TEST_F(MallocDebugConfigTest, free_track_backtrace_num_frames_zero) {
- ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames=0"));
+ ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames=0")) << getFakeLogPrint();
ASSERT_EQ(0U, config->options);
ASSERT_EQ(0U, config->free_track_backtrace_num_frames);
@@ -418,11 +431,11 @@
}
TEST_F(MallocDebugConfigTest, free_track_backtrace_num_frames_and_free_track) {
- ASSERT_TRUE(InitConfig("free_track free_track_backtrace_num_frames=123"));
+ ASSERT_TRUE(InitConfig("free_track free_track_backtrace_num_frames=123")) << getFakeLogPrint();
ASSERT_EQ(FREE_TRACK | FILL_ON_FREE, config->options);
ASSERT_EQ(123U, config->free_track_backtrace_num_frames);
- ASSERT_TRUE(InitConfig("free_track free_track_backtrace_num_frames"));
+ ASSERT_TRUE(InitConfig("free_track free_track_backtrace_num_frames")) << getFakeLogPrint();
ASSERT_EQ(FREE_TRACK | FILL_ON_FREE, config->options);
ASSERT_EQ(16U, config->free_track_backtrace_num_frames);
@@ -431,7 +444,7 @@
}
TEST_F(MallocDebugConfigTest, leak_track) {
- ASSERT_TRUE(InitConfig("leak_track"));
+ ASSERT_TRUE(InitConfig("leak_track")) << getFakeLogPrint();
ASSERT_EQ(LEAK_TRACK | TRACK_ALLOCS, config->options);
ASSERT_STREQ("", getFakeLogBuf().c_str());
@@ -439,7 +452,7 @@
}
TEST_F(MallocDebugConfigTest, leak_track_fail) {
- ASSERT_FALSE(InitConfig("leak_track=100"));
+ ASSERT_FALSE(InitConfig("leak_track=100")) << getFakeLogPrint();
ASSERT_STREQ("", getFakeLogBuf().c_str());
std::string log_msg(
@@ -448,6 +461,32 @@
ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
+TEST_F(MallocDebugConfigTest, record_allocs) {
+ ASSERT_TRUE(InitConfig("record_allocs=1234")) << getFakeLogPrint();
+ ASSERT_EQ(RECORD_ALLOCS, config->options);
+ ASSERT_EQ(1234U, config->record_allocs_num_entries);
+ ASSERT_STREQ("/data/local/tmp/record_allocs.txt", config->record_allocs_file.c_str());
+
+ ASSERT_TRUE(InitConfig("record_allocs")) << getFakeLogPrint();
+ ASSERT_EQ(RECORD_ALLOCS, config->options);
+ ASSERT_EQ(8000000U, config->record_allocs_num_entries);
+ ASSERT_STREQ("/data/local/tmp/record_allocs.txt", config->record_allocs_file.c_str());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ ASSERT_STREQ("", getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugConfigTest, record_allocs_file) {
+ ASSERT_TRUE(InitConfig("record_allocs=1234 record_allocs_file=/fake/file")) << getFakeLogPrint();
+ ASSERT_STREQ("/fake/file", config->record_allocs_file.c_str());
+
+ ASSERT_TRUE(InitConfig("record_allocs_file")) << getFakeLogPrint();
+ ASSERT_STREQ("/data/local/tmp/record_allocs.txt", config->record_allocs_file.c_str());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ ASSERT_STREQ("", getFakeLogPrint().c_str());
+}
+
TEST_F(MallocDebugConfigTest, guard_min_error) {
ASSERT_FALSE(InitConfig("guard=0"));
@@ -626,3 +665,23 @@
"value must be <= 256: 400\n");
ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
+
+TEST_F(MallocDebugConfigTest, record_alloc_min_error) {
+ ASSERT_FALSE(InitConfig("record_allocs=0"));
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string log_msg(
+ "6 malloc_debug malloc_testing: bad value for option 'record_allocs', "
+ "value must be >= 1: 0\n");
+ ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
+}
+
+TEST_F(MallocDebugConfigTest, record_allocs_max_error) {
+ ASSERT_FALSE(InitConfig("record_allocs=100000000"));
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string log_msg(
+ "6 malloc_debug malloc_testing: bad value for option 'record_allocs', "
+ "value must be <= 50000000: 100000000\n");
+ ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
+}
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index 014b913..edb03f6 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -30,6 +30,7 @@
#include <gtest/gtest.h>
+#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <private/bionic_macros.h>
@@ -79,12 +80,16 @@
return offset;
}
+static constexpr const char RECORD_ALLOCS_FILE[] = "/data/local/tmp/record_allocs.txt";
+
class MallocDebugTest : public ::testing::Test {
protected:
void SetUp() override {
initialized = false;
resetLogs();
backtrace_fake_clear_all();
+ // Delete the record data file if it exists.
+ unlink(RECORD_ALLOCS_FILE);
}
void TearDown() override {
@@ -1266,7 +1271,7 @@
debug_free_malloc_leak_info(info);
// Send the signal to enable.
- ASSERT_TRUE(kill(getpid(), SIGRTMIN + 10) == 0);
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 19) == 0);
sleep(1);
pointer = debug_malloc(100);
@@ -1291,7 +1296,7 @@
debug_free_malloc_leak_info(info);
// Send the signal to disable.
- ASSERT_TRUE(kill(getpid(), SIGRTMIN + 10) == 0);
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 19) == 0);
sleep(1);
pointer = debug_malloc(200);
@@ -1311,7 +1316,7 @@
ASSERT_STREQ("", getFakeLogBuf().c_str());
std::string expected_log = android::base::StringPrintf(
"4 malloc_debug malloc_testing: Run: 'kill -%d %d' to enable backtracing.\n",
- SIGRTMIN + 10, getpid());
+ SIGRTMAX - 19, getpid());
ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
}
@@ -1512,3 +1517,231 @@
debug_free(pointer);
}
#endif
+
+void VerifyRecordAllocs() {
+ std::string expected;
+
+ void* pointer = debug_malloc(10);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 10\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ pointer = debug_calloc(1, 20);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: calloc %p 20 1\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ pointer = debug_realloc(nullptr, 30);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: realloc %p 0x0 30\n", getpid(), pointer);
+ void* old_pointer = pointer;
+ pointer = debug_realloc(pointer, 2048);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: realloc %p %p 2048\n", getpid(),
+ pointer, old_pointer);
+ debug_realloc(pointer, 0);
+ expected += android::base::StringPrintf("%d: realloc 0x0 %p 0\n", getpid(), pointer);
+
+ pointer = debug_memalign(16, 40);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: memalign %p 16 40\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ ASSERT_EQ(0, debug_posix_memalign(&pointer, 32, 50));
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: memalign %p 32 50\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
+ pointer = debug_pvalloc(60);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: memalign %p 4096 4096\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ pointer = debug_valloc(70);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: memalign %p 4096 70\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+#endif
+
+ // Dump all of the data accumulated so far.
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
+ sleep(1);
+
+ // This triggers the dumping.
+ pointer = debug_malloc(110);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 110\n", getpid(), pointer);
+
+ // Read all of the contents.
+ std::string actual;
+ ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
+
+ ASSERT_STREQ(expected.c_str(), actual.c_str());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "4 malloc_debug malloc_testing: Run: 'kill -%d %d' to dump the allocation records.\n",
+ SIGRTMAX - 18, getpid());
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+
+ debug_free(pointer);
+}
+
+TEST_F(MallocDebugTest, record_allocs_no_header) {
+ Init("record_allocs");
+
+ VerifyRecordAllocs();
+}
+
+TEST_F(MallocDebugTest, record_allocs_with_header) {
+ Init("record_allocs front_guard");
+
+ VerifyRecordAllocs();
+}
+
+TEST_F(MallocDebugTest, record_allocs_max) {
+ Init("record_allocs=5");
+
+ std::string expected;
+
+ void* pointer = debug_malloc(10);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 10\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ pointer = debug_malloc(20);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 20\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ pointer = debug_malloc(1024);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 1024\n", getpid(), pointer);
+ debug_free(pointer);
+
+ // Dump all of the data accumulated so far.
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
+ sleep(1);
+
+ // This triggers the dumping.
+ pointer = debug_malloc(110);
+ ASSERT_TRUE(pointer != nullptr);
+
+ // Read all of the contents.
+ std::string actual;
+ ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
+
+ ASSERT_STREQ(expected.c_str(), actual.c_str());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "4 malloc_debug malloc_testing: Run: 'kill -%d %d' to dump the allocation records.\n",
+ SIGRTMAX - 18, getpid());
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+
+ debug_free(pointer);
+}
+
+TEST_F(MallocDebugTest, record_allocs_thread_done) {
+ Init("record_allocs=5");
+
+ static pid_t tid = 0;
+ static void* pointer = nullptr;
+ std::thread thread([](){
+ tid = gettid();
+ pointer = debug_malloc(100);
+ write(0, pointer, 0);
+ debug_free(pointer);
+ });
+ thread.join();
+
+ std::string expected = android::base::StringPrintf("%d: malloc %p 100\n", tid, pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", tid, pointer);
+ expected += android::base::StringPrintf("%d: thread_done 0x0\n", tid);
+
+ // Dump all of the data accumulated so far.
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
+ sleep(1);
+
+ // This triggers the dumping.
+ pointer = debug_malloc(23);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 23\n", getpid(), pointer);
+
+ // Read all of the contents.
+ std::string actual;
+ ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
+
+ ASSERT_STREQ(expected.c_str(), actual.c_str());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "4 malloc_debug malloc_testing: Run: 'kill -%d %d' to dump the allocation records.\n",
+ SIGRTMAX - 18, getpid());
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+
+ debug_free(pointer);
+}
+
+TEST_F(MallocDebugTest, record_allocs_file_name_fail) {
+ Init("record_allocs=5");
+
+ // Delete the special.txt file and create a symbolic link there to
+ // make sure the create file will fail.
+ unlink(RECORD_ALLOCS_FILE);
+
+ ASSERT_EQ(0, symlink("/data/local/tmp/does_not_exist", RECORD_ALLOCS_FILE));
+
+ std::string expected;
+
+ void* pointer = debug_malloc(10);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 10\n", getpid(), pointer);
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ // Dump all of the data accumulated so far.
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
+ sleep(1);
+
+ // This triggers the dumping.
+ pointer = debug_malloc(110);
+ ASSERT_TRUE(pointer != nullptr);
+ expected += android::base::StringPrintf("%d: malloc %p 110\n", getpid(), pointer);
+
+ // Read all of the contents.
+ std::string actual;
+ ASSERT_FALSE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
+
+ // Unlink the file so the next dump passes.
+ ASSERT_EQ(0, unlink(RECORD_ALLOCS_FILE));
+
+ // Dump all of the data accumulated so far.
+ ASSERT_TRUE(kill(getpid(), SIGRTMAX - 18) == 0);
+ sleep(1);
+
+ // This triggers the dumping.
+ debug_free(pointer);
+ expected += android::base::StringPrintf("%d: free %p\n", getpid(), pointer);
+
+ ASSERT_TRUE(android::base::ReadFileToString(RECORD_ALLOCS_FILE, &actual));
+ ASSERT_STREQ(expected.c_str(), actual.c_str());
+
+ ASSERT_STREQ("", getFakeLogBuf().c_str());
+ std::string expected_log = android::base::StringPrintf(
+ "4 malloc_debug malloc_testing: Run: 'kill -%d %d' to dump the allocation records.\n",
+ SIGRTMAX - 18, getpid());
+ expected_log += android::base::StringPrintf(
+ "6 malloc_debug Cannot create record alloc file %s: Too many symbolic links encountered\n",
+ RECORD_ALLOCS_FILE);
+ ASSERT_STREQ(expected_log.c_str(), getFakeLogPrint().c_str());
+}
diff --git a/libc/private/bionic_macros.h b/libc/private/bionic_macros.h
index 4969bd9..d5c5b9c 100644
--- a/libc/private/bionic_macros.h
+++ b/libc/private/bionic_macros.h
@@ -17,6 +17,8 @@
#ifndef _BIONIC_MACROS_H_
#define _BIONIC_MACROS_H_
+#include <stdint.h>
+
// Frameworks OpenGL code currently leaks this header and allows
// collisions with other declarations, e.g., from libnativehelper.
// TODO: Remove once cleaned up. b/18334516
@@ -46,4 +48,22 @@
? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
: (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value)))))
+static inline uintptr_t align_down(uintptr_t p, size_t align) {
+ return p & ~(align - 1);
+}
+
+static inline uintptr_t align_up(uintptr_t p, size_t align) {
+ return (p + align - 1) & ~(align - 1);
+}
+
+template <typename T>
+static inline T* align_down(T* p, size_t align) {
+ return reinterpret_cast<T*>(align_down(reinterpret_cast<uintptr_t>(p), align));
+}
+
+template <typename T>
+static inline T* align_up(T* p, size_t align) {
+ return reinterpret_cast<T*>(align_up(reinterpret_cast<uintptr_t>(p), align));
+}
+
#endif // _BIONIC_MACROS_H_
diff --git a/libc/private/bionic_vdso.h b/libc/private/bionic_vdso.h
index 5400de5..8fd0743 100644
--- a/libc/private/bionic_vdso.h
+++ b/libc/private/bionic_vdso.h
@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _PRIVATE_BIONIC_VDSO_H
#define _PRIVATE_BIONIC_VDSO_H
@@ -33,7 +34,7 @@
#if defined(__aarch64__)
#define VDSO_CLOCK_GETTIME_SYMBOL "__kernel_clock_gettime"
#define VDSO_GETTIMEOFDAY_SYMBOL "__kernel_gettimeofday"
-#elif defined(__x86_64__) || defined(__i386__)
+#elif defined(__arm__) || defined(__i386__) || defined(__x86_64__)
#define VDSO_CLOCK_GETTIME_SYMBOL "__vdso_clock_gettime"
#define VDSO_GETTIMEOFDAY_SYMBOL "__vdso_gettimeofday"
#endif
diff --git a/libc/private/libc_logging.h b/libc/private/libc_logging.h
index 4aa3ece..9fa5982 100644
--- a/libc/private/libc_logging.h
+++ b/libc/private/libc_logging.h
@@ -68,29 +68,25 @@
};
// Formats a message to the log (priority 'fatal'), then aborts.
-__LIBC_HIDDEN__ __noreturn void __libc_fatal(const char* fmt, ...) __printflike(1, 2);
+__noreturn void __libc_fatal(const char* _Nonnull, ...) __printflike(1, 2);
// Formats a message to the log (priority 'fatal'), prefixed by "FORTIFY: ", then aborts.
-__LIBC_HIDDEN__ __noreturn void __fortify_fatal(const char* fmt, ...) __printflike(1, 2);
+__noreturn void __fortify_fatal(const char* _Nonnull, ...) __printflike(1, 2);
//
// Formatting routines for the C library's internal debugging.
// Unlike the usual alternatives, these don't allocate, and they don't drag in all of stdio.
//
-__LIBC_HIDDEN__ int __libc_format_buffer(char* buffer, size_t buffer_size, const char* format, ...)
- __printflike(3, 4);
-
-__LIBC_HIDDEN__ int __libc_format_fd(int fd, const char* format, ...)
- __printflike(2, 3);
-
-__LIBC_HIDDEN__ int __libc_format_log(int priority, const char* tag, const char* format, ...)
- __printflike(3, 4);
-
-__LIBC_HIDDEN__ int __libc_format_log_va_list(int priority, const char* tag, const char* format,
- va_list ap);
-
-__LIBC_HIDDEN__ int __libc_write_log(int priority, const char* tag, const char* msg);
+int __libc_format_buffer(char* _Nonnull buf, size_t size, const char* _Nonnull fmt, ...) __printflike(3, 4);
+int __libc_format_fd(int fd, const char* _Nonnull format , ...) __printflike(2, 3);
+int __libc_format_log(int pri, const char* _Nonnull tag, const char* _Nonnull fmt, ...) __printflike(3, 4);
+#if defined(__arm__) || defined(__aarch64__) || defined(__x86_64__)
+int __libc_format_log_va_list(int pri, const char* _Nonnull tag, const char* _Nonnull fmt, va_list ap);
+#else // defined(__mips__) || defined(__i386__)
+int __libc_format_log_va_list(int pri, const char* _Nonnull tag, const char* _Nonnull fmt, va_list _Nonnull ap);
+#endif
+int __libc_write_log(int pri, const char* _Nonnull tag, const char* _Nonnull msg);
__END_DECLS
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index de06a2f..b4aa06c 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -555,41 +555,43 @@
if syscall.has_key("x86_64"):
syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
- # Scan a Linux kernel asm/unistd.h file containing __NR_* constants
+
+ # Scan Linux kernel asm/unistd.h files containing __NR_* constants
# and write out equivalent SYS_* constants for glibc source compatibility.
- def scan_linux_unistd_h(self, fp, path):
- pattern = re.compile(r'^#define __NR_([a-z]\S+) .*')
- syscalls = set() # MIPS defines everything three times; work around that.
- for line in open(path):
- m = re.search(pattern, line)
- if m:
- syscalls.add(m.group(1))
- for syscall in sorted(syscalls):
- fp.write("#define SYS_%s %s\n" % (syscall, make__NR_name(syscall)))
-
-
def gen_glibc_syscalls_h(self):
- # TODO: generate a separate file for each architecture, like glibc's bits/syscall.h.
glibc_syscalls_h_path = "include/bits/glibc-syscalls.h"
logging.info("generating " + glibc_syscalls_h_path)
glibc_fp = create_file(glibc_syscalls_h_path)
glibc_fp.write("/* %s */\n" % warning)
- glibc_fp.write("#ifndef _BIONIC_GLIBC_SYSCALLS_H_\n")
- glibc_fp.write("#define _BIONIC_GLIBC_SYSCALLS_H_\n")
+ glibc_fp.write("#ifndef _BIONIC_BITS_GLIBC_SYSCALLS_H_\n")
+ glibc_fp.write("#define _BIONIC_BITS_GLIBC_SYSCALLS_H_\n")
- glibc_fp.write("#if defined(__aarch64__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-generic/unistd.h"))
- glibc_fp.write("#elif defined(__arm__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-arm/asm/unistd.h"))
- glibc_fp.write("#elif defined(__mips__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-mips/asm/unistd.h"))
- glibc_fp.write("#elif defined(__i386__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-x86/asm/unistd_32.h"))
- glibc_fp.write("#elif defined(__x86_64__)\n")
- self.scan_linux_unistd_h(glibc_fp, os.path.join(bionic_libc_root, "kernel/uapi/asm-x86/asm/unistd_64.h"))
- glibc_fp.write("#endif\n")
+ # Collect the set of all syscalls for all architectures.
+ syscalls = set()
+ pattern = re.compile(r'^\s*#\s*define\s*__NR_([a-z]\S+)')
+ for unistd_h in ["kernel/uapi/asm-generic/unistd.h",
+ "kernel/uapi/asm-arm/asm/unistd.h",
+ "kernel/uapi/asm-mips/asm/unistd.h",
+ "kernel/uapi/asm-x86/asm/unistd_32.h",
+ "kernel/uapi/asm-x86/asm/unistd_64.h"]:
+ for line in open(os.path.join(bionic_libc_root, unistd_h)):
+ m = re.search(pattern, line)
+ if m:
+ nr_name = m.group(1)
+ if 'reserved' not in nr_name and 'unused' not in nr_name:
+ syscalls.add(nr_name)
- glibc_fp.write("#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */\n")
+ # Write out a single file listing them all. Note that the input
+ # files include #if trickery, so even for a single architecture
+ # we don't know exactly which ones are available.
+ # https://code.google.com/p/android/issues/detail?id=215853
+ for syscall in sorted(syscalls):
+ nr_name = make__NR_name(syscall)
+ glibc_fp.write("#if defined(%s)\n" % nr_name)
+ glibc_fp.write(" #define SYS_%s %s\n" % (syscall, nr_name))
+ glibc_fp.write("#endif\n")
+
+ glibc_fp.write("#endif /* _BIONIC_BITS_GLIBC_SYSCALLS_H_ */\n")
glibc_fp.close()
self.other_files.append(glibc_syscalls_h_path)
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index f370e87..165dd2d 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -1317,11 +1317,11 @@
{
#if defined(__ANDROID__)
// The TZ environment variable is meant to override the system-wide setting.
- const char * name = getenv("TZ");
+ const char* name = getenv("TZ");
// If that's not set, look at the "persist.sys.timezone" system property.
if (name == NULL) {
- static const prop_info *pi;
+ static const prop_info* pi;
if (!pi) {
pi = __system_property_find("persist.sys.timezone");
@@ -1336,12 +1336,21 @@
s = serial;
}
if (ok) {
+ // POSIX and Java disagree about the sign in a timezone string. For POSIX, "GMT+3" means
+ // "3 hours west/behind", but for Java it means "3 hours east/ahead". Since (a) Java is
+ // the one that matches human expectations and (b) this system property is used directly
+ // by Java, we flip the sign here to translate from Java to POSIX. http://b/25463955.
+ if (buf[3] == '-') {
+ buf[3] = '+';
+ } else if (buf[3] == '+') {
+ buf[3] = '-';
+ }
name = buf;
}
}
}
- // If that's not available (because you're running AOSP on a WiFi-only
+ // If the system property is also not available (because you're running AOSP on a WiFi-only
// device, say), fall back to GMT.
if (name == NULL) name = gmt;
diff --git a/libc/zoneinfo/tzdata b/libc/zoneinfo/tzdata
index e161cec..538e663 100644
--- a/libc/zoneinfo/tzdata
+++ b/libc/zoneinfo/tzdata
Binary files differ
diff --git a/linker/Android.bp b/linker/Android.bp
new file mode 100644
index 0000000..d7e97f0
--- /dev/null
+++ b/linker/Android.bp
@@ -0,0 +1,144 @@
+cc_library_static {
+ name: "liblinker_malloc",
+ clang: true,
+
+ srcs: [
+ "linker_allocator.cpp",
+ "linker_memory.cpp",
+ ],
+
+ // We need to access Bionic private headers in the linker.
+ include_dirs: ["bionic/libc"],
+}
+
+cc_binary {
+ clang: true,
+
+ srcs: [
+ "dlfcn.cpp",
+ "linker.cpp",
+ "linker_block_allocator.cpp",
+ "linker_gdb_support.cpp",
+ "linker_libc_support.c",
+ "linker_logger.cpp",
+ "linker_mapped_file_fragment.cpp",
+ "linker_phdr.cpp",
+ "linker_sdk_versions.cpp",
+ "linker_utils.cpp",
+ "rt.cpp",
+ ],
+
+ arch: {
+ arm: {
+ srcs: ["arch/arm/begin.S"],
+
+ cflags: ["-D__work_around_b_24465209__"],
+ },
+ arm64: {
+ srcs: ["arch/arm64/begin.S"],
+ },
+ x86: {
+ srcs: ["arch/x86/begin.c"],
+
+ cflags: ["-D__work_around_b_24465209__"],
+ },
+ x86_64: {
+ srcs: ["arch/x86_64/begin.S"],
+ },
+ mips: {
+ srcs: [
+ "arch/mips/begin.S",
+ "linker_mips.cpp",
+ ],
+ },
+ mips64: {
+ srcs: [
+ "arch/mips64/begin.S",
+ "linker_mips.cpp",
+ ],
+ },
+ },
+
+ // We need to access Bionic private headers in the linker.
+ include_dirs: ["bionic/libc"],
+
+ // -shared is used to overwrite the -Bstatic and -static
+ // flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
+ // This dynamic linker is actually a shared object linked with static libraries.
+ ldflags: [
+ "-shared",
+ "-Wl,-Bsymbolic",
+ "-Wl,--exclude-libs,ALL",
+ ],
+
+ cflags: [
+ "-fno-stack-protector",
+ "-Wstrict-overflow=5",
+ "-fvisibility=hidden",
+ "-Wall",
+ "-Wextra",
+ "-Wunused",
+ "-Werror",
+ ],
+
+ // TODO: split out the asflags.
+ asflags: [
+ "-fno-stack-protector",
+ "-Wstrict-overflow=5",
+ "-fvisibility=hidden",
+ "-Wall",
+ "-Wextra",
+ "-Wunused",
+ "-Werror",
+ ],
+
+ conlyflags: ["-std=gnu99"],
+
+ cppflags: ["-Wold-style-cast"],
+
+ // we don't want crtbegin.o (because we have begin.o), so unset it
+ // just for this module
+ nocrt: true,
+
+ static_libs: [
+ "libc_nomalloc",
+ "libziparchive",
+ "libutils",
+ "libbase",
+ "libz",
+ "liblog",
+ "libdebuggerd_client",
+
+ // Important: The liblinker_malloc should be the last library in the list
+ // to overwrite any other malloc implementations by other static libraries.
+ "liblinker_malloc"
+ ],
+ static_executable: true,
+
+ name: "linker",
+ multilib: {
+ lib32: {
+ symlinks: ["linker_asan"],
+ },
+ lib64: {
+ suffix: "64",
+ symlinks: ["linker_asan64"],
+ },
+ },
+ target: {
+ android64: {
+ cflags: ["-DTARGET_IS_64_BIT"],
+ },
+ },
+ compile_multilib: "both",
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
+
+ // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
+ // looking up symbols in the linker by mistake.
+ prefix_symbols: "__dl_",
+}
diff --git a/linker/Android.mk b/linker/Android.mk
index 29520f9..ea7451c 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -1,128 +1,3 @@
LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_CLANG := true
-
-LOCAL_MODULE := liblinker_malloc
-
-LOCAL_SRC_FILES := \
- linker_allocator.cpp \
- linker_memory.cpp
-
-# We need to access Bionic private headers in the linker.
-LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
-
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_CLANG := true
-
-LOCAL_SRC_FILES := \
- dlfcn.cpp \
- linker.cpp \
- linker_block_allocator.cpp \
- linker_gdb_support.cpp \
- linker_libc_support.c \
- linker_mapped_file_fragment.cpp \
- linker_phdr.cpp \
- linker_sdk_versions.cpp \
- linker_utils.cpp \
- rt.cpp \
-
-LOCAL_SRC_FILES_arm := arch/arm/begin.S
-LOCAL_SRC_FILES_arm64 := arch/arm64/begin.S
-LOCAL_SRC_FILES_x86 := arch/x86/begin.c
-LOCAL_SRC_FILES_x86_64 := arch/x86_64/begin.S
-LOCAL_SRC_FILES_mips := arch/mips/begin.S linker_mips.cpp
-LOCAL_SRC_FILES_mips64 := arch/mips64/begin.S linker_mips.cpp
-
-# -shared is used to overwrite the -Bstatic and -static
-# flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
-# This dynamic linker is actually a shared object linked with static libraries.
-LOCAL_LDFLAGS := \
- -shared \
- -Wl,-Bsymbolic \
- -Wl,--exclude-libs,ALL \
-
-LOCAL_CFLAGS += \
- -fno-stack-protector \
- -Wstrict-overflow=5 \
- -fvisibility=hidden \
- -Wall -Wextra -Wunused -Werror \
-
-LOCAL_CFLAGS_arm += -D__work_around_b_24465209__
-LOCAL_CFLAGS_x86 += -D__work_around_b_24465209__
-
-LOCAL_CONLYFLAGS += \
- -std=gnu99 \
-
-LOCAL_CPPFLAGS += \
- -Wold-style-cast \
-
-ifeq ($(TARGET_IS_64_BIT),true)
-LOCAL_CPPFLAGS += -DTARGET_IS_64_BIT
-endif
-
-# We need to access Bionic private headers in the linker.
-LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
-
-# we don't want crtbegin.o (because we have begin.o), so unset it
-# just for this module
-LOCAL_NO_CRT := true
-# TODO: split out the asflags.
-LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_STATIC_LIBRARIES := \
- libc_nomalloc \
- libziparchive \
- libutils \
- libbase \
- libz \
- liblog \
- libdebuggerd_client
-
-# Important: The liblinker_malloc should be the last library in the list
-# to overwrite any other malloc implementations by other static libraries.
-LOCAL_STATIC_LIBRARIES += liblinker_malloc
-
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-
-LOCAL_MODULE := linker
-LOCAL_MODULE_STEM_32 := linker
-LOCAL_MODULE_STEM_64 := linker64
-LOCAL_MULTILIB := both
-
-# Leave the symbols in the shared library so that stack unwinders can produce
-# meaningful name resolution.
-LOCAL_STRIP_MODULE := keep_symbols
-
-# Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
-# looking up symbols in the linker by mistake.
-#
-# Note we are using "=" instead of ":=" to defer the evaluation,
-# because LOCAL_2ND_ARCH_VAR_PREFIX or linked_module isn't set properly yet at this point.
-LOCAL_POST_LINK_CMD = $(hide) $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) \
- --prefix-symbols=__dl_ $(linked_module)
-
-include $(BUILD_EXECUTABLE)
-
-
-define add-linker-symlink
-$(eval _from := $(TARGET_OUT)/bin/$(1))
-$(eval _to:=$(2))
-$(_from): $(LOCAL_MODULE_MAKEFILE)
- @echo "Symlink: $$@ -> $(_to)"
- @mkdir -p $$(dir $$@)
- @rm -rf $$@
- $(hide) ln -sf $(_to) $$@
-endef
-
-$(eval $(call add-linker-symlink,linker_asan,linker))
-ifeq ($(TARGET_IS_64_BIT),true)
-$(eval $(call add-linker-symlink,linker_asan64,linker64))
-endif
-
include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index a3ebcd6..110846d 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -68,6 +68,7 @@
static void* dlopen_ext(const char* filename, int flags,
const android_dlextinfo* extinfo, void* caller_addr) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
+ g_linker_logger.ResetState();
void* result = do_dlopen(filename, flags, extinfo, caller_addr);
if (result == nullptr) {
__bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
@@ -88,6 +89,7 @@
void* dlsym_impl(void* handle, const char* symbol, const char* version, void* caller_addr) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
+ g_linker_logger.ResetState();
void* result;
if (!do_dlsym(handle, symbol, version, caller_addr, &result)) {
__bionic_format_dlerror(linker_get_error_buffer(), nullptr);
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 0fe0c38..71e3774 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -61,6 +61,7 @@
#include "linker_utils.h"
#include "android-base/strings.h"
+#include "android-base/stringprintf.h"
#include "debuggerd/client.h"
#include "ziparchive/zip_archive.h"
@@ -192,9 +193,13 @@
static bool g_public_namespace_initialized;
static soinfo::soinfo_list_t g_public_namespace;
-__LIBC_HIDDEN__ int g_ld_debug_verbosity;
+int g_ld_debug_verbosity;
+abort_msg_t* g_abort_message = nullptr; // For debuggerd.
-__LIBC_HIDDEN__ abort_msg_t* g_abort_message = nullptr; // For debuggerd.
+// These values are used to call constructors for .init_array && .preinit_array
+int g_argc = 0;
+char** g_argv = nullptr;
+char** g_envp = nullptr;
static std::string dirname(const char *path) {
const char* last_slash = strrchr(path, '/');
@@ -2226,17 +2231,54 @@
parse_LD_LIBRARY_PATH(ld_library_path);
}
+static std::string android_dlextinfo_to_string(const android_dlextinfo* info) {
+ if (info == nullptr) {
+ return "(null)";
+ }
+
+ return android::base::StringPrintf("[flags=0x%" PRIx64 ","
+ " reserved_addr=%p,"
+ " reserved_size=0x%zx,"
+ " relro_fd=%d,"
+ " library_fd=%d,"
+ " library_fd_offset=0x%" PRIx64 ","
+ " library_namespace=%s@%p]",
+ info->flags,
+ info->reserved_addr,
+ info->reserved_size,
+ info->relro_fd,
+ info->library_fd,
+ info->library_fd_offset,
+ (info->flags & ANDROID_DLEXT_USE_NAMESPACE) != 0 ?
+ (info->library_namespace != nullptr ?
+ info->library_namespace->get_name() : "(null)") : "(n/a)",
+ (info->flags & ANDROID_DLEXT_USE_NAMESPACE) != 0 ?
+ info->library_namespace : nullptr);
+}
+
void* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo,
void* caller_addr) {
soinfo* const caller = find_containing_library(caller_addr);
+ android_namespace_t* ns = get_caller_namespace(caller);
+
+ LD_LOG(kLogDlopen,
+ "dlopen(name=\"%s\", flags=0x%x, extinfo=%s, caller=\"%s\", caller_ns=%s@%p) ...",
+ name,
+ flags,
+ android_dlextinfo_to_string(extinfo).c_str(),
+ caller == nullptr ? "(null)" : caller->get_realpath(),
+ ns == nullptr ? "(null)" : ns->get_name(),
+ ns);
+
+ auto failure_guard = make_scope_guard([&]() {
+ LD_LOG(kLogDlopen, "... dlopen failed: %s", linker_get_error_buffer());
+ });
if ((flags & ~(RTLD_NOW|RTLD_LAZY|RTLD_LOCAL|RTLD_GLOBAL|RTLD_NODELETE|RTLD_NOLOAD)) != 0) {
DL_ERR("invalid flags to dlopen: %x", flags);
return nullptr;
}
- android_namespace_t* ns = get_caller_namespace(caller);
-
if (extinfo != nullptr) {
if ((extinfo->flags & ~(ANDROID_DLEXT_VALID_FLAG_BITS)) != 0) {
DL_ERR("invalid extended flags to android_dlopen_ext: 0x%" PRIx64, extinfo->flags);
@@ -2269,8 +2311,13 @@
ProtectedDataGuard guard;
soinfo* si = find_library(ns, name, flags, extinfo, caller);
if (si != nullptr) {
+ failure_guard.disable();
si->call_constructors();
- return si->to_handle();
+ void* handle = si->to_handle();
+ LD_LOG(kLogDlopen,
+ "... dlopen successful: realpath=\"%s\", soname=\"%s\", handle=%p",
+ si->get_realpath(), si->get_soname(), handle);
+ return handle;
}
return nullptr;
@@ -2977,13 +3024,41 @@
}
#endif // !defined(__mips__)
-void soinfo::call_array(const char* array_name __unused, linker_function_t* functions,
- size_t count, bool reverse) {
+static void call_function(const char* function_name __unused,
+ linker_ctor_function_t function,
+ const char* realpath __unused) {
+ if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
+ return;
+ }
+
+ TRACE("[ Calling c-tor %s @ %p for '%s' ]", function_name, function, realpath);
+ function(g_argc, g_argv, g_envp);
+ TRACE("[ Done calling c-tor %s @ %p for '%s' ]", function_name, function, realpath);
+}
+
+static void call_function(const char* function_name __unused,
+ linker_dtor_function_t function,
+ const char* realpath __unused) {
+ if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
+ return;
+ }
+
+ TRACE("[ Calling d-tor %s @ %p for '%s' ]", function_name, function, realpath);
+ function();
+ TRACE("[ Done calling d-tor %s @ %p for '%s' ]", function_name, function, realpath);
+}
+
+template <typename F>
+static void call_array(const char* array_name __unused,
+ F* functions,
+ size_t count,
+ bool reverse,
+ const char* realpath) {
if (functions == nullptr) {
return;
}
- TRACE("[ Calling %s (size %zd) @ %p for '%s' ]", array_name, count, functions, get_realpath());
+ TRACE("[ Calling %s (size %zd) @ %p for '%s' ]", array_name, count, functions, realpath);
int begin = reverse ? (count - 1) : 0;
int end = reverse ? -1 : count;
@@ -2991,26 +3066,16 @@
for (int i = begin; i != end; i += step) {
TRACE("[ %s[%d] == %p ]", array_name, i, functions[i]);
- call_function("function", functions[i]);
+ call_function("function", functions[i], realpath);
}
- TRACE("[ Done calling %s for '%s' ]", array_name, get_realpath());
-}
-
-void soinfo::call_function(const char* function_name __unused, linker_function_t function) {
- if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
- return;
- }
-
- TRACE("[ Calling %s @ %p for '%s' ]", function_name, function, get_realpath());
- function();
- TRACE("[ Done calling %s @ %p for '%s' ]", function_name, function, get_realpath());
+ TRACE("[ Done calling %s for '%s' ]", array_name, realpath);
}
void soinfo::call_pre_init_constructors() {
// DT_PREINIT_ARRAY functions are called before any other constructors for executables,
// but ignored in a shared library.
- call_array("DT_PREINIT_ARRAY", preinit_array_, preinit_array_count_, false);
+ call_array("DT_PREINIT_ARRAY", preinit_array_, preinit_array_count_, false, get_realpath());
}
void soinfo::call_constructors() {
@@ -3042,8 +3107,8 @@
TRACE("\"%s\": calling constructors", get_realpath());
// DT_INIT should be called before DT_INIT_ARRAY if both are present.
- call_function("DT_INIT", init_func_);
- call_array("DT_INIT_ARRAY", init_array_, init_array_count_, false);
+ call_function("DT_INIT", init_func_, get_realpath());
+ call_array("DT_INIT_ARRAY", init_array_, init_array_count_, false, get_realpath());
}
void soinfo::call_destructors() {
@@ -3053,10 +3118,10 @@
TRACE("\"%s\": calling destructors", get_realpath());
// DT_FINI_ARRAY must be parsed in reverse order.
- call_array("DT_FINI_ARRAY", fini_array_, fini_array_count_, true);
+ call_array("DT_FINI_ARRAY", fini_array_, fini_array_count_, true, get_realpath());
// DT_FINI should be called after DT_FINI_ARRAY if both are present.
- call_function("DT_FINI", fini_func_);
+ call_function("DT_FINI", fini_func_, get_realpath());
}
void soinfo::add_child(soinfo* child) {
@@ -3598,17 +3663,17 @@
#endif
case DT_INIT:
- init_func_ = reinterpret_cast<linker_function_t>(load_bias + d->d_un.d_ptr);
+ init_func_ = reinterpret_cast<linker_ctor_function_t>(load_bias + d->d_un.d_ptr);
DEBUG("%s constructors (DT_INIT) found at %p", get_realpath(), init_func_);
break;
case DT_FINI:
- fini_func_ = reinterpret_cast<linker_function_t>(load_bias + d->d_un.d_ptr);
+ fini_func_ = reinterpret_cast<linker_dtor_function_t>(load_bias + d->d_un.d_ptr);
DEBUG("%s destructors (DT_FINI) found at %p", get_realpath(), fini_func_);
break;
case DT_INIT_ARRAY:
- init_array_ = reinterpret_cast<linker_function_t*>(load_bias + d->d_un.d_ptr);
+ init_array_ = reinterpret_cast<linker_ctor_function_t*>(load_bias + d->d_un.d_ptr);
DEBUG("%s constructors (DT_INIT_ARRAY) found at %p", get_realpath(), init_array_);
break;
@@ -3617,7 +3682,7 @@
break;
case DT_FINI_ARRAY:
- fini_array_ = reinterpret_cast<linker_function_t*>(load_bias + d->d_un.d_ptr);
+ fini_array_ = reinterpret_cast<linker_dtor_function_t*>(load_bias + d->d_un.d_ptr);
DEBUG("%s destructors (DT_FINI_ARRAY) found at %p", get_realpath(), fini_array_);
break;
@@ -3626,7 +3691,7 @@
break;
case DT_PREINIT_ARRAY:
- preinit_array_ = reinterpret_cast<linker_function_t*>(load_bias + d->d_un.d_ptr);
+ preinit_array_ = reinterpret_cast<linker_ctor_function_t*>(load_bias + d->d_un.d_ptr);
DEBUG("%s constructors (DT_PREINIT_ARRAY) found at %p", get_realpath(), preinit_array_);
break;
@@ -4070,6 +4135,8 @@
};
debuggerd_init(&callbacks);
+ g_linker_logger.ResetState();
+
// Get a few environment variables.
const char* LD_DEBUG = getenv("LD_DEBUG");
if (LD_DEBUG != nullptr) {
@@ -4143,7 +4210,7 @@
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(si->base);
if (elf_hdr->e_type != ET_DYN) {
__libc_fatal("\"%s\": error: only position independent executables (PIE) are supported.",
- args.argv[0]);
+ g_argv[0]);
}
// Use LD_LIBRARY_PATH and LD_PRELOAD (but only if we aren't setuid/setgid).
@@ -4155,7 +4222,7 @@
init_default_namespace();
if (!si->prelink_image()) {
- __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", args.argv[0], linker_get_error_buffer());
+ __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
}
// add somain to global group
@@ -4186,10 +4253,10 @@
!find_libraries(&g_default_namespace, si, needed_library_names, needed_libraries_count,
nullptr, &g_ld_preloads, ld_preloads_count, RTLD_GLOBAL, nullptr,
/* add_as_children */ true)) {
- __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", args.argv[0], linker_get_error_buffer());
+ __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
} else if (needed_libraries_count == 0) {
if (!si->link_image(g_empty_list, soinfo::soinfo_list_t::make_list(si), nullptr)) {
- __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", args.argv[0], linker_get_error_buffer());
+ __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
}
si->increment_ref_count();
}
@@ -4212,12 +4279,12 @@
#if TIMING
gettimeofday(&t1, nullptr);
- PRINT("LINKER TIME: %s: %d microseconds", args.argv[0], (int) (
+ PRINT("LINKER TIME: %s: %d microseconds", g_argv[0], (int) (
(((long long)t1.tv_sec * 1000000LL) + (long long)t1.tv_usec) -
(((long long)t0.tv_sec * 1000000LL) + (long long)t0.tv_usec)));
#endif
#if STATS
- PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol", args.argv[0],
+ PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol", g_argv[0],
linker_stats.count[kRelocAbsolute],
linker_stats.count[kRelocRelative],
linker_stats.count[kRelocCopy],
@@ -4243,7 +4310,7 @@
}
}
}
- PRINT("PAGES MODIFIED: %s: %d (%dKB)", args.argv[0], count, count * 4);
+ PRINT("PAGES MODIFIED: %s: %d (%dKB)", g_argv[0], count, count * 4);
}
#endif
@@ -4280,8 +4347,8 @@
return 0;
}
-static void __linker_cannot_link(KernelArgumentBlock& args) {
- __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", args.argv[0], linker_get_error_buffer());
+static void __linker_cannot_link() {
+ __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
}
/*
@@ -4296,6 +4363,10 @@
extern "C" ElfW(Addr) __linker_init(void* raw_args) {
KernelArgumentBlock args(raw_args);
+ g_argc = args.argc;
+ g_argv = args.argv;
+ g_envp = args.envp;
+
ElfW(Addr) linker_addr = args.getauxval(AT_BASE);
ElfW(Addr) entry_point = args.getauxval(AT_ENTRY);
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);
@@ -4312,7 +4383,7 @@
if (reinterpret_cast<ElfW(Addr)>(&_start) == entry_point) {
__libc_format_fd(STDOUT_FILENO,
"This is %s, the helper program for shared library executables.\n",
- args.argv[0]);
+ g_argv[0]);
exit(0);
}
@@ -4325,7 +4396,7 @@
linker_so.set_linker_flag();
// Prelink the linker so we can access linker globals.
- if (!linker_so.prelink_image()) __linker_cannot_link(args);
+ if (!linker_so.prelink_image()) __linker_cannot_link();
// This might not be obvious... The reasons why we pass g_empty_list
// in place of local_group here are (1) we do not really need it, because
@@ -4333,7 +4404,7 @@
// itself without having to look into local_group and (2) allocators
// are not yet initialized, and therefore we cannot use linked_list.push_*
// functions at this point.
- if (!linker_so.link_image(g_empty_list, g_empty_list, nullptr)) __linker_cannot_link(args);
+ if (!linker_so.link_image(g_empty_list, g_empty_list, nullptr)) __linker_cannot_link();
#if defined(__i386__)
// On x86, we can't make system calls before this point.
@@ -4349,7 +4420,7 @@
// We didn't protect the linker's RELRO pages in link_image because we
// couldn't make system calls on x86 at that point, but we can now...
- if (!linker_so.protect_relro()) __linker_cannot_link(args);
+ if (!linker_so.protect_relro()) __linker_cannot_link();
// Initialize the linker's static libc's globals
__libc_init_globals(args);
diff --git a/linker/linker.h b/linker/linker.h
index fbd236f..d8c0e19 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -40,6 +40,7 @@
#include "private/bionic_page.h"
#include "private/libc_logging.h"
#include "linked_list.h"
+#include "linker_logger.h"
#include <string>
#include <vector>
@@ -48,7 +49,7 @@
do { \
__libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \
/* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \
- DEBUG("%s\n", linker_get_error_buffer()); \
+ LD_LOG(kLogErrors, "%s\n", linker_get_error_buffer()); \
} while (false)
#define DL_WARN(fmt, x...) \
@@ -95,7 +96,8 @@
#define SOINFO_NAME_LEN 128
#endif
-typedef void (*linker_function_t)();
+typedef void (*linker_dtor_function_t)();
+typedef void (*linker_ctor_function_t)(int, char**, char**);
// Android uses RELA for aarch64 and x86_64. mips64 still uses REL.
#if defined(__aarch64__) || defined(__x86_64__)
@@ -233,16 +235,16 @@
size_t rel_count_;
#endif
- linker_function_t* preinit_array_;
+ linker_ctor_function_t* preinit_array_;
size_t preinit_array_count_;
- linker_function_t* init_array_;
+ linker_ctor_function_t* init_array_;
size_t init_array_count_;
- linker_function_t* fini_array_;
+ linker_dtor_function_t* fini_array_;
size_t fini_array_count_;
- linker_function_t init_func_;
- linker_function_t fini_func_;
+ linker_ctor_function_t init_func_;
+ linker_dtor_function_t fini_func_;
#if defined(__arm__)
public:
@@ -372,8 +374,6 @@
bool lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
const char* sym_name, const version_info** vi);
- void call_array(const char* array_name, linker_function_t* functions, size_t count, bool reverse);
- void call_function(const char* function_name, linker_function_t function);
template<typename ElfRelIteratorT>
bool relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& rel_iterator,
const soinfo_list_t& global_group, const soinfo_list_t& local_group);
@@ -502,4 +502,7 @@
const char* permitted_when_isolated_path,
android_namespace_t* parent_namespace);
+constexpr unsigned kLibraryAlignmentBits = 18;
+constexpr size_t kLibraryAlignment = 1UL << kLibraryAlignmentBits;
+
#endif
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp
index 57811d8..7deddea 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_allocator.cpp
@@ -15,6 +15,7 @@
*/
#include "linker_allocator.h"
+#include "linker_debug.h"
#include "linker.h"
#include <algorithm>
@@ -73,6 +74,8 @@
: type_(0), block_size_(0), free_pages_cnt_(0), free_blocks_list_(nullptr) {}
void* LinkerSmallObjectAllocator::alloc() {
+ CHECK(block_size_ != 0);
+
if (free_blocks_list_ == nullptr) {
alloc_page();
}
diff --git a/linker/linker_logger.cpp b/linker/linker_logger.cpp
new file mode 100644
index 0000000..a9d358a
--- /dev/null
+++ b/linker/linker_logger.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/system_properties.h>
+#include <unistd.h>
+
+#include <string>
+#include <vector>
+
+#include "android-base/strings.h"
+#include "linker_logger.h"
+#include "private/libc_logging.h"
+
+LinkerLogger g_linker_logger;
+
+static const char* kSystemLdDebugProperty = "debug.ld.all";
+static const char* kLdDebugPropertyPrefix = "debug.ld.app.";
+
+static const char* kOptionErrors = "dlerror";
+static const char* kOptionDlopen = "dlopen";
+
+static std::string property_get(const char* name) {
+ char value[PROP_VALUE_MAX] = {};
+ __system_property_get(name, value);
+ return value;
+}
+
+static uint32_t ParseProperty(const std::string& value) {
+ if (value.empty()) {
+ return 0;
+ }
+
+ std::vector<std::string> options = android::base::Split(value, ",");
+
+ uint32_t flags = 0;
+
+ for (const auto& o : options) {
+ if (o == kOptionErrors) {
+ flags |= kLogErrors;
+ } else if (o == kOptionDlopen){
+ flags |= kLogDlopen;
+ } else {
+ __libc_format_log(ANDROID_LOG_WARN, "linker", "Unknown debug.ld option \"%s\", will ignore.", o.c_str());
+ }
+ }
+
+ return flags;
+}
+
+void LinkerLogger::ResetState() {
+ // the most likely scenario app is not debuggable and
+ // is running on user build - the logging is disabled.
+ if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) {
+ return;
+ }
+
+ flags_ = 0;
+ // check flag applied to all processes first
+ std::string value = property_get(kSystemLdDebugProperty);
+ flags_ |= ParseProperty(value);
+
+ // get process basename
+ std::string process_name = basename(g_argv[0]);
+
+ std::string property_name = std::string(kLdDebugPropertyPrefix) + process_name;
+
+ // Property names are limited to PROP_NAME_MAX.
+
+ if (property_name.size() >= PROP_NAME_MAX) {
+ size_t count = PROP_NAME_MAX - 1;
+ // remove trailing dots...
+ while (property_name[count-1] == '.') {
+ --count;
+ }
+
+ property_name = property_name.substr(0, count);
+ }
+ value = property_get(property_name.c_str());
+ flags_ |= ParseProperty(value);
+}
+
+void LinkerLogger::Log(uint32_t type, const char* format, ...) {
+ if ((flags_ & type) == 0) {
+ return;
+ }
+
+ va_list ap;
+ va_start(ap, format);
+ __libc_format_log_va_list(ANDROID_LOG_DEBUG, "linker", format, ap);
+ va_end(ap);
+}
+
diff --git a/linker/linker_logger.h b/linker/linker_logger.h
new file mode 100644
index 0000000..0932471
--- /dev/null
+++ b/linker/linker_logger.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_LOGGER_H_
+#define _LINKER_LOGGER_H_
+
+#include <stdlib.h>
+#include <limits.h>
+#include "private/bionic_macros.h"
+
+#define LD_LOG(type, x...) \
+ { \
+ g_linker_logger.Log(type, x); \
+ }
+
+constexpr const uint32_t kLogErrors = 1 << 0;
+constexpr const uint32_t kLogDlopen = 1 << 1;
+
+class LinkerLogger {
+ public:
+ LinkerLogger() : flags_(0) { }
+
+ void ResetState();
+ void Log(uint32_t type, const char* format, ...);
+ private:
+ uint32_t flags_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinkerLogger);
+};
+
+extern LinkerLogger g_linker_logger;
+extern char** g_argv;
+
+#endif /* _LINKER_LOGGER_H_ */
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 136e432..a7af82f 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -252,7 +252,12 @@
off64_t range_start;
off64_t range_end;
- return safe_add(&range_start, file_offset_, offset) &&
+ // Only header can be located at the 0 offset... This function called to
+ // check DYNSYM and DYNAMIC sections and phdr/shdr - none of them can be
+ // at offset 0.
+
+ return offset > 0 &&
+ safe_add(&range_start, file_offset_, offset) &&
safe_add(&range_end, range_start, size) &&
range_start < file_size_ &&
range_end <= file_size_;
@@ -324,6 +329,35 @@
return false;
}
+ // Make sure dynamic_shdr offset and size matches PT_DYNAMIC phdr
+ size_t pt_dynamic_offset = 0;
+ size_t pt_dynamic_filesz = 0;
+ for (size_t i = 0; i < phdr_num_; ++i) {
+ const ElfW(Phdr)* phdr = &phdr_table_[i];
+ if (phdr->p_type == PT_DYNAMIC) {
+ pt_dynamic_offset = phdr->p_offset;
+ pt_dynamic_filesz = phdr->p_filesz;
+ }
+ }
+
+ if (pt_dynamic_offset != dynamic_shdr->sh_offset) {
+ DL_ERR("\"%s\" .dynamic section has invalid offset: 0x%zx, "
+ "expected to match PT_DYNAMIC offset: 0x%zx",
+ name_.c_str(),
+ static_cast<size_t>(dynamic_shdr->sh_offset),
+ pt_dynamic_offset);
+ return false;
+ }
+
+ if (pt_dynamic_filesz != dynamic_shdr->sh_size) {
+ DL_ERR("\"%s\" .dynamic section has invalid size: 0x%zx, "
+ "expected to match PT_DYNAMIC filesz: 0x%zx",
+ name_.c_str(),
+ static_cast<size_t>(dynamic_shdr->sh_size),
+ pt_dynamic_filesz);
+ return false;
+ }
+
if (dynamic_shdr->sh_link >= shdr_num_) {
DL_ERR("\"%s\" .dynamic section has invalid sh_link: %d", name_.c_str(), dynamic_shdr->sh_link);
return false;
@@ -415,6 +449,40 @@
return max_vaddr - min_vaddr;
}
+// Reserve a virtual address range such that if it's limits were extended to the next 2**align
+// boundary, it would not overlap with any existing mappings.
+static void* ReserveAligned(void* hint, size_t size, size_t align) {
+ int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
+ // Address hint is only used in Art for the image mapping, and it is pretty important. Don't mess
+ // with it.
+ // FIXME: try an aligned allocation and fall back to plain mmap() if the former does not provide a
+ // mapping at the requested address?
+ if (align == PAGE_SIZE || hint != nullptr) {
+ void* mmap_ptr = mmap(hint, size, PROT_NONE, mmap_flags, -1, 0);
+ if (mmap_ptr == MAP_FAILED) {
+ return nullptr;
+ }
+ return mmap_ptr;
+ }
+
+ // Allocate enough space so that the end of the desired region aligned up is still inside the
+ // mapping.
+ size_t mmap_size = align_up(size, align) + align - PAGE_SIZE;
+ uint8_t* mmap_ptr =
+ reinterpret_cast<uint8_t*>(mmap(nullptr, mmap_size, PROT_NONE, mmap_flags, -1, 0));
+ if (mmap_ptr == MAP_FAILED) {
+ return nullptr;
+ }
+
+ uint8_t* first = align_up(mmap_ptr, align);
+ uint8_t* last = align_down(mmap_ptr + mmap_size, align) - size;
+ size_t n = arc4random_uniform((last - first) / PAGE_SIZE + 1);
+ uint8_t* start = first + n * PAGE_SIZE;
+ munmap(mmap_ptr, start - mmap_ptr);
+ munmap(start + size, mmap_ptr + mmap_size - (start + size));
+ return start;
+}
+
// Reserve a virtual address range big enough to hold all loadable
// segments of a program header table. This is done by creating a
// private anonymous mmap() with PROT_NONE.
@@ -456,9 +524,8 @@
reserved_size - load_size_, load_size_, name_.c_str());
return false;
}
- int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
- start = mmap(mmap_hint, load_size_, PROT_NONE, mmap_flags, -1, 0);
- if (start == MAP_FAILED) {
+ start = ReserveAligned(mmap_hint, load_size_, kLibraryAlignment);
+ if (start == nullptr) {
DL_ERR("couldn't reserve %zd bytes of address space for \"%s\"", load_size_, name_.c_str());
return false;
}
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..4ea1122
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,411 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "bionic_tests_defaults",
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+ cflags: [
+ "-fstack-protector-all",
+ "-g",
+ "-Wall",
+ "-Wextra",
+ "-Wunused",
+ "-Werror",
+ "-fno-builtin",
+
+ // We want to test deprecated API too.
+ "-Wno-deprecated-declarations",
+
+ // For glibc.
+ "-D__STDC_LIMIT_MACROS",
+ ],
+ stl: "libc++",
+ sanitize: {
+ never: true,
+ },
+}
+
+// -----------------------------------------------------------------------------
+// All standard tests.
+// -----------------------------------------------------------------------------
+
+cc_test_library {
+ name: "libBionicStandardTests",
+ defaults: ["bionic_tests_defaults"],
+ srcs: [
+ "arpa_inet_test.cpp",
+ "buffer_tests.cpp",
+ "bug_26110743_test.cpp",
+ "complex_test.cpp",
+ "ctype_test.cpp",
+ "dirent_test.cpp",
+ "error_test.cpp",
+ "eventfd_test.cpp",
+ "fcntl_test.cpp",
+ "fenv_test.cpp",
+ "ftw_test.cpp",
+ "getauxval_test.cpp",
+ "getcwd_test.cpp",
+ "grp_pwd_test.cpp",
+ "ifaddrs_test.cpp",
+ "inttypes_test.cpp",
+ "libc_logging_test.cpp",
+ "libgen_basename_test.cpp",
+ "libgen_test.cpp",
+ "locale_test.cpp",
+ "malloc_test.cpp",
+ "math_test.cpp",
+ "mntent_test.cpp",
+ "netdb_test.cpp",
+ "net_if_test.cpp",
+ "netinet_ether_test.cpp",
+ "netinet_in_test.cpp",
+ "netinet_udp_test.cpp",
+ "nl_types_test.cpp",
+ "pthread_test.cpp",
+ "pty_test.cpp",
+ "regex_test.cpp",
+ "resolv_test.cpp",
+ "sched_test.cpp",
+ "search_test.cpp",
+ "semaphore_test.cpp",
+ "setjmp_test.cpp",
+ "signal_test.cpp",
+ "stack_protector_test.cpp",
+ "stack_protector_test_helper.cpp",
+ "stack_unwinding_test.cpp",
+ "stdatomic_test.cpp",
+ "stdint_test.cpp",
+ "stdio_nofortify_test.cpp",
+ "stdio_test.cpp",
+ "stdio_ext_test.cpp",
+ "stdlib_test.cpp",
+ "string_nofortify_test.cpp",
+ "string_test.cpp",
+ "string_posix_strerror_r_test.cpp",
+ "strings_nofortify_test.cpp",
+ "strings_test.cpp",
+ "sstream_test.cpp",
+ "sys_epoll_test.cpp",
+ "sys_mman_test.cpp",
+ "sys_personality_test.cpp",
+ "sys_prctl_test.cpp",
+ "sys_procfs_test.cpp",
+ "sys_ptrace_test.cpp",
+ "sys_quota_test.cpp",
+ "sys_resource_test.cpp",
+ "sys_select_test.cpp",
+ "sys_sendfile_test.cpp",
+ "sys_socket_test.cpp",
+ "sys_stat_test.cpp",
+ "sys_statvfs_test.cpp",
+ "sys_syscall_test.cpp",
+ "sys_sysinfo_test.cpp",
+ "sys_sysmacros_test.cpp",
+ "sys_time_test.cpp",
+ "sys_timex_test.cpp",
+ "sys_types_test.cpp",
+ "sys_uio_test.cpp",
+ "sys_vfs_test.cpp",
+ "sys_xattr_test.cpp",
+ "system_properties_test.cpp",
+ "time_test.cpp",
+ "uchar_test.cpp",
+ "uniqueptr_test.cpp",
+ "unistd_nofortify_test.cpp",
+ "unistd_test.cpp",
+ "utmp_test.cpp",
+ "wchar_test.cpp",
+ "wctype_test.cpp",
+ ],
+
+ include_dirs: [
+ "bionic/libc",
+ "external/tinyxml2",
+ ],
+
+ static_libs: ["libbase"],
+ host_ldlibs: ["-lrt"],
+}
+
+// -----------------------------------------------------------------------------
+// Fortify tests.
+// -----------------------------------------------------------------------------
+
+cc_defaults {
+ name: "bionic_fortify_tests_defaults",
+ cflags: [
+ "-Wno-error",
+ "-U_FORTIFY_SOURCE",
+ ],
+ srcs: ["fortify_test_main.cpp"],
+ target: {
+ host: {
+ clang_cflags: ["-D__clang__"],
+ },
+ },
+}
+
+cc_test_library {
+ name: "libfortify1-tests-gcc",
+ defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"],
+ clang: false,
+ cflags: [
+ "-D_FORTIFY_SOURCE=1",
+ "-DTEST_NAME=Fortify1_gcc"
+ ],
+}
+
+cc_test_library {
+ name: "libfortify2-tests-gcc",
+ defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"],
+ clang: false,
+ cflags: [
+ "-D_FORTIFY_SOURCE=2",
+ "-DTEST_NAME=Fortify2_gcc"
+ ],
+}
+
+cc_test_library {
+ name: "libfortify1-tests-clang",
+ defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"],
+ clang: true,
+ cflags: [
+ "-D_FORTIFY_SOURCE=1",
+ "-DTEST_NAME=Fortify1_clang"
+ ],
+}
+
+cc_test_library {
+ name: "libfortify2-tests-clang",
+ defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"],
+ clang: true,
+ cflags: [
+ "-D_FORTIFY_SOURCE=2",
+ "-DTEST_NAME=Fortify2_clang"
+ ],
+}
+
+// -----------------------------------------------------------------------------
+// Library of all tests (excluding the dynamic linker tests).
+// -----------------------------------------------------------------------------
+cc_test_library {
+ name: "libBionicTests",
+ defaults: ["bionic_tests_defaults"],
+ whole_static_libs: [
+ "libBionicStandardTests",
+ "libfortify1-tests-gcc",
+ "libfortify2-tests-gcc",
+ "libfortify1-tests-clang",
+ "libfortify2-tests-clang",
+ ],
+}
+
+// -----------------------------------------------------------------------------
+// Library of bionic customized gtest main function, with simplified output format.
+// -----------------------------------------------------------------------------
+cc_test_library {
+ name: "libBionicGtestMain",
+ defaults: ["bionic_tests_defaults"],
+ srcs: ["gtest_main.cpp"],
+ target: {
+ darwin: {
+ enabled: true,
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+// Library of bionic customized gtest main function, with normal gtest output format,
+// which is needed by bionic cts test.
+// -----------------------------------------------------------------------------
+cc_test_library {
+ name: "libBionicCtsGtestMain",
+ defaults: ["bionic_tests_defaults"],
+ srcs: ["gtest_main.cpp"],
+ cppflags: ["-DUSING_GTEST_OUTPUT_FORMAT"],
+}
+
+// -----------------------------------------------------------------------------
+// Tests for the device using bionic's .so. Run with:
+// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
+// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64
+// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc32
+// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc64
+// -----------------------------------------------------------------------------
+cc_defaults {
+ name: "bionic_unit_tests_defaults",
+ host_supported: false,
+
+ whole_static_libs: [
+ "libBionicTests",
+ "libBionicGtestMain",
+ ],
+
+ static_libs: [
+ "libtinyxml2",
+ "liblog",
+ "libbase",
+ ],
+
+ srcs: [
+ // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
+ "atexit_test.cpp",
+ "dl_test.cpp",
+ "dlext_test.cpp",
+ "__cxa_thread_atexit_test.cpp",
+ "dlfcn_test.cpp",
+ "libdl_test.cpp",
+ "pthread_dlfcn_test.cpp",
+ "thread_local_test.cpp",
+ ],
+
+ conlyflags: [
+ "-fexceptions",
+ "-fnon-call-exceptions",
+ ],
+
+ ldflags: ["-Wl,--export-dynamic"],
+
+ include_dirs: ["bionic/libc"],
+
+ target: {
+ android: {
+ shared_libs: [
+ "libdl",
+ "libpagemap",
+ "libdl_preempt_test_1",
+ "libdl_preempt_test_2",
+ "libdl_test_df_1_global",
+ ],
+ static_libs: [
+ // The order of these libraries matters, do not shuffle them.
+ "libbase",
+ "libziparchive",
+ "libz",
+ "libutils",
+ ],
+ },
+ }
+}
+
+cc_test {
+ name: "bionic-unit-tests",
+ defaults: ["bionic_unit_tests_defaults", "bionic_tests_defaults"],
+ clang: true,
+}
+
+cc_test {
+ name: "bionic-unit-tests-gcc",
+ defaults: ["bionic_unit_tests_defaults", "bionic_tests_defaults"],
+ clang: false,
+}
+
+// -----------------------------------------------------------------------------
+// Tests for the device linked against bionic's static library. Run with:
+// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static32
+// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static64
+// -----------------------------------------------------------------------------
+cc_test {
+ name: "bionic-unit-tests-static",
+ defaults: ["bionic_tests_defaults"],
+ host_supported: false,
+
+ whole_static_libs: [
+ "libBionicTests",
+ "libBionicGtestMain",
+ ],
+
+ static_libs: [
+ "libm",
+ "libc",
+ "libc++_static",
+ "libdl",
+ "libtinyxml2",
+ "liblog",
+ "libbase",
+ ],
+
+ static_executable: true,
+ stl: "libc++_static",
+
+ // libc and libc++ both define std::nothrow. libc's is a private symbol, but this
+ // still causes issues when linking libc.a and libc++.a, since private isn't
+ // effective until it has been linked. To fix this, just allow multiple symbol
+ // definitions for the static tests.
+ ldflags: ["-Wl,--allow-multiple-definition"],
+}
+
+// -----------------------------------------------------------------------------
+// Tests to run on the host and linked against glibc. Run with:
+// cd bionic/tests; mm bionic-unit-tests-glibc-run
+// -----------------------------------------------------------------------------
+
+cc_test_host {
+ name: "bionic-unit-tests-glibc",
+ defaults: ["bionic_tests_defaults"],
+
+ srcs: [
+ "atexit_test.cpp",
+ "dlfcn_test.cpp",
+ "dl_test.cpp",
+ "pthread_dlfcn_test.cpp",
+ ],
+
+ shared_libs: [
+ "libdl_preempt_test_1",
+ "libdl_preempt_test_2",
+
+ "libdl_test_df_1_global",
+ ],
+
+ whole_static_libs: [
+ "libBionicStandardTests",
+ "libBionicGtestMain",
+ "libfortify1-tests-gcc",
+ "libfortify2-tests-gcc",
+ "libfortify1-tests-clang",
+ "libfortify2-tests-clang",
+ ],
+
+ static_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ ],
+
+ host_ldlibs: [
+ "-lresolv",
+ "-lrt",
+ "-ldl",
+ "-lutil",
+ ],
+
+ include_dirs: ["bionic/libc"],
+
+ ldflags: ["-Wl,--export-dynamic"],
+
+ sanitize: {
+ never: false,
+ },
+}
+
+subdirs = ["libs"]
diff --git a/tests/Android.mk b/tests/Android.mk
index b3ff5eb..0da3b88 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -16,426 +16,14 @@
LOCAL_PATH := $(call my-dir)
-# -----------------------------------------------------------------------------
-# Unit tests.
-# -----------------------------------------------------------------------------
-
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
build_host := true
else
build_host := false
endif
-common_additional_dependencies := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# All standard tests.
-# -----------------------------------------------------------------------------
-test_cflags = \
- -fstack-protector-all \
- -g \
- -Wall -Wextra -Wunused \
- -Werror \
- -fno-builtin \
-
-# We want to test deprecated API too.
-test_cflags += \
- -Wno-deprecated-declarations \
-
-test_cflags += -D__STDC_LIMIT_MACROS # For glibc.
-
-test_cppflags := \
-
-libBionicStandardTests_src_files := \
- arpa_inet_test.cpp \
- buffer_tests.cpp \
- bug_26110743_test.cpp \
- complex_test.cpp \
- ctype_test.cpp \
- dirent_test.cpp \
- error_test.cpp \
- eventfd_test.cpp \
- fcntl_test.cpp \
- fenv_test.cpp \
- ftw_test.cpp \
- getauxval_test.cpp \
- getcwd_test.cpp \
- grp_pwd_test.cpp \
- ifaddrs_test.cpp \
- inttypes_test.cpp \
- libc_logging_test.cpp \
- libgen_basename_test.cpp \
- libgen_test.cpp \
- locale_test.cpp \
- malloc_test.cpp \
- math_test.cpp \
- mntent_test.cpp \
- netdb_test.cpp \
- net_if_test.cpp \
- netinet_ether_test.cpp \
- netinet_in_test.cpp \
- netinet_udp_test.cpp \
- nl_types_test.cpp \
- pthread_test.cpp \
- pty_test.cpp \
- regex_test.cpp \
- resolv_test.cpp \
- sched_test.cpp \
- search_test.cpp \
- semaphore_test.cpp \
- setjmp_test.cpp \
- signal_test.cpp \
- stack_protector_test.cpp \
- stack_protector_test_helper.cpp \
- stack_unwinding_test.cpp \
- stdatomic_test.cpp \
- stdint_test.cpp \
- stdio_nofortify_test.cpp \
- stdio_test.cpp \
- stdio_ext_test.cpp \
- stdlib_test.cpp \
- string_nofortify_test.cpp \
- string_test.cpp \
- string_posix_strerror_r_test.cpp \
- strings_nofortify_test.cpp \
- strings_test.cpp \
- sstream_test.cpp \
- sys_epoll_test.cpp \
- sys_mman_test.cpp \
- sys_personality_test.cpp \
- sys_prctl_test.cpp \
- sys_procfs_test.cpp \
- sys_ptrace_test.cpp \
- sys_quota_test.cpp \
- sys_resource_test.cpp \
- sys_select_test.cpp \
- sys_sendfile_test.cpp \
- sys_socket_test.cpp \
- sys_stat_test.cpp \
- sys_statvfs_test.cpp \
- sys_syscall_test.cpp \
- sys_sysinfo_test.cpp \
- sys_sysmacros_test.cpp \
- sys_time_test.cpp \
- sys_timex_test.cpp \
- sys_types_test.cpp \
- sys_uio_test.cpp \
- sys_vfs_test.cpp \
- sys_xattr_test.cpp \
- system_properties_test.cpp \
- time_test.cpp \
- uchar_test.cpp \
- uniqueptr_test.cpp \
- unistd_nofortify_test.cpp \
- unistd_test.cpp \
- utmp_test.cpp \
- wchar_test.cpp \
- wctype_test.cpp \
-
-libBionicStandardTests_cflags := \
- $(test_cflags) \
-
-libBionicStandardTests_cppflags := \
- $(test_cppflags) \
-
-libBionicStandardTests_c_includes := \
- bionic/libc \
- external/tinyxml2 \
-
-libBionicStandardTests_static_libraries := \
- libbase \
-
-libBionicStandardTests_ldlibs_host := \
- -lrt \
-
-module := libBionicStandardTests
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# Fortify tests.
-# -----------------------------------------------------------------------------
-$(foreach compiler,gcc clang, \
- $(foreach test,1 2, \
- $(eval fortify$(test)-tests-$(compiler)_cflags := \
- $(test_cflags) \
- -Wno-error \
- -U_FORTIFY_SOURCE \
- -D_FORTIFY_SOURCE=$(test) \
- -DTEST_NAME=Fortify$(test)_$(compiler)); \
- $(eval fortify$(test)-tests-$(compiler)_src_files := \
- fortify_test_main.cpp); \
- $(eval fortify_libs += fortify$(test)-tests-$(compiler)); \
- ) \
-)
-
-fortify1-tests-gcc_clang_target := false
-module := fortify1-tests-gcc
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-fortify2-tests-gcc_clang_target := false
-module := fortify2-tests-gcc
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-fortify1-tests-clang_clang_target := true
-fortify1-tests-clang_cflags_host := -D__clang__
-
-module := fortify1-tests-clang
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-fortify2-tests-clang_clang_target := true
-
-fortify2-tests-clang_cflags_host := -D__clang__
-
-module := fortify2-tests-clang
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# Library of all tests (excluding the dynamic linker tests).
-# -----------------------------------------------------------------------------
-libBionicTests_whole_static_libraries := \
- libBionicStandardTests \
- $(fortify_libs) \
-
-module := libBionicTests
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# Library of bionic customized gtest main function, with simplified output format.
-# -----------------------------------------------------------------------------
-libBionicGtestMain_src_files := gtest_main.cpp
-
-libBionicGtestMain_cflags := $(test_cflags)
-
-libBionicGtestMain_cppflags := $(test_cppflags)
-
-module := libBionicGtestMain
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-
-ifeq ($(HOST_OS),$(filter $(HOST_OS),linux darwin))
-saved_build_host := $(build_host)
-build_host := true
-include $(LOCAL_PATH)/Android.build.mk
-build_host := $(saved_build_host)
-endif
-
-# -----------------------------------------------------------------------------
-# Library of bionic customized gtest main function, with normal gtest output format,
-# which is needed by bionic cts test.
-# -----------------------------------------------------------------------------
-libBionicCtsGtestMain_src_files := gtest_main.cpp
-
-libBionicCtsGtestMain_cflags := $(test_cflags)
-
-libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT \
-
-module := libBionicCtsGtestMain
-module_tag := optional
-build_type := target
-build_target := STATIC_TEST_LIBRARY
-include $(LOCAL_PATH)/Android.build.mk
-build_type := host
-include $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# Tests for the device using bionic's .so. Run with:
-# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
-# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64
-# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc32
-# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc64
-# -----------------------------------------------------------------------------
-common_bionic-unit-tests_whole_static_libraries := \
- libBionicTests \
- libBionicGtestMain \
-
-common_bionic-unit-tests_static_libraries := \
- libtinyxml2 \
- liblog \
- libbase \
-
-# TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
-common_bionic-unit-tests_src_files := \
- atexit_test.cpp \
- dl_test.cpp \
- dlext_test.cpp \
- __cxa_thread_atexit_test.cpp \
- dlfcn_test.cpp \
- libdl_test.cpp \
- pthread_dlfcn_test.cpp \
- thread_local_test.cpp \
-
-common_bionic-unit-tests_cflags := $(test_cflags)
-
-common_bionic-unit-tests_conlyflags := \
- -fexceptions \
- -fnon-call-exceptions \
-
-common_bionic-unit-tests_cppflags := $(test_cppflags)
-
-common_bionic-unit-tests_ldflags := \
- -Wl,--export-dynamic
-
-common_bionic-unit-tests_c_includes := \
- bionic/libc \
-
-common_bionic-unit-tests_shared_libraries_target := \
- libdl \
- libpagemap \
- libdl_preempt_test_1 \
- libdl_preempt_test_2 \
- libdl_test_df_1_global \
-
-# The order of these libraries matters, do not shuffle them.
-common_bionic-unit-tests_static_libraries_target := \
- libbase \
- libziparchive \
- libz \
- libutils \
-
-module_tag := optional
-build_type := target
-build_target := NATIVE_TEST
-
-module := bionic-unit-tests
-bionic-unit-tests_clang_target := true
-bionic-unit-tests_whole_static_libraries := $(common_bionic-unit-tests_whole_static_libraries)
-bionic-unit-tests_static_libraries := $(common_bionic-unit-tests_static_libraries)
-bionic-unit-tests_src_files := $(common_bionic-unit-tests_src_files)
-bionic-unit-tests_cflags := $(common_bionic-unit-tests_cflags)
-bionic-unit-tests_conlyflags := $(common_bionic-unit-tests_conlyflags)
-bionic-unit-tests_cppflags := $(common_bionic-unit-tests_cppflags)
-bionic-unit-tests_ldflags := $(common_bionic-unit-tests_ldflags)
-bionic-unit-tests_c_includes := $(common_bionic-unit-tests_c_includes)
-bionic-unit-tests_shared_libraries_target := $(common_bionic-unit-tests_shared_libraries_target)
-bionic-unit-tests_static_libraries_target := $(common_bionic-unit-tests_static_libraries_target)
-include $(LOCAL_PATH)/Android.build.mk
-
-module := bionic-unit-tests-gcc
-bionic-unit-tests-gcc_clang_target := false
-bionic-unit-tests-gcc_whole_static_libraries := $(common_bionic-unit-tests_whole_static_libraries)
-bionic-unit-tests-gcc_static_libraries := $(common_bionic-unit-tests_static_libraries)
-bionic-unit-tests-gcc_src_files := $(common_bionic-unit-tests_src_files)
-bionic-unit-tests-gcc_cflags := $(common_bionic-unit-tests_cflags)
-bionic-unit-tests-gcc_conlyflags := $(common_bionic-unit-tests_conlyflags)
-bionic-unit-tests-gcc_cppflags := $(common_bionic-unit-tests_cppflags)
-bionic-unit-tests-gcc_ldflags := $(common_bionic-unit-tests_ldflags)
-bionic-unit-tests-gcc_c_includes := $(common_bionic-unit-tests_c_includes)
-bionic-unit-tests-gcc_shared_libraries_target := $(common_bionic-unit-tests_shared_libraries_target)
-bionic-unit-tests-gcc_static_libraries_target := $(common_bionic-unit-tests_static_libraries_target)
-include $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# Tests for the device linked against bionic's static library. Run with:
-# adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static32
-# adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static64
-# -----------------------------------------------------------------------------
-bionic-unit-tests-static_whole_static_libraries := \
- libBionicTests \
- libBionicGtestMain \
-
-bionic-unit-tests-static_static_libraries := \
- libm \
- libc \
- libc++_static \
- libdl \
- libtinyxml2 \
- liblog \
- libbase \
-
-bionic-unit-tests-static_force_static_executable := true
-
-# libc and libc++ both define std::nothrow. libc's is a private symbol, but this
-# still causes issues when linking libc.a and libc++.a, since private isn't
-# effective until it has been linked. To fix this, just allow multiple symbol
-# definitions for the static tests.
-bionic-unit-tests-static_ldflags := -Wl,--allow-multiple-definition
-
-module := bionic-unit-tests-static
-module_tag := optional
-build_type := target
-build_target := NATIVE_TEST
-include $(LOCAL_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
-# Tests to run on the host and linked against glibc. Run with:
-# cd bionic/tests; mm bionic-unit-tests-glibc-run
-# -----------------------------------------------------------------------------
-
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
-bionic-unit-tests-glibc_src_files := \
- atexit_test.cpp \
- dlfcn_test.cpp \
- dl_test.cpp \
- pthread_dlfcn_test.cpp \
-
-bionic-unit-tests-glibc_shared_libraries := \
- libdl_preempt_test_1 \
- libdl_preempt_test_2
-
-bionic-unit-tests-glibc_shared_libraries += libdl_test_df_1_global
-
-bionic-unit-tests-glibc_whole_static_libraries := \
- libBionicStandardTests \
- libBionicGtestMain \
- $(fortify_libs) \
-
-bionic-unit-tests-glibc_static_libraries := \
- libbase \
- liblog \
- libcutils \
-
-bionic-unit-tests-glibc_ldlibs := \
- -lresolv -lrt -ldl -lutil \
-
-bionic-unit-tests-glibc_c_includes := \
- bionic/libc \
-
-bionic-unit-tests-glibc_cflags := $(test_cflags)
-bionic-unit-tests-glibc_cppflags := $(test_cppflags)
-bionic-unit-tests-glibc_ldflags := -Wl,--export-dynamic
-
-bionic-unit-tests-glibc_allow_asan := true
-
-module := bionic-unit-tests-glibc
-module_tag := optional
-build_type := host
-build_target := NATIVE_TEST
-include $(LOCAL_PATH)/Android.build.mk
-
# -----------------------------------------------------------------------------
# Compile time tests.
# -----------------------------------------------------------------------------
@@ -483,52 +71,6 @@
LOCAL_SRC_FILES :=
include $(BUILD_STATIC_LIBRARY)
-# -----------------------------------------------------------------------------
-# Host glibc tests.
-# -----------------------------------------------------------------------------
-
-# gtest needs ANDROID_DATA/local/tmp for death test output.
-# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
-# Use the current target out directory as ANDROID_DATA.
-# BIONIC_TEST_FLAGS is either empty or it comes from the user.
-.PHONY: bionic-unit-tests-glibc-run
-bionic-unit-tests-glibc-run: bionic-unit-tests-glibc
- mkdir -p $(TARGET_OUT_DATA)/local/tmp
- ANDROID_DATA=$(TARGET_OUT_DATA) \
- ANDROID_ROOT=$(TARGET_OUT) \
- $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc64 $(BIONIC_TEST_FLAGS)
-
-# -----------------------------------------------------------------------------
-# Run the unit tests built against x86 bionic on an x86 host.
-# -----------------------------------------------------------------------------
-
-include $(LOCAL_PATH)/../build/run-on-host.mk
-
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
-
-TEST_TIMEOUT := 0
-
-# BIONIC_TEST_FLAGS is either empty or it comes from the user.
-.PHONY: bionic-unit-tests-run-on-host32
-bionic-unit-tests-run-on-host32: bionic-unit-tests bionic-prepare-run-on-host
- ANDROID_DATA=$(TARGET_OUT_DATA) \
- ANDROID_DNS_MODE=local \
- ANDROID_ROOT=$(TARGET_OUT) \
- timeout $(TEST_TIMEOUT) \
- $(TARGET_OUT_DATA)/nativetest/bionic-unit-tests/bionic-unit-tests32 $(BIONIC_TEST_FLAGS)
-
-ifeq ($(TARGET_IS_64_BIT),true)
-# add target to run lp64 tests
-.PHONY: bionic-unit-tests-run-on-host64
-bionic-unit-tests-run-on-host64: bionic-unit-tests bionic-prepare-run-on-host
- ANDROID_DATA=$(TARGET_OUT_DATA) \
- ANDROID_DNS_MODE=local \
- ANDROID_ROOT=$(TARGET_OUT) \
- timeout $(TEST_TIMEOUT) \
- $(TARGET_OUT_DATA)/nativetest64/bionic-unit-tests/bionic-unit-tests64 $(BIONIC_TEST_FLAGS)
-endif
-
-endif # x86 x86_64
endif # linux-x86
include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index a0e83fe..c3230e7 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -628,7 +628,9 @@
ASSERT_FALSE(android_init_namespaces(path.c_str(), nullptr));
ASSERT_STREQ("android_init_namespaces failed: error initializing public namespace: "
- "\"libnstest_public.so\" was not found in the default namespace", dlerror());
+ "a library with soname \"libnstest_public.so\" was not found in the "
+ "default namespace",
+ dlerror());
ASSERT_FALSE(android_init_namespaces("", nullptr));
ASSERT_STREQ("android_init_namespaces failed: error initializing public namespace: "
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 56df1a6..5bf5861 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -38,15 +38,24 @@
}
static int g_ctor_function_called = 0;
+static int g_ctor_argc = 0;
+static char** g_ctor_argv = reinterpret_cast<char**>(0xDEADBEEF);
+static char** g_ctor_envp = g_ctor_envp;
-extern "C" void ctor_function() __attribute__ ((constructor));
+extern "C" void ctor_function(int argc, char** argv, char** envp) __attribute__ ((constructor));
-extern "C" void ctor_function() {
+extern "C" void ctor_function(int argc, char** argv, char** envp) {
g_ctor_function_called = 17;
+ g_ctor_argc = argc;
+ g_ctor_argv = argv;
+ g_ctor_envp = envp;
}
TEST(dlfcn, ctor_function_call) {
ASSERT_EQ(17, g_ctor_function_called);
+ ASSERT_TRUE(g_ctor_argc = get_argc());
+ ASSERT_TRUE(g_ctor_argv = get_argv());
+ ASSERT_TRUE(g_ctor_envp = get_envp());
}
TEST(dlfcn, dlsym_in_executable) {
diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp
index 2b58646..a08a2e1 100644
--- a/tests/gtest_main.cpp
+++ b/tests/gtest_main.cpp
@@ -47,11 +47,26 @@
#endif
static std::string g_executable_path;
+static int g_argc;
+static char** g_argv;
+static char** g_envp;
const std::string& get_executable_path() {
return g_executable_path;
}
+int get_argc() {
+ return g_argc;
+}
+
+char** get_argv() {
+ return g_argv;
+}
+
+char** get_envp() {
+ return g_envp;
+}
+
namespace testing {
namespace internal {
@@ -1122,8 +1137,11 @@
return std::string(path, path_len);
}
-int main(int argc, char** argv) {
+int main(int argc, char** argv, char** envp) {
g_executable_path = get_proc_self_exe();
+ g_argc = argc;
+ g_argv = argv;
+ g_envp = envp;
std::vector<char*> arg_list;
for (int i = 0; i < argc; ++i) {
arg_list.push_back(argv[i]);
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
new file mode 100644
index 0000000..0303138
--- /dev/null
+++ b/tests/libs/Android.bp
@@ -0,0 +1,443 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "bionic_testlib_defaults",
+ host_supported: true,
+ sanitize: {
+ never: true,
+ },
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+// Library to test gnu-styled hash
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libgnu-hash-table-library",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlext_test_library.cpp"],
+ ldflags: ["-Wl,--hash-style=gnu"],
+ arch: {
+ mips: {
+ enabled: false,
+ },
+ mips64: {
+ enabled: false,
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+// Library to test sysv-styled hash
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libsysv-hash-table-library",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlext_test_library.cpp"],
+ ldflags: ["-Wl,--hash-style=sysv"],
+}
+
+// -----------------------------------------------------------------------------
+// Library used by dlext tests - with GNU RELRO program header
+// -----------------------------------------------------------------------------
+// In Android.mk to support creating symlinks
+
+// -----------------------------------------------------------------------------
+// Library used by dlext tests - without GNU RELRO program header
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libdlext_test_norelro",
+ srcs: ["dlext_test_library.cpp"],
+ ldflags: ["-Wl,-z,norelro"],
+ shared_libs = ["libtest_simple"],
+}
+
+// -----------------------------------------------------------------------------
+// Library used by dlext tests - different name non-default location
+// -----------------------------------------------------------------------------
+// In Android.mk to support installing to /data
+
+// -----------------------------------------------------------------------------
+// Libraries used by dlext tests for open from a zip-file
+// -----------------------------------------------------------------------------
+// In Android.mk to support installing to /data
+
+// ----------------------------------------------------------------------------
+// Library with soname which does not match filename
+// ----------------------------------------------------------------------------
+// In Android.mk to support zipped and aligned tests
+
+// -----------------------------------------------------------------------------
+// Library used by dlext tests - zipped and aligned
+// -----------------------------------------------------------------------------
+// In Android.mk to support zipped and aligned tests
+
+// -----------------------------------------------------------------------------
+// Library used by dlfcn tests
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_simple",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_simple.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library used by dlfcn nodelete tests
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_nodelete_1",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_nodelete_1.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library used by dlfcn nodelete tests
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_nodelete_2",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_nodelete_2.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library used by dlfcn nodelete tests
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_nodelete_dt_flags_1",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
+ ldflags: ["-Wl,-z,nodelete"],
+}
+
+// -----------------------------------------------------------------------------
+// Build test helper libraries for linker namespaces
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.linker_namespaces.mk
+
+// -----------------------------------------------------------------------------
+// Build DT_RUNPATH test helper libraries
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
+
+// -----------------------------------------------------------------------------
+// Build library with two parents
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
+
+// -----------------------------------------------------------------------------
+// Build libtest_check_order_dlsym.so with its dependencies.
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
+
+// -----------------------------------------------------------------------------
+// Build libtest_check_order_siblings.so with its dependencies.
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
+
+// -----------------------------------------------------------------------------
+// Build libtest_check_order_root.so with its dependencies.
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
+
+// -----------------------------------------------------------------------------
+// Build libtest_versioned_lib.so with its dependencies.
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
+
+// -----------------------------------------------------------------------------
+// Build libraries needed by pthread_atfork tests
+// -----------------------------------------------------------------------------
+// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
+
+// -----------------------------------------------------------------------------
+// Library with dependency loop used by dlfcn tests
+//
+// libtest_with_dependency_loop -> a -> b -> c -> a
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_with_dependency_loop",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_loopy_root.cpp"],
+ shared_libs: ["libtest_with_dependency_loop_a"],
+}
+
+// -----------------------------------------------------------------------------
+// libtest_with_dependency_loop_a.so
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_with_dependency_loop_a",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_loopy_a.cpp"],
+ shared_libs: ["libtest_with_dependency_loop_b_tmp"],
+}
+
+// -----------------------------------------------------------------------------
+// libtest_with_dependency_loop_b.so
+//
+// this is temporary placeholder - will be removed
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_with_dependency_loop_b_tmp",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_loopy_invalid.cpp"],
+ ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
+}
+
+// -----------------------------------------------------------------------------
+// libtest_with_dependency_loop_b.so
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_with_dependency_loop_b",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_loopy_b.cpp"],
+ shared_libs: ["libtest_with_dependency_loop_c"],
+}
+
+// -----------------------------------------------------------------------------
+// libtest_with_dependency_loop_c.so
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_with_dependency_loop_c",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_loopy_c.cpp"],
+ shared_libs: ["libtest_with_dependency_loop_a"],
+}
+
+// -----------------------------------------------------------------------------
+// libtest_relo_check_dt_needed_order.so
+// |
+// +-> libtest_relo_check_dt_needed_order_1.so
+// |
+// +-> libtest_relo_check_dt_needed_order_2.so
+// -----------------------------------------------------------------------------
+
+
+cc_library {
+ name: "libtest_relo_check_dt_needed_order",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
+ shared_libs: [
+ "libtest_relo_check_dt_needed_order_1",
+ "libtest_relo_check_dt_needed_order_2",
+ ],
+}
+
+cc_library {
+ name: "libtest_relo_check_dt_needed_order_1",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
+}
+
+cc_library {
+ name: "libtest_relo_check_dt_needed_order_2",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library with dependency used by dlfcn tests
+// -----------------------------------------------------------------------------
+// In Android.mk to support dependency on libdlext_test
+
+// -----------------------------------------------------------------------------
+// Library used by ifunc tests
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_ifunc",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_ifunc.c"],
+
+ // TODO(dimitry): clang does not support ifunc attribute
+ clang: false,
+ arch: {
+ mips: {
+ enabled: false,
+ },
+ mips64: {
+ enabled: false,
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+// Library used by atexit tests
+// -----------------------------------------------------------------------------
+
+cc_library {
+ name: "libtest_atexit",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["atexit_testlib.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// This library is used by dl_load test to check symbol preempting
+// by main executable
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libdl_preempt_test_1",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dl_preempt_library_1.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// This library is used by dl_load test to check symbol preempting
+// by libdl_preempt_test_1.so
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libdl_preempt_test_2",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dl_preempt_library_2.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library with DF_1_GLOBAL
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libdl_test_df_1_global",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dl_df_1_global.cpp"],
+ ldflags: ["-Wl,-z,global"],
+
+ target: {
+ host: {
+ // TODO (dimitry): host ld.gold does not yet support -z global
+ // remove this line once it is updated.
+ ldflags: ["-fuse-ld=bfd"],
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+// Library using symbol from libdl_test_df_1_global
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlsym_df_1_global",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dl_df_1_use_global.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library with weak function
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlsym_weak_func",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlsym_weak_function.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library to check RTLD_LOCAL with dlsym in 'this'
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlsym_from_this",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlsym_from_this_symbol.cpp"],
+ shared_libs: ["libtest_dlsym_from_this_child"],
+
+ target: {
+ android: {
+ shared_libs: ["libdl"],
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlsym_from_this_child",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlsym_from_this_functions.cpp"],
+ shared_libs: ["libtest_dlsym_from_this_grandchild"],
+}
+
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlsym_from_this_grandchild",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlsym_from_this_symbol2.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Empty library
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_empty",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["empty.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library with weak undefined function
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlopen_weak_undefined_func",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_weak_undefined.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library with constructor that calls dlopen() b/7941716
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlopen_from_ctor",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
+ target: {
+ android: {
+ shared_libs: ["libdl"],
+ },
+ },
+}
+
+// -----------------------------------------------------------------------------
+// Library that depends on the library with constructor that calls dlopen() b/7941716
+// -----------------------------------------------------------------------------
+cc_library {
+ name: "libtest_dlopen_from_ctor_main",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["empty.cpp"],
+ shared_libs: ["libtest_dlopen_from_ctor"],
+}
+
+// -----------------------------------------------------------------------------
+// Tool to use to align the shared libraries in a zip file.
+// -----------------------------------------------------------------------------
+cc_binary_host {
+ name: "bionic_tests_zipalign",
+ srcs: ["bionic_tests_zipalign.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ static_libs: [
+ "libziparchive",
+ "liblog",
+ "libbase",
+ "libz",
+ "libutils",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
diff --git a/tests/libs/Android.mk b/tests/libs/Android.mk
index 82bfc05..aa70b86 100644
--- a/tests/libs/Android.mk
+++ b/tests/libs/Android.mk
@@ -33,34 +33,6 @@
$(TEST_PATH)/Android.build.mk
# -----------------------------------------------------------------------------
-# Library to test gnu-styled hash
-# -----------------------------------------------------------------------------
-ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
-libgnu-hash-table-library_src_files := \
- dlext_test_library.cpp \
-
-libgnu-hash-table-library_ldflags := \
- -Wl,--hash-style=gnu \
-
-module := libgnu-hash-table-library
-module_tag := optional
-include $(LOCAL_PATH)/Android.build.testlib.mk
-endif
-
-# -----------------------------------------------------------------------------
-# Library to test sysv-styled hash
-# -----------------------------------------------------------------------------
-libsysv-hash-table-library_src_files := \
- dlext_test_library.cpp \
-
-libsysv-hash-table-library_ldflags := \
- -Wl,--hash-style=sysv \
-
-module := libsysv-hash-table-library
-module_tag := optional
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
# Library used by dlext tests - with GNU RELRO program header
# -----------------------------------------------------------------------------
libdlext_test_src_files := \
@@ -96,23 +68,6 @@
$(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
# -----------------------------------------------------------------------------
-# Library used by dlext tests - without GNU RELRO program header
-# -----------------------------------------------------------------------------
-libdlext_test_norelro_src_files := \
- dlext_test_library.cpp \
-
-libdlext_test_norelro_ldflags := \
- -Wl,-z,norelro \
-
-libdlext_test_norelro_shared_libraries := libtest_simple
-
-module := libdlext_test_norelro
-module_tag := optional
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
# Library used by dlext tests - different name non-default location
# -----------------------------------------------------------------------------
libdlext_test_fd_src_files := \
@@ -176,44 +131,6 @@
endif
# -----------------------------------------------------------------------------
-# Library used by dlfcn tests
-# -----------------------------------------------------------------------------
-libtest_simple_src_files := \
- dlopen_testlib_simple.cpp
-
-module := libtest_simple
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library used by dlfcn nodelete tests
-# -----------------------------------------------------------------------------
-libtest_nodelete_1_src_files := \
- dlopen_nodelete_1.cpp
-
-module := libtest_nodelete_1
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library used by dlfcn nodelete tests
-# -----------------------------------------------------------------------------
-libtest_nodelete_2_src_files := \
- dlopen_nodelete_2.cpp
-
-module := libtest_nodelete_2
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library used by dlfcn nodelete tests
-# -----------------------------------------------------------------------------
-libtest_nodelete_dt_flags_1_src_files := \
- dlopen_nodelete_dt_flags_1.cpp
-
-libtest_nodelete_dt_flags_1_ldflags := -Wl,-z,nodelete
-
-module := libtest_nodelete_dt_flags_1
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
# Build test helper libraries for linker namespaces
# -----------------------------------------------------------------------------
include $(LOCAL_PATH)/Android.build.linker_namespaces.mk
@@ -254,82 +171,6 @@
include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
# -----------------------------------------------------------------------------
-# Library with dependency loop used by dlfcn tests
-#
-# libtest_with_dependency_loop -> a -> b -> c -> a
-# -----------------------------------------------------------------------------
-libtest_with_dependency_loop_src_files := dlopen_testlib_loopy_root.cpp
-
-libtest_with_dependency_loop_shared_libraries := \
- libtest_with_dependency_loop_a
-
-module := libtest_with_dependency_loop
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# libtest_with_dependency_loop_a.so
-# -----------------------------------------------------------------------------
-libtest_with_dependency_loop_a_src_files := dlopen_testlib_loopy_a.cpp
-
-libtest_with_dependency_loop_a_shared_libraries := \
- libtest_with_dependency_loop_b_tmp
-
-module := libtest_with_dependency_loop_a
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# libtest_with_dependency_loop_b.so
-#
-# this is temporary placeholder - will be removed
-# -----------------------------------------------------------------------------
-libtest_with_dependency_loop_b_tmp_src_files := dlopen_testlib_loopy_invalid.cpp
-libtest_with_dependency_loop_b_tmp_ldflags := -Wl,-soname=libtest_with_dependency_loop_b.so
-
-module := libtest_with_dependency_loop_b_tmp
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# libtest_with_dependency_loop_b.so
-# -----------------------------------------------------------------------------
-libtest_with_dependency_loop_b_src_files := dlopen_testlib_loopy_b.cpp
-libtest_with_dependency_loop_b_shared_libraries := libtest_with_dependency_loop_c
-
-module := libtest_with_dependency_loop_b
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# libtest_with_dependency_loop_c.so
-# -----------------------------------------------------------------------------
-libtest_with_dependency_loop_c_src_files := dlopen_testlib_loopy_c.cpp
-
-libtest_with_dependency_loop_c_shared_libraries := \
- libtest_with_dependency_loop_a
-
-module := libtest_with_dependency_loop_c
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# libtest_relo_check_dt_needed_order.so
-# |
-# +-> libtest_relo_check_dt_needed_order_1.so
-# |
-# +-> libtest_relo_check_dt_needed_order_2.so
-# -----------------------------------------------------------------------------
-libtest_relo_check_dt_needed_order_shared_libraries := \
- libtest_relo_check_dt_needed_order_1 libtest_relo_check_dt_needed_order_2
-
-libtest_relo_check_dt_needed_order_src_files := dlopen_testlib_relo_check_dt_needed_order.cpp
-libtest_relo_check_dt_needed_order_1_src_files := dlopen_testlib_relo_check_dt_needed_order_1.cpp
-libtest_relo_check_dt_needed_order_2_src_files := dlopen_testlib_relo_check_dt_needed_order_2.cpp
-
-module := libtest_relo_check_dt_needed_order
-include $(LOCAL_PATH)/Android.build.testlib.mk
-module := libtest_relo_check_dt_needed_order_1
-include $(LOCAL_PATH)/Android.build.testlib.mk
-module := libtest_relo_check_dt_needed_order_2
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
# Library with dependency used by dlfcn tests
# -----------------------------------------------------------------------------
libtest_with_dependency_src_files := \
@@ -339,161 +180,3 @@
module := libtest_with_dependency
include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library used by ifunc tests
-# -----------------------------------------------------------------------------
-libtest_ifunc_src_files := \
- dlopen_testlib_ifunc.c
-
-# TODO(dimitry): clang does not support ifunc attribute
-libtest_ifunc_clang_host := false
-
-module := libtest_ifunc
-build_target := SHARED_LIBRARY
-
-build_type := host
-include $(TEST_PATH)/Android.build.mk
-
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm arm64 x86 x86_64))
- build_type := target
- libtest_ifunc_clang_target := false
- include $(TEST_PATH)/Android.build.mk
-endif
-
-
-# -----------------------------------------------------------------------------
-# Library used by atexit tests
-# -----------------------------------------------------------------------------
-
-libtest_atexit_src_files := \
- atexit_testlib.cpp
-
-module := libtest_atexit
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# This library is used by dl_load test to check symbol preempting
-# by main executable
-# -----------------------------------------------------------------------------
-libdl_preempt_test_1_src_files := dl_preempt_library_1.cpp
-
-module := libdl_preempt_test_1
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# This library is used by dl_load test to check symbol preempting
-# by libdl_preempt_test_1.so
-# -----------------------------------------------------------------------------
-libdl_preempt_test_2_src_files := dl_preempt_library_2.cpp
-
-module := libdl_preempt_test_2
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library with DF_1_GLOBAL
-# -----------------------------------------------------------------------------
-libdl_test_df_1_global_src_files := dl_df_1_global.cpp
-libdl_test_df_1_global_ldflags := -Wl,-z,global
-
-# TODO (dimitry): host ld.gold does not yet support -z global
-# remove this line once it is updated.
-libdl_test_df_1_global_ldflags_host := -fuse-ld=bfd
-
-module := libdl_test_df_1_global
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library using symbol from libdl_test_df_1_global
-# -----------------------------------------------------------------------------
-libtest_dlsym_df_1_global_src_files := dl_df_1_use_global.cpp
-module := libtest_dlsym_df_1_global
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library with weak function
-# -----------------------------------------------------------------------------
-libtest_dlsym_weak_func_src_files := \
- dlsym_weak_function.cpp
-
-module := libtest_dlsym_weak_func
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library to check RTLD_LOCAL with dlsym in 'this'
-# -----------------------------------------------------------------------------
-libtest_dlsym_from_this_src_files := dlsym_from_this_symbol.cpp
-
-libtest_dlsym_from_this_shared_libraries_target := libdl
-libtest_dlsym_from_this_shared_libraries := libtest_dlsym_from_this_child
-
-module := libtest_dlsym_from_this
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-libtest_dlsym_from_this_child_src_files := dlsym_from_this_functions.cpp
-
-libtest_dlsym_from_this_child_shared_libraries := libtest_dlsym_from_this_grandchild
-
-module := libtest_dlsym_from_this_child
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-libtest_dlsym_from_this_grandchild_src_files := dlsym_from_this_symbol2.cpp
-
-module := libtest_dlsym_from_this_grandchild
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Empty library
-# -----------------------------------------------------------------------------
-libtest_empty_src_files := empty.cpp
-
-module := libtest_empty
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library with weak undefined function
-# -----------------------------------------------------------------------------
-libtest_dlopen_weak_undefined_func_src_files := \
- dlopen_weak_undefined.cpp
-
-module := libtest_dlopen_weak_undefined_func
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library with constructor that calls dlopen() b/7941716
-# -----------------------------------------------------------------------------
-libtest_dlopen_from_ctor_src_files := \
- dlopen_testlib_dlopen_from_ctor.cpp
-
-module := libtest_dlopen_from_ctor
-
-libtest_dlopen_from_ctor_shared_libraries_target := libdl
-
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Library that depends on the library with constructor that calls dlopen() b/7941716
-# -----------------------------------------------------------------------------
-
-libtest_dlopen_from_ctor_main_src_files := empty.cpp
-libtest_dlopen_from_ctor_main_shared_libraries := libtest_dlopen_from_ctor
-
-module := libtest_dlopen_from_ctor_main
-include $(LOCAL_PATH)/Android.build.testlib.mk
-
-# -----------------------------------------------------------------------------
-# Tool to use to align the shared libraries in a zip file.
-# -----------------------------------------------------------------------------
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := bionic_tests_zipalign.cpp
-LOCAL_MODULE := bionic_tests_zipalign
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_STATIC_LIBRARIES := libziparchive-host liblog libbase libz libutils
-
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tests/run-on-host.sh b/tests/run-on-host.sh
new file mode 100755
index 0000000..c47bc4f
--- /dev/null
+++ b/tests/run-on-host.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -e
+
+. $(dirname $0)/../build/run-on-host.sh
+
+if [ "$1" = glibc ]; then
+ m -j bionic-unit-tests-glibc
+ (
+ cd ${ANDROID_BUILD_TOP}
+ export ANDROID_DATA=${TARGET_OUT_DATA}
+ export ANDROID_ROOT=${TARGET_OUT}
+ ${HOST_OUT}/nativetest64/bionic-unit-tests-glibc/bionic-unit-tests-glibc $@
+ )
+ exit 0
+elif [ "$1" != 32 -a "$1" != 64 ]; then
+ echo "Usage: $0 [ 32 | 64 | glibc ] [gtest flags]"
+ exit 1
+fi
+
+if [ ${HOST_OS}-${HOST_ARCH} = linux-x86 -o ${HOST_OS}-${HOST_ARCH} = linux-x86_64 ]; then
+
+ prepare $1 bionic-unit-tests
+
+ if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then
+ (
+ cd ${ANDROID_BUILD_TOP}
+ export ANDROID_DATA=${TARGET_OUT_DATA}
+ export ANDROID_DNS_MODE=local
+ export ANDROID_ROOT=${TARGET_OUT}
+ ${NATIVETEST}/bionic-unit-tests/bionic-unit-tests $@
+ )
+ else
+ echo "$0 not supported on TARGET_ARCH=$TARGET_ARCH"
+ fi
+fi
diff --git a/tests/sys_mman_test.cpp b/tests/sys_mman_test.cpp
index ddb6c77..62401a6 100644
--- a/tests/sys_mman_test.cpp
+++ b/tests/sys_mman_test.cpp
@@ -221,14 +221,21 @@
ASSERT_EQ(MAP_FAILED, mremap(nullptr, 0, 0, 0));
}
-const size_t huge = size_t(PTRDIFF_MAX) + 1;
+constexpr size_t kHuge = size_t(PTRDIFF_MAX) + 1;
TEST(sys_mman, mmap_PTRDIFF_MAX) {
- ASSERT_EQ(MAP_FAILED, mmap(nullptr, huge, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
+ ASSERT_EQ(MAP_FAILED, mmap(nullptr, kHuge, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
}
TEST(sys_mman, mremap_PTRDIFF_MAX) {
void* map = mmap(nullptr, PAGE_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
ASSERT_NE(MAP_FAILED, map);
- ASSERT_EQ(MAP_FAILED, mremap(map, PAGE_SIZE, huge, MREMAP_MAYMOVE));
+ ASSERT_EQ(MAP_FAILED, mremap(map, PAGE_SIZE, kHuge, MREMAP_MAYMOVE));
+}
+
+TEST(sys_mman, mmap_bug_27265969) {
+ char* base = reinterpret_cast<char*>(mmap(nullptr, PAGE_SIZE * 2, PROT_EXEC | PROT_READ,
+ MAP_ANONYMOUS | MAP_PRIVATE, 0, 0));
+ // Some kernels had bugs that would cause segfaults here...
+ __builtin___clear_cache(base, base + (PAGE_SIZE * 2));
}
diff --git a/tests/sys_syscall_test.cpp b/tests/sys_syscall_test.cpp
index 9c5e350..68a7167 100644
--- a/tests/sys_syscall_test.cpp
+++ b/tests/sys_syscall_test.cpp
@@ -21,3 +21,10 @@
TEST(unistd, syscall) {
ASSERT_EQ(getpid(), syscall(SYS_getpid));
}
+
+// https://code.google.com/p/android/issues/detail?id=215853
+#if defined(__LP64__)
+ #if defined(SYS_mmap2)
+ #error SYS_mmap2 should not be defined for LP64
+ #endif
+#endif
diff --git a/tests/utils.h b/tests/utils.h
index f8e0039..08e8cea 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -122,4 +122,9 @@
// The absolute path to the executable
const std::string& get_executable_path();
+// Access to argc/argv/envp
+int get_argc();
+char** get_argv();
+char** get_envp();
+
#endif
diff --git a/tools/Android.bp b/tools/Android.bp
new file mode 100644
index 0000000..b44c296
--- /dev/null
+++ b/tools/Android.bp
@@ -0,0 +1 @@
+subdirs = ["*"]
diff --git a/tools/relocation_packer/Android.bp b/tools/relocation_packer/Android.bp
new file mode 100644
index 0000000..2907b31
--- /dev/null
+++ b/tools/relocation_packer/Android.bp
@@ -0,0 +1,84 @@
+//
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "relocation_packer_flags",
+ cppflags: [
+ "-Wall",
+ "-Wextra",
+ "-Wunused",
+ "-Werror",
+ "-Wold-style-cast",
+ ],
+
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_library_host_static {
+ name: "lib_relocation_packer",
+ defaults: ["relocation_packer_flags"],
+ srcs: [
+ "src/debug.cc",
+ "src/delta_encoder.cc",
+ "src/elf_file.cc",
+ "src/packer.cc",
+ "src/sleb128.cc",
+ ],
+
+ static_libs: [
+ "libelf",
+ "libz",
+ ],
+}
+
+cc_binary_host {
+ name: "relocation_packer",
+ defaults: ["relocation_packer_flags"],
+
+ srcs: ["src/main.cc"],
+ static_libs: [
+ "lib_relocation_packer",
+ "libelf",
+ "libz",
+ "libbase",
+ ],
+
+ // Statically linking libc++ to make it work from prebuilts
+ stl: "libc++_static",
+}
+
+cc_test_host {
+ name: "relocation_packer_unit_tests",
+ defaults: ["relocation_packer_flags"],
+
+ srcs: [
+ "src/debug_unittest.cc",
+ "src/delta_encoder_unittest.cc",
+ "src/elf_file_unittest.cc",
+ "src/sleb128_unittest.cc",
+ "src/packer_unittest.cc",
+ ],
+
+ static_libs: [
+ "lib_relocation_packer",
+ "libelf",
+ "libz",
+ ],
+}
diff --git a/tools/relocation_packer/Android.mk b/tools/relocation_packer/Android.mk
index bdb54b7..9905657 100644
--- a/tools/relocation_packer/Android.mk
+++ b/tools/relocation_packer/Android.mk
@@ -14,64 +14,9 @@
# limitations under the License.
#
-ifeq ($(HOST_OS),linux)
-common_cppflags := -Wall -Wextra -Wunused -Werror -Wold-style-cast
-
LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_CPP_EXTENSION := .cc
-
-LOCAL_SRC_FILES := \
- src/debug.cc \
- src/delta_encoder.cc \
- src/elf_file.cc \
- src/packer.cc \
- src/sleb128.cc \
-
-LOCAL_STATIC_LIBRARIES := libelf libz
-LOCAL_MODULE := lib_relocation_packer
-
-LOCAL_CPPFLAGS := $(common_cppflags)
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_CPP_EXTENSION := .cc
-
-LOCAL_SRC_FILES := src/main.cc
-LOCAL_STATIC_LIBRARIES := lib_relocation_packer libelf libz libbase
-
-# Statically linking libc++ to make it work from prebuilts
-LOCAL_CXX_STL := libc++_static
-
-LOCAL_MODULE := relocation_packer
-
-LOCAL_CPPFLAGS := $(common_cppflags)
-
-include $(BUILD_HOST_EXECUTABLE)
-
-include $(CLEAR_VARS)
-
-LOCAL_CPP_EXTENSION := .cc
-
-LOCAL_SRC_FILES := \
- src/debug_unittest.cc \
- src/delta_encoder_unittest.cc \
- src/elf_file_unittest.cc \
- src/sleb128_unittest.cc \
- src/packer_unittest.cc \
-
-LOCAL_STATIC_LIBRARIES := lib_relocation_packer libelf libz
-
-LOCAL_CPPFLAGS := $(common_cppflags)
-
-LOCAL_MODULE := relocation_packer_unit_tests
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-include $(BUILD_HOST_NATIVE_TEST)
+ifeq ($(HOST_OS),linux)
# $(1) library name
define copy-test-library