DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master
Bug: 142003500
Change-Id: Ie49d42cdad6ddee79669ad23a2b35e0436a9aba2
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp
index 70f7bab..a7be965 100644
--- a/benchmarks/Android.bp
+++ b/benchmarks/Android.bp
@@ -29,6 +29,7 @@
"bionic_benchmarks.cpp",
"atomic_benchmark.cpp",
"ctype_benchmark.cpp",
+ "dlfcn_benchmark.cpp",
"get_heap_size_benchmark.cpp",
"inttypes_benchmark.cpp",
"malloc_benchmark.cpp",
diff --git a/benchmarks/ctype_benchmark.cpp b/benchmarks/ctype_benchmark.cpp
index 3c7f48d..eab0133 100644
--- a/benchmarks/ctype_benchmark.cpp
+++ b/benchmarks/ctype_benchmark.cpp
@@ -19,6 +19,63 @@
#include <benchmark/benchmark.h>
#include "util.h"
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_y1, isalnum('A'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_y2, isalnum('a'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_y3, isalnum('0'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalnum_n, isalnum('_'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalpha_y1, isalpha('A'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalpha_y2, isalpha('a'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isalpha_n, isalpha('_'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isascii_y, isascii('x'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isascii_n, isascii(0x88));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isblank_y1, isblank(' '));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isblank_y2, isblank('\t'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isblank_n, isblank('_'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_iscntrl_y1, iscntrl('\b'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_iscntrl_y2, iscntrl('\x7f'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_iscntrl_n, iscntrl('_'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isdigit_y, iscntrl('0'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isdigit_n, iscntrl('_'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y1, isgraph('A'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y2, isgraph('a'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y3, isgraph('0'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_y4, isgraph('_'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isgraph_n, isgraph(' '));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_islower_y, islower('x'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_islower_n, islower('X'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y1, isprint('A'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y2, isprint('a'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y3, isprint('0'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y4, isprint('_'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_y5, isprint(' '));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isprint_n, isprint('\b'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_ispunct_y, ispunct('_'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_ispunct_n, ispunct('A'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isspace_y1, isspace(' '));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isspace_y2, isspace('\t'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isspace_n, isspace('A'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isupper_y, isupper('X'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isupper_n, isupper('x'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_y1, isxdigit('0'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_y2, isxdigit('a'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_y3, isxdigit('A'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_isxdigit_n, isxdigit('_'));
+
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_toascii_y, isascii('x'));
+BIONIC_TRIVIAL_BENCHMARK(BM_ctype_toascii_n, isascii(0x88));
+
BIONIC_TRIVIAL_BENCHMARK(BM_ctype_tolower_y, tolower('X'));
BIONIC_TRIVIAL_BENCHMARK(BM_ctype_tolower_n, tolower('x'));
diff --git a/benchmarks/dlfcn_benchmark.cpp b/benchmarks/dlfcn_benchmark.cpp
new file mode 100644
index 0000000..6a2bb57
--- /dev/null
+++ b/benchmarks/dlfcn_benchmark.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 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 <android-base/strings.h>
+#include <benchmark/benchmark.h>
+#include <dlfcn.h>
+
+#include "util.h"
+
+void local_function() {}
+
+template<typename F>
+int bm_dladdr(F fun) {
+ const void* addr = reinterpret_cast<void*>(fun);
+ Dl_info info;
+ int res = dladdr(addr, &info);
+ if (res == 0) abort();
+ if (info.dli_fname == nullptr) abort();
+
+ // needed for DoNotOptimize
+ return res;
+}
+BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_libc_printf, bm_dladdr(printf));
+BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_libdl_dladdr, bm_dladdr(dladdr));
+BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_local_function, bm_dladdr(local_function));
+BIONIC_TRIVIAL_BENCHMARK(BM_dladdr_libbase_split, bm_dladdr(android::base::Split));
diff --git a/docs/defines.md b/docs/defines.md
new file mode 100644
index 0000000..4775cd2
--- /dev/null
+++ b/docs/defines.md
@@ -0,0 +1,66 @@
+# When to use which `#define`
+
+Using `#ifdef` or equivalents is common when writing portable code. Which to use
+when can be quite tricky. This document describes the most common choices
+related to Android.
+
+## `__BIONIC__`
+
+If your code is specific to Android's C library, bionic, use `__BIONIC__`. This
+is typically a good choice when you use libc API that's only in bionic, such as
+the system property functions. Common alternatives on this dimension are
+`__GLIBC__`, `__APPLE__`, or `_WIN32`. Note that although bionic is most often
+seen on Android devices, it is possible to use bionic on the host too.
+
+## `__ANDROID__`
+
+If your code is specific to Android devices, use `__ANDROID__`. This isn't
+useful as you might think, and one of the other choices on this page is usually
+more appropriate. This is typically a good choice if you have code that's part
+of the OS and needs to behave differently on the host than on the device.
+Genuine cases are quite rare, and `__BIONIC__` is often more specific (but
+remember that it is possible -- if unusual -- to use bionic on the host).
+
+## `__ANDROID_API__`
+
+If your code can be built targeting a variety of different OS versions, use
+`__ANDROID_API__` to test which version you're building against. This is
+typically useful if you can use new NDK APIs when available, but don't require
+them if not.
+
+One thing to note (if your code may also be built as part of the OS itself) is
+that for most of the year, the OS builds with this set to 10,000 rather than the
+obvious "next" API level such as 19. Once the API level has been decided, the
+value of `__ANDROID_API__` drops to that number.
+
+## `__linux__`
+
+If your code requires a Linux kernel, use `__linux__`. This is typically a good
+choice when you use Linux-specific API, such as a Linux-specific system call or
+a file in `/proc`, but aren't restricted to just Android and would work equally
+well on a desktop Linux distro, say. Common alternatives on this dimension
+are `__APPLE__` or `_WIN32`.
+
+## `__ANDROID_NDK__`
+
+If your code can be built either as part of an app _or_ as part of the OS
+itself, use `__ANDROID_NDK__` to differentiate between those two circumstances.
+This is typically a good choice when your code uses non-NDK API if it's built as
+part of the OS, but sticks to just the NDK APIs otherwise.
+
+## `__NDK_MAJOR__`, `__NDK_MINOR__`, `__NDK_BETA__`, `__NDK_BUILD__`, `__NDK_CANARY__`
+
+If your code can be built with a variety of different NDK versions, and needs to
+work around issues with some of them, use these macros to detect the versinon of
+the NDK you're being built with. Usually only `__NDK_MAJOR__` will be necessary.
+
+## `__arm__`, `__aarch64__`, `__i386__`, `__x86_64__`
+
+If your code is specific to a particular processor architecture, use these
+macros to conditionally compile. Note that the ABI usually called `arm64` uses
+the macro `__aarch64__` and the ABI usually called `x86` uses `__i386__`.
+
+## `__LP32__` and `__LP64__`
+
+If your code depends on "bitness" -- whether `long` and pointers are 32- or
+64-bit -- use these macros to conditionally compile.
diff --git a/docs/native_allocator.md b/docs/native_allocator.md
index 82a98fe..adfa6ef 100644
--- a/docs/native_allocator.md
+++ b/docs/native_allocator.md
@@ -100,6 +100,19 @@
The allocation tests are not meant to be complete, so it is expected
that a native allocator will have its own set of tests that can be run.
+### Libmemunreachable Tests
+The libmemunreachable tests verify that the iterator functions are working
+properly.
+
+To run all of the tests:
+
+ adb shell /data/nativetest64/memunreachable_binder_test/memunreachable_binder_test
+ adb shell /data/nativetest/memunreachable_binder_test/memunreachable_binder_test
+ adb shell /data/nativetest64/memunreachable_test/memunreachable_test
+ adb shell /data/nativetest/memunreachable_test/memunreachable_test
+ adb shell /data/nativetest64/memunreachable_unit_test/memunreachable_unit_test
+ adb shell /data/nativetest/memunreachable_unit_test/memunreachable_unit_test
+
### CTS Entropy Test
In addition to the bionic tests, there is also a CTS test that is designed
to verify that the addresses returned by malloc are sufficiently randomized
@@ -263,21 +276,22 @@
To generate these traces, see the [Malloc Debug documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md),
the option [record\_allocs](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md#record_allocs_total_entries).
-To run these benchmarks, first copy the trace files to the target and
-unzip them using these commands:
+To run these benchmarks, first copy the trace files to the target using
+these commands:
adb shell push system/extras/traces /data/local/tmp
- adb shell 'cd /data/local/tmp/traces && for name in *.zip; do unzip $name; done'
Since all of the traces come from applications, the `memory_replay` program
will always call `mallopt(M_DECAY_TIME, 1)' before running the trace.
Run the benchmark thusly:
- adb shell memory_replay64 /data/local/tmp/traces/XXX.txt
- adb shell memory_replay32 /data/local/tmp/traces/XXX.txt
+ adb shell memory_replay64 /data/local/tmp/traces/XXX.zip
+ adb shell memory_replay32 /data/local/tmp/traces/XXX.zip
-Where XXX.txt is the name of a trace file.
+Where XXX.zip is the name of a zipped trace file. The `memory_replay`
+program also can process text files, but all trace files are currently
+checked in as zip files.
Every 100000 allocation operations, a dump of the RSS and VA space will be
performed. At the end, a final RSS and VA space number will be printed.
diff --git a/libc/Android.bp b/libc/Android.bp
index 5f82b13..e30abb7 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -271,8 +271,6 @@
defaults: ["libc_defaults"],
srcs: [
"upstream-freebsd/lib/libc/gen/ldexp.c",
- "upstream-freebsd/lib/libc/gen/sleep.c",
- "upstream-freebsd/lib/libc/gen/usleep.c",
"upstream-freebsd/lib/libc/stdlib/getopt_long.c",
"upstream-freebsd/lib/libc/stdlib/hcreate.c",
"upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
@@ -438,7 +436,6 @@
"upstream-openbsd/lib/libc/gen/fnmatch.c",
"upstream-openbsd/lib/libc/gen/ftok.c",
"upstream-openbsd/lib/libc/gen/getprogname.c",
- "upstream-openbsd/lib/libc/gen/isctype.c",
"upstream-openbsd/lib/libc/gen/setprogname.c",
"upstream-openbsd/lib/libc/gen/verr.c",
"upstream-openbsd/lib/libc/gen/verrx.c",
@@ -857,20 +854,28 @@
},
arm64: {
srcs: [
- "arch-arm64/generic/bionic/memchr.S",
"arch-arm64/generic/bionic/memcmp.S",
"arch-arm64/generic/bionic/memcpy.S",
"arch-arm64/generic/bionic/memmove.S",
"arch-arm64/generic/bionic/memset.S",
"arch-arm64/generic/bionic/stpcpy.S",
- "arch-arm64/generic/bionic/strchr.S",
- "arch-arm64/generic/bionic/strcmp.S",
"arch-arm64/generic/bionic/strcpy.S",
- "arch-arm64/generic/bionic/strlen.S",
- "arch-arm64/generic/bionic/strncmp.S",
- "arch-arm64/generic/bionic/strnlen.S",
"arch-arm64/generic/bionic/wmemmove.S",
+ "arch-arm64/default/bionic/memchr.S",
+ "arch-arm64/default/bionic/strchr.S",
+ "arch-arm64/default/bionic/strcmp.S",
+ "arch-arm64/default/bionic/strlen.S",
+ "arch-arm64/default/bionic/strncmp.S",
+ "arch-arm64/default/bionic/strnlen.S",
+
+ "arch-arm64/mte/bionic/memchr.c",
+ "arch-arm64/mte/bionic/strchr.cpp",
+ "arch-arm64/mte/bionic/strcmp.c",
+ "arch-arm64/mte/bionic/strlen.c",
+ "arch-arm64/mte/bionic/strncmp.c",
+ "arch-arm64/mte/bionic/strnlen.c",
+
"arch-arm64/bionic/__bionic_clone.S",
"arch-arm64/bionic/_exit_with_stack_teardown.S",
"arch-arm64/bionic/setjmp.S",
@@ -1073,6 +1078,7 @@
"bionic/atof.cpp",
"bionic/bionic_allocator.cpp",
"bionic/bionic_arc4random.cpp",
+ "bionic/bionic_call_ifunc_resolver.cpp",
"bionic/bionic_futex.cpp",
"bionic/bionic_netlink.cpp",
"bionic/bionic_systrace.cpp",
@@ -1179,6 +1185,7 @@
"bionic/sigaction.cpp",
"bionic/signal.cpp",
"bionic/sigprocmask.cpp",
+ "bionic/sleep.cpp",
"bionic/spawn.cpp",
"bionic/stat.cpp",
"bionic/stdlib_l.cpp",
@@ -1213,6 +1220,7 @@
"bionic/tmpfile.cpp",
"bionic/umount.cpp",
"bionic/unlink.cpp",
+ "bionic/usleep.cpp",
"bionic/wait.cpp",
"bionic/wchar.cpp",
"bionic/wchar_l.cpp",
@@ -1494,6 +1502,9 @@
arm: {
srcs: ["arch-arm/static_function_dispatch.S"],
},
+ arm64: {
+ srcs: ["arch-arm64/static_function_dispatch.S"],
+ },
},
whole_static_libs: [
@@ -1519,6 +1530,9 @@
arm: {
srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
},
+ arm64: {
+ srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
+ },
},
whole_static_libs: [
@@ -1526,6 +1540,22 @@
],
}
+// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
+// executable.
+cc_library_static {
+ name: "libc_unwind_static",
+ defaults: ["libc_defaults"],
+ cflags: ["-DLIBC_STATIC"],
+
+ srcs: ["bionic/dl_iterate_phdr_static.cpp"],
+ arch: {
+ // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
+ arm: {
+ srcs: ["arch-arm/bionic/exidx_static.c"],
+ },
+ },
+}
+
// ========================================================
// libc_nomalloc.a
// ========================================================
@@ -1538,20 +1568,13 @@
cc_library_static {
name: "libc_nomalloc",
-
defaults: ["libc_defaults"],
-
- arch: {
- arm: {
- srcs: ["arch-arm/bionic/exidx_static.c"],
- },
- },
-
cflags: ["-DLIBC_STATIC"],
whole_static_libs: [
"libc_common_static",
"libc_init_static",
+ "libc_unwind_static",
],
}
@@ -1573,7 +1596,6 @@
filegroup {
name: "libc_sources_static",
srcs: [
- "bionic/dl_iterate_phdr_static.cpp",
"bionic/malloc_common.cpp",
"bionic/malloc_limit.cpp",
],
@@ -1587,11 +1609,6 @@
],
}
-filegroup {
- name: "libc_sources_static_arm",
- srcs: [ "arch-arm/bionic/exidx_static.c" ],
-}
-
// ========================================================
// libc.a + libc.so
// ========================================================
@@ -1614,6 +1631,7 @@
whole_static_libs: [
"libc_init_static",
"libc_common_static",
+ "libc_unwind_static",
],
},
shared: {
@@ -1663,9 +1681,6 @@
// special for arm
cflags: ["-DCRT_LEGACY_WORKAROUND"],
},
- static: {
- srcs: [":libc_sources_static_arm"],
- },
// Arm 32 bit does not produce complete exidx unwind information
// so keep the .debug_frame which is relatively small and does
@@ -1713,6 +1728,11 @@
versions: ["10000"],
},
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.runtime",
+ ],
+
// Sorting bss symbols by size usually results in less dirty pages at run
// time, because small symbols are grouped together.
sort_bss_symbols_by_size: true,
diff --git a/libc/arch-arm/bionic/exidx_static.c b/libc/arch-arm/bionic/exidx_static.c
index ef3745f..9830c54 100644
--- a/libc/arch-arm/bionic/exidx_static.c
+++ b/libc/arch-arm/bionic/exidx_static.c
@@ -43,7 +43,11 @@
extern struct exidx_entry __exidx_end;
extern struct exidx_entry __exidx_start;
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __attribute__((unused)), int* pcount) {
+_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc __attribute__((unused)), int* pcount) {
*pcount = (&__exidx_end - &__exidx_start);
return (_Unwind_Ptr)&__exidx_start;
}
+
+_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int *pcount) {
+ return dl_unwind_find_exidx(pc, pcount);
+}
diff --git a/libc/arch-arm/dynamic_function_dispatch.cpp b/libc/arch-arm/dynamic_function_dispatch.cpp
index 75000a2..1d2f38f 100644
--- a/libc/arch-arm/dynamic_function_dispatch.cpp
+++ b/libc/arch-arm/dynamic_function_dispatch.cpp
@@ -149,7 +149,7 @@
typedef void* memcpy_func(void*, const void*, size_t);
DEFINE_IFUNC_FOR(memcpy) {
- return memmove_resolver();
+ return memmove_resolver(hwcap);
}
typedef void* __memcpy_func(void*, const void*, size_t);
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index c307bc3..a76e9ca 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -29,7 +29,10 @@
#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
#include <asm/signal.h>
-#include <linux/sched.h>
+
+// Must match the defines in linux/sched.h
+#define CLONE_VM 0x00000100
+#define CLONE_VFORK 0x00004000
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
diff --git a/libc/arch-arm64/generic/bionic/memchr.S b/libc/arch-arm64/default/bionic/memchr.S
similarity index 98%
rename from libc/arch-arm64/generic/bionic/memchr.S
rename to libc/arch-arm64/default/bionic/memchr.S
index 7b7e699..7fbcc8f 100644
--- a/libc/arch-arm64/generic/bionic/memchr.S
+++ b/libc/arch-arm64/default/bionic/memchr.S
@@ -69,7 +69,7 @@
* identify exactly which byte has matched.
*/
-ENTRY(memchr)
+ENTRY(memchr_default)
/*
* Magic constant 0x40100401 allows us to identify which lane matches
* the requested byte.
@@ -161,4 +161,4 @@
.Lzero_length:
mov result, xzr
ret
-END(memchr)
+END(memchr_default)
diff --git a/libc/arch-arm64/generic/bionic/strchr.S b/libc/arch-arm64/default/bionic/strchr.S
similarity index 98%
rename from libc/arch-arm64/generic/bionic/strchr.S
rename to libc/arch-arm64/default/bionic/strchr.S
index 2db0c76..f8cb724 100644
--- a/libc/arch-arm64/generic/bionic/strchr.S
+++ b/libc/arch-arm64/default/bionic/strchr.S
@@ -73,7 +73,7 @@
/* Locals and temporaries. */
-ENTRY(strchr)
+ENTRY(strchr_default)
/* Magic constant 0x40100401 to allow us to identify which lane
matches the requested byte. Magic constant 0x80200802 used
similarly for NUL termination. */
@@ -150,4 +150,4 @@
add result, src, tmp1, lsr #1
csel result, result, xzr, eq
ret
-END(strchr)
+END(strchr_default)
diff --git a/libc/arch-arm64/generic/bionic/strcmp.S b/libc/arch-arm64/default/bionic/strcmp.S
similarity index 99%
rename from libc/arch-arm64/generic/bionic/strcmp.S
rename to libc/arch-arm64/default/bionic/strcmp.S
index fbc215e..dfac7c4 100644
--- a/libc/arch-arm64/generic/bionic/strcmp.S
+++ b/libc/arch-arm64/default/bionic/strcmp.S
@@ -58,7 +58,7 @@
#define pos x11
/* Start of performance-critical section -- one 64B cache line. */
-ENTRY(strcmp)
+ENTRY(strcmp_default)
.p2align 6
eor tmp1, src1, src2
mov zeroones, #REP8_01
@@ -189,4 +189,4 @@
L(done):
sub result, data1, data2
ret
-END(strcmp)
+END(strcmp_default)
diff --git a/libc/arch-arm64/generic/bionic/strlen.S b/libc/arch-arm64/default/bionic/strlen.S
similarity index 99%
rename from libc/arch-arm64/generic/bionic/strlen.S
rename to libc/arch-arm64/default/bionic/strlen.S
index 6e540fc..07c5294 100644
--- a/libc/arch-arm64/generic/bionic/strlen.S
+++ b/libc/arch-arm64/default/bionic/strlen.S
@@ -94,7 +94,7 @@
whether the first fetch, which may be misaligned, crosses a page
boundary. */
-ENTRY(strlen)
+ENTRY(strlen_default)
and tmp1, srcin, MIN_PAGE_SIZE - 1
mov zeroones, REP8_01
cmp tmp1, MIN_PAGE_SIZE - 16
@@ -224,4 +224,4 @@
csel data2, data2, tmp2, eq
b L(page_cross_entry)
-END(strlen)
+END(strlen_default)
diff --git a/libc/arch-arm64/generic/bionic/strncmp.S b/libc/arch-arm64/default/bionic/strncmp.S
similarity index 99%
rename from libc/arch-arm64/generic/bionic/strncmp.S
rename to libc/arch-arm64/default/bionic/strncmp.S
index b81f43a..5432b73 100644
--- a/libc/arch-arm64/generic/bionic/strncmp.S
+++ b/libc/arch-arm64/default/bionic/strncmp.S
@@ -65,7 +65,7 @@
.rep 7
nop /* Pad so that the loop below fits a cache line. */
.endr
-ENTRY(strncmp)
+ENTRY(strncmp_default)
cbz limit, .Lret0
eor tmp1, src1, src2
mov zeroones, #REP8_01
@@ -277,4 +277,4 @@
.Lret0:
mov result, #0
ret
-END(strncmp)
+END(strncmp_default)
diff --git a/libc/arch-arm64/generic/bionic/strnlen.S b/libc/arch-arm64/default/bionic/strnlen.S
similarity index 98%
rename from libc/arch-arm64/generic/bionic/strnlen.S
rename to libc/arch-arm64/default/bionic/strnlen.S
index 0ad446e..1694532 100644
--- a/libc/arch-arm64/generic/bionic/strnlen.S
+++ b/libc/arch-arm64/default/bionic/strnlen.S
@@ -68,7 +68,7 @@
mov len, limit
ret
-ENTRY(strnlen)
+ENTRY(strnlen_default)
cbz limit, .Lhit_limit
mov zeroones, #REP8_01
bic src, srcin, #15
@@ -171,4 +171,4 @@
csinv data1, data1, xzr, le
csel data2, data2, data2a, le
b .Lrealigned
-END(strnlen)
+END(strnlen_default)
diff --git a/libc/arch-arm64/dynamic_function_dispatch.cpp b/libc/arch-arm64/dynamic_function_dispatch.cpp
new file mode 100644
index 0000000..37abea4
--- /dev/null
+++ b/libc/arch-arm64/dynamic_function_dispatch.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2019 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 <platform/bionic/mte_kernel.h>
+#include <private/bionic_ifuncs.h>
+#include <stddef.h>
+#include <sys/auxv.h>
+
+extern "C" {
+
+static bool supports_mte(unsigned long hwcap2) {
+#ifdef ANDROID_EXPERIMENTAL_MTE
+ return hwcap2 & HWCAP2_MTE;
+#else
+ (void)hwcap2;
+ return false;
+#endif
+}
+
+typedef void* memchr_func(const void*, int, size_t);
+DEFINE_IFUNC_FOR(memchr) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(memchr_func, memchr_mte);
+ } else {
+ RETURN_FUNC(memchr_func, memchr_default);
+ }
+}
+
+typedef char* strchr_func(const char*, int);
+DEFINE_IFUNC_FOR(strchr) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strchr_func, strchr_mte);
+ } else {
+ RETURN_FUNC(strchr_func, strchr_default);
+ }
+}
+
+typedef int strcmp_func(const char*, const char*);
+DEFINE_IFUNC_FOR(strcmp) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strcmp_func, strcmp_mte);
+ } else {
+ RETURN_FUNC(strcmp_func, strcmp_default);
+ }
+}
+
+typedef size_t strlen_func(const char*);
+DEFINE_IFUNC_FOR(strlen) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strlen_func, strlen_mte);
+ } else {
+ RETURN_FUNC(strlen_func, strlen_default);
+ }
+}
+
+typedef int strncmp_func(const char*, const char*, int);
+DEFINE_IFUNC_FOR(strncmp) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strncmp_func, strncmp_mte);
+ } else {
+ RETURN_FUNC(strncmp_func, strncmp_default);
+ }
+}
+
+typedef size_t strnlen_func(const char*, int);
+DEFINE_IFUNC_FOR(strnlen) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strnlen_func, strnlen_mte);
+ } else {
+ RETURN_FUNC(strnlen_func, strnlen_default);
+ }
+}
+
+} // extern "C"
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/mte/bionic/memchr.c
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/mte/bionic/memchr.c
index b38ef17..33b2fc2 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/mte/bionic/memchr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,7 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#define memchr memchr_mte
+#include <upstream-openbsd/lib/libc/string/memchr.c>
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/mte/bionic/strchr.cpp
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/mte/bionic/strchr.cpp
index b38ef17..7d394df 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/mte/bionic/strchr.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,5 @@
* SUCH DAMAGE.
*/
-#include <link.h>
-
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#define strchr strchr_mte
+#include <bionic/strchr.cpp>
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/mte/bionic/strcmp.c
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/mte/bionic/strcmp.c
index b38ef17..0e134f0 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/mte/bionic/strcmp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,7 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#define strcmp strcmp_mte
+#include <upstream-openbsd/lib/libc/string/strcmp.c>
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/mte/bionic/strlen.c
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/mte/bionic/strlen.c
index b38ef17..de88320 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/mte/bionic/strlen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,7 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#define strlen strlen_mte
+#include <upstream-openbsd/lib/libc/string/strlen.c>
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/mte/bionic/strncmp.c
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/mte/bionic/strncmp.c
index b38ef17..54d08e9 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/mte/bionic/strncmp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,7 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#define strncmp strncmp_mte
+#include <upstream-openbsd/lib/libc/string/strncmp.c>
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/mte/bionic/strnlen.c
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/mte/bionic/strnlen.c
index b38ef17..3dc251d 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/mte/bionic/strnlen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,5 @@
* SUCH DAMAGE.
*/
-#include <link.h>
-
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#define strnlen strnlen_mte
+#include <bionic/strnlen.c>
diff --git a/linker/linker_exidx_static.c b/libc/arch-arm64/static_function_dispatch.S
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/arch-arm64/static_function_dispatch.S
index b38ef17..8e3a4c1 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/arch-arm64/static_function_dispatch.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,16 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <private/bionic_asm.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
+#define FUNCTION_DELEGATE(name, impl) \
+ENTRY(name); \
+ b impl; \
+END(name)
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+FUNCTION_DELEGATE(memchr, memchr_mte)
+FUNCTION_DELEGATE(strchr, strchr_mte)
+FUNCTION_DELEGATE(strcmp, strcmp_mte)
+FUNCTION_DELEGATE(strlen, strlen_mte)
+FUNCTION_DELEGATE(strncmp, strncmp_mte)
+FUNCTION_DELEGATE(strnlen, strnlen_mte)
diff --git a/linker/linker_exidx_static.c b/libc/bionic/bionic_call_ifunc_resolver.cpp
similarity index 61%
copy from linker/linker_exidx_static.c
copy to libc/bionic/bionic_call_ifunc_resolver.cpp
index b38ef17..8522835 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/bionic/bionic_call_ifunc_resolver.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,21 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include "private/bionic_call_ifunc_resolver.h"
+#include <sys/auxv.h>
+#include <sys/ifunc.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
+ElfW(Addr) __bionic_call_ifunc_resolver(ElfW(Addr) resolver_addr) {
+#if defined(__aarch64__)
+ typedef ElfW(Addr) (*ifunc_resolver_t)(uint64_t, __ifunc_arg_t*);
+ static __ifunc_arg_t arg = { sizeof(__ifunc_arg_t), getauxval(AT_HWCAP), getauxval(AT_HWCAP2) };
+ return reinterpret_cast<ifunc_resolver_t>(resolver_addr)(arg._hwcap | _IFUNC_ARG_HWCAP, &arg);
+#elif defined(__arm__)
+ typedef ElfW(Addr) (*ifunc_resolver_t)(unsigned long);
+ static unsigned long hwcap = getauxval(AT_HWCAP);
+ return reinterpret_cast<ifunc_resolver_t>(resolver_addr)(hwcap);
+#else
+ typedef ElfW(Addr) (*ifunc_resolver_t)(void);
+ return reinterpret_cast<ifunc_resolver_t>(resolver_addr)();
+#endif
}
diff --git a/libc/bionic/ctype.cpp b/libc/bionic/ctype.cpp
index b72935b..ba8afca 100644
--- a/libc/bionic/ctype.cpp
+++ b/libc/bionic/ctype.cpp
@@ -28,70 +28,146 @@
#include <ctype.h>
+static inline int __in_range(int c, char lo, char hi) {
+ return c >= lo && c <= hi;
+}
+
+int isalnum(int c) {
+ // `isalnum(c)` is `isalpha(c) || isdigit(c)`, but there's no obvious way
+ // to simplify that, and the table lookup is just slightly faster...
+ // Note that this is unsafe for inputs less than -1 (EOF) or greater than
+ // 0xff. This is true of other C libraries too.
+ return (_ctype_[c + 1] & (_CTYPE_U|_CTYPE_L|_CTYPE_N));
+}
+
int isalnum_l(int c, locale_t) {
return isalnum(c);
}
+int isalpha(int c) {
+ return __in_range(c, 'A', 'Z') || __in_range(c, 'a', 'z');
+}
+
int isalpha_l(int c, locale_t) {
return isalpha(c);
}
+int isascii(int c) {
+ return static_cast<unsigned>(c) < 0x80;
+}
+
+int isblank(int c) {
+ return c == ' ' || c == '\t';
+}
+
int isblank_l(int c, locale_t) {
return isblank(c);
}
+int iscntrl(int c) {
+ return (static_cast<unsigned>(c) < ' ') || c == 0x7f;
+}
+
int iscntrl_l(int c, locale_t) {
return iscntrl(c);
}
+int isdigit(int c) {
+ return __in_range(c, '0', '9');
+}
+
int isdigit_l(int c, locale_t) {
return isdigit(c);
}
+int isgraph(int c) {
+ return __in_range(c, '!', '~');
+}
+
int isgraph_l(int c, locale_t) {
return isgraph(c);
}
+int islower(int c) {
+ return __in_range(c, 'a', 'z');
+}
+
int islower_l(int c, locale_t) {
return islower(c);
}
+int isprint(int c) {
+ return __in_range(c, ' ', '~');
+}
+
int isprint_l(int c, locale_t) {
return isprint(c);
}
+int ispunct(int c) {
+ // `ispunct(c)` is `isgraph(c) && !isalnum(c)`, but there's no obvious way
+ // to simplify that, and the table lookup is just slightly faster...
+ // Note that this is unsafe for inputs less than -1 (EOF) or greater than
+ // 0xff. This is true of other C libraries too.
+ return (_ctype_[c + 1] & _CTYPE_P);
+}
+
int ispunct_l(int c, locale_t) {
return ispunct(c);
}
+int isspace(int c) {
+ return c == ' ' || __in_range(c, '\t', '\r');
+}
+
int isspace_l(int c, locale_t) {
return isspace(c);
}
+int isupper(int c) {
+ return __in_range(c, 'A', 'Z');
+}
+
int isupper_l(int c, locale_t) {
return isupper(c);
}
+int isxdigit(int c) {
+ return __in_range(c, '0', '9') || __in_range(c, 'a', 'f') || __in_range(c, 'A', 'F');
+}
+
int isxdigit_l(int c, locale_t) {
return isxdigit(c);
}
+int toascii(int c) {
+ return c & 0x7f;
+}
+
+int _toupper(int c) {
+ // Using EOR rather than AND makes no difference on arm, but saves an
+ // instruction on arm64.
+ return c ^ 0x20;
+}
+
+int toupper(int c) {
+ if (c >= 'a' && c <= 'z') return _toupper(c);
+ return c;
+}
+
int toupper_l(int c, locale_t) {
return toupper(c);
}
-int tolower_l(int c, locale_t) {
- return tolower(c);
+int _tolower(int c) {
+ return c | 0x20;
}
int tolower(int c) {
- if (c >= 'A' && c <= 'Z') return c | 0x20;
+ if (c >= 'A' && c <= 'Z') return _tolower(c);
return c;
}
-int toupper(int c) {
- // Using EOR rather than AND makes no difference on arm, but saves an
- // instruction on arm64.
- if (c >= 'a' && c <= 'z') return c ^ 0x20;
- return c;
+int tolower_l(int c, locale_t) {
+ return tolower(c);
}
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index b4bddce..0b74023 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -39,6 +39,7 @@
#include "libc_init_common.h"
#include "pthread_internal.h"
+#include "private/bionic_call_ifunc_resolver.h"
#include "private/bionic_elf_tls.h"
#include "private/bionic_globals.h"
#include "private/bionic_macros.h"
@@ -81,11 +82,10 @@
return;
}
- typedef ElfW(Addr) (*ifunc_resolver_t)(void);
for (ElfW(Rela) *r = __rela_iplt_start; r != __rela_iplt_end; ++r) {
ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
ElfW(Addr) resolver = r->r_addend;
- *offset = reinterpret_cast<ifunc_resolver_t>(resolver)();
+ *offset = __bionic_call_ifunc_resolver(resolver);
}
}
#else
@@ -103,11 +103,10 @@
return;
}
- typedef ElfW(Addr) (*ifunc_resolver_t)(void);
for (ElfW(Rel) *r = __rel_iplt_start; r != __rel_iplt_end; ++r) {
ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset);
ElfW(Addr) resolver = *offset;
- *offset = reinterpret_cast<ifunc_resolver_t>(resolver)();
+ *offset = __bionic_call_ifunc_resolver(resolver);
}
}
#endif
diff --git a/libc/bionic/open.cpp b/libc/bionic/open.cpp
index df5ab21..222e5d3 100644
--- a/libc/bionic/open.cpp
+++ b/libc/bionic/open.cpp
@@ -70,7 +70,6 @@
if (needs_mode(flags)) __fortify_fatal("open: called with O_CREAT/O_TMPFILE but no mode");
return __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), 0);
}
-__strong_alias(__open64_2, __open_2);
int openat(int fd, const char *pathname, int flags, ...) {
mode_t mode = 0;
@@ -90,4 +89,3 @@
if (needs_mode(flags)) __fortify_fatal("open: called with O_CREAT/O_TMPFILE but no mode");
return __openat(fd, pathname, force_O_LARGEFILE(flags), 0);
}
-__strong_alias(__openat64_2, __openat_2);
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 0dbf539..1dc1066 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -344,6 +344,8 @@
name);
}
+extern "C" int __rt_sigprocmask(int, const sigset64_t*, sigset64_t*, size_t);
+
__attribute__((no_sanitize("hwaddress")))
static int __pthread_start(void* arg) {
pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(arg);
@@ -358,6 +360,7 @@
__set_stack_and_tls_vma_name(false);
__init_additional_stacks(thread);
+ __rt_sigprocmask(SIG_SETMASK, &thread->start_mask, nullptr, sizeof(thread->start_mask));
void* result = thread->start_routine(thread->start_routine_arg);
pthread_exit(result);
@@ -420,7 +423,12 @@
__init_user_desc(&tls_descriptor, false, tls);
tls = &tls_descriptor;
#endif
+
+ sigset64_t block_all_mask;
+ sigfillset64(&block_all_mask);
+ __rt_sigprocmask(SIG_SETMASK, &block_all_mask, &thread->start_mask, sizeof(thread->start_mask));
int rc = clone(__pthread_start, child_stack, flags, thread, &(thread->tid), tls, &(thread->tid));
+ __rt_sigprocmask(SIG_SETMASK, &thread->start_mask, nullptr, sizeof(thread->start_mask));
if (rc == -1) {
int clone_errno = errno;
// We don't have to unlock the mutex at all because clone(2) failed so there's no child waiting to
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 22cc400..22b0558 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -98,6 +98,7 @@
void* (*start_routine)(void*);
void* start_routine_arg;
void* return_value;
+ sigset64_t start_mask;
void* alternate_signal_stack;
diff --git a/linker/linker_exidx_static.c b/libc/bionic/sleep.cpp
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/bionic/sleep.cpp
index b38ef17..fcfd9b2 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/bionic/sleep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,16 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <unistd.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
+#include <time.h>
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
+unsigned sleep(unsigned s) {
+#if !defined(__LP64__)
+ // `s` is `unsigned`, but tv_sec is `int` on LP32.
+ if (s > INT_MAX) return s - INT_MAX + sleep(INT_MAX);
+#endif
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
+ timespec ts = {.tv_sec = static_cast<time_t>(s)};
+ return (nanosleep(&ts, &ts) == -1) ? ts.tv_sec : 0;
}
diff --git a/linker/linker_exidx_static.c b/libc/bionic/usleep.cpp
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/bionic/usleep.cpp
index b38ef17..2204684 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/bionic/usleep.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,13 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#include <unistd.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
+#include <time.h>
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
+int usleep(useconds_t us) {
+ timespec ts;
+ ts.tv_sec = us / 1000000;
+ ts.tv_nsec = (us % 1000000) * 1000;
+ return nanosleep(&ts, nullptr);
}
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index af7cde1..577fb00 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -31,76 +31,83 @@
/**
* @file android/api-level.h
* @brief Functions and constants for dealing with multiple API levels.
+ *
+ * See
+ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
*/
#include <sys/cdefs.h>
__BEGIN_DECLS
-#ifndef __ANDROID_API_FUTURE__
/**
- * Magic version number for an Android OS build which has
- * not yet turned into an official release,
- * for comparisons against __ANDROID_API__.
+ * Magic version number for an Android OS build which has not yet turned
+ * into an official release, for comparison against `__ANDROID_API__`. See
+ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
*/
#define __ANDROID_API_FUTURE__ 10000
-#endif
+/* This #ifndef should never be true except when doxygen is generating docs. */
#ifndef __ANDROID_API__
/**
* `__ANDROID_API__` is the API level being targeted. For the OS,
* this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the
- * compiler/build system based on the API level you claimed to target.
+ * compiler system based on the API level you claimed to target. See
+ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
*/
#define __ANDROID_API__ __ANDROID_API_FUTURE__
#endif
-/** Names the Gingerbread API level (9), for comparisons against __ANDROID_API__. */
+/** Names the Gingerbread API level (9), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_G__ 9
-/** Names the Ice-Cream Sandwich API level (14), for comparisons against __ANDROID_API__. */
+/** Names the Ice-Cream Sandwich API level (14), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_I__ 14
-/** Names the Jellybean API level (16), for comparisons against __ANDROID_API__. */
+/** Names the Jellybean API level (16), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_J__ 16
-/** Names the Jellybean MR1 API level (17), for comparisons against __ANDROID_API__. */
+/** Names the Jellybean MR1 API level (17), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_J_MR1__ 17
-/** Names the Jellybean MR2 API level (18), for comparisons against __ANDROID_API__. */
+/** Names the Jellybean MR2 API level (18), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_J_MR2__ 18
-/** Names the KitKat API level (19), for comparisons against __ANDROID_API__. */
+/** Names the KitKat API level (19), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_K__ 19
-/** Names the Lollipop API level (21), for comparisons against __ANDROID_API__. */
+/** Names the Lollipop API level (21), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_L__ 21
-/** Names the Lollipop MR1 API level (22), for comparisons against __ANDROID_API__. */
+/** Names the Lollipop MR1 API level (22), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_L_MR1__ 22
-/** Names the Marshmallow API level (23), for comparisons against __ANDROID_API__. */
+/** Names the Marshmallow API level (23), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_M__ 23
-/** Names the Nougat API level (24), for comparisons against __ANDROID_API__. */
+/** Names the Nougat API level (24), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_N__ 24
-/** Names the Nougat MR1 API level (25), for comparisons against __ANDROID_API__. */
+/** Names the Nougat MR1 API level (25), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_N_MR1__ 25
-/** Names the Oreo API level (26), for comparisons against __ANDROID_API__. */
+/** Names the Oreo API level (26), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_O__ 26
-/** Names the Oreo MR1 API level (27), for comparisons against __ANDROID_API__. */
+/** Names the Oreo MR1 API level (27), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_O_MR1__ 27
-/** Names the Pie API level (28), for comparisons against __ANDROID_API__. */
+/** Names the Pie API level (28), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_P__ 28
-/** Names the "Q" API level (29), for comparisons against __ANDROID_API__. */
+/**
+ * Names the "Q" API level (29), for comparison against `__ANDROID_API__`.
+ * This release was called Android 10 publicly, not to be (but sure to be)
+ * confused with API level 10.
+ */
#define __ANDROID_API_Q__ 29
-/** Names the "R" API level (30), for comparisons against __ANDROID_API__. */
+/** Names the "R" API level (30), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_R__ 30
/**
diff --git a/libc/include/bits/fortify/fcntl.h b/libc/include/bits/fortify/fcntl.h
index 4bb441e..ded62ee 100644
--- a/libc/include/bits/fortify/fcntl.h
+++ b/libc/include/bits/fortify/fcntl.h
@@ -45,7 +45,6 @@
/* O_TMPFILE shares bits with O_DIRECTORY. */
#define __open_modes_useful(flags) (((flags) & O_CREAT) || ((flags) & O_TMPFILE) == O_TMPFILE)
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
__BIONIC_ERROR_FUNCTION_VISIBILITY
int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
__errorattr(__open_too_many_args_error);
@@ -60,7 +59,11 @@
int open(const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'open' " __open_too_few_args_error) {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
return __open_2(pathname, flags);
+#else
+ return __open_real(pathname, flags);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
}
__BIONIC_FORTIFY_INLINE
@@ -80,7 +83,11 @@
int openat(int dirfd, const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'openat' " __open_too_few_args_error) {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
return __openat_2(dirfd, pathname, flags);
+#else
+ return __openat_real(dirfd, pathname, flags);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
}
__BIONIC_FORTIFY_INLINE
@@ -90,13 +97,9 @@
"'openat' " __open_useless_modes_warning) {
return __openat_real(dirfd, pathname, flags, modes);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-#if __ANDROID_API__ >= __ANDROID_API_R__
-int __open64_2(const char*, int) __INTRODUCED_IN(30);
-int __openat64_2(int, const char*, int) __INTRODUCED_IN(30);
-int __open64_real(const char* __path, int __flags, ...) __RENAME(open64);
-int __openat64_real(int, const char*, int, ...) __RENAME(openat64);
+#if __ANDROID_API__ >= __ANDROID_API_L__
+/* Note that open == open64, so we reuse those bits in the open64 variants below. */
__BIONIC_ERROR_FUNCTION_VISIBILITY
int open64(const char* pathname, int flags, mode_t modes, ...) __overloadable
@@ -106,7 +109,7 @@
int open64(const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'open64' " __open_too_few_args_error) {
- return __open64_2(pathname, flags);
+ return __open_2(pathname, flags);
}
__BIONIC_FORTIFY_INLINE
@@ -114,7 +117,7 @@
__overloadable
__clang_warning_if(!__open_modes_useful(flags) && modes,
"'open64' " __open_useless_modes_warning) {
- return __open64_real(pathname, flags, modes);
+ return __open_real(pathname, flags, modes);
}
__BIONIC_ERROR_FUNCTION_VISIBILITY
@@ -126,7 +129,7 @@
int openat64(int dirfd, const char* const __pass_object_size pathname, int flags)
__overloadable
__clang_error_if(__open_modes_useful(flags), "'openat64' " __open_too_few_args_error) {
- return __openat64_2(dirfd, pathname, flags);
+ return __openat_2(dirfd, pathname, flags);
}
__BIONIC_FORTIFY_INLINE
@@ -134,9 +137,9 @@
__overloadable
__clang_warning_if(!__open_modes_useful(flags) && modes,
"'openat64' " __open_useless_modes_warning) {
- return __openat64_real(dirfd, pathname, flags, modes);
+ return __openat_real(dirfd, pathname, flags, modes);
}
-#endif /* __ANDROID_API__ >= __ANDROID_API_R__ */
+#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
#undef __open_too_many_args_error
#undef __open_too_few_args_error
diff --git a/libc/include/bits/fortify/stdio.h b/libc/include/bits/fortify/stdio.h
index 8bb5b68..528d5fb 100644
--- a/libc/include/bits/fortify/stdio.h
+++ b/libc/include/bits/fortify/stdio.h
@@ -50,7 +50,23 @@
}
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+__BIONIC_ERROR_FUNCTION_VISIBILITY
+int sprintf(char* dest, const char* format)
+ __overloadable
+ __enable_if(__bos_unevaluated_lt(__bos(dest), __builtin_strlen(format)),
+ "format string will always overflow destination buffer")
+ __errorattr("format string will always overflow destination buffer");
+
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
+__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
+int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
+ va_list va;
+ va_start(va, format);
+ int result = __builtin___vsprintf_chk(dest, 0, __bos(dest), format, va);
+ va_end(va);
+ return result;
+}
+
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_VARIADIC __printflike(3, 4)
int snprintf(char* const __pass_object_size dest, size_t size, const char* format, ...)
@@ -61,26 +77,9 @@
va_end(va);
return result;
}
-
-__BIONIC_ERROR_FUNCTION_VISIBILITY
-int sprintf(char* dest, const char* format)
- __overloadable
- __enable_if(__bos_unevaluated_lt(__bos(dest), __builtin_strlen(format)),
- "format string will always overflow destination buffer")
- __errorattr("format string will always overflow destination buffer");
-
-__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
-int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
- va_list va;
- va_start(va, format);
- int result = __builtin___vsprintf_chk(dest, 0, __bos(dest), format, va);
- va_end(va);
- return result;
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
-#if __ANDROID_API__ >= __ANDROID_API_N__
-#define __bos_trivially_not_lt_mul(bos_val, size, count) \
+#define __bos_trivially_ge_mul(bos_val, size, count) \
__bos_dynamic_check_impl_and(bos_val, >=, (size) * (count), \
!__unsafe_check_mul_overflow(size, count))
@@ -91,12 +90,14 @@
"in call to 'fread', size * count overflows")
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
"in call to 'fread', size * count is too large for the given buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_N__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_mul(bos, size, count)) {
- return __call_bypassing_fortify(fread)(buf, size, count, stream);
+ if (!__bos_trivially_ge_mul(bos, size, count)) {
+ return __fread_chk(buf, size, count, stream, bos);
}
- return __fread_chk(buf, size, count, stream, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+ return __call_bypassing_fortify(fread)(buf, size, count, stream);
}
__BIONIC_FORTIFY_INLINE
@@ -106,32 +107,31 @@
"in call to 'fwrite', size * count overflows")
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
"in call to 'fwrite', size * count is too large for the given buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_N__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_mul(bos, size, count)) {
- return __call_bypassing_fortify(fwrite)(buf, size, count, stream);
+ if (!__bos_trivially_ge_mul(bos, size, count)) {
+ return __fwrite_chk(buf, size, count, stream, bos);
}
-
- return __fwrite_chk(buf, size, count, stream, bos);
-}
-#undef __bos_trivially_not_lt_mul
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+ return __call_bypassing_fortify(fwrite)(buf, size, count, stream);
+}
+#undef __bos_trivially_ge_mul
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
__BIONIC_FORTIFY_INLINE
char* fgets(char* const __pass_object_size dest, int size, FILE* stream)
__overloadable
__clang_error_if(size < 0, "in call to 'fgets', size should not be negative")
__clang_error_if(__bos_unevaluated_lt(__bos(dest), size),
"in call to 'fgets', size is larger than the destination buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
size_t bos = __bos(dest);
- if (__bos_dynamic_check_impl_and(bos, >=, (size_t)size, size >= 0)) {
- return __call_bypassing_fortify(fgets)(dest, size, stream);
+ if (!__bos_dynamic_check_impl_and(bos, >=, (size_t)size, size >= 0)) {
+ return __fgets_chk(dest, size, stream, bos);
}
-
- return __fgets_chk(dest, size, stream, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+ return __call_bypassing_fortify(fgets)(dest, size, stream);
+}
#endif /* defined(__BIONIC_FORTIFY) */
diff --git a/libc/include/bits/fortify/string.h b/libc/include/bits/fortify/string.h
index 9be2b1a..bd36483 100644
--- a/libc/include/bits/fortify/string.h
+++ b/libc/include/bits/fortify/string.h
@@ -46,7 +46,7 @@
void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
__overloadable {
size_t bos_dst = __bos0(dst);
- if (__bos_trivially_not_lt(bos_dst, copy_amount)) {
+ if (__bos_trivially_ge(bos_dst, copy_amount)) {
return __builtin_memcpy(dst, src, copy_amount);
}
return __builtin___memcpy_chk(dst, src, copy_amount, bos_dst);
@@ -56,7 +56,7 @@
__BIONIC_FORTIFY_INLINE
void* memmove(void* const dst __pass_object_size0, const void* src, size_t len) __overloadable {
size_t bos_dst = __bos0(dst);
- if (__bos_trivially_not_lt(bos_dst, len)) {
+ if (__bos_trivially_ge(bos_dst, len)) {
return __builtin_memmove(dst, src, len);
}
return __builtin___memmove_chk(dst, src, len, bos_dst);
@@ -71,39 +71,40 @@
__clang_error_if(__bos_unevaluated_lt(__bos0(dst), copy_amount),
"'mempcpy' called with size bigger than buffer") {
size_t bos_dst = __bos0(dst);
- if (__bos_trivially_not_lt(bos_dst, copy_amount)) {
+ if (__bos_trivially_ge(bos_dst, copy_amount)) {
return __builtin_mempcpy(dst, src, copy_amount);
}
return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
}
#endif /* __ANDROID_API__ >= __ANDROID_API_R__ */
-#endif
+#endif /* __USE_GNU */
-#if __ANDROID_API__ >= __ANDROID_API_L__
__BIONIC_FORTIFY_INLINE
char* stpcpy(char* const dst __pass_object_size, const char* src)
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'stpcpy' called with string bigger than buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_L__
size_t bos_dst = __bos(dst);
- if (__bos_trivially_not_le(bos_dst, __builtin_strlen(src))) {
- return __builtin_stpcpy(dst, src);
+ if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
+ return __builtin___stpcpy_chk(dst, src, bos_dst);
}
- return __builtin___stpcpy_chk(dst, src, bos_dst);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+ return __builtin_stpcpy(dst, src);
+}
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
__BIONIC_FORTIFY_INLINE
char* strcpy(char* const dst __pass_object_size, const char* src)
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'strcpy' called with string bigger than buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
size_t bos_dst = __bos(dst);
- if (__bos_trivially_not_le(bos_dst, __builtin_strlen(src))) {
- return __builtin_strcpy(dst, src);
+ if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
+ return __builtin___strcpy_chk(dst, src, bos_dst);
}
- return __builtin___strcpy_chk(dst, src, bos_dst);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+ return __builtin_strcpy(dst, src);
}
__BIONIC_FORTIFY_INLINE
@@ -111,27 +112,34 @@
__overloadable
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
"'strcat' called with string bigger than buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
return __builtin___strcat_chk(dst, src, __bos(dst));
+#else
+ return __builtin_strcat(dst, src);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
}
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
char* strncat(char* const dst __pass_object_size, const char* src, size_t n) __overloadable {
return __builtin___strncat_chk(dst, src, n, __bos(dst));
}
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
/* No diag -- clang diagnoses misuses of this on its own. */
__BIONIC_FORTIFY_INLINE
void* memset(void* const s __pass_object_size0, int c, size_t n) __overloadable
/* If you're a user who wants this warning to go away: use `(&memset)(foo, bar, baz)`. */
__clang_warning_if(c && !n, "'memset' will set 0 bytes; maybe the arguments got flipped?") {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
size_t bos = __bos0(s);
- if (__bos_trivially_not_lt(bos, n)) {
- return __builtin_memset(s, c, n);
+ if (!__bos_trivially_ge(bos, n)) {
+ return __builtin___memset_chk(s, c, n, bos);
}
- return __builtin___memset_chk(s, c, n, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+ return __builtin_memset(s, c, n);
+}
#if __ANDROID_API__ >= __ANDROID_API_M__
__BIONIC_FORTIFY_INLINE
@@ -189,19 +197,19 @@
}
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
-#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
__BIONIC_FORTIFY_INLINE
size_t strlcpy(char* const dst __pass_object_size, const char* src, size_t size)
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
"'strlcpy' called with size bigger than buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
size_t bos = __bos(dst);
- if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
- return __call_bypassing_fortify(strlcpy)(dst, src, size);
+ if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+ return __strlcpy_chk(dst, src, size, bos);
}
-
- return __strlcpy_chk(dst, src, size, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+ return __call_bypassing_fortify(strlcpy)(dst, src, size);
}
__BIONIC_FORTIFY_INLINE
@@ -209,50 +217,51 @@
__overloadable
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
"'strlcat' called with size bigger than buffer") {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
size_t bos = __bos(dst);
- if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
- return __call_bypassing_fortify(strlcat)(dst, src, size);
+ if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+ return __strlcat_chk(dst, src, size, bos);
}
-
- return __strlcat_chk(dst, src, size, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+ return __call_bypassing_fortify(strlcat)(dst, src, size);
}
__BIONIC_FORTIFY_INLINE
size_t strlen(const char* const s __pass_object_size0) __overloadable {
size_t bos = __bos0(s);
- if (__bos_trivially_gt(bos, __builtin_strlen(s))) {
- return __builtin_strlen(s);
+#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
+ if (!__bos_trivially_gt(bos, __builtin_strlen(s))) {
+ return __strlen_chk(s, bos);
}
-
- return __strlen_chk(s, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
+ return __builtin_strlen(s);
+}
-#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
__BIONIC_FORTIFY_INLINE
char* strchr(const char* const s __pass_object_size, int c) __overloadable {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
size_t bos = __bos(s);
- if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
- return __builtin_strchr(s, c);
+ if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+ return __strchr_chk(s, c, bos);
}
-
- return __strchr_chk(s, c, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
+ return __builtin_strchr(s, c);
}
__BIONIC_FORTIFY_INLINE
char* strrchr(const char* const s __pass_object_size, int c) __overloadable {
+#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
size_t bos = __bos(s);
- if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
- return __builtin_strrchr(s, c);
+ if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
+ return __strrchr_chk(s, c, bos);
}
-
- return __strrchr_chk(s, c, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
+ return __builtin_strrchr(s, c);
+}
#if __ANDROID_API__ >= __ANDROID_API_M__
#if defined(__cplusplus)
diff --git a/libc/include/bits/fortify/unistd.h b/libc/include/bits/fortify/unistd.h
index 547a168..45ed2cf 100644
--- a/libc/include/bits/fortify/unistd.h
+++ b/libc/include/bits/fortify/unistd.h
@@ -35,14 +35,13 @@
ssize_t __pread_real(int, void*, size_t, off_t) __RENAME(pread);
ssize_t __pread64_chk(int, void*, size_t, off64_t, size_t) __INTRODUCED_IN(23);
-ssize_t __pread64_real(int, void*, size_t, off64_t) __RENAME(pread64) __INTRODUCED_IN(12);
+ssize_t __pread64_real(int, void*, size_t, off64_t) __RENAME(pread64);
ssize_t __pwrite_chk(int, const void*, size_t, off_t, size_t) __INTRODUCED_IN(24);
ssize_t __pwrite_real(int, const void*, size_t, off_t) __RENAME(pwrite);
ssize_t __pwrite64_chk(int, const void*, size_t, off64_t, size_t) __INTRODUCED_IN(24);
-ssize_t __pwrite64_real(int, const void*, size_t, off64_t) __RENAME(pwrite64)
- __INTRODUCED_IN(12);
+ssize_t __pwrite64_real(int, const void*, size_t, off64_t) __RENAME(pwrite64);
ssize_t __read_chk(int, void*, size_t, size_t) __INTRODUCED_IN(21);
ssize_t __write_chk(int, const void*, size_t, size_t) __INTRODUCED_IN(24);
@@ -66,148 +65,151 @@
__clang_error_if(__bos_unevaluated_lt((objsize), (what)), \
"in call to '" #fn "', '" #what "' bytes overflows the given object")
-#define __bos_trivially_not_lt_no_overflow(bos_val, index) \
+#define __bos_trivially_ge_no_overflow(bos_val, index) \
((__bos_dynamic_check_impl_and((bos_val), >=, (index), (bos_val) <= SSIZE_MAX) && \
__builtin_constant_p(index) && (index) <= SSIZE_MAX))
-#if __ANDROID_API__ >= __ANDROID_API_N__
__BIONIC_FORTIFY_INLINE
char* getcwd(char* const __pass_object_size buf, size_t size)
__overloadable
__error_if_overflows_objectsize(size, __bos(buf), getcwd) {
+#if __ANDROID_API__ >= __ANDROID_API_N__
size_t bos = __bos(buf);
- if (__bos_trivially_not_lt(bos, size)) {
- return __call_bypassing_fortify(getcwd)(buf, size);
+ if (!__bos_trivially_ge(bos, size)) {
+ return __getcwd_chk(buf, size, bos);
}
-
- return __getcwd_chk(buf, size, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+ return __call_bypassing_fortify(getcwd)(buf, size);
+}
-#if __ANDROID_API__ >= __ANDROID_API_M__
+#if !defined(__USE_FILE_OFFSET64)
__BIONIC_FORTIFY_INLINE
ssize_t pread(int fd, void* const __pass_object_size0 buf, size_t count, off_t offset)
__overloadable
__error_if_overflows_ssizet(count, pread)
__error_if_overflows_objectsize(count, __bos0(buf), pread) {
+#if __ANDROID_API__ >= __ANDROID_API_M__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, count)) {
- return __PREAD_PREFIX(real)(fd, buf, count, offset);
+ if (!__bos_trivially_ge_no_overflow(bos, count)) {
+ return __PREAD_PREFIX(chk)(fd, buf, count, offset, bos);
}
-
- return __PREAD_PREFIX(chk)(fd, buf, count, offset, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+ return __PREAD_PREFIX(real)(fd, buf, count, offset);
}
+#endif /* !defined(__USE_FILE_OFFSET64) */
__BIONIC_FORTIFY_INLINE
ssize_t pread64(int fd, void* const __pass_object_size0 buf, size_t count, off64_t offset)
__overloadable
__error_if_overflows_ssizet(count, pread64)
__error_if_overflows_objectsize(count, __bos0(buf), pread64) {
+#if __ANDROID_API__ >= __ANDROID_API_M__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, count)) {
- return __pread64_real(fd, buf, count, offset);
+ if (!__bos_trivially_ge_no_overflow(bos, count)) {
+ return __pread64_chk(fd, buf, count, offset, bos);
}
-
- return __pread64_chk(fd, buf, count, offset, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+ return __pread64_real(fd, buf, count, offset);
+}
-#if __ANDROID_API__ >= __ANDROID_API_N__
+#if !defined(__USE_FILE_OFFSET64)
__BIONIC_FORTIFY_INLINE
ssize_t pwrite(int fd, const void* const __pass_object_size0 buf, size_t count, off_t offset)
__overloadable
__error_if_overflows_ssizet(count, pwrite)
__error_if_overflows_objectsize(count, __bos0(buf), pwrite) {
+#if __ANDROID_API__ >= __ANDROID_API_N__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, count)) {
- return __PWRITE_PREFIX(real)(fd, buf, count, offset);
+ if (!__bos_trivially_ge_no_overflow(bos, count)) {
+ return __PWRITE_PREFIX(chk)(fd, buf, count, offset, bos);
}
-
- return __PWRITE_PREFIX(chk)(fd, buf, count, offset, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+ return __PWRITE_PREFIX(real)(fd, buf, count, offset);
}
+#endif /* !defined(__USE_FILE_OFFSET64) */
__BIONIC_FORTIFY_INLINE
ssize_t pwrite64(int fd, const void* const __pass_object_size0 buf, size_t count, off64_t offset)
__overloadable
__error_if_overflows_ssizet(count, pwrite64)
__error_if_overflows_objectsize(count, __bos0(buf), pwrite64) {
+#if __ANDROID_API__ >= __ANDROID_API_N__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, count)) {
- return __pwrite64_real(fd, buf, count, offset);
+ if (!__bos_trivially_ge_no_overflow(bos, count)) {
+ return __pwrite64_chk(fd, buf, count, offset, bos);
}
-
- return __pwrite64_chk(fd, buf, count, offset, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+ return __pwrite64_real(fd, buf, count, offset);
+}
-#if __ANDROID_API__ >= __ANDROID_API_L__
__BIONIC_FORTIFY_INLINE
ssize_t read(int fd, void* const __pass_object_size0 buf, size_t count)
__overloadable
__error_if_overflows_ssizet(count, read)
__error_if_overflows_objectsize(count, __bos0(buf), read) {
+#if __ANDROID_API__ >= __ANDROID_API_L__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, count)) {
- return __call_bypassing_fortify(read)(fd, buf, count);
+ if (!__bos_trivially_ge_no_overflow(bos, count)) {
+ return __read_chk(fd, buf, count, bos);
}
-
- return __read_chk(fd, buf, count, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
+ return __call_bypassing_fortify(read)(fd, buf, count);
+}
-#if __ANDROID_API__ >= __ANDROID_API_N__
__BIONIC_FORTIFY_INLINE
ssize_t write(int fd, const void* const __pass_object_size0 buf, size_t count)
__overloadable
__error_if_overflows_ssizet(count, write)
__error_if_overflows_objectsize(count, __bos0(buf), write) {
+#if __ANDROID_API__ >= __ANDROID_API_N__
size_t bos = __bos0(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, count)) {
- return __call_bypassing_fortify(write)(fd, buf, count);
+ if (!__bos_trivially_ge_no_overflow(bos, count)) {
+ return __write_chk(fd, buf, count, bos);
}
-
- return __write_chk(fd, buf, count, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
+ return __call_bypassing_fortify(write)(fd, buf, count);
+}
-#if __ANDROID_API__ >= __ANDROID_API_M__
__BIONIC_FORTIFY_INLINE
ssize_t readlink(const char* path, char* const __pass_object_size buf, size_t size)
__overloadable
__error_if_overflows_ssizet(size, readlink)
__error_if_overflows_objectsize(size, __bos(buf), readlink) {
+#if __ANDROID_API__ >= __ANDROID_API_M__
size_t bos = __bos(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, size)) {
- return __call_bypassing_fortify(readlink)(path, buf, size);
+ if (!__bos_trivially_ge_no_overflow(bos, size)) {
+ return __readlink_chk(path, buf, size, bos);
}
-
- return __readlink_chk(path, buf, size, bos);
+#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+ return __call_bypassing_fortify(readlink)(path, buf, size);
}
+#if __ANDROID_API__ >= __ANDROID_API_L__
__BIONIC_FORTIFY_INLINE
ssize_t readlinkat(int dirfd, const char* path, char* const __pass_object_size buf, size_t size)
__overloadable
__error_if_overflows_ssizet(size, readlinkat)
__error_if_overflows_objectsize(size, __bos(buf), readlinkat) {
+#if __ANDROID_API__ >= __ANDROID_API_M__
size_t bos = __bos(buf);
- if (__bos_trivially_not_lt_no_overflow(bos, size)) {
- return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
+ if (!__bos_trivially_ge_no_overflow(bos, size)) {
+ return __readlinkat_chk(dirfd, path, buf, size, bos);
}
-
- return __readlinkat_chk(dirfd, path, buf, size, bos);
-}
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
+ return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
+}
+#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
-#undef __bos_trivially_not_lt_no_overflow
+#undef __bos_trivially_ge_no_overflow
#undef __enable_if_no_overflow_ssizet
#undef __error_if_overflows_objectsize
#undef __error_if_overflows_ssizet
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index 6b3e347..aabcaab 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -114,6 +114,9 @@
#if defined(__NR_clone)
#define SYS_clone __NR_clone
#endif
+#if defined(__NR_clone3)
+ #define SYS_clone3 __NR_clone3
+#endif
#if defined(__NR_close)
#define SYS_close __NR_close
#endif
@@ -717,6 +720,9 @@
#if defined(__NR_personality)
#define SYS_personality __NR_personality
#endif
+#if defined(__NR_pidfd_open)
+ #define SYS_pidfd_open __NR_pidfd_open
+#endif
#if defined(__NR_pidfd_send_signal)
#define SYS_pidfd_send_signal __NR_pidfd_send_signal
#endif
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
index e91b0e2..e7df299 100644
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -97,7 +97,7 @@
int isspace(int __ch);
/** Returns true if `ch` is in `[A-Z]`. */
int isupper(int __ch);
-/** Returns true if `ch` is in `[0-9a-f]`. */
+/** Returns true if `ch` is in `[0-9A-Fa-f]`. */
int isxdigit(int __ch);
/** Returns the corresponding lower-case character if `ch` is upper-case, or `ch` otherwise. */
diff --git a/libc/include/fenv.h b/libc/include/fenv.h
index 886612e..90ac805 100644
--- a/libc/include/fenv.h
+++ b/libc/include/fenv.h
@@ -46,11 +46,9 @@
// fenv was always available on x86.
#if __ANDROID_API__ >= __ANDROID_API_L__ || defined(__i386__)
int feclearexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
- __INTRODUCED_IN_X86(9);
+int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int feraiseexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fesetexceptflag(const fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
- __INTRODUCED_IN_X86(9);
+int fesetexceptflag(const fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int fetestexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int fegetround(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
@@ -59,8 +57,7 @@
int fegetenv(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int feholdexcept(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int fesetenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int feupdateenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
- __INTRODUCED_IN_X86(9);
+int feupdateenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int feenableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
int fedisableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
diff --git a/libc/include/math.h b/libc/include/math.h
index beb66a7..7efc83a 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -217,7 +217,7 @@
long double lgammal(long double __x) __RENAME_LDBL(lgamma, 3, 21);
double tgamma(double __x);
-float tgammaf(float __x) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
+float tgammaf(float __x);
long double tgammal(long double __x) __RENAME_LDBL(tgamma, 3, 21);
double ceil(double __x);
@@ -276,8 +276,8 @@
float copysignf(float __value, float __sign) __attribute_const__;
long double copysignl(long double __value, long double __sign) __RENAME_LDBL(copysign, 3, 3) __attribute_const__;
-double nan(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
-float nanf(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
+double nan(const char* __kind) __attribute_const__;
+float nanf(const char* __kind) __attribute_const__;
long double nanl(const char* __kind) __RENAME_LDBL(nan, 13, 13) __attribute_const__;
double nextafter(double __x, double __y);
diff --git a/libc/include/netinet/ether.h b/libc/include/netinet/ether.h
index 6268a14..480063d 100644
--- a/libc/include/netinet/ether.h
+++ b/libc/include/netinet/ether.h
@@ -43,39 +43,31 @@
* representation of the given Ethernet address.
*
* Returns a pointer to a static buffer.
- *
- * Available since API level 11.
*/
-char* ether_ntoa(const struct ether_addr* __addr) __INTRODUCED_IN(11);
+char* ether_ntoa(const struct ether_addr* __addr);
/**
* [ether_ntoa_r(3)](http://man7.org/linux/man-pages/man3/ether_ntoa_r.3.html) returns a string
* representation of the given Ethernet address.
*
* Returns a pointer to the given buffer.
- *
- * Available since API level 11.
*/
-char* ether_ntoa_r(const struct ether_addr* __addr, char* __buf) __INTRODUCED_IN(11);
+char* ether_ntoa_r(const struct ether_addr* __addr, char* __buf);
/**
* [ether_aton(3)](http://man7.org/linux/man-pages/man3/ether_aton.3.html) returns an `ether_addr`
* corresponding to the given Ethernet address string.
*
* Returns a pointer to a static buffer, or NULL if the given string isn't a valid MAC address.
- *
- * Available since API level 11.
*/
-struct ether_addr* ether_aton(const char* __ascii) __INTRODUCED_IN(11);
+struct ether_addr* ether_aton(const char* __ascii);
/**
* [ether_aton_r(3)](http://man7.org/linux/man-pages/man3/ether_aton_r.3.html) returns an
* `ether_addr` corresponding to the given Ethernet address string.
*
* Returns a pointer to the given buffer, or NULL if the given string isn't a valid MAC address.
- *
- * Available since API level 11.
*/
-struct ether_addr* ether_aton_r(const char* __ascii, struct ether_addr* __addr) __INTRODUCED_IN(11);
+struct ether_addr* ether_aton_r(const char* __ascii, struct ether_addr* __addr);
__END_DECLS
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 31509b4..b549871 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -92,7 +92,7 @@
#define PTHREAD_SCOPE_SYSTEM 0
#define PTHREAD_SCOPE_PROCESS 1
-int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void)) __INTRODUCED_IN(12);
+int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void));
int pthread_attr_destroy(pthread_attr_t* __attr);
int pthread_attr_getdetachstate(const pthread_attr_t* __attr, int* __state);
diff --git a/libc/include/pwd.h b/libc/include/pwd.h
index 5c516d7..d481aac 100644
--- a/libc/include/pwd.h
+++ b/libc/include/pwd.h
@@ -89,8 +89,8 @@
void setpwent(void) __INTRODUCED_IN(26);
void endpwent(void) __INTRODUCED_IN(26);
-int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result) __INTRODUCED_IN(12);
-int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result) __INTRODUCED_IN(12);
+int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result);
+int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result);
__END_DECLS
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 1f50366..52a8ca6 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -56,7 +56,7 @@
int clone(int (*__fn)(void*), void* __child_stack, int __flags, void* __arg, ...)
__INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(17);
int unshare(int __flags) __INTRODUCED_IN(17);
-int sched_getcpu(void) __INTRODUCED_IN(12);
+int sched_getcpu(void);
int setns(int __fd, int __ns_type) __INTRODUCED_IN(21);
#ifdef __LP64__
@@ -74,8 +74,8 @@
__CPU_BITTYPE __bits[ CPU_SETSIZE / __CPU_BITS ];
} cpu_set_t;
-int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* __set) __INTRODUCED_IN(12);
-int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* __set) __INTRODUCED_IN(12);
+int sched_setaffinity(pid_t __pid, size_t __set_size, const cpu_set_t* __set);
+int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* __set);
#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t), set)
#define CPU_SET(cpu, set) CPU_SET_S(cpu, sizeof(cpu_set_t), set)
@@ -98,8 +98,8 @@
#define CPU_ALLOC(count) __sched_cpualloc((count))
#define CPU_FREE(set) __sched_cpufree((set))
-cpu_set_t* __sched_cpualloc(size_t __count) __INTRODUCED_IN(12);
-void __sched_cpufree(cpu_set_t* __set) __INTRODUCED_IN(12);
+cpu_set_t* __sched_cpualloc(size_t __count);
+void __sched_cpufree(cpu_set_t* __set);
#define CPU_ZERO_S(setsize, set) __builtin_memset(set, 0, setsize)
@@ -143,7 +143,7 @@
#define CPU_COUNT_S(setsize, set) __sched_cpucount((setsize), (set))
-int __sched_cpucount(size_t __set_size, const cpu_set_t* __set) __INTRODUCED_IN(12);
+int __sched_cpucount(size_t __set_size, const cpu_set_t* __set);
#endif /* __USE_GNU */
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index 67d3c2f..b22071f 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -73,10 +73,8 @@
#define setjmp(__env) setjmp(__env)
-int sigsetjmp(sigjmp_buf __env, int __save_signal_mask) __returns_twice __INTRODUCED_IN_ARM(9)
- __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
-__noreturn void siglongjmp(sigjmp_buf __env, int __value) __INTRODUCED_IN_ARM(9)
- __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
+int sigsetjmp(sigjmp_buf __env, int __save_signal_mask);
+__noreturn void siglongjmp(sigjmp_buf __env, int __value);
__END_DECLS
diff --git a/libc/include/signal.h b/libc/include/signal.h
index c788ca6..cd11656 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -105,7 +105,7 @@
int raise(int __signal);
int kill(pid_t __pid, int __signal);
int killpg(int __pgrp, int __signal);
-int tgkill(int __tgid, int __tid, int __signal) __INTRODUCED_IN_32(16);
+int tgkill(int __tgid, int __tid, int __signal);
int sigaltstack(const stack_t* __new_signal_stack, stack_t* __old_signal_stack);
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 689b650..8078bda 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -36,6 +36,10 @@
#pragma once
+/**
+ * `__BIONIC__` is always defined if you're building with bionic. See
+ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ */
#define __BIONIC__ 1
#if defined(__cplusplus)
@@ -305,14 +309,8 @@
__bos_dynamic_check_impl_and(bos_val, op, index, 1)
#define __bos_trivially_ge(bos_val, index) __bos_dynamic_check_impl((bos_val), >=, (index))
-
#define __bos_trivially_gt(bos_val, index) __bos_dynamic_check_impl((bos_val), >, (index))
-/* The names here are meant to match nicely with the __bos_unevaluated macros above. */
-#define __bos_trivially_not_lt __bos_trivially_ge
-#define __bos_trivially_not_le __bos_trivially_gt
-
-
#if defined(__BIONIC_FORTIFY) || defined(__BIONIC_DECLARE_FORTIFY_HELPERS)
# define __BIONIC_INCLUDE_FORTIFY_HEADERS 1
#endif
diff --git a/libc/include/sys/ifunc.h b/libc/include/sys/ifunc.h
new file mode 100644
index 0000000..7fbca4a
--- /dev/null
+++ b/libc/include/sys/ifunc.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#pragma once
+
+#include <sys/cdefs.h>
+
+/**
+ * @file sys/ifunc.h
+ * @brief Declarations used for ifunc resolvers. Currently only meaningful for arm64.
+ */
+
+__BEGIN_DECLS
+
+#if defined(__aarch64__)
+
+/**
+ * Provides information about hardware capabilities to ifunc resolvers.
+ *
+ * Starting with API level 30, ifunc resolvers on arm64 are passed two arguments. The first is a
+ * uint64_t whose value is equal to getauxval(AT_HWCAP) | _IFUNC_ARG_HWCAP. The second is a pointer
+ * to a data structure of this type. Prior to API level 30, no arguments are passed to ifunc
+ * resolvers. Code that wishes to be compatible with prior API levels should not accept any
+ * arguments in the resolver.
+ */
+typedef struct __ifunc_arg_t {
+ /** Set to sizeof(__ifunc_arg_t). */
+ unsigned long _size;
+
+ /** Set to getauxval(AT_HWCAP). */
+ unsigned long _hwcap;
+
+ /** Set to getauxval(AT_HWCAP2). */
+ unsigned long _hwcap2;
+} __ifunc_arg_t;
+
+/**
+ * If this bit is set in the first argument to an ifunc resolver, indicates that the second argument
+ * is a pointer to a data structure of type __ifunc_arg_t. This bit is always set on Android
+ * starting with API level 30.
+ */
+#define _IFUNC_ARG_HWCAP (1ULL << 62)
+
+#endif
+
+__END_DECLS
diff --git a/libc/include/sys/personality.h b/libc/include/sys/personality.h
index cea0bf8..9eb992f 100644
--- a/libc/include/sys/personality.h
+++ b/libc/include/sys/personality.h
@@ -43,9 +43,7 @@
* process' personality.
*
* Returns the previous persona on success, and returns -1 and sets `errno` on failure.
- *
- * Available since API level 15.
*/
-int personality(unsigned int __persona) __INTRODUCED_IN(15);
+int personality(unsigned int __persona);
__END_DECLS
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 9be444c..1ee8d2a 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -26,8 +26,12 @@
* SUCH DAMAGE.
*/
-#ifndef _SYS_SELECT_H_
-#define _SYS_SELECT_H_
+#pragma once
+
+/**
+ * @file sys/select.h
+ * @brief Wait for events on a set of file descriptors (but use <poll.h> instead).
+ */
#include <sys/cdefs.h>
#include <sys/types.h>
@@ -39,9 +43,17 @@
typedef unsigned long fd_mask;
+/**
+ * The limit on the largest fd that can be used with this API.
+ * Use <poll.h> instead.
+ */
#define FD_SETSIZE 1024
#define NFDBITS (8 * sizeof(fd_mask))
+/**
+ * The type of a file descriptor set. Limited to 1024 fds.
+ * Use <poll.h> instead.
+ */
typedef struct {
fd_mask fds_bits[FD_SETSIZE/NFDBITS];
} fd_set;
@@ -67,21 +79,53 @@
#define __FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
#define __FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
-
#if __ANDROID_API__ >= __ANDROID_API_L__
+
+/** Removes `fd` from the given set. Use <poll.h> instead. */
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
+/** Adds `fd` to the given set. Use <poll.h> instead. */
#define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
+/** Tests whether `fd` is in the given set. Use <poll.h> instead. */
#define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
+
#else
+
+/** Removes `fd` from the given set. Use <poll.h> instead. */
#define FD_CLR(fd, set) __FD_CLR(fd, set)
+/** Adds `fd` to the given set. Use <poll.h> instead. */
#define FD_SET(fd, set) __FD_SET(fd, set)
+/** Tests whether `fd` is in the given set. Use <poll.h> instead. */
#define FD_ISSET(fd, set) __FD_ISSET(fd, set)
+
#endif /* __ANDROID_API >= 21 */
+/**
+ * [select(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
+ * set of file descriptors. Use poll() instead.
+ *
+ * Returns the number of ready file descriptors on success, 0 for timeout,
+ * and returns -1 and sets `errno` on failure.
+ */
int select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, struct timeval* __timeout);
+
+/**
+ * [pselect(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
+ * set of file descriptors. Use ppoll() instead.
+ *
+ * Returns the number of ready file descriptors on success, 0 for timeout,
+ * and returns -1 and sets `errno` on failure.
+ */
int pselect(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset_t* __mask);
+
+/**
+ * [pselect64(2)](http://man7.org/linux/man-pages/man2/select.2.html) waits on a
+ * set of file descriptors. Use ppoll64() instead.
+ *
+ * Returns the number of ready file descriptors on success, 0 for timeout,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 28.
+ */
int pselect64(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset64_t* __mask) __INTRODUCED_IN(28);
__END_DECLS
-
-#endif
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 84a5015..79113b6 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -185,8 +185,7 @@
#define UTIME_NOW ((1L << 30) - 1L)
#define UTIME_OMIT ((1L << 30) - 2L)
-int utimensat(int __dir_fd, const char* __path, const struct timespec __times[2], int __flags)
- __INTRODUCED_IN(12);
+int utimensat(int __dir_fd, const char* __path, const struct timespec __times[2], int __flags);
int futimens(int __dir_fd, const struct timespec __times[2]) __INTRODUCED_IN(19);
__END_DECLS
diff --git a/libc/include/sys/system_properties.h b/libc/include/sys/system_properties.h
index f469599..a2e1923 100644
--- a/libc/include/sys/system_properties.h
+++ b/libc/include/sys/system_properties.h
@@ -43,7 +43,7 @@
/*
* Sets system property `name` to `value`, creating the system property if it doesn't already exist.
*/
-int __system_property_set(const char* __name, const char* __value) __INTRODUCED_IN(12);
+int __system_property_set(const char* __name, const char* __value);
/*
* Returns a `prop_info` corresponding system property `name`, or nullptr if it doesn't exist.
diff --git a/libc/include/time.h b/libc/include/time.h
index 48c5efc..a7a6fe5 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -105,8 +105,8 @@
int timer_getoverrun(timer_t __timer);
/* Non-standard extensions that are in the BSDs and glibc. */
-time_t timelocal(struct tm* __tm) __INTRODUCED_IN(12);
-time_t timegm(struct tm* __tm) __INTRODUCED_IN(12);
+time_t timelocal(struct tm* __tm);
+time_t timegm(struct tm* __tm);
#define TIME_UTC 1
int timespec_get(struct timespec* __ts, int __base) __INTRODUCED_IN(29);
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 9000407..7c01549 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -204,7 +204,7 @@
long pathconf(const char* __path, int __name);
int access(const char* __path, int __mode);
-int faccessat(int __dirfd, const char* __path, int __mode, int __flags) __INTRODUCED_IN(16);
+int faccessat(int __dirfd, const char* __path, int __mode, int __flags);
int link(const char* __old_path, const char* __new_path);
int linkat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, int __flags) __INTRODUCED_IN(21);
int unlink(const char* __path);
@@ -214,7 +214,7 @@
int rmdir(const char* __path);
int pipe(int __fds[2]);
#if defined(__USE_GNU)
-int pipe2(int __fds[2], int __flags) __INTRODUCED_IN(9);
+int pipe2(int __fds[2], int __flags);
#endif
int chroot(const char* __path);
int symlink(const char* __old_path, const char* __new_path);
@@ -242,17 +242,15 @@
int dup2(int __old_fd, int __new_fd);
int dup3(int __old_fd, int __new_fd, int __flags) __INTRODUCED_IN(21);
int fsync(int __fd);
-int fdatasync(int __fd) __INTRODUCED_IN(9);
+int fdatasync(int __fd);
/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
#if defined(__USE_FILE_OFFSET64)
int truncate(const char* __path, off_t __length) __RENAME(truncate64) __INTRODUCED_IN(21);
off_t lseek(int __fd, off_t __offset, int __whence) __RENAME(lseek64);
-ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset)
- __RENAME(pread64) __INTRODUCED_IN(12);
-ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset)
- __RENAME(pwrite64) __INTRODUCED_IN(12);
-int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64) __INTRODUCED_IN(12);
+ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset) __RENAME(pread64);
+ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset) __RENAME(pwrite64);
+int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64);
#else
int truncate(const char* __path, off_t __length);
off_t lseek(int __fd, off_t __offset, int __whence);
@@ -263,9 +261,9 @@
int truncate64(const char* __path, off64_t __length) __INTRODUCED_IN(21);
off64_t lseek64(int __fd, off64_t __offset, int __whence);
-ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset) __INTRODUCED_IN(12);
-ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset) __INTRODUCED_IN(12);
-int ftruncate64(int __fd, off64_t __length) __INTRODUCED_IN(12);
+ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset);
+ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset);
+int ftruncate64(int __fd, off64_t __length);
int pause(void);
unsigned int alarm(unsigned int __seconds);
@@ -280,7 +278,7 @@
int isatty(int __fd);
char* ttyname(int __fd);
-int ttyname_r(int __fd, char* __buf, size_t __buf_size) __INTRODUCED_IN(8);
+int ttyname_r(int __fd, char* __buf, size_t __buf_size);
int acct(const char* __path);
diff --git a/libc/kernel/uapi/asm-arm/asm/kvm.h b/libc/kernel/uapi/asm-arm/asm/kvm.h
index 95f0c4d..72bcb03 100644
--- a/libc/kernel/uapi/asm-arm/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm/asm/kvm.h
@@ -146,6 +146,16 @@
#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-common.h b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
index d9e73dc..091bd74 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-common.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
@@ -405,4 +405,6 @@
#define __NR_fsconfig (__NR_SYSCALL_BASE + 431)
#define __NR_fsmount (__NR_SYSCALL_BASE + 432)
#define __NR_fspick (__NR_SYSCALL_BASE + 433)
+#define __NR_pidfd_open (__NR_SYSCALL_BASE + 434)
+#define __NR_clone3 (__NR_SYSCALL_BASE + 435)
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/hwcap.h b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
index 80935fc..8a38ab7 100644
--- a/libc/kernel/uapi/asm-arm64/asm/hwcap.h
+++ b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
@@ -57,4 +57,6 @@
#define HWCAP2_SVEBITPERM (1 << 4)
#define HWCAP2_SVESHA3 (1 << 5)
#define HWCAP2_SVESM4 (1 << 6)
+#define HWCAP2_FLAGM2 (1 << 7)
+#define HWCAP2_FRINT (1 << 8)
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/kvm.h b/libc/kernel/uapi/asm-arm64/asm/kvm.h
index b62d9ef..e345744 100644
--- a/libc/kernel/uapi/asm-arm64/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm64/asm/kvm.h
@@ -141,6 +141,16 @@
#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
#define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
#define KVM_REG_ARM64_SVE_ZREG_BASE 0
#define KVM_REG_ARM64_SVE_PREG_BASE 0x400
diff --git a/libc/kernel/uapi/asm-arm64/asm/ptrace.h b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
index c4c5748..b3e0aea 100644
--- a/libc/kernel/uapi/asm-arm64/asm/ptrace.h
+++ b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
@@ -45,6 +45,8 @@
#define PSR_s 0x00ff0000
#define PSR_x 0x0000ff00
#define PSR_c 0x000000ff
+#define PTRACE_SYSEMU 31
+#define PTRACE_SYSEMU_SINGLESTEP 32
#ifndef __ASSEMBLY__
struct user_pt_regs {
__u64 regs[31];
diff --git a/libc/kernel/uapi/asm-generic/mman-common.h b/libc/kernel/uapi/asm-generic/mman-common.h
index b986825..21d0356 100644
--- a/libc/kernel/uapi/asm-generic/mman-common.h
+++ b/libc/kernel/uapi/asm-generic/mman-common.h
@@ -28,8 +28,13 @@
#define MAP_TYPE 0x0f
#define MAP_FIXED 0x10
#define MAP_ANONYMOUS 0x20
-#define MAP_UNINITIALIZED 0x0
+#define MAP_POPULATE 0x008000
+#define MAP_NONBLOCK 0x010000
+#define MAP_STACK 0x020000
+#define MAP_HUGETLB 0x040000
+#define MAP_SYNC 0x080000
#define MAP_FIXED_NOREPLACE 0x100000
+#define MAP_UNINITIALIZED 0x4000000
#define MLOCK_ONFAULT 0x01
#define MS_ASYNC 1
#define MS_INVALIDATE 2
diff --git a/libc/kernel/uapi/asm-generic/mman.h b/libc/kernel/uapi/asm-generic/mman.h
index 84caab7..33d43f7 100644
--- a/libc/kernel/uapi/asm-generic/mman.h
+++ b/libc/kernel/uapi/asm-generic/mman.h
@@ -24,11 +24,6 @@
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
#define MAP_NORESERVE 0x4000
-#define MAP_POPULATE 0x8000
-#define MAP_NONBLOCK 0x10000
-#define MAP_STACK 0x20000
-#define MAP_HUGETLB 0x40000
-#define MAP_SYNC 0x80000
#define MCL_CURRENT 1
#define MCL_FUTURE 2
#define MCL_ONFAULT 4
diff --git a/libc/kernel/uapi/asm-generic/socket.h b/libc/kernel/uapi/asm-generic/socket.h
index bfc9ce2..11557aa 100644
--- a/libc/kernel/uapi/asm-generic/socket.h
+++ b/libc/kernel/uapi/asm-generic/socket.h
@@ -94,6 +94,7 @@
#define SO_TIMESTAMPING_NEW 65
#define SO_RCVTIMEO_NEW 66
#define SO_SNDTIMEO_NEW 67
+#define SO_DETACH_REUSEPORT_BPF 68
#if __BITS_PER_LONG == 64 || defined(__x86_64__) && defined(__ILP32__)
#define SO_TIMESTAMP SO_TIMESTAMP_OLD
#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index 73520e1..2128ff5 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -392,8 +392,12 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#ifdef __ARCH_WANT_SYS_CLONE3
+#define __NR_clone3 435
+#endif
#undef __NR_syscalls
-#define __NR_syscalls 434
+#define __NR_syscalls 436
#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
#define __NR_fcntl __NR3264_fcntl
#define __NR_statfs __NR3264_statfs
diff --git a/libc/kernel/uapi/asm-mips/asm/socket.h b/libc/kernel/uapi/asm-mips/asm/socket.h
index fe15ad1..d24c09e 100644
--- a/libc/kernel/uapi/asm-mips/asm/socket.h
+++ b/libc/kernel/uapi/asm-mips/asm/socket.h
@@ -93,6 +93,7 @@
#define SO_TIMESTAMPING_NEW 65
#define SO_RCVTIMEO_NEW 66
#define SO_SNDTIMEO_NEW 67
+#define SO_DETACH_REUSEPORT_BPF 68
#if __BITS_PER_LONG == 64
#define SO_TIMESTAMP SO_TIMESTAMP_OLD
#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_n32.h b/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
index ad928ac..285b1f0 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_n32.h
@@ -380,4 +380,5 @@
#define __NR_fsconfig (__NR_Linux + 431)
#define __NR_fsmount (__NR_Linux + 432)
#define __NR_fspick (__NR_Linux + 433)
+#define __NR_pidfd_open (__NR_Linux + 434)
#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_n64.h b/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
index 0ffc069..9b2650f 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_n64.h
@@ -356,4 +356,5 @@
#define __NR_fsconfig (__NR_Linux + 431)
#define __NR_fsmount (__NR_Linux + 432)
#define __NR_fspick (__NR_Linux + 433)
+#define __NR_pidfd_open (__NR_Linux + 434)
#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
index af3c850..a335768 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n32.h
@@ -19,5 +19,5 @@
#ifndef _UAPI_ASM_MIPS_UNISTD_NR_N32_H
#define _UAPI_ASM_MIPS_UNISTD_NR_N32_H
#define __NR_N32_Linux 6000
-#define __NR_N32_Linux_syscalls 434
+#define __NR_N32_Linux_syscalls 435
#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
index c78f3e6..c4812a5 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_nr_n64.h
@@ -19,5 +19,5 @@
#ifndef _UAPI_ASM_MIPS_UNISTD_NR_N64_H
#define _UAPI_ASM_MIPS_UNISTD_NR_N64_H
#define __NR_64_Linux 5000
-#define __NR_64_Linux_syscalls 434
+#define __NR_64_Linux_syscalls 435
#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h b/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
index 444710e..041051a 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_nr_o32.h
@@ -19,5 +19,5 @@
#ifndef _UAPI_ASM_MIPS_UNISTD_NR_O32_H
#define _UAPI_ASM_MIPS_UNISTD_NR_O32_H
#define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls 434
+#define __NR_O32_Linux_syscalls 435
#endif
diff --git a/libc/kernel/uapi/asm-mips/asm/unistd_o32.h b/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
index 5bf392b..acbfa6b 100644
--- a/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
+++ b/libc/kernel/uapi/asm-mips/asm/unistd_o32.h
@@ -426,4 +426,5 @@
#define __NR_fsconfig (__NR_Linux + 431)
#define __NR_fsmount (__NR_Linux + 432)
#define __NR_fspick (__NR_Linux + 433)
+#define __NR_pidfd_open (__NR_Linux + 434)
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/bootparam.h b/libc/kernel/uapi/asm-x86/asm/bootparam.h
index dc90f57..af66fdb 100644
--- a/libc/kernel/uapi/asm-x86/asm/bootparam.h
+++ b/libc/kernel/uapi/asm-x86/asm/bootparam.h
@@ -38,6 +38,8 @@
#define XLF_EFI_HANDOVER_32 (1 << 2)
#define XLF_EFI_HANDOVER_64 (1 << 3)
#define XLF_EFI_KEXEC (1 << 4)
+#define XLF_5LEVEL (1 << 5)
+#define XLF_5LEVEL_ENABLED (1 << 6)
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/screen_info.h>
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm.h b/libc/kernel/uapi/asm-x86/asm/kvm.h
index 4ec3c10..d4865fb 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -318,6 +318,7 @@
#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
+#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
#define KVM_STATE_NESTED_FORMAT_VMX 0
#define KVM_STATE_NESTED_FORMAT_SVM 1
#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
@@ -349,4 +350,14 @@
struct kvm_vmx_nested_state_data vmx[0];
} data;
};
+struct kvm_pmu_event_filter {
+ __u32 action;
+ __u32 nevents;
+ __u32 fixed_counter_bitmap;
+ __u32 flags;
+ __u32 pad[4];
+ __u64 events[0];
+};
+#define KVM_PMU_EVENT_ALLOW 0
+#define KVM_PMU_EVENT_DENY 1
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm_para.h b/libc/kernel/uapi/asm-x86/asm/kvm_para.h
index 47ecca9..ad8fe0b 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm_para.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm_para.h
@@ -32,6 +32,8 @@
#define KVM_FEATURE_PV_TLB_FLUSH 9
#define KVM_FEATURE_ASYNC_PF_VMEXIT 10
#define KVM_FEATURE_PV_SEND_IPI 11
+#define KVM_FEATURE_POLL_CONTROL 12
+#define KVM_FEATURE_PV_SCHED_YIELD 13
#define KVM_HINTS_REALTIME 0
#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24
#define MSR_KVM_WALL_CLOCK 0x11
@@ -42,6 +44,7 @@
#define MSR_KVM_ASYNC_PF_EN 0x4b564d02
#define MSR_KVM_STEAL_TIME 0x4b564d03
#define MSR_KVM_PV_EOI_EN 0x4b564d04
+#define MSR_KVM_POLL_CONTROL 0x4b564d05
struct kvm_steal_time {
__u64 steal;
__u32 version;
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_32.h b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
index 09f2e7b..06e4a01 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
@@ -441,4 +441,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_64.h b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
index 36859b5..bcb6eae 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_64.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
@@ -363,4 +363,6 @@
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
index d3e2d3f..3357bd1 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
@@ -316,6 +316,8 @@
#define __NR_fsconfig (__X32_SYSCALL_BIT + 431)
#define __NR_fsmount (__X32_SYSCALL_BIT + 432)
#define __NR_fspick (__X32_SYSCALL_BIT + 433)
+#define __NR_pidfd_open (__X32_SYSCALL_BIT + 434)
+#define __NR_clone3 (__X32_SYSCALL_BIT + 435)
#define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
#define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
#define __NR_ioctl (__X32_SYSCALL_BIT + 514)
diff --git a/libc/kernel/uapi/drm/amdgpu_drm.h b/libc/kernel/uapi/drm/amdgpu_drm.h
index 193881d..dda9ced 100644
--- a/libc/kernel/uapi/drm/amdgpu_drm.h
+++ b/libc/kernel/uapi/drm/amdgpu_drm.h
@@ -546,6 +546,7 @@
#define AMDGPU_VRAM_TYPE_HBM 6
#define AMDGPU_VRAM_TYPE_DDR3 7
#define AMDGPU_VRAM_TYPE_DDR4 8
+#define AMDGPU_VRAM_TYPE_GDDR6 9
struct drm_amdgpu_info_device {
__u32 device_id;
__u32 chip_rev;
@@ -594,6 +595,7 @@
__u32 cu_ao_bitmap[4][4];
__u64 high_va_offset;
__u64 high_va_max;
+ __u32 pa_sc_tile_steering_override;
};
struct drm_amdgpu_info_hw_ip {
__u32 hw_ip_version_major;
@@ -628,6 +630,7 @@
#define AMDGPU_FAMILY_CZ 135
#define AMDGPU_FAMILY_AI 141
#define AMDGPU_FAMILY_RV 142
+#define AMDGPU_FAMILY_NV 143
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/drm.h b/libc/kernel/uapi/drm/drm.h
index 66adf99..7c5ffbb 100644
--- a/libc/kernel/uapi/drm/drm.h
+++ b/libc/kernel/uapi/drm/drm.h
@@ -23,6 +23,7 @@
#include <asm/ioctl.h>
typedef unsigned int drm_handle_t;
#else
+#include <stdint.h>
#include <sys/ioccom.h>
#include <sys/types.h>
typedef int8_t __s8;
diff --git a/libc/kernel/uapi/drm/drm_mode.h b/libc/kernel/uapi/drm/drm_mode.h
index 3f321d0..403c787 100644
--- a/libc/kernel/uapi/drm/drm_mode.h
+++ b/libc/kernel/uapi/drm/drm_mode.h
@@ -368,6 +368,26 @@
__u16 blue;
__u16 reserved;
};
+struct hdr_metadata_infoframe {
+ __u8 eotf;
+ __u8 metadata_type;
+ struct {
+ __u16 x, y;
+ } display_primaries[3];
+ struct {
+ __u16 x, y;
+ } white_point;
+ __u16 max_display_mastering_luminance;
+ __u16 min_display_mastering_luminance;
+ __u16 max_cll;
+ __u16 max_fall;
+};
+struct hdr_output_metadata {
+ __u32 metadata_type;
+ union {
+ struct hdr_metadata_infoframe hdmi_metadata_type1;
+ };
+};
#define DRM_MODE_PAGE_FLIP_EVENT 0x01
#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
diff --git a/libc/kernel/uapi/drm/i915_drm.h b/libc/kernel/uapi/drm/i915_drm.h
index d83a4c0..8965f01 100644
--- a/libc/kernel/uapi/drm/i915_drm.h
+++ b/libc/kernel/uapi/drm/i915_drm.h
@@ -46,6 +46,8 @@
struct i915_engine_class_instance {
__u16 engine_class;
__u16 engine_instance;
+#define I915_ENGINE_CLASS_INVALID_NONE - 1
+#define I915_ENGINE_CLASS_INVALID_VIRTUAL - 2
};
enum drm_i915_pmu_engine_sample {
I915_SAMPLE_BUSY = 0,
@@ -212,6 +214,8 @@
#define DRM_I915_PERF_ADD_CONFIG 0x37
#define DRM_I915_PERF_REMOVE_CONFIG 0x38
#define DRM_I915_QUERY 0x39
+#define DRM_I915_GEM_VM_CREATE 0x3a
+#define DRM_I915_GEM_VM_DESTROY 0x3b
#define DRM_IOCTL_I915_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
#define DRM_IOCTL_I915_FLUSH DRM_IO(DRM_COMMAND_BASE + DRM_I915_FLUSH)
#define DRM_IOCTL_I915_FLIP DRM_IO(DRM_COMMAND_BASE + DRM_I915_FLIP)
@@ -270,6 +274,8 @@
#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
+#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)
+#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control)
typedef struct drm_i915_batchbuffer {
int start;
int used;
@@ -351,6 +357,7 @@
#define I915_PARAM_HAS_CONTEXT_ISOLATION 50
#define I915_PARAM_CS_TIMESTAMP_FREQUENCY 51
#define I915_PARAM_MMAP_GTT_COHERENT 52
+#define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53
typedef struct drm_i915_getparam {
__s32 param;
int __user * value;
@@ -540,7 +547,8 @@
#define I915_EXEC_FENCE_OUT (1 << 17)
#define I915_EXEC_BATCH_FIRST (1 << 18)
#define I915_EXEC_FENCE_ARRAY (1 << 19)
-#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_ARRAY << 1))
+#define I915_EXEC_FENCE_SUBMIT (1 << 20)
+#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_SUBMIT << 1))
#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
#define i915_execbuffer2_set_context_id(eb2,context) (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
#define i915_execbuffer2_get_context_id(eb2) ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
@@ -681,7 +689,8 @@
__u32 ctx_id;
__u32 flags;
#define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0)
-#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN (- (I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS << 1))
+#define I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE (1u << 1)
+#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN (- (I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE << 1))
__u64 extensions;
};
struct drm_i915_gem_context_param {
@@ -699,22 +708,68 @@
#define I915_CONTEXT_MIN_USER_PRIORITY - 1023
#define I915_CONTEXT_PARAM_SSEU 0x7
#define I915_CONTEXT_PARAM_RECOVERABLE 0x8
+#define I915_CONTEXT_PARAM_VM 0x9
+#define I915_CONTEXT_PARAM_ENGINES 0xa
__u64 value;
};
struct drm_i915_gem_context_param_sseu {
struct i915_engine_class_instance engine;
__u32 flags;
+#define I915_CONTEXT_SSEU_FLAG_ENGINE_INDEX (1u << 0)
__u64 slice_mask;
__u64 subslice_mask;
__u16 min_eus_per_subslice;
__u16 max_eus_per_subslice;
__u32 rsvd;
};
+struct i915_context_engines_load_balance {
+ struct i915_user_extension base;
+ __u16 engine_index;
+ __u16 num_siblings;
+ __u32 flags;
+ __u64 mbz64;
+ struct i915_engine_class_instance engines[0];
+} __attribute__((packed));
+#define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__,N__) struct { struct i915_user_extension base; __u16 engine_index; __u16 num_siblings; __u32 flags; __u64 mbz64; struct i915_engine_class_instance engines[N__]; \
+} __attribute__((packed)) name__
+struct i915_context_engines_bond {
+ struct i915_user_extension base;
+ struct i915_engine_class_instance master;
+ __u16 virtual_index;
+ __u16 num_bonds;
+ __u64 flags;
+ __u64 mbz64[4];
+ struct i915_engine_class_instance engines[0];
+} __attribute__((packed));
+#define I915_DEFINE_CONTEXT_ENGINES_BOND(name__,N__) struct { struct i915_user_extension base; struct i915_engine_class_instance master; __u16 virtual_index; __u16 num_bonds; __u64 flags; __u64 mbz64[4]; struct i915_engine_class_instance engines[N__]; \
+} __attribute__((packed)) name__
+struct i915_context_param_engines {
+ __u64 extensions;
+#define I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE 0
+#define I915_CONTEXT_ENGINES_EXT_BOND 1
+ struct i915_engine_class_instance engines[0];
+} __attribute__((packed));
+#define I915_DEFINE_CONTEXT_PARAM_ENGINES(name__,N__) struct { __u64 extensions; struct i915_engine_class_instance engines[N__]; \
+} __attribute__((packed)) name__
struct drm_i915_gem_context_create_ext_setparam {
#define I915_CONTEXT_CREATE_EXT_SETPARAM 0
struct i915_user_extension base;
struct drm_i915_gem_context_param param;
};
+struct drm_i915_gem_context_create_ext_clone {
+#define I915_CONTEXT_CREATE_EXT_CLONE 1
+ struct i915_user_extension base;
+ __u32 clone_id;
+ __u32 flags;
+#define I915_CONTEXT_CLONE_ENGINES (1u << 0)
+#define I915_CONTEXT_CLONE_FLAGS (1u << 1)
+#define I915_CONTEXT_CLONE_SCHEDATTR (1u << 2)
+#define I915_CONTEXT_CLONE_SSEU (1u << 3)
+#define I915_CONTEXT_CLONE_TIMELINE (1u << 4)
+#define I915_CONTEXT_CLONE_VM (1u << 5)
+#define I915_CONTEXT_CLONE_UNKNOWN - (I915_CONTEXT_CLONE_VM << 1)
+ __u64 rsvd;
+};
struct drm_i915_gem_context_destroy {
__u32 ctx_id;
__u32 pad;
@@ -799,6 +854,7 @@
struct drm_i915_query_item {
__u64 query_id;
#define DRM_I915_QUERY_TOPOLOGY_INFO 1
+#define DRM_I915_QUERY_ENGINE_INFO 2
__s32 length;
__u32 flags;
__u64 data_ptr;
@@ -819,6 +875,20 @@
__u16 eu_stride;
__u8 data[];
};
+struct drm_i915_engine_info {
+ struct i915_engine_class_instance engine;
+ __u32 rsvd0;
+ __u64 flags;
+ __u64 capabilities;
+#define I915_VIDEO_CLASS_CAPABILITY_HEVC (1 << 0)
+#define I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC (1 << 1)
+ __u64 rsvd1[4];
+};
+struct drm_i915_query_engine_info {
+ __u32 num_engines;
+ __u32 rsvd[3];
+ struct drm_i915_engine_info engines[];
+};
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/panfrost_drm.h b/libc/kernel/uapi/drm/panfrost_drm.h
index 17f093b..4da1447 100644
--- a/libc/kernel/uapi/drm/panfrost_drm.h
+++ b/libc/kernel/uapi/drm/panfrost_drm.h
@@ -28,12 +28,16 @@
#define DRM_PANFROST_MMAP_BO 0x03
#define DRM_PANFROST_GET_PARAM 0x04
#define DRM_PANFROST_GET_BO_OFFSET 0x05
+#define DRM_PANFROST_PERFCNT_ENABLE 0x06
+#define DRM_PANFROST_PERFCNT_DUMP 0x07
#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
#define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo)
#define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo)
#define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param)
#define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
+#define DRM_IOCTL_PANFROST_PERFCNT_ENABLE DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable)
+#define DRM_IOCTL_PANFROST_PERFCNT_DUMP DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct drm_panfrost_perfcnt_dump)
#define PANFROST_JD_REQ_FS (1 << 0)
struct drm_panfrost_submit {
__u64 jc;
@@ -74,6 +78,13 @@
__u32 pad;
__u64 offset;
};
+struct drm_panfrost_perfcnt_enable {
+ __u32 enable;
+ __u32 counterset;
+};
+struct drm_panfrost_perfcnt_dump {
+ __u64 buf_ptr;
+};
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/v3d_drm.h b/libc/kernel/uapi/drm/v3d_drm.h
index 985f327..0b6b94f 100644
--- a/libc/kernel/uapi/drm/v3d_drm.h
+++ b/libc/kernel/uapi/drm/v3d_drm.h
@@ -29,6 +29,7 @@
#define DRM_V3D_GET_PARAM 0x04
#define DRM_V3D_GET_BO_OFFSET 0x05
#define DRM_V3D_SUBMIT_TFU 0x06
+#define DRM_V3D_SUBMIT_CSD 0x07
#define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)
#define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
#define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo)
@@ -36,6 +37,7 @@
#define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)
#define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)
#define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
+#define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
struct drm_v3d_submit_cl {
__u32 bcl_start;
__u32 bcl_end;
@@ -76,6 +78,7 @@
DRM_V3D_PARAM_V3D_CORE0_IDENT1,
DRM_V3D_PARAM_V3D_CORE0_IDENT2,
DRM_V3D_PARAM_SUPPORTS_TFU,
+ DRM_V3D_PARAM_SUPPORTS_CSD,
};
struct drm_v3d_get_param {
__u32 param;
@@ -99,6 +102,14 @@
__u32 in_sync;
__u32 out_sync;
};
+struct drm_v3d_submit_csd {
+ __u32 cfg[7];
+ __u32 coef[4];
+ __u64 bo_handles;
+ __u32 bo_handle_count;
+ __u32 in_sync;
+ __u32 out_sync;
+};
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/linux/adfs_fs.h b/libc/kernel/uapi/linux/adfs_fs.h
index 6fb9347..aa1d732 100644
--- a/libc/kernel/uapi/linux/adfs_fs.h
+++ b/libc/kernel/uapi/linux/adfs_fs.h
@@ -41,12 +41,13 @@
__u8 log2sharesize : 4;
__u8 unused40 : 4;
__u8 big_flag : 1;
- __u8 unused41 : 1;
+ __u8 unused41 : 7;
__u8 nzones_high;
+ __u8 reserved43;
__le32 format_version;
__le32 root_size;
__u8 unused52[60 - 52];
-};
+} __attribute__((packed, aligned(4)));
#define ADFS_DISCRECORD (0xc00)
#define ADFS_DR_OFFSET (0x1c0)
#define ADFS_DR_SIZE 60
diff --git a/libc/kernel/uapi/linux/audit.h b/libc/kernel/uapi/linux/audit.h
index 509d734..3f1d8f0 100644
--- a/libc/kernel/uapi/linux/audit.h
+++ b/libc/kernel/uapi/linux/audit.h
@@ -211,6 +211,7 @@
#define AUDIT_OBJ_GID 110
#define AUDIT_FIELD_COMPARE 111
#define AUDIT_EXE 112
+#define AUDIT_SADDR_FAM 113
#define AUDIT_ARG0 200
#define AUDIT_ARG1 (AUDIT_ARG0 + 1)
#define AUDIT_ARG2 (AUDIT_ARG0 + 2)
diff --git a/libc/kernel/uapi/linux/batadv_packet.h b/libc/kernel/uapi/linux/batadv_packet.h
index 6d5226c..ede53cf 100644
--- a/libc/kernel/uapi/linux/batadv_packet.h
+++ b/libc/kernel/uapi/linux/batadv_packet.h
@@ -60,6 +60,8 @@
BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
+ BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
+ BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
};
#define BATADV_TT_DATA_TYPE_MASK 0x0F
enum batadv_tt_data_flags {
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index 3f09421..7e78758 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -148,6 +148,7 @@
BPF_PROG_TYPE_FLOW_DISSECTOR,
BPF_PROG_TYPE_CGROUP_SYSCTL,
BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
+ BPF_PROG_TYPE_CGROUP_SOCKOPT,
};
enum bpf_attach_type {
BPF_CGROUP_INET_INGRESS,
@@ -171,6 +172,8 @@
BPF_CGROUP_SYSCTL,
BPF_CGROUP_UDP4_RECVMSG,
BPF_CGROUP_UDP6_RECVMSG,
+ BPF_CGROUP_GETSOCKOPT,
+ BPF_CGROUP_SETSOCKOPT,
__MAX_BPF_ATTACH_TYPE
};
#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
@@ -178,6 +181,7 @@
#define BPF_F_ALLOW_MULTI (1U << 1)
#define BPF_F_STRICT_ALIGNMENT (1U << 0)
#define BPF_F_ANY_ALIGNMENT (1U << 1)
+#define BPF_F_TEST_RND_HI32 (1U << 2)
#define BPF_PSEUDO_MAP_FD 1
#define BPF_PSEUDO_MAP_VALUE 2
#define BPF_PSEUDO_CALL 1
@@ -326,7 +330,7 @@
__u64 probe_addr;
} task_fd_query;
} __attribute__((aligned(8)));
-#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete),
+#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal),
#define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
enum bpf_func_id {
__BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
@@ -475,6 +479,10 @@
__u32 sacked_out;
__u64 bytes_received;
__u64 bytes_acked;
+ __u32 dsack_dups;
+ __u32 delivered;
+ __u32 delivered_ce;
+ __u32 icsk_retransmits;
};
struct bpf_sock_tuple {
union {
@@ -492,6 +500,9 @@
} ipv6;
};
};
+struct bpf_xdp_sock {
+ __u32 queue_id;
+};
#define XDP_PACKET_HEADROOM 256
enum xdp_action {
XDP_ABORTED = 0,
@@ -601,6 +612,7 @@
__u32 protocol;
__u32 msg_src_ip4;
__u32 msg_src_ip6[4];
+ __bpf_md_ptr(struct bpf_sock *, sk);
};
struct bpf_sock_ops {
__u32 op;
@@ -642,11 +654,13 @@
__u32 sk_txhash;
__u64 bytes_received;
__u64 bytes_acked;
+ __bpf_md_ptr(struct bpf_sock *, sk);
};
#define BPF_SOCK_OPS_RTO_CB_FLAG (1 << 0)
#define BPF_SOCK_OPS_RETRANS_CB_FLAG (1 << 1)
#define BPF_SOCK_OPS_STATE_CB_FLAG (1 << 2)
-#define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7
+#define BPF_SOCK_OPS_RTT_CB_FLAG (1 << 3)
+#define BPF_SOCK_OPS_ALL_CB_FLAGS 0xF
enum {
BPF_SOCK_OPS_VOID,
BPF_SOCK_OPS_TIMEOUT_INIT,
@@ -660,6 +674,7 @@
BPF_SOCK_OPS_RETRANS_CB,
BPF_SOCK_OPS_STATE_CB,
BPF_SOCK_OPS_TCP_LISTEN_CB,
+ BPF_SOCK_OPS_RTT_CB,
};
enum {
BPF_TCP_ESTABLISHED = 1,
@@ -783,4 +798,13 @@
__u32 write;
__u32 file_pos;
};
+struct bpf_sockopt {
+ __bpf_md_ptr(struct bpf_sock *, sk);
+ __bpf_md_ptr(void *, optval);
+ __bpf_md_ptr(void *, optval_end);
+ __s32 level;
+ __s32 optname;
+ __s32 optlen;
+ __s32 retval;
+};
#endif
diff --git a/libc/kernel/uapi/linux/btrfs_tree.h b/libc/kernel/uapi/linux/btrfs_tree.h
index 0618f66..be0c8b0 100644
--- a/libc/kernel/uapi/linux/btrfs_tree.h
+++ b/libc/kernel/uapi/linux/btrfs_tree.h
@@ -383,6 +383,7 @@
#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA)
#define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID10)
#define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)
+#define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1)
#define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
#define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
#define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | BTRFS_AVAIL_ALLOC_BIT_SINGLE)
diff --git a/libc/kernel/uapi/linux/cec.h b/libc/kernel/uapi/linux/cec.h
index 05af529..a3aa2d6 100644
--- a/libc/kernel/uapi/linux/cec.h
+++ b/libc/kernel/uapi/linux/cec.h
@@ -38,6 +38,7 @@
__u8 tx_error_cnt;
};
#define CEC_MSG_FL_REPLY_TO_FOLLOWERS (1 << 0)
+#define CEC_MSG_FL_RAW (1 << 1)
#define CEC_TX_STATUS_OK (1 << 0)
#define CEC_TX_STATUS_ARB_LOST (1 << 1)
#define CEC_TX_STATUS_NACK (1 << 2)
diff --git a/libc/kernel/uapi/linux/coda.h b/libc/kernel/uapi/linux/coda.h
index 93d6f7c..aad1b97 100644
--- a/libc/kernel/uapi/linux/coda.h
+++ b/libc/kernel/uapi/linux/coda.h
@@ -38,10 +38,6 @@
typedef unsigned long long u_quad_t;
#endif
#define inline
-struct timespec {
- long ts_sec;
- long ts_nsec;
-};
#else
#include <sys/time.h>
typedef unsigned long long u_quad_t;
@@ -57,12 +53,6 @@
#else
#define cdev_t dev_t
#endif
-#ifdef __CYGWIN32__
-struct timespec {
- time_t tv_sec;
- long tv_nsec;
-};
-#endif
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef signed char int8_t;
@@ -132,6 +122,10 @@
C_VFIFO,
C_VBAD
};
+struct coda_timespec {
+ int64_t tv_sec;
+ long tv_nsec;
+};
struct coda_vattr {
long va_type;
u_short va_mode;
@@ -141,9 +135,9 @@
long va_fileid;
u_quad_t va_size;
long va_blocksize;
- struct timespec va_atime;
- struct timespec va_mtime;
- struct timespec va_ctime;
+ struct coda_timespec va_atime;
+ struct coda_timespec va_mtime;
+ struct coda_timespec va_ctime;
u_long va_gen;
u_long va_flags;
cdev_t va_rdev;
@@ -190,17 +184,18 @@
#define CODA_STATFS 34
#define CODA_STORE 35
#define CODA_RELEASE 36
-#define CODA_NCALLS 37
+#define CODA_ACCESS_INTENT 37
+#define CODA_NCALLS 38
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
#define VC_MAXDATASIZE 8192
#define VC_MAXMSGSIZE sizeof(union inputArgs) + sizeof(union outputArgs) + VC_MAXDATASIZE
#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
-#define CODA_KERNEL_VERSION 3
+#define CODA_KERNEL_VERSION 5
struct coda_in_hdr {
u_int32_t opcode;
u_int32_t unique;
- pid_t pid;
- pid_t pgid;
+ __kernel_pid_t pid;
+ __kernel_pid_t pgid;
vuid_t uid;
};
struct coda_out_hdr {
@@ -439,6 +434,21 @@
struct coda_out_hdr oh;
struct coda_statfs stat;
};
+#define CODA_ACCESS_TYPE_READ 1
+#define CODA_ACCESS_TYPE_WRITE 2
+#define CODA_ACCESS_TYPE_MMAP 3
+#define CODA_ACCESS_TYPE_READ_FINISH 4
+#define CODA_ACCESS_TYPE_WRITE_FINISH 5
+struct coda_access_intent_in {
+ struct coda_in_hdr ih;
+ struct CodaFid VFid;
+ int count;
+ int pos;
+ int type;
+};
+struct coda_access_intent_out {
+ struct coda_out_hdr out;
+};
#define CODA_NOCACHE 0x80000000
union inputArgs {
struct coda_in_hdr ih;
@@ -464,6 +474,7 @@
struct coda_open_by_fd_in coda_open_by_fd;
struct coda_open_by_path_in coda_open_by_path;
struct coda_statfs_in coda_statfs;
+ struct coda_access_intent_in coda_access_intent;
};
union outputArgs {
struct coda_out_hdr oh;
diff --git a/libc/kernel/uapi/linux/coda_psdev.h b/libc/kernel/uapi/linux/coda_psdev.h
deleted file mode 100644
index 7850db6..0000000
--- a/libc/kernel/uapi/linux/coda_psdev.h
+++ /dev/null
@@ -1,28 +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__CODA_PSDEV_H
-#define _UAPI__CODA_PSDEV_H
-#include <linux/magic.h>
-#define CODA_PSDEV_MAJOR 67
-#define MAX_CODADEVS 5
-#define CODA_REQ_ASYNC 0x1
-#define CODA_REQ_READ 0x2
-#define CODA_REQ_WRITE 0x4
-#define CODA_REQ_ABORT 0x8
-#endif
diff --git a/libc/kernel/uapi/linux/devlink.h b/libc/kernel/uapi/linux/devlink.h
index 972d8cc..1cf9d95 100644
--- a/libc/kernel/uapi/linux/devlink.h
+++ b/libc/kernel/uapi/linux/devlink.h
@@ -83,6 +83,8 @@
DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,
DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
DEVLINK_CMD_FLASH_UPDATE,
+ DEVLINK_CMD_FLASH_UPDATE_END,
+ DEVLINK_CMD_FLASH_UPDATE_STATUS,
__DEVLINK_CMD_MAX,
DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
};
@@ -119,6 +121,8 @@
DEVLINK_PORT_FLAVOUR_PHYSICAL,
DEVLINK_PORT_FLAVOUR_CPU,
DEVLINK_PORT_FLAVOUR_DSA,
+ DEVLINK_PORT_FLAVOUR_PCI_PF,
+ DEVLINK_PORT_FLAVOUR_PCI_VF,
};
enum devlink_param_cmode {
DEVLINK_PARAM_CMODE_RUNTIME,
@@ -256,6 +260,11 @@
DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,
DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME,
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG,
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,
+ DEVLINK_ATTR_PORT_PCI_PF_NUMBER,
+ DEVLINK_ATTR_PORT_PCI_VF_NUMBER,
__DEVLINK_ATTR_MAX,
DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/dma-buf.h b/libc/kernel/uapi/linux/dma-buf.h
index 7771906..3d7c099 100644
--- a/libc/kernel/uapi/linux/dma-buf.h
+++ b/libc/kernel/uapi/linux/dma-buf.h
@@ -28,6 +28,8 @@
#define DMA_BUF_SYNC_START (0 << 2)
#define DMA_BUF_SYNC_END (1 << 2)
#define DMA_BUF_SYNC_VALID_FLAGS_MASK (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
+#define DMA_BUF_NAME_LEN 32
#define DMA_BUF_BASE 'b'
#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
+#define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
#endif
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index 67a7efd..6b2b8d5 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -604,6 +604,8 @@
ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64,
ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65,
ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66,
+ ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67,
+ ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68,
__ETHTOOL_LINK_MODE_MASK_NBITS
};
#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) (1UL << (ETHTOOL_LINK_MODE_ ##base_name ##_BIT))
diff --git a/libc/kernel/uapi/linux/if_ether.h b/libc/kernel/uapi/linux/if_ether.h
index 9e0b15c..dd2dedb 100644
--- a/libc/kernel/uapi/linux/if_ether.h
+++ b/libc/kernel/uapi/linux/if_ether.h
@@ -72,6 +72,7 @@
#define ETH_P_802_EX1 0x88B5
#define ETH_P_PREAUTH 0x88C7
#define ETH_P_TIPC 0x88CA
+#define ETH_P_LLDP 0x88CC
#define ETH_P_MACSEC 0x88E5
#define ETH_P_8021AH 0x88E7
#define ETH_P_MVRP 0x88F5
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 8d0080b..45ef92b 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -515,6 +515,7 @@
IFLA_BOND_AD_USER_PORT_KEY,
IFLA_BOND_AD_ACTOR_SYSTEM,
IFLA_BOND_TLB_DYNAMIC_LB,
+ IFLA_BOND_PEER_NOTIF_DELAY,
__IFLA_BOND_MAX,
};
#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
@@ -561,6 +562,7 @@
IFLA_VF_IB_NODE_GUID,
IFLA_VF_IB_PORT_GUID,
IFLA_VF_VLAN_LIST,
+ IFLA_VF_BROADCAST,
__IFLA_VF_MAX,
};
#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
@@ -568,6 +570,9 @@
__u32 vf;
__u8 mac[32];
};
+struct ifla_vf_broadcast {
+ __u8 broadcast[32];
+};
struct ifla_vf_vlan {
__u32 vf;
__u32 vlan;
diff --git a/libc/kernel/uapi/linux/if_packet.h b/libc/kernel/uapi/linux/if_packet.h
index 300aa7b..db24bbe 100644
--- a/libc/kernel/uapi/linux/if_packet.h
+++ b/libc/kernel/uapi/linux/if_packet.h
@@ -117,7 +117,7 @@
#define TP_STATUS_WRONG_FORMAT (1 << 2)
#define TP_STATUS_TS_SOFTWARE (1 << 29)
#define TP_STATUS_TS_SYS_HARDWARE (1 << 30)
-#define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
+#define TP_STATUS_TS_RAW_HARDWARE (1U << 31)
#define TP_FT_REQ_FILL_RXHASH 0x1
struct tpacket_hdr {
unsigned long tp_status;
diff --git a/libc/kernel/uapi/linux/if_xdp.h b/libc/kernel/uapi/linux/if_xdp.h
index a0935bd..2c2596c 100644
--- a/libc/kernel/uapi/linux/if_xdp.h
+++ b/libc/kernel/uapi/linux/if_xdp.h
@@ -47,6 +47,7 @@
#define XDP_UMEM_FILL_RING 5
#define XDP_UMEM_COMPLETION_RING 6
#define XDP_STATISTICS 7
+#define XDP_OPTIONS 8
struct xdp_umem_reg {
__u64 addr;
__u64 len;
@@ -58,6 +59,10 @@
__u64 rx_invalid_descs;
__u64 tx_invalid_descs;
};
+struct xdp_options {
+ __u32 flags;
+};
+#define XDP_OPTIONS_ZEROCOPY (1 << 0)
#define XDP_PGOFF_RX_RING 0
#define XDP_PGOFF_TX_RING 0x80000000
#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
index 434b24b..c5055ba 100644
--- a/libc/kernel/uapi/linux/io_uring.h
+++ b/libc/kernel/uapi/linux/io_uring.h
@@ -33,6 +33,7 @@
__u32 fsync_flags;
__u16 poll_events;
__u32 sync_range_flags;
+ __u32 msg_flags;
};
__u64 user_data;
union {
@@ -42,6 +43,7 @@
};
#define IOSQE_FIXED_FILE (1U << 0)
#define IOSQE_IO_DRAIN (1U << 1)
+#define IOSQE_IO_LINK (1U << 2)
#define IORING_SETUP_IOPOLL (1U << 0)
#define IORING_SETUP_SQPOLL (1U << 1)
#define IORING_SETUP_SQ_AFF (1U << 2)
@@ -54,6 +56,8 @@
#define IORING_OP_POLL_ADD 6
#define IORING_OP_POLL_REMOVE 7
#define IORING_OP_SYNC_FILE_RANGE 8
+#define IORING_OP_SENDMSG 9
+#define IORING_OP_RECVMSG 10
#define IORING_FSYNC_DATASYNC (1U << 0)
struct io_uring_cqe {
__u64 user_data;
diff --git a/libc/kernel/uapi/linux/iommu.h b/libc/kernel/uapi/linux/iommu.h
new file mode 100644
index 0000000..3c7849a
--- /dev/null
+++ b/libc/kernel/uapi/linux/iommu.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** 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_IOMMU_H
+#define _UAPI_IOMMU_H
+#include <linux/types.h>
+#define IOMMU_FAULT_PERM_READ (1 << 0)
+#define IOMMU_FAULT_PERM_WRITE (1 << 1)
+#define IOMMU_FAULT_PERM_EXEC (1 << 2)
+#define IOMMU_FAULT_PERM_PRIV (1 << 3)
+enum iommu_fault_type {
+ IOMMU_FAULT_DMA_UNRECOV = 1,
+ IOMMU_FAULT_PAGE_REQ,
+};
+enum iommu_fault_reason {
+ IOMMU_FAULT_REASON_UNKNOWN = 0,
+ IOMMU_FAULT_REASON_PASID_FETCH,
+ IOMMU_FAULT_REASON_BAD_PASID_ENTRY,
+ IOMMU_FAULT_REASON_PASID_INVALID,
+ IOMMU_FAULT_REASON_WALK_EABT,
+ IOMMU_FAULT_REASON_PTE_FETCH,
+ IOMMU_FAULT_REASON_PERMISSION,
+ IOMMU_FAULT_REASON_ACCESS,
+ IOMMU_FAULT_REASON_OOR_ADDRESS,
+};
+struct iommu_fault_unrecoverable {
+ __u32 reason;
+#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0)
+#define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1)
+#define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2)
+ __u32 flags;
+ __u32 pasid;
+ __u32 perm;
+ __u64 addr;
+ __u64 fetch_addr;
+};
+struct iommu_fault_page_request {
+#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
+#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
+#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
+ __u32 flags;
+ __u32 pasid;
+ __u32 grpid;
+ __u32 perm;
+ __u64 addr;
+ __u64 private_data[2];
+};
+struct iommu_fault {
+ __u32 type;
+ __u32 padding;
+ union {
+ struct iommu_fault_unrecoverable event;
+ struct iommu_fault_page_request prm;
+ __u8 padding2[56];
+ };
+};
+enum iommu_page_response_code {
+ IOMMU_PAGE_RESP_SUCCESS = 0,
+ IOMMU_PAGE_RESP_INVALID,
+ IOMMU_PAGE_RESP_FAILURE,
+};
+struct iommu_page_response {
+#define IOMMU_PAGE_RESP_VERSION_1 1
+ __u32 version;
+#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0)
+ __u32 flags;
+ __u32 pasid;
+ __u32 grpid;
+ __u32 code;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/ip_vs.h b/libc/kernel/uapi/linux/ip_vs.h
index 0230aae..6e3defe 100644
--- a/libc/kernel/uapi/linux/ip_vs.h
+++ b/libc/kernel/uapi/linux/ip_vs.h
@@ -88,8 +88,12 @@
enum {
IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0,
IP_VS_CONN_F_TUNNEL_TYPE_GUE,
+ IP_VS_CONN_F_TUNNEL_TYPE_GRE,
IP_VS_CONN_F_TUNNEL_TYPE_MAX,
};
+#define IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM (0)
+#define IP_VS_TUNNEL_ENCAP_FLAG_CSUM (1 << 0)
+#define IP_VS_TUNNEL_ENCAP_FLAG_REMCSUM (1 << 1)
struct ip_vs_service_user {
__u16 protocol;
__be32 addr;
@@ -243,6 +247,7 @@
IPVS_DEST_ATTR_STATS64,
IPVS_DEST_ATTR_TUN_TYPE,
IPVS_DEST_ATTR_TUN_PORT,
+ IPVS_DEST_ATTR_TUN_FLAGS,
__IPVS_DEST_ATTR_MAX,
};
#define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/isdn.h b/libc/kernel/uapi/linux/isdn.h
deleted file mode 100644
index b1ec37e..0000000
--- a/libc/kernel/uapi/linux/isdn.h
+++ /dev/null
@@ -1,125 +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__ISDN_H__
-#define _UAPI__ISDN_H__
-#include <linux/ioctl.h>
-#include <linux/tty.h>
-#define ISDN_MAX_DRIVERS 32
-#define ISDN_MAX_CHANNELS 64
-#define IIOCNETAIF _IO('I', 1)
-#define IIOCNETDIF _IO('I', 2)
-#define IIOCNETSCF _IO('I', 3)
-#define IIOCNETGCF _IO('I', 4)
-#define IIOCNETANM _IO('I', 5)
-#define IIOCNETDNM _IO('I', 6)
-#define IIOCNETGNM _IO('I', 7)
-#define IIOCGETSET _IO('I', 8)
-#define IIOCSETSET _IO('I', 9)
-#define IIOCSETVER _IO('I', 10)
-#define IIOCNETHUP _IO('I', 11)
-#define IIOCSETGST _IO('I', 12)
-#define IIOCSETBRJ _IO('I', 13)
-#define IIOCSIGPRF _IO('I', 14)
-#define IIOCGETPRF _IO('I', 15)
-#define IIOCSETPRF _IO('I', 16)
-#define IIOCGETMAP _IO('I', 17)
-#define IIOCSETMAP _IO('I', 18)
-#define IIOCNETASL _IO('I', 19)
-#define IIOCNETDIL _IO('I', 20)
-#define IIOCGETCPS _IO('I', 21)
-#define IIOCGETDVR _IO('I', 22)
-#define IIOCNETLCR _IO('I', 23)
-#define IIOCNETDWRSET _IO('I', 24)
-#define IIOCNETALN _IO('I', 32)
-#define IIOCNETDLN _IO('I', 33)
-#define IIOCNETGPN _IO('I', 34)
-#define IIOCDBGVAR _IO('I', 127)
-#define IIOCDRVCTL _IO('I', 128)
-#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
-#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
-#define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2)
-#define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3)
-#define ISDN_NET_ENCAP_ETHER 0
-#define ISDN_NET_ENCAP_RAWIP 1
-#define ISDN_NET_ENCAP_IPTYP 2
-#define ISDN_NET_ENCAP_CISCOHDLC 3
-#define ISDN_NET_ENCAP_SYNCPPP 4
-#define ISDN_NET_ENCAP_UIHDLC 5
-#define ISDN_NET_ENCAP_CISCOHDLCK 6
-#define ISDN_NET_ENCAP_X25IFACE 7
-#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
-#define ISDN_USAGE_NONE 0
-#define ISDN_USAGE_RAW 1
-#define ISDN_USAGE_MODEM 2
-#define ISDN_USAGE_NET 3
-#define ISDN_USAGE_VOICE 4
-#define ISDN_USAGE_FAX 5
-#define ISDN_USAGE_MASK 7
-#define ISDN_USAGE_DISABLED 32
-#define ISDN_USAGE_EXCLUSIVE 64
-#define ISDN_USAGE_OUTGOING 128
-#define ISDN_MODEM_NUMREG 24
-#define ISDN_LMSNLEN 255
-#define ISDN_CMSGLEN 50
-#define ISDN_MSNLEN 32
-#define NET_DV 0x06
-#define TTY_DV 0x06
-#define INF_DV 0x01
-typedef struct {
- char drvid[25];
- unsigned long arg;
-} isdn_ioctl_struct;
-typedef struct {
- char name[10];
- char phone[ISDN_MSNLEN];
- int outgoing;
-} isdn_net_ioctl_phone;
-typedef struct {
- char name[10];
- char master[10];
- char slave[10];
- char eaz[256];
- char drvid[25];
- int onhtime;
- int charge;
- int l2_proto;
- int l3_proto;
- int p_encap;
- int exclusive;
- int dialmax;
- int slavedelay;
- int cbdelay;
- int chargehup;
- int ihup;
- int secure;
- int callback;
- int cbhup;
- int pppbind;
- int chargeint;
- int triggercps;
- int dialtimeout;
- int dialwait;
- int dialmode;
-} isdn_net_ioctl_cfg;
-#define ISDN_NET_DIALMODE_MASK 0xC0
-#define ISDN_NET_DM_OFF 0x00
-#define ISDN_NET_DM_MANUAL 0x40
-#define ISDN_NET_DM_AUTO 0x80
-#define ISDN_NET_DIALMODE(x) ((& (x))->flags & ISDN_NET_DIALMODE_MASK)
-#endif
diff --git a/libc/kernel/uapi/linux/isdn/capicmd.h b/libc/kernel/uapi/linux/isdn/capicmd.h
index d6ce6ed..419b278 100644
--- a/libc/kernel/uapi/linux/isdn/capicmd.h
+++ b/libc/kernel/uapi/linux/isdn/capicmd.h
@@ -21,6 +21,7 @@
#define CAPI_MSG_BASELEN 8
#define CAPI_DATA_B3_REQ_LEN (CAPI_MSG_BASELEN + 4 + 4 + 2 + 2 + 2)
#define CAPI_DATA_B3_RESP_LEN (CAPI_MSG_BASELEN + 4 + 2)
+#define CAPI_DISCONNECT_B3_RESP_LEN (CAPI_MSG_BASELEN + 4)
#define CAPI_ALERT 0x01
#define CAPI_CONNECT 0x02
#define CAPI_CONNECT_ACTIVE 0x03
diff --git a/libc/kernel/uapi/linux/isdn_ppp.h b/libc/kernel/uapi/linux/isdn_ppp.h
deleted file mode 100644
index 83cb77c..0000000
--- a/libc/kernel/uapi/linux/isdn_ppp.h
+++ /dev/null
@@ -1,61 +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_ISDN_PPP_H
-#define _UAPI_LINUX_ISDN_PPP_H
-#define CALLTYPE_INCOMING 0x1
-#define CALLTYPE_OUTGOING 0x2
-#define CALLTYPE_CALLBACK 0x4
-#define IPPP_VERSION "2.2.0"
-struct pppcallinfo {
- int calltype;
- unsigned char local_num[64];
- unsigned char remote_num[64];
- int charge_units;
-};
-#define PPPIOCGCALLINFO _IOWR('t', 128, struct pppcallinfo)
-#define PPPIOCBUNDLE _IOW('t', 129, int)
-#define PPPIOCGMPFLAGS _IOR('t', 130, int)
-#define PPPIOCSMPFLAGS _IOW('t', 131, int)
-#define PPPIOCSMPMTU _IOW('t', 132, int)
-#define PPPIOCSMPMRU _IOW('t', 133, int)
-#define PPPIOCGCOMPRESSORS _IOR('t', 134, unsigned long[8])
-#define PPPIOCSCOMPRESSOR _IOW('t', 135, int)
-#define PPPIOCGIFNAME _IOR('t', 136, char[IFNAMSIZ])
-#define SC_MP_PROT 0x00000200
-#define SC_REJ_MP_PROT 0x00000400
-#define SC_OUT_SHORT_SEQ 0x00000800
-#define SC_IN_SHORT_SEQ 0x00004000
-#define SC_DECOMP_ON 0x01
-#define SC_COMP_ON 0x02
-#define SC_DECOMP_DISCARD 0x04
-#define SC_COMP_DISCARD 0x08
-#define SC_LINK_DECOMP_ON 0x10
-#define SC_LINK_COMP_ON 0x20
-#define SC_LINK_DECOMP_DISCARD 0x40
-#define SC_LINK_COMP_DISCARD 0x80
-#define ISDN_PPP_COMP_MAX_OPTIONS 16
-#define IPPP_COMP_FLAG_XMIT 0x1
-#define IPPP_COMP_FLAG_LINK 0x2
-struct isdn_ppp_comp_data {
- int num;
- unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
- int optlen;
- int flags;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/isdnif.h b/libc/kernel/uapi/linux/isdnif.h
deleted file mode 100644
index 933f4b1..0000000
--- a/libc/kernel/uapi/linux/isdnif.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__ISDNIF_H__
-#define _UAPI__ISDNIF_H__
-#define ISDN_PTYPE_UNKNOWN 0
-#define ISDN_PTYPE_1TR6 1
-#define ISDN_PTYPE_EURO 2
-#define ISDN_PTYPE_LEASED 3
-#define ISDN_PTYPE_NI1 4
-#define ISDN_PTYPE_MAX 7
-#define ISDN_PROTO_L2_X75I 0
-#define ISDN_PROTO_L2_X75UI 1
-#define ISDN_PROTO_L2_X75BUI 2
-#define ISDN_PROTO_L2_HDLC 3
-#define ISDN_PROTO_L2_TRANS 4
-#define ISDN_PROTO_L2_X25DTE 5
-#define ISDN_PROTO_L2_X25DCE 6
-#define ISDN_PROTO_L2_V11096 7
-#define ISDN_PROTO_L2_V11019 8
-#define ISDN_PROTO_L2_V11038 9
-#define ISDN_PROTO_L2_MODEM 10
-#define ISDN_PROTO_L2_FAX 11
-#define ISDN_PROTO_L2_HDLC_56K 12
-#define ISDN_PROTO_L2_MAX 15
-#define ISDN_PROTO_L3_TRANS 0
-#define ISDN_PROTO_L3_TRANSDSP 1
-#define ISDN_PROTO_L3_FCLASS2 2
-#define ISDN_PROTO_L3_FCLASS1 3
-#define ISDN_PROTO_L3_MAX 7
-#endif
diff --git a/libc/kernel/uapi/linux/isst_if.h b/libc/kernel/uapi/linux/isst_if.h
new file mode 100644
index 0000000..322f70d
--- /dev/null
+++ b/libc/kernel/uapi/linux/isst_if.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** 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 __ISST_IF_H
+#define __ISST_IF_H
+#include <linux/types.h>
+struct isst_if_platform_info {
+ __u16 api_version;
+ __u16 driver_version;
+ __u16 max_cmds_per_ioctl;
+ __u8 mbox_supported;
+ __u8 mmio_supported;
+};
+struct isst_if_cpu_map {
+ __u32 logical_cpu;
+ __u32 physical_cpu;
+};
+struct isst_if_cpu_maps {
+ __u32 cmd_count;
+ struct isst_if_cpu_map cpu_map[1];
+};
+struct isst_if_io_reg {
+ __u32 read_write;
+ __u32 logical_cpu;
+ __u32 reg;
+ __u32 value;
+};
+struct isst_if_io_regs {
+ __u32 req_count;
+ struct isst_if_io_reg io_reg[1];
+};
+struct isst_if_mbox_cmd {
+ __u32 logical_cpu;
+ __u32 parameter;
+ __u32 req_data;
+ __u32 resp_data;
+ __u16 command;
+ __u16 sub_command;
+ __u32 reserved;
+};
+struct isst_if_mbox_cmds {
+ __u32 cmd_count;
+ struct isst_if_mbox_cmd mbox_cmd[1];
+};
+struct isst_if_msr_cmd {
+ __u32 read_write;
+ __u32 logical_cpu;
+ __u64 msr;
+ __u64 data;
+};
+struct isst_if_msr_cmds {
+ __u32 cmd_count;
+ struct isst_if_msr_cmd msr_cmd[1];
+};
+#define ISST_IF_MAGIC 0xFE
+#define ISST_IF_GET_PLATFORM_INFO _IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *)
+#define ISST_IF_GET_PHY_ID _IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *)
+#define ISST_IF_IO_CMD _IOW(ISST_IF_MAGIC, 2, struct isst_if_io_regs *)
+#define ISST_IF_MBOX_COMMAND _IOWR(ISST_IF_MAGIC, 3, struct isst_if_mbox_cmds *)
+#define ISST_IF_MSR_COMMAND _IOWR(ISST_IF_MAGIC, 4, struct isst_if_msr_cmds *)
+#endif
diff --git a/libc/kernel/uapi/linux/keyctl.h b/libc/kernel/uapi/linux/keyctl.h
index 53f0468..e3fef38 100644
--- a/libc/kernel/uapi/linux/keyctl.h
+++ b/libc/kernel/uapi/linux/keyctl.h
@@ -66,6 +66,8 @@
#define KEYCTL_PKEY_SIGN 27
#define KEYCTL_PKEY_VERIFY 28
#define KEYCTL_RESTRICT_KEYRING 29
+#define KEYCTL_MOVE 30
+#define KEYCTL_CAPABILITIES 31
struct keyctl_dh_params {
union {
#ifndef __cplusplus
@@ -104,4 +106,15 @@
};
__u32 __spare[7];
};
+#define KEYCTL_MOVE_EXCL 0x00000001
+#define KEYCTL_CAPS0_CAPABILITIES 0x01
+#define KEYCTL_CAPS0_PERSISTENT_KEYRINGS 0x02
+#define KEYCTL_CAPS0_DIFFIE_HELLMAN 0x04
+#define KEYCTL_CAPS0_PUBLIC_KEY 0x08
+#define KEYCTL_CAPS0_BIG_KEY 0x10
+#define KEYCTL_CAPS0_INVALIDATE 0x20
+#define KEYCTL_CAPS0_RESTRICT_KEYRING 0x40
+#define KEYCTL_CAPS0_MOVE 0x80
+#define KEYCTL_CAPS1_NS_KEYRING_NAME 0x01
+#define KEYCTL_CAPS1_NS_KEY_TAG 0x02
#endif
diff --git a/libc/kernel/uapi/linux/kfd_ioctl.h b/libc/kernel/uapi/linux/kfd_ioctl.h
index 400c423..8b09f00 100644
--- a/libc/kernel/uapi/linux/kfd_ioctl.h
+++ b/libc/kernel/uapi/linux/kfd_ioctl.h
@@ -26,9 +26,10 @@
__u32 major_version;
__u32 minor_version;
};
-#define KFD_IOC_QUEUE_TYPE_COMPUTE 0
-#define KFD_IOC_QUEUE_TYPE_SDMA 1
-#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
+#define KFD_IOC_QUEUE_TYPE_COMPUTE 0x0
+#define KFD_IOC_QUEUE_TYPE_SDMA 0x1
+#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 0x2
+#define KFD_IOC_QUEUE_TYPE_SDMA_XGMI 0x3
#define KFD_MAX_QUEUE_PERCENTAGE 100
#define KFD_MAX_QUEUE_PRIORITY 15
struct kfd_ioctl_create_queue_args {
@@ -236,6 +237,7 @@
#define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1)
#define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2)
#define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3)
+#define KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP (1 << 4)
#define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31)
#define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30)
#define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29)
@@ -279,6 +281,10 @@
__u32 gpu_id;
__u32 dmabuf_fd;
};
+enum kfd_mmio_remap {
+ KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0,
+ KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4,
+};
#define AMDKFD_IOCTL_BASE 'K'
#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
#define AMDKFD_IOR(nr,type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index 374b0d1..7b8fb1b 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -529,7 +529,8 @@
#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0)
#define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
-#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE)
+#define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
+#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE | KVM_X86_DISABLE_EXITS_CSTATE)
struct kvm_enable_cap {
__u32 cap;
__u32 flags;
@@ -775,6 +776,7 @@
#define KVM_CAP_ARM_SVE 170
#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
+#define KVM_CAP_PMU_EVENT_FILTER 173
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_irqchip {
__u32 irqchip;
@@ -1017,6 +1019,7 @@
#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg)
#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)
#define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char)
+#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
diff --git a/libc/kernel/uapi/linux/kvm_para.h b/libc/kernel/uapi/linux/kvm_para.h
index b08a605..9a4dd29 100644
--- a/libc/kernel/uapi/linux/kvm_para.h
+++ b/libc/kernel/uapi/linux/kvm_para.h
@@ -34,5 +34,6 @@
#define KVM_HC_MIPS_CONSOLE_OUTPUT 8
#define KVM_HC_CLOCK_PAIRING 9
#define KVM_HC_SEND_IPI 10
+#define KVM_HC_SCHED_YIELD 11
#include <asm/kvm_para.h>
#endif
diff --git a/libc/kernel/uapi/linux/magic.h b/libc/kernel/uapi/linux/magic.h
index f3b337e..38b5c85 100644
--- a/libc/kernel/uapi/linux/magic.h
+++ b/libc/kernel/uapi/linux/magic.h
@@ -94,4 +94,6 @@
#define UDF_SUPER_MAGIC 0x15013346
#define BALLOON_KVM_MAGIC 0x13661366
#define ZSMALLOC_MAGIC 0x58295829
+#define DMA_BUF_MAGIC 0x444d4142
+#define Z3FOLD_MAGIC 0x33
#endif
diff --git a/libc/kernel/uapi/linux/media.h b/libc/kernel/uapi/linux/media.h
index 68821e7..fe29568 100644
--- a/libc/kernel/uapi/linux/media.h
+++ b/libc/kernel/uapi/linux/media.h
@@ -68,7 +68,7 @@
#define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002)
#define MEDIA_ENT_FL_DEFAULT (1 << 0)
#define MEDIA_ENT_FL_CONNECTOR (1 << 1)
-#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
+#define MEDIA_ENT_ID_FLAG_NEXT (1U << 31)
struct media_entity_desc {
__u32 id;
char name[32];
diff --git a/libc/kernel/uapi/linux/mii.h b/libc/kernel/uapi/linux/mii.h
index 5c87990..3c6c564 100644
--- a/libc/kernel/uapi/linux/mii.h
+++ b/libc/kernel/uapi/linux/mii.h
@@ -113,6 +113,8 @@
#define EXPANSION_NPCAPABLE 0x0008
#define EXPANSION_MFAULTS 0x0010
#define EXPANSION_RESV 0xffe0
+#define ESTATUS_1000_XFULL 0x8000
+#define ESTATUS_1000_XHALF 0x4000
#define ESTATUS_1000_TFULL 0x2000
#define ESTATUS_1000_THALF 0x1000
#define NWAYTEST_RESV1 0x00ff
diff --git a/libc/kernel/uapi/linux/wanrouter.h b/libc/kernel/uapi/linux/netfilter/nf_synproxy.h
similarity index 68%
copy from libc/kernel/uapi/linux/wanrouter.h
copy to libc/kernel/uapi/linux/netfilter/nf_synproxy.h
index 9bd45a3..474838e 100644
--- a/libc/kernel/uapi/linux/wanrouter.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_synproxy.h
@@ -16,12 +16,18 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_ROUTER_H
-#define _UAPI_ROUTER_H
-enum wan_states {
- WAN_UNCONFIGURED,
- WAN_DISCONNECTED,
- WAN_CONNECTING,
- WAN_CONNECTED
+#ifndef _NF_SYNPROXY_H
+#define _NF_SYNPROXY_H
+#include <linux/types.h>
+#define NF_SYNPROXY_OPT_MSS 0x01
+#define NF_SYNPROXY_OPT_WSCALE 0x02
+#define NF_SYNPROXY_OPT_SACK_PERM 0x04
+#define NF_SYNPROXY_OPT_TIMESTAMP 0x08
+#define NF_SYNPROXY_OPT_ECN 0x10
+#define NF_SYNPROXY_OPT_MASK (NF_SYNPROXY_OPT_MSS | NF_SYNPROXY_OPT_WSCALE | NF_SYNPROXY_OPT_SACK_PERM | NF_SYNPROXY_OPT_TIMESTAMP)
+struct nf_synproxy_info {
+ __u8 options;
+ __u8 wscale;
+ __u16 mss;
};
#endif
diff --git a/libc/kernel/uapi/linux/netfilter/nf_tables.h b/libc/kernel/uapi/linux/netfilter/nf_tables.h
index 6869f58..ec6ac82 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_tables.h
@@ -125,6 +125,7 @@
NFTA_CHAIN_TYPE,
NFTA_CHAIN_COUNTERS,
NFTA_CHAIN_PAD,
+ NFTA_CHAIN_FLAGS,
__NFTA_CHAIN_MAX
};
#define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
@@ -372,6 +373,7 @@
enum nft_exthdr_op {
NFT_EXTHDR_OP_IPV6,
NFT_EXTHDR_OP_TCPOPT,
+ NFT_EXTHDR_OP_IPV4,
__NFT_EXTHDR_OP_MAX
};
#define NFT_EXTHDR_OP_MAX (__NFT_EXTHDR_OP_MAX - 1)
@@ -416,6 +418,8 @@
NFT_META_SECPATH,
NFT_META_IIFKIND,
NFT_META_OIFKIND,
+ NFT_META_BRI_IIFPVID,
+ NFT_META_BRI_IIFVPROTO,
};
enum nft_rt_keys {
NFT_RT_CLASSID,
@@ -740,6 +744,16 @@
__NFTA_CT_TIMEOUT_MAX,
};
#define NFTA_CT_TIMEOUT_MAX (__NFTA_CT_TIMEOUT_MAX - 1)
+enum nft_ct_expectation_attributes {
+ NFTA_CT_EXPECT_UNSPEC,
+ NFTA_CT_EXPECT_L3PROTO,
+ NFTA_CT_EXPECT_L4PROTO,
+ NFTA_CT_EXPECT_DPORT,
+ NFTA_CT_EXPECT_TIMEOUT,
+ NFTA_CT_EXPECT_SIZE,
+ __NFTA_CT_EXPECT_MAX,
+};
+#define NFTA_CT_EXPECT_MAX (__NFTA_CT_EXPECT_MAX - 1)
#define NFT_OBJECT_UNSPEC 0
#define NFT_OBJECT_COUNTER 1
#define NFT_OBJECT_QUOTA 2
@@ -749,7 +763,8 @@
#define NFT_OBJECT_TUNNEL 6
#define NFT_OBJECT_CT_TIMEOUT 7
#define NFT_OBJECT_SECMARK 8
-#define __NFT_OBJECT_MAX 9
+#define NFT_OBJECT_CT_EXPECT 9
+#define __NFT_OBJECT_MAX 10
#define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1)
enum nft_object_attributes {
NFTA_OBJ_UNSPEC,
@@ -793,6 +808,14 @@
enum nft_osf_flags {
NFT_OSF_F_VERSION = (1 << 0),
};
+enum nft_synproxy_attributes {
+ NFTA_SYNPROXY_UNSPEC,
+ NFTA_SYNPROXY_MSS,
+ NFTA_SYNPROXY_WSCALE,
+ NFTA_SYNPROXY_FLAGS,
+ __NFTA_SYNPROXY_MAX,
+};
+#define NFTA_SYNPROXY_MAX (__NFTA_SYNPROXY_MAX - 1)
enum nft_devices_attributes {
NFTA_DEVICE_UNSPEC,
NFTA_DEVICE_NAME,
diff --git a/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h b/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h
index cb53431..4d7f436 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_SYNPROXY.h
@@ -18,15 +18,11 @@
****************************************************************************/
#ifndef _XT_SYNPROXY_H
#define _XT_SYNPROXY_H
-#include <linux/types.h>
-#define XT_SYNPROXY_OPT_MSS 0x01
-#define XT_SYNPROXY_OPT_WSCALE 0x02
-#define XT_SYNPROXY_OPT_SACK_PERM 0x04
-#define XT_SYNPROXY_OPT_TIMESTAMP 0x08
-#define XT_SYNPROXY_OPT_ECN 0x10
-struct xt_synproxy_info {
- __u8 options;
- __u8 wscale;
- __u16 mss;
-};
+#include <linux/netfilter/nf_synproxy.h>
+#define XT_SYNPROXY_OPT_MSS NF_SYNPROXY_OPT_MSS
+#define XT_SYNPROXY_OPT_WSCALE NF_SYNPROXY_OPT_WSCALE
+#define XT_SYNPROXY_OPT_SACK_PERM NF_SYNPROXY_OPT_SACK_PERM
+#define XT_SYNPROXY_OPT_TIMESTAMP NF_SYNPROXY_OPT_TIMESTAMP
+#define XT_SYNPROXY_OPT_ECN NF_SYNPROXY_OPT_ECN
+#define xt_synproxy_info nf_synproxy_info
#endif
diff --git a/libc/kernel/uapi/linux/netfilter/xt_connlabel.h b/libc/kernel/uapi/linux/netfilter/xt_connlabel.h
index f59cbee..7548fa1 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_connlabel.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_connlabel.h
@@ -16,6 +16,8 @@
***
****************************************************************************
****************************************************************************/
+#ifndef _UAPI_XT_CONNLABEL_H
+#define _UAPI_XT_CONNLABEL_H
#include <linux/types.h>
#define XT_CONNLABEL_MAXBIT 127
enum xt_connlabel_mtopts {
@@ -26,3 +28,4 @@
__u16 bit;
__u16 options;
};
+#endif
diff --git a/libc/kernel/uapi/linux/netfilter/xt_nfacct.h b/libc/kernel/uapi/linux/netfilter/xt_nfacct.h
index 4060002..a2b042e 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_nfacct.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_nfacct.h
@@ -24,4 +24,8 @@
char name[NFACCT_NAME_MAX];
struct nf_acct * nfacct;
};
+struct xt_nfacct_match_info_v1 {
+ char name[NFACCT_NAME_MAX];
+ struct nf_acct * nfacct __attribute__((aligned(8)));
+};
#endif
diff --git a/libc/kernel/uapi/linux/netfilter/xt_owner.h b/libc/kernel/uapi/linux/netfilter/xt_owner.h
index d829dab..e077aad 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_owner.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_owner.h
@@ -23,7 +23,9 @@
XT_OWNER_UID = 1 << 0,
XT_OWNER_GID = 1 << 1,
XT_OWNER_SOCKET = 1 << 2,
+ XT_OWNER_SUPPL_GROUPS = 1 << 3,
};
+#define XT_OWNER_MASK (XT_OWNER_UID | XT_OWNER_GID | XT_OWNER_SOCKET | XT_OWNER_SUPPL_GROUPS)
struct xt_owner_match_info {
__u32 uid_min, uid_max;
__u32 gid_min, gid_max;
diff --git a/libc/kernel/uapi/linux/flat.h b/libc/kernel/uapi/linux/nexthop.h
similarity index 60%
copy from libc/kernel/uapi/linux/flat.h
copy to libc/kernel/uapi/linux/nexthop.h
index d2af100..a2a959f 100644
--- a/libc/kernel/uapi/linux/flat.h
+++ b/libc/kernel/uapi/linux/nexthop.h
@@ -16,27 +16,40 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_LINUX_FLAT_H
-#define _UAPI_LINUX_FLAT_H
-#define FLAT_VERSION 0x00000004L
-#define MAX_SHARED_LIBS (1)
-struct flat_hdr {
- char magic[4];
- unsigned long rev;
- unsigned long entry;
- unsigned long data_start;
- unsigned long data_end;
- unsigned long bss_end;
- unsigned long stack_size;
- unsigned long reloc_start;
- unsigned long reloc_count;
- unsigned long flags;
- unsigned long build_date;
- unsigned long filler[5];
+#ifndef _UAPI_LINUX_NEXTHOP_H
+#define _UAPI_LINUX_NEXTHOP_H
+#include <linux/types.h>
+struct nhmsg {
+ unsigned char nh_family;
+ unsigned char nh_scope;
+ unsigned char nh_protocol;
+ unsigned char resvd;
+ unsigned int nh_flags;
};
-#define FLAT_FLAG_RAM 0x0001
-#define FLAT_FLAG_GOTPIC 0x0002
-#define FLAT_FLAG_GZIP 0x0004
-#define FLAT_FLAG_GZDATA 0x0008
-#define FLAT_FLAG_KTRACE 0x0010
+struct nexthop_grp {
+ __u32 id;
+ __u8 weight;
+ __u8 resvd1;
+ __u16 resvd2;
+};
+enum {
+ NEXTHOP_GRP_TYPE_MPATH,
+ __NEXTHOP_GRP_TYPE_MAX,
+};
+#define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
+enum {
+ NHA_UNSPEC,
+ NHA_ID,
+ NHA_GROUP,
+ NHA_GROUP_TYPE,
+ NHA_BLACKHOLE,
+ NHA_OIF,
+ NHA_GATEWAY,
+ NHA_ENCAP_TYPE,
+ NHA_ENCAP,
+ NHA_GROUPS,
+ NHA_MASTER,
+ __NHA_MAX,
+};
+#define NHA_MAX (__NHA_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index 12b37ae..082601d 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -463,6 +463,8 @@
NL80211_ATTR_AIRTIME_WEIGHT,
NL80211_ATTR_STA_TX_POWER_SETTING,
NL80211_ATTR_STA_TX_POWER,
+ NL80211_ATTR_SAE_PASSWORD,
+ NL80211_ATTR_TWT_RESPONDER,
__NL80211_ATTR_AFTER_LAST,
NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -1017,6 +1019,7 @@
enum nl80211_wpa_versions {
NL80211_WPA_VERSION_1 = 1 << 0,
NL80211_WPA_VERSION_2 = 1 << 1,
+ NL80211_WPA_VERSION_3 = 1 << 2,
};
enum nl80211_key_default_types {
__NL80211_KEY_DEFAULT_TYPE_INVALID,
@@ -1284,7 +1287,7 @@
NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28,
NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29,
NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30,
- NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31,
+ NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1U << 31,
};
enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_VHT_IBSS,
@@ -1326,6 +1329,7 @@
NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
NL80211_EXT_FEATURE_EXT_KEY_ID,
NL80211_EXT_FEATURE_STA_TX_PWR,
+ NL80211_EXT_FEATURE_SAE_OFFLOAD,
NUM_NL80211_EXT_FEATURES,
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
};
diff --git a/libc/kernel/uapi/linux/pci_regs.h b/libc/kernel/uapi/linux/pci_regs.h
index 4c8cc95..bd4d98f 100644
--- a/libc/kernel/uapi/linux/pci_regs.h
+++ b/libc/kernel/uapi/linux/pci_regs.h
@@ -437,6 +437,7 @@
#define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002
#define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003
#define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004
+#define PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005
#define PCI_EXP_LNKCAP_MLW 0x000003f0
#define PCI_EXP_LNKCAP_ASPMS 0x00000c00
#define PCI_EXP_LNKCAP_L0SEL 0x00007000
@@ -465,6 +466,7 @@
#define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002
#define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003
#define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004
+#define PCI_EXP_LNKSTA_CLS_32_0GB 0x0005
#define PCI_EXP_LNKSTA_NLW 0x03f0
#define PCI_EXP_LNKSTA_NLW_X1 0x0010
#define PCI_EXP_LNKSTA_NLW_X2 0x0020
@@ -562,6 +564,7 @@
#define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004
#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008
#define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010
+#define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020
#define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100
#define PCI_EXP_LNKCTL2 48
#define PCI_EXP_LNKCTL2_TLS 0x000f
@@ -569,6 +572,7 @@
#define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002
#define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003
#define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004
+#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005
#define PCI_EXP_LNKSTA2 50
#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52
#define PCI_EXP_SLTCAP2 52
diff --git a/libc/kernel/uapi/linux/pkt_cls.h b/libc/kernel/uapi/linux/pkt_cls.h
index 6db3a6d..0727916 100644
--- a/libc/kernel/uapi/linux/pkt_cls.h
+++ b/libc/kernel/uapi/linux/pkt_cls.h
@@ -94,6 +94,9 @@
TCA_ID_SIMP = TCA_ACT_SIMP,
TCA_ID_IFE = TCA_ACT_IFE,
TCA_ID_SAMPLE = TCA_ACT_SAMPLE,
+ TCA_ID_CTINFO,
+ TCA_ID_MPLS,
+ TCA_ID_CT,
__TCA_ID_MAX = 255
};
#define TCA_ID_MAX __TCA_ID_MAX
@@ -431,10 +434,24 @@
TCA_FLOWER_KEY_PORT_SRC_MAX,
TCA_FLOWER_KEY_PORT_DST_MIN,
TCA_FLOWER_KEY_PORT_DST_MAX,
+ TCA_FLOWER_KEY_CT_STATE,
+ TCA_FLOWER_KEY_CT_STATE_MASK,
+ TCA_FLOWER_KEY_CT_ZONE,
+ TCA_FLOWER_KEY_CT_ZONE_MASK,
+ TCA_FLOWER_KEY_CT_MARK,
+ TCA_FLOWER_KEY_CT_MARK_MASK,
+ TCA_FLOWER_KEY_CT_LABELS,
+ TCA_FLOWER_KEY_CT_LABELS_MASK,
__TCA_FLOWER_MAX,
};
#define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
enum {
+ TCA_FLOWER_KEY_CT_FLAGS_NEW = 1 << 0,
+ TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1,
+ TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2,
+ TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3,
+};
+enum {
TCA_FLOWER_KEY_ENC_OPTS_UNSPEC,
TCA_FLOWER_KEY_ENC_OPTS_GENEVE,
__TCA_FLOWER_KEY_ENC_OPTS_MAX,
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index 2e1f24b..15ee3b0 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -18,6 +18,7 @@
****************************************************************************/
#ifndef __LINUX_PKT_SCHED_H
#define __LINUX_PKT_SCHED_H
+#include <linux/const.h>
#include <linux/types.h>
#define TC_PRIO_BESTEFFORT 0
#define TC_PRIO_FILLER 1
@@ -740,8 +741,9 @@
__s32 delta;
__s32 clockid;
__u32 flags;
-#define TC_ETF_DEADLINE_MODE_ON BIT(0)
-#define TC_ETF_OFFLOAD_ON BIT(1)
+#define TC_ETF_DEADLINE_MODE_ON _BITUL(0)
+#define TC_ETF_OFFLOAD_ON _BITUL(1)
+#define TC_ETF_SKIP_SOCK_CHECK _BITUL(2)
};
enum {
TCA_ETF_UNSPEC,
@@ -875,6 +877,7 @@
__TCA_TAPRIO_SCHED_MAX,
};
#define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1)
+#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST 0x1
enum {
TCA_TAPRIO_ATTR_UNSPEC,
TCA_TAPRIO_ATTR_PRIOMAP,
@@ -886,6 +889,8 @@
TCA_TAPRIO_ATTR_ADMIN_SCHED,
TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME,
TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION,
+ TCA_TAPRIO_ATTR_FLAGS,
+ TCA_TAPRIO_ATTR_TXTIME_DELAY,
__TCA_TAPRIO_ATTR_MAX,
};
#define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/ptrace.h b/libc/kernel/uapi/linux/ptrace.h
index 4a68738..a1528db 100644
--- a/libc/kernel/uapi/linux/ptrace.h
+++ b/libc/kernel/uapi/linux/ptrace.h
@@ -55,6 +55,34 @@
__u64 filter_off;
__u64 flags;
};
+#define PTRACE_GET_SYSCALL_INFO 0x420e
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+struct ptrace_syscall_info {
+ __u8 op;
+ __u32 arch __attribute__((__aligned__(sizeof(__u32))));
+ __u64 instruction_pointer;
+ __u64 stack_pointer;
+ union {
+ struct {
+ __u64 nr;
+ __u64 args[6];
+ } entry;
+ struct {
+ __s64 rval;
+ __u8 is_error;
+ } exit;
+ struct {
+ __u64 nr;
+ __u64 args[6];
+ __u32 ret_data;
+ } seccomp;
+ };
+};
+#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
+#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
#define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
#define PTRACE_EVENT_FORK 1
#define PTRACE_EVENT_VFORK 2
diff --git a/libc/kernel/uapi/linux/rds.h b/libc/kernel/uapi/linux/rds.h
index 951427f..537aab5 100644
--- a/libc/kernel/uapi/linux/rds.h
+++ b/libc/kernel/uapi/linux/rds.h
@@ -170,6 +170,8 @@
__u32 rdma_mr_max;
__u32 rdma_mr_size;
__u8 tos;
+ __u8 sl;
+ __u32 cache_allocs;
};
struct rds6_info_rdma_connection {
struct in6_addr src_addr;
@@ -182,6 +184,8 @@
__u32 rdma_mr_max;
__u32 rdma_mr_size;
__u8 tos;
+ __u8 sl;
+ __u32 cache_allocs;
};
enum rds_message_rxpath_latency {
RDS_MSG_RX_HDR_TO_DGRAM_START = 0,
diff --git a/libc/kernel/uapi/linux/rtnetlink.h b/libc/kernel/uapi/linux/rtnetlink.h
index 33af1b3..b0feb7e 100644
--- a/libc/kernel/uapi/linux/rtnetlink.h
+++ b/libc/kernel/uapi/linux/rtnetlink.h
@@ -139,6 +139,12 @@
#define RTM_DELCHAIN RTM_DELCHAIN
RTM_GETCHAIN,
#define RTM_GETCHAIN RTM_GETCHAIN
+ RTM_NEWNEXTHOP = 104,
+#define RTM_NEWNEXTHOP RTM_NEWNEXTHOP
+ RTM_DELNEXTHOP,
+#define RTM_DELNEXTHOP RTM_DELNEXTHOP
+ RTM_GETNEXTHOP,
+#define RTM_GETNEXTHOP RTM_GETNEXTHOP
__RTM_MAX,
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
};
@@ -257,6 +263,7 @@
RTA_IP_PROTO,
RTA_SPORT,
RTA_DPORT,
+ RTA_NH_ID,
__RTA_MAX
};
#define RTA_MAX (__RTA_MAX - 1)
@@ -522,6 +529,8 @@
#define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R
RTNLGRP_IPV6_MROUTE_R,
#define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R
+ RTNLGRP_NEXTHOP,
+#define RTNLGRP_NEXTHOP RTNLGRP_NEXTHOP
__RTNLGRP_MAX
};
#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/sched.h b/libc/kernel/uapi/linux/sched.h
index 0460083..b396348 100644
--- a/libc/kernel/uapi/linux/sched.h
+++ b/libc/kernel/uapi/linux/sched.h
@@ -18,6 +18,7 @@
****************************************************************************/
#ifndef _UAPI_LINUX_SCHED_H
#define _UAPI_LINUX_SCHED_H
+#include <linux/types.h>
#define CSIGNAL 0x000000ff
#define CLONE_VM 0x00000100
#define CLONE_FS 0x00000200
@@ -43,6 +44,16 @@
#define CLONE_NEWPID 0x20000000
#define CLONE_NEWNET 0x40000000
#define CLONE_IO 0x80000000
+struct clone_args {
+ __aligned_u64 flags;
+ __aligned_u64 pidfd;
+ __aligned_u64 child_tid;
+ __aligned_u64 parent_tid;
+ __aligned_u64 exit_signal;
+ __aligned_u64 stack;
+ __aligned_u64 stack_size;
+ __aligned_u64 tls;
+};
#define SCHED_NORMAL 0
#define SCHED_FIFO 1
#define SCHED_RR 2
@@ -53,5 +64,11 @@
#define SCHED_FLAG_RESET_ON_FORK 0x01
#define SCHED_FLAG_RECLAIM 0x02
#define SCHED_FLAG_DL_OVERRUN 0x04
-#define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN)
+#define SCHED_FLAG_KEEP_POLICY 0x08
+#define SCHED_FLAG_KEEP_PARAMS 0x10
+#define SCHED_FLAG_UTIL_CLAMP_MIN 0x20
+#define SCHED_FLAG_UTIL_CLAMP_MAX 0x40
+#define SCHED_FLAG_KEEP_ALL (SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS)
+#define SCHED_FLAG_UTIL_CLAMP (SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX)
+#define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN | SCHED_FLAG_KEEP_ALL | SCHED_FLAG_UTIL_CLAMP)
#endif
diff --git a/libc/kernel/uapi/linux/sched/types.h b/libc/kernel/uapi/linux/sched/types.h
index cf6f1c7..385b21a 100644
--- a/libc/kernel/uapi/linux/sched/types.h
+++ b/libc/kernel/uapi/linux/sched/types.h
@@ -23,6 +23,7 @@
int sched_priority;
};
#define SCHED_ATTR_SIZE_VER0 48
+#define SCHED_ATTR_SIZE_VER1 56
struct sched_attr {
__u32 size;
__u32 sched_policy;
@@ -32,5 +33,7 @@
__u64 sched_runtime;
__u64 sched_deadline;
__u64 sched_period;
+ __u32 sched_util_min;
+ __u32 sched_util_max;
};
#endif
diff --git a/libc/kernel/uapi/linux/sed-opal.h b/libc/kernel/uapi/linux/sed-opal.h
index a532073..fc12509 100644
--- a/libc/kernel/uapi/linux/sed-opal.h
+++ b/libc/kernel/uapi/linux/sed-opal.h
@@ -25,6 +25,10 @@
OPAL_MBR_ENABLE = 0x0,
OPAL_MBR_DISABLE = 0x01,
};
+enum opal_mbr_done_flag {
+ OPAL_MBR_NOT_DONE = 0x0,
+ OPAL_MBR_DONE = 0x01
+};
enum opal_user {
OPAL_ADMIN1 = 0x0,
OPAL_USER1 = 0x01,
@@ -81,6 +85,17 @@
__u8 enable_disable;
__u8 __align[7];
};
+struct opal_mbr_done {
+ struct opal_key key;
+ __u8 done_flag;
+ __u8 __align[7];
+};
+struct opal_shadow_mbr {
+ struct opal_key key;
+ const __u64 data;
+ __u64 offset;
+ __u64 size;
+};
#define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
#define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
#define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
@@ -93,4 +108,7 @@
#define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
#define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
#define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
+#define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key)
+#define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done)
+#define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr)
#endif
diff --git a/libc/kernel/uapi/linux/serial_core.h b/libc/kernel/uapi/linux/serial_core.h
index c5ce9fe..29fcdf4 100644
--- a/libc/kernel/uapi/linux/serial_core.h
+++ b/libc/kernel/uapi/linux/serial_core.h
@@ -88,7 +88,6 @@
#define PORT_M32R_SIO 68
#define PORT_JSM 69
#define PORT_PNX8XXX 70
-#define PORT_NETX 71
#define PORT_SUNHV 72
#define PORT_S3C2412 73
#define PORT_UARTLITE 74
diff --git a/libc/kernel/uapi/linux/snmp.h b/libc/kernel/uapi/linux/snmp.h
index 2a48541..9f500ca 100644
--- a/libc/kernel/uapi/linux/snmp.h
+++ b/libc/kernel/uapi/linux/snmp.h
@@ -251,6 +251,7 @@
LINUX_MIB_TCPZEROWINDOWDROP,
LINUX_MIB_TCPRCVQDROP,
LINUX_MIB_TCPWQUEUETOOBIG,
+ LINUX_MIB_TCPFASTOPENPASSIVEALTKEY,
__LINUX_MIB_MAX
};
enum {
diff --git a/libc/kernel/uapi/linux/socket.h b/libc/kernel/uapi/linux/socket.h
index 4f52bcb..608d31f 100644
--- a/libc/kernel/uapi/linux/socket.h
+++ b/libc/kernel/uapi/linux/socket.h
@@ -19,10 +19,14 @@
#ifndef _UAPI_LINUX_SOCKET_H
#define _UAPI_LINUX_SOCKET_H
#define _K_SS_MAXSIZE 128
-#define _K_SS_ALIGNSIZE (__alignof__(struct sockaddr *))
typedef unsigned short __kernel_sa_family_t;
struct sockaddr_storage {
- __kernel_sa_family_t ss_family;
- char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
-} __attribute__((aligned(_K_SS_ALIGNSIZE)));
+ union {
+ struct {
+ __kernel_sa_family_t ss_family;
+ char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
+ };
+ void * __align;
+ };
+};
#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ct.h b/libc/kernel/uapi/linux/tc_act/tc_ct.h
new file mode 100644
index 0000000..0443b95
--- /dev/null
+++ b/libc/kernel/uapi/linux/tc_act/tc_ct.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** 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_TC_CT_H
+#define __UAPI_TC_CT_H
+#include <linux/types.h>
+#include <linux/pkt_cls.h>
+enum {
+ TCA_CT_UNSPEC,
+ TCA_CT_PARMS,
+ TCA_CT_TM,
+ TCA_CT_ACTION,
+ TCA_CT_ZONE,
+ TCA_CT_MARK,
+ TCA_CT_MARK_MASK,
+ TCA_CT_LABELS,
+ TCA_CT_LABELS_MASK,
+ TCA_CT_NAT_IPV4_MIN,
+ TCA_CT_NAT_IPV4_MAX,
+ TCA_CT_NAT_IPV6_MIN,
+ TCA_CT_NAT_IPV6_MAX,
+ TCA_CT_NAT_PORT_MIN,
+ TCA_CT_NAT_PORT_MAX,
+ TCA_CT_PAD,
+ __TCA_CT_MAX
+};
+#define TCA_CT_MAX (__TCA_CT_MAX - 1)
+#define TCA_CT_ACT_COMMIT (1 << 0)
+#define TCA_CT_ACT_FORCE (1 << 1)
+#define TCA_CT_ACT_CLEAR (1 << 2)
+#define TCA_CT_ACT_NAT (1 << 3)
+#define TCA_CT_ACT_NAT_SRC (1 << 4)
+#define TCA_CT_ACT_NAT_DST (1 << 5)
+struct tc_ct {
+ tc_gen;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/isdn_divertif.h b/libc/kernel/uapi/linux/tc_act/tc_ctinfo.h
similarity index 66%
copy from libc/kernel/uapi/linux/isdn_divertif.h
copy to libc/kernel/uapi/linux/tc_act/tc_ctinfo.h
index d353113..18fdf60 100644
--- a/libc/kernel/uapi/linux/isdn_divertif.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_ctinfo.h
@@ -16,15 +16,26 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_LINUX_ISDN_DIVERTIF_H
-#define _UAPI_LINUX_ISDN_DIVERTIF_H
-#define DIVERT_IF_MAGIC 0x25873401
-#define DIVERT_CMD_REG 0x00
-#define DIVERT_CMD_REL 0x01
-#define DIVERT_NO_ERR 0x00
-#define DIVERT_CMD_ERR 0x01
-#define DIVERT_VER_ERR 0x02
-#define DIVERT_REG_ERR 0x03
-#define DIVERT_REL_ERR 0x04
-#define DIVERT_REG_NAME isdn_register_divert
+#ifndef __UAPI_TC_CTINFO_H
+#define __UAPI_TC_CTINFO_H
+#include <linux/types.h>
+#include <linux/pkt_cls.h>
+struct tc_ctinfo {
+ tc_gen;
+};
+enum {
+ TCA_CTINFO_UNSPEC,
+ TCA_CTINFO_PAD,
+ TCA_CTINFO_TM,
+ TCA_CTINFO_ACT,
+ TCA_CTINFO_ZONE,
+ TCA_CTINFO_PARMS_DSCP_MASK,
+ TCA_CTINFO_PARMS_DSCP_STATEMASK,
+ TCA_CTINFO_PARMS_CPMARK_MASK,
+ TCA_CTINFO_STATS_DSCP_SET,
+ TCA_CTINFO_STATS_DSCP_ERROR,
+ TCA_CTINFO_STATS_CPMARK_SET,
+ __TCA_CTINFO_MAX
+};
+#define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/isdn_divertif.h b/libc/kernel/uapi/linux/tc_act/tc_mpls.h
similarity index 67%
rename from libc/kernel/uapi/linux/isdn_divertif.h
rename to libc/kernel/uapi/linux/tc_act/tc_mpls.h
index d353113..e1a4905 100644
--- a/libc/kernel/uapi/linux/isdn_divertif.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_mpls.h
@@ -16,15 +16,28 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_LINUX_ISDN_DIVERTIF_H
-#define _UAPI_LINUX_ISDN_DIVERTIF_H
-#define DIVERT_IF_MAGIC 0x25873401
-#define DIVERT_CMD_REG 0x00
-#define DIVERT_CMD_REL 0x01
-#define DIVERT_NO_ERR 0x00
-#define DIVERT_CMD_ERR 0x01
-#define DIVERT_VER_ERR 0x02
-#define DIVERT_REG_ERR 0x03
-#define DIVERT_REL_ERR 0x04
-#define DIVERT_REG_NAME isdn_register_divert
+#ifndef __LINUX_TC_MPLS_H
+#define __LINUX_TC_MPLS_H
+#include <linux/pkt_cls.h>
+#define TCA_MPLS_ACT_POP 1
+#define TCA_MPLS_ACT_PUSH 2
+#define TCA_MPLS_ACT_MODIFY 3
+#define TCA_MPLS_ACT_DEC_TTL 4
+struct tc_mpls {
+ tc_gen;
+ int m_action;
+};
+enum {
+ TCA_MPLS_UNSPEC,
+ TCA_MPLS_TM,
+ TCA_MPLS_PARMS,
+ TCA_MPLS_PAD,
+ TCA_MPLS_PROTO,
+ TCA_MPLS_LABEL,
+ TCA_MPLS_TC,
+ TCA_MPLS_TTL,
+ TCA_MPLS_BOS,
+ __TCA_MPLS_MAX,
+};
+#define TCA_MPLS_MAX (__TCA_MPLS_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/tcp.h b/libc/kernel/uapi/linux/tcp.h
index ce3d735..1ec025f 100644
--- a/libc/kernel/uapi/linux/tcp.h
+++ b/libc/kernel/uapi/linux/tcp.h
@@ -92,6 +92,7 @@
#define TCP_ZEROCOPY_RECEIVE 35
#define TCP_INQ 36
#define TCP_CM_INQ TCP_INQ
+#define TCP_TX_DELAY 37
#define TCP_REPAIR_ON 1
#define TCP_REPAIR_OFF 0
#define TCP_REPAIR_OFF_NO_WP - 1
diff --git a/libc/kernel/uapi/linux/unix_diag.h b/libc/kernel/uapi/linux/unix_diag.h
index 837ab5a..4bcc47a 100644
--- a/libc/kernel/uapi/linux/unix_diag.h
+++ b/libc/kernel/uapi/linux/unix_diag.h
@@ -34,6 +34,7 @@
#define UDIAG_SHOW_ICONS 0x00000008
#define UDIAG_SHOW_RQLEN 0x00000010
#define UDIAG_SHOW_MEMINFO 0x00000020
+#define UDIAG_SHOW_UID 0x00000040
struct unix_diag_msg {
__u8 udiag_family;
__u8 udiag_type;
@@ -50,6 +51,7 @@
UNIX_DIAG_RQLEN,
UNIX_DIAG_MEMINFO,
UNIX_DIAG_SHUTDOWN,
+ UNIX_DIAG_UID,
__UNIX_DIAG_MAX,
};
#define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1)
diff --git a/libc/kernel/uapi/linux/usbdevice_fs.h b/libc/kernel/uapi/linux/usbdevice_fs.h
index 87afabe..03f3bfb 100644
--- a/libc/kernel/uapi/linux/usbdevice_fs.h
+++ b/libc/kernel/uapi/linux/usbdevice_fs.h
@@ -52,6 +52,14 @@
unsigned int devnum;
unsigned char slow;
};
+struct usbdevfs_conninfo_ex {
+ __u32 size;
+ __u32 busnum;
+ __u32 devnum;
+ __u32 speed;
+ __u8 num_ports;
+ __u8 ports[7];
+};
#define USBDEVFS_URB_SHORT_NOT_OK 0x01
#define USBDEVFS_URB_ISO_ASAP 0x02
#define USBDEVFS_URB_BULK_CONTINUATION 0x04
@@ -101,6 +109,7 @@
#define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10
#define USBDEVFS_CAP_MMAP 0x20
#define USBDEVFS_CAP_DROP_PRIVILEGES 0x40
+#define USBDEVFS_CAP_CONNINFO_EX 0x80
#define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
#define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
struct usbdevfs_disconnect_claim {
@@ -148,4 +157,5 @@
#define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams)
#define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32)
#define USBDEVFS_GET_SPEED _IO('U', 31)
+#define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len)
#endif
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 7a133f5..9288710 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -299,6 +299,8 @@
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE + 221)
enum v4l2_mpeg_video_multi_slice_mode {
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
+ V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB = 1,
+ V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES = 2,
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
};
@@ -310,6 +312,22 @@
#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE + 227)
#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE + 228)
#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE + 229)
+#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_MPEG_BASE + 270)
+enum v4l2_mpeg_video_mpeg2_level {
+ V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW = 0,
+ V4L2_MPEG_VIDEO_MPEG2_LEVEL_MAIN = 1,
+ V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH_1440 = 2,
+ V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH = 3,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE (V4L2_CID_MPEG_BASE + 271)
+enum v4l2_mpeg_video_mpeg2_profile {
+ V4L2_MPEG_VIDEO_MPEG2_PROFILE_SIMPLE = 0,
+ V4L2_MPEG_VIDEO_MPEG2_PROFILE_MAIN = 1,
+ V4L2_MPEG_VIDEO_MPEG2_PROFILE_SNR_SCALABLE = 2,
+ V4L2_MPEG_VIDEO_MPEG2_PROFILE_SPATIALLY_SCALABLE = 3,
+ V4L2_MPEG_VIDEO_MPEG2_PROFILE_HIGH = 4,
+ V4L2_MPEG_VIDEO_MPEG2_PROFILE_MULTIVIEW = 5,
+};
#define V4L2_CID_FWHT_I_FRAME_QP (V4L2_CID_MPEG_BASE + 290)
#define V4L2_CID_FWHT_P_FRAME_QP (V4L2_CID_MPEG_BASE + 291)
#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE + 300)
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index ab29f91..f78358d 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -16,5 +16,5 @@
***
****************************************************************************
****************************************************************************/
-#define LINUX_VERSION_CODE 328203
+#define LINUX_VERSION_CODE 328450
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/libc/kernel/uapi/linux/videodev2.h b/libc/kernel/uapi/linux/videodev2.h
index f77c6bd..e81697e 100644
--- a/libc/kernel/uapi/linux/videodev2.h
+++ b/libc/kernel/uapi/linux/videodev2.h
@@ -27,7 +27,7 @@
#define VIDEO_MAX_FRAME 32
#define VIDEO_MAX_PLANES 8
#define v4l2_fourcc(a,b,c,d) ((__u32) (a) | ((__u32) (b) << 8) | ((__u32) (c) << 16) | ((__u32) (d) << 24))
-#define v4l2_fourcc_be(a,b,c,d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
+#define v4l2_fourcc_be(a,b,c,d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
enum v4l2_field {
V4L2_FIELD_ANY = 0,
V4L2_FIELD_NONE = 1,
diff --git a/libc/kernel/uapi/linux/virtio_ids.h b/libc/kernel/uapi/linux/virtio_ids.h
index 010d819..f7e1392 100644
--- a/libc/kernel/uapi/linux/virtio_ids.h
+++ b/libc/kernel/uapi/linux/virtio_ids.h
@@ -32,4 +32,6 @@
#define VIRTIO_ID_INPUT 18
#define VIRTIO_ID_VSOCK 19
#define VIRTIO_ID_CRYPTO 20
+#define VIRTIO_ID_IOMMU 23
+#define VIRTIO_ID_PMEM 27
#endif
diff --git a/libc/kernel/uapi/linux/virtio_iommu.h b/libc/kernel/uapi/linux/virtio_iommu.h
new file mode 100644
index 0000000..b08de57
--- /dev/null
+++ b/libc/kernel/uapi/linux/virtio_iommu.h
@@ -0,0 +1,136 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** 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_VIRTIO_IOMMU_H
+#define _UAPI_LINUX_VIRTIO_IOMMU_H
+#include <linux/types.h>
+#define VIRTIO_IOMMU_F_INPUT_RANGE 0
+#define VIRTIO_IOMMU_F_DOMAIN_RANGE 1
+#define VIRTIO_IOMMU_F_MAP_UNMAP 2
+#define VIRTIO_IOMMU_F_BYPASS 3
+#define VIRTIO_IOMMU_F_PROBE 4
+#define VIRTIO_IOMMU_F_MMIO 5
+struct virtio_iommu_range_64 {
+ __le64 start;
+ __le64 end;
+};
+struct virtio_iommu_range_32 {
+ __le32 start;
+ __le32 end;
+};
+struct virtio_iommu_config {
+ __le64 page_size_mask;
+ struct virtio_iommu_range_64 input_range;
+ struct virtio_iommu_range_32 domain_range;
+ __le32 probe_size;
+};
+#define VIRTIO_IOMMU_T_ATTACH 0x01
+#define VIRTIO_IOMMU_T_DETACH 0x02
+#define VIRTIO_IOMMU_T_MAP 0x03
+#define VIRTIO_IOMMU_T_UNMAP 0x04
+#define VIRTIO_IOMMU_T_PROBE 0x05
+#define VIRTIO_IOMMU_S_OK 0x00
+#define VIRTIO_IOMMU_S_IOERR 0x01
+#define VIRTIO_IOMMU_S_UNSUPP 0x02
+#define VIRTIO_IOMMU_S_DEVERR 0x03
+#define VIRTIO_IOMMU_S_INVAL 0x04
+#define VIRTIO_IOMMU_S_RANGE 0x05
+#define VIRTIO_IOMMU_S_NOENT 0x06
+#define VIRTIO_IOMMU_S_FAULT 0x07
+#define VIRTIO_IOMMU_S_NOMEM 0x08
+struct virtio_iommu_req_head {
+ __u8 type;
+ __u8 reserved[3];
+};
+struct virtio_iommu_req_tail {
+ __u8 status;
+ __u8 reserved[3];
+};
+struct virtio_iommu_req_attach {
+ struct virtio_iommu_req_head head;
+ __le32 domain;
+ __le32 endpoint;
+ __u8 reserved[8];
+ struct virtio_iommu_req_tail tail;
+};
+struct virtio_iommu_req_detach {
+ struct virtio_iommu_req_head head;
+ __le32 domain;
+ __le32 endpoint;
+ __u8 reserved[8];
+ struct virtio_iommu_req_tail tail;
+};
+#define VIRTIO_IOMMU_MAP_F_READ (1 << 0)
+#define VIRTIO_IOMMU_MAP_F_WRITE (1 << 1)
+#define VIRTIO_IOMMU_MAP_F_MMIO (1 << 2)
+#define VIRTIO_IOMMU_MAP_F_MASK (VIRTIO_IOMMU_MAP_F_READ | VIRTIO_IOMMU_MAP_F_WRITE | VIRTIO_IOMMU_MAP_F_MMIO)
+struct virtio_iommu_req_map {
+ struct virtio_iommu_req_head head;
+ __le32 domain;
+ __le64 virt_start;
+ __le64 virt_end;
+ __le64 phys_start;
+ __le32 flags;
+ struct virtio_iommu_req_tail tail;
+};
+struct virtio_iommu_req_unmap {
+ struct virtio_iommu_req_head head;
+ __le32 domain;
+ __le64 virt_start;
+ __le64 virt_end;
+ __u8 reserved[4];
+ struct virtio_iommu_req_tail tail;
+};
+#define VIRTIO_IOMMU_PROBE_T_NONE 0
+#define VIRTIO_IOMMU_PROBE_T_RESV_MEM 1
+#define VIRTIO_IOMMU_PROBE_T_MASK 0xfff
+struct virtio_iommu_probe_property {
+ __le16 type;
+ __le16 length;
+};
+#define VIRTIO_IOMMU_RESV_MEM_T_RESERVED 0
+#define VIRTIO_IOMMU_RESV_MEM_T_MSI 1
+struct virtio_iommu_probe_resv_mem {
+ struct virtio_iommu_probe_property head;
+ __u8 subtype;
+ __u8 reserved[3];
+ __le64 start;
+ __le64 end;
+};
+struct virtio_iommu_req_probe {
+ struct virtio_iommu_req_head head;
+ __le32 endpoint;
+ __u8 reserved[64];
+ __u8 properties[];
+};
+#define VIRTIO_IOMMU_FAULT_R_UNKNOWN 0
+#define VIRTIO_IOMMU_FAULT_R_DOMAIN 1
+#define VIRTIO_IOMMU_FAULT_R_MAPPING 2
+#define VIRTIO_IOMMU_FAULT_F_READ (1 << 0)
+#define VIRTIO_IOMMU_FAULT_F_WRITE (1 << 1)
+#define VIRTIO_IOMMU_FAULT_F_EXEC (1 << 2)
+#define VIRTIO_IOMMU_FAULT_F_ADDRESS (1 << 8)
+struct virtio_iommu_fault {
+ __u8 reason;
+ __u8 reserved[3];
+ __le32 flags;
+ __le32 endpoint;
+ __u8 reserved2[4];
+ __le64 address;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/wanrouter.h b/libc/kernel/uapi/linux/virtio_pmem.h
similarity index 74%
rename from libc/kernel/uapi/linux/wanrouter.h
rename to libc/kernel/uapi/linux/virtio_pmem.h
index 9bd45a3..38740f3 100644
--- a/libc/kernel/uapi/linux/wanrouter.h
+++ b/libc/kernel/uapi/linux/virtio_pmem.h
@@ -16,12 +16,20 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_ROUTER_H
-#define _UAPI_ROUTER_H
-enum wan_states {
- WAN_UNCONFIGURED,
- WAN_DISCONNECTED,
- WAN_CONNECTING,
- WAN_CONNECTED
+#ifndef _UAPI_LINUX_VIRTIO_PMEM_H
+#define _UAPI_LINUX_VIRTIO_PMEM_H
+#include <linux/types.h>
+#include <linux/virtio_ids.h>
+#include <linux/virtio_config.h>
+struct virtio_pmem_config {
+ __u64 start;
+ __u64 size;
+};
+#define VIRTIO_PMEM_REQ_TYPE_FLUSH 0
+struct virtio_pmem_resp {
+ __le32 ret;
+};
+struct virtio_pmem_req {
+ __le32 type;
};
#endif
diff --git a/libc/kernel/uapi/misc/habanalabs.h b/libc/kernel/uapi/misc/habanalabs.h
index 1029a67..8fcf30f 100644
--- a/libc/kernel/uapi/misc/habanalabs.h
+++ b/libc/kernel/uapi/misc/habanalabs.h
@@ -39,6 +39,23 @@
GOYA_QUEUE_ID_TPC7,
GOYA_QUEUE_ID_SIZE
};
+enum goya_engine_id {
+ GOYA_ENGINE_ID_DMA_0 = 0,
+ GOYA_ENGINE_ID_DMA_1,
+ GOYA_ENGINE_ID_DMA_2,
+ GOYA_ENGINE_ID_DMA_3,
+ GOYA_ENGINE_ID_DMA_4,
+ GOYA_ENGINE_ID_MME_0,
+ GOYA_ENGINE_ID_TPC_0,
+ GOYA_ENGINE_ID_TPC_1,
+ GOYA_ENGINE_ID_TPC_2,
+ GOYA_ENGINE_ID_TPC_3,
+ GOYA_ENGINE_ID_TPC_4,
+ GOYA_ENGINE_ID_TPC_5,
+ GOYA_ENGINE_ID_TPC_6,
+ GOYA_ENGINE_ID_TPC_7,
+ GOYA_ENGINE_ID_SIZE
+};
enum hl_device_status {
HL_DEVICE_STATUS_OPERATIONAL,
HL_DEVICE_STATUS_IN_RESET,
@@ -74,7 +91,7 @@
};
struct hl_info_hw_idle {
__u32 is_idle;
- __u32 pad;
+ __u32 busy_engines_mask;
};
struct hl_info_device_status {
__u32 status;
diff --git a/libc/kernel/uapi/rdma/ib_user_cm.h b/libc/kernel/uapi/rdma/ib_user_cm.h
deleted file mode 100644
index 5ba46b8..0000000
--- a/libc/kernel/uapi/rdma/ib_user_cm.h
+++ /dev/null
@@ -1,265 +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 IB_USER_CM_H
-#define IB_USER_CM_H
-#include <linux/types.h>
-#include <rdma/ib_user_sa.h>
-#define IB_USER_CM_ABI_VERSION 5
-enum {
- IB_USER_CM_CMD_CREATE_ID,
- IB_USER_CM_CMD_DESTROY_ID,
- IB_USER_CM_CMD_ATTR_ID,
- IB_USER_CM_CMD_LISTEN,
- IB_USER_CM_CMD_NOTIFY,
- IB_USER_CM_CMD_SEND_REQ,
- IB_USER_CM_CMD_SEND_REP,
- IB_USER_CM_CMD_SEND_RTU,
- IB_USER_CM_CMD_SEND_DREQ,
- IB_USER_CM_CMD_SEND_DREP,
- IB_USER_CM_CMD_SEND_REJ,
- IB_USER_CM_CMD_SEND_MRA,
- IB_USER_CM_CMD_SEND_LAP,
- IB_USER_CM_CMD_SEND_APR,
- IB_USER_CM_CMD_SEND_SIDR_REQ,
- IB_USER_CM_CMD_SEND_SIDR_REP,
- IB_USER_CM_CMD_EVENT,
- IB_USER_CM_CMD_INIT_QP_ATTR,
-};
-struct ib_ucm_cmd_hdr {
- __u32 cmd;
- __u16 in;
- __u16 out;
-};
-struct ib_ucm_create_id {
- __aligned_u64 uid;
- __aligned_u64 response;
-};
-struct ib_ucm_create_id_resp {
- __u32 id;
-};
-struct ib_ucm_destroy_id {
- __aligned_u64 response;
- __u32 id;
- __u32 reserved;
-};
-struct ib_ucm_destroy_id_resp {
- __u32 events_reported;
-};
-struct ib_ucm_attr_id {
- __aligned_u64 response;
- __u32 id;
- __u32 reserved;
-};
-struct ib_ucm_attr_id_resp {
- __be64 service_id;
- __be64 service_mask;
- __be32 local_id;
- __be32 remote_id;
-};
-struct ib_ucm_init_qp_attr {
- __aligned_u64 response;
- __u32 id;
- __u32 qp_state;
-};
-struct ib_ucm_listen {
- __be64 service_id;
- __be64 service_mask;
- __u32 id;
- __u32 reserved;
-};
-struct ib_ucm_notify {
- __u32 id;
- __u32 event;
-};
-struct ib_ucm_private_data {
- __aligned_u64 data;
- __u32 id;
- __u8 len;
- __u8 reserved[3];
-};
-struct ib_ucm_req {
- __u32 id;
- __u32 qpn;
- __u32 qp_type;
- __u32 psn;
- __be64 sid;
- __aligned_u64 data;
- __aligned_u64 primary_path;
- __aligned_u64 alternate_path;
- __u8 len;
- __u8 peer_to_peer;
- __u8 responder_resources;
- __u8 initiator_depth;
- __u8 remote_cm_response_timeout;
- __u8 flow_control;
- __u8 local_cm_response_timeout;
- __u8 retry_count;
- __u8 rnr_retry_count;
- __u8 max_cm_retries;
- __u8 srq;
- __u8 reserved[5];
-};
-struct ib_ucm_rep {
- __aligned_u64 uid;
- __aligned_u64 data;
- __u32 id;
- __u32 qpn;
- __u32 psn;
- __u8 len;
- __u8 responder_resources;
- __u8 initiator_depth;
- __u8 target_ack_delay;
- __u8 failover_accepted;
- __u8 flow_control;
- __u8 rnr_retry_count;
- __u8 srq;
- __u8 reserved[4];
-};
-struct ib_ucm_info {
- __u32 id;
- __u32 status;
- __aligned_u64 info;
- __aligned_u64 data;
- __u8 info_len;
- __u8 data_len;
- __u8 reserved[6];
-};
-struct ib_ucm_mra {
- __aligned_u64 data;
- __u32 id;
- __u8 len;
- __u8 timeout;
- __u8 reserved[2];
-};
-struct ib_ucm_lap {
- __aligned_u64 path;
- __aligned_u64 data;
- __u32 id;
- __u8 len;
- __u8 reserved[3];
-};
-struct ib_ucm_sidr_req {
- __u32 id;
- __u32 timeout;
- __be64 sid;
- __aligned_u64 data;
- __aligned_u64 path;
- __u16 reserved_pkey;
- __u8 len;
- __u8 max_cm_retries;
- __u8 reserved[4];
-};
-struct ib_ucm_sidr_rep {
- __u32 id;
- __u32 qpn;
- __u32 qkey;
- __u32 status;
- __aligned_u64 info;
- __aligned_u64 data;
- __u8 info_len;
- __u8 data_len;
- __u8 reserved[6];
-};
-struct ib_ucm_event_get {
- __aligned_u64 response;
- __aligned_u64 data;
- __aligned_u64 info;
- __u8 data_len;
- __u8 info_len;
- __u8 reserved[6];
-};
-struct ib_ucm_req_event_resp {
- struct ib_user_path_rec primary_path;
- struct ib_user_path_rec alternate_path;
- __be64 remote_ca_guid;
- __u32 remote_qkey;
- __u32 remote_qpn;
- __u32 qp_type;
- __u32 starting_psn;
- __u8 responder_resources;
- __u8 initiator_depth;
- __u8 local_cm_response_timeout;
- __u8 flow_control;
- __u8 remote_cm_response_timeout;
- __u8 retry_count;
- __u8 rnr_retry_count;
- __u8 srq;
- __u8 port;
- __u8 reserved[7];
-};
-struct ib_ucm_rep_event_resp {
- __be64 remote_ca_guid;
- __u32 remote_qkey;
- __u32 remote_qpn;
- __u32 starting_psn;
- __u8 responder_resources;
- __u8 initiator_depth;
- __u8 target_ack_delay;
- __u8 failover_accepted;
- __u8 flow_control;
- __u8 rnr_retry_count;
- __u8 srq;
- __u8 reserved[5];
-};
-struct ib_ucm_rej_event_resp {
- __u32 reason;
-};
-struct ib_ucm_mra_event_resp {
- __u8 timeout;
- __u8 reserved[3];
-};
-struct ib_ucm_lap_event_resp {
- struct ib_user_path_rec path;
-};
-struct ib_ucm_apr_event_resp {
- __u32 status;
-};
-struct ib_ucm_sidr_req_event_resp {
- __u16 pkey;
- __u8 port;
- __u8 reserved;
-};
-struct ib_ucm_sidr_rep_event_resp {
- __u32 status;
- __u32 qkey;
- __u32 qpn;
-};
-#define IB_UCM_PRES_DATA 0x01
-#define IB_UCM_PRES_INFO 0x02
-#define IB_UCM_PRES_PRIMARY 0x04
-#define IB_UCM_PRES_ALTERNATE 0x08
-struct ib_ucm_event_resp {
- __aligned_u64 uid;
- __u32 id;
- __u32 event;
- __u32 present;
- __u32 reserved;
- union {
- struct ib_ucm_req_event_resp req_resp;
- struct ib_ucm_rep_event_resp rep_resp;
- struct ib_ucm_rej_event_resp rej_resp;
- struct ib_ucm_mra_event_resp mra_resp;
- struct ib_ucm_lap_event_resp lap_resp;
- struct ib_ucm_apr_event_resp apr_resp;
- struct ib_ucm_sidr_req_event_resp sidr_req_resp;
- struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
- __u32 send_status;
- } u;
-};
-#endif
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
index 66bd666..dcd281a 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -32,6 +32,7 @@
MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_METHOD_DEVX_QUERY_UAR,
MLX5_IB_METHOD_DEVX_QUERY_EQN,
+ MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT,
};
enum mlx5_ib_devx_other_attrs {
MLX5_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT),
@@ -66,6 +67,13 @@
MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_WR_ID,
MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN,
};
+enum mlx5_ib_devx_subscribe_event_attrs {
+ MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+ MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_OBJ_HANDLE,
+ MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_TYPE_NUM_LIST,
+ MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_NUM,
+ MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_COOKIE,
+};
enum mlx5_ib_devx_query_eqn_attrs {
MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN,
@@ -94,15 +102,23 @@
enum mlx5_ib_devx_async_cmd_fd_alloc_attrs {
MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
};
+enum mlx5_ib_devx_async_event_fd_alloc_attrs {
+ MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+ MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_FLAGS,
+};
enum mlx5_ib_devx_async_cmd_fd_methods {
MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
};
+enum mlx5_ib_devx_async_event_fd_methods {
+ MLX5_IB_METHOD_DEVX_ASYNC_EVENT_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
+};
enum mlx5_ib_objects {
MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_OBJECT_DEVX_OBJ,
MLX5_IB_OBJECT_DEVX_UMEM,
MLX5_IB_OBJECT_FLOW_MATCHER,
MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD,
+ MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD,
};
enum mlx5_ib_flow_matcher_create_attrs {
MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
index a75368d..64bc843 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -42,4 +42,11 @@
MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM,
MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM,
};
+enum mlx5_ib_uapi_devx_create_event_channel_flags {
+ MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
+};
+struct mlx5_ib_uapi_devx_async_event_hdr {
+ __aligned_u64 cookie;
+ __u8 out_data[];
+};
#endif
diff --git a/libc/kernel/uapi/rdma/rdma_netlink.h b/libc/kernel/uapi/rdma/rdma_netlink.h
index bbb1822..ed585cf 100644
--- a/libc/kernel/uapi/rdma/rdma_netlink.h
+++ b/libc/kernel/uapi/rdma/rdma_netlink.h
@@ -136,6 +136,15 @@
IWPM_NLA_HELLO_MAX
};
enum {
+ RDMA_NODE_IB_CA = 1,
+ RDMA_NODE_IB_SWITCH,
+ RDMA_NODE_IB_ROUTER,
+ RDMA_NODE_RNIC,
+ RDMA_NODE_USNIC,
+ RDMA_NODE_USNIC_UDP,
+ RDMA_NODE_UNSPECIFIED,
+};
+enum {
RDMA_NL_LS_OP_RESOLVE = 0,
RDMA_NL_LS_OP_SET_TIMEOUT,
RDMA_NL_LS_OP_IP_RESOLVE,
@@ -191,11 +200,12 @@
RDMA_NLDEV_CMD_RES_CQ_GET,
RDMA_NLDEV_CMD_RES_MR_GET,
RDMA_NLDEV_CMD_RES_PD_GET,
+ RDMA_NLDEV_CMD_GET_CHARDEV,
+ RDMA_NLDEV_CMD_STAT_SET,
+ RDMA_NLDEV_CMD_STAT_GET,
+ RDMA_NLDEV_CMD_STAT_DEL,
RDMA_NLDEV_NUM_OPS
};
-enum {
- RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
-};
enum rdma_nldev_print_type {
RDMA_NLDEV_PRINT_TYPE_UNSPEC,
RDMA_NLDEV_PRINT_TYPE_HEX,
@@ -271,6 +281,31 @@
RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
RDMA_NLDEV_ATTR_DEV_PROTOCOL,
RDMA_NLDEV_NET_NS_FD,
+ RDMA_NLDEV_ATTR_CHARDEV_TYPE,
+ RDMA_NLDEV_ATTR_CHARDEV_NAME,
+ RDMA_NLDEV_ATTR_CHARDEV_ABI,
+ RDMA_NLDEV_ATTR_CHARDEV,
+ RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID,
+ RDMA_NLDEV_ATTR_STAT_MODE,
+ RDMA_NLDEV_ATTR_STAT_RES,
+ RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK,
+ RDMA_NLDEV_ATTR_STAT_COUNTER,
+ RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY,
+ RDMA_NLDEV_ATTR_STAT_COUNTER_ID,
+ RDMA_NLDEV_ATTR_STAT_HWCOUNTERS,
+ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY,
+ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME,
+ RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE,
+ RDMA_NLDEV_ATTR_DEV_DIM,
RDMA_NLDEV_ATTR_MAX
};
+enum rdma_nl_counter_mode {
+ RDMA_COUNTER_MODE_NONE,
+ RDMA_COUNTER_MODE_AUTO,
+ RDMA_COUNTER_MODE_MANUAL,
+ RDMA_COUNTER_MODE_MAX,
+};
+enum rdma_nl_counter_mask {
+ RDMA_COUNTER_MASK_QP_TYPE = 1,
+};
#endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
index 2692e3a..b779bc8 100644
--- a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
@@ -71,5 +71,6 @@
RDMA_DRIVER_HFI1,
RDMA_DRIVER_QIB,
RDMA_DRIVER_EFA,
+ RDMA_DRIVER_SIW,
};
#endif
diff --git a/libc/kernel/uapi/linux/flat.h b/libc/kernel/uapi/rdma/rvt-abi.h
similarity index 61%
rename from libc/kernel/uapi/linux/flat.h
rename to libc/kernel/uapi/rdma/rvt-abi.h
index d2af100..49632ee 100644
--- a/libc/kernel/uapi/linux/flat.h
+++ b/libc/kernel/uapi/rdma/rvt-abi.h
@@ -16,27 +16,32 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_LINUX_FLAT_H
-#define _UAPI_LINUX_FLAT_H
-#define FLAT_VERSION 0x00000004L
-#define MAX_SHARED_LIBS (1)
-struct flat_hdr {
- char magic[4];
- unsigned long rev;
- unsigned long entry;
- unsigned long data_start;
- unsigned long data_end;
- unsigned long bss_end;
- unsigned long stack_size;
- unsigned long reloc_start;
- unsigned long reloc_count;
- unsigned long flags;
- unsigned long build_date;
- unsigned long filler[5];
+#ifndef RVT_ABI_USER_H
+#define RVT_ABI_USER_H
+#include <linux/types.h>
+#include <rdma/ib_user_verbs.h>
+#ifndef RDMA_ATOMIC_UAPI
+#define RDMA_ATOMIC_UAPI(_type,_name) struct { _type val; } _name
+#endif
+struct rvt_wqe_sge {
+ __aligned_u64 addr;
+ __u32 length;
+ __u32 lkey;
};
-#define FLAT_FLAG_RAM 0x0001
-#define FLAT_FLAG_GOTPIC 0x0002
-#define FLAT_FLAG_GZIP 0x0004
-#define FLAT_FLAG_GZDATA 0x0008
-#define FLAT_FLAG_KTRACE 0x0010
+struct rvt_cq_wc {
+ RDMA_ATOMIC_UAPI(__u32, head);
+ RDMA_ATOMIC_UAPI(__u32, tail);
+ struct ib_uverbs_wc uqueue[];
+};
+struct rvt_rwqe {
+ __u64 wr_id;
+ __u8 num_sge;
+ __u8 padding[7];
+ struct rvt_wqe_sge sg_list[];
+};
+struct rvt_rwq {
+ RDMA_ATOMIC_UAPI(__u32, head);
+ RDMA_ATOMIC_UAPI(__u32, tail);
+ struct rvt_rwqe wq[];
+};
#endif
diff --git a/libc/kernel/uapi/rdma/siw-abi.h b/libc/kernel/uapi/rdma/siw-abi.h
new file mode 100644
index 0000000..e2363a1
--- /dev/null
+++ b/libc/kernel/uapi/rdma/siw-abi.h
@@ -0,0 +1,153 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** 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 _SIW_USER_H
+#define _SIW_USER_H
+#include <linux/types.h>
+#define SIW_NODE_DESC_COMMON "Software iWARP stack"
+#define SIW_ABI_VERSION 1
+#define SIW_MAX_SGE 6
+#define SIW_UOBJ_MAX_KEY 0x08FFFF
+#define SIW_INVAL_UOBJ_KEY (SIW_UOBJ_MAX_KEY + 1)
+struct siw_uresp_create_cq {
+ __u32 cq_id;
+ __u32 num_cqe;
+ __aligned_u64 cq_key;
+};
+struct siw_uresp_create_qp {
+ __u32 qp_id;
+ __u32 num_sqe;
+ __u32 num_rqe;
+ __u32 pad;
+ __aligned_u64 sq_key;
+ __aligned_u64 rq_key;
+};
+struct siw_ureq_reg_mr {
+ __u8 stag_key;
+ __u8 reserved[3];
+ __u32 pad;
+};
+struct siw_uresp_reg_mr {
+ __u32 stag;
+ __u32 pad;
+};
+struct siw_uresp_create_srq {
+ __u32 num_rqe;
+ __u32 pad;
+ __aligned_u64 srq_key;
+};
+struct siw_uresp_alloc_ctx {
+ __u32 dev_id;
+ __u32 pad;
+};
+enum siw_opcode {
+ SIW_OP_WRITE,
+ SIW_OP_READ,
+ SIW_OP_READ_LOCAL_INV,
+ SIW_OP_SEND,
+ SIW_OP_SEND_WITH_IMM,
+ SIW_OP_SEND_REMOTE_INV,
+ SIW_OP_FETCH_AND_ADD,
+ SIW_OP_COMP_AND_SWAP,
+ SIW_OP_RECEIVE,
+ SIW_OP_READ_RESPONSE,
+ SIW_OP_INVAL_STAG,
+ SIW_OP_REG_MR,
+ SIW_NUM_OPCODES
+};
+struct siw_sge {
+ __aligned_u64 laddr;
+ __u32 length;
+ __u32 lkey;
+};
+#define SIW_MAX_INLINE (sizeof(struct siw_sge) * (SIW_MAX_SGE - 1))
+#if SIW_MAX_SGE < 2
+#error "SIW_MAX_SGE must be at least 2"
+#endif
+enum siw_wqe_flags {
+ SIW_WQE_VALID = 1,
+ SIW_WQE_INLINE = (1 << 1),
+ SIW_WQE_SIGNALLED = (1 << 2),
+ SIW_WQE_SOLICITED = (1 << 3),
+ SIW_WQE_READ_FENCE = (1 << 4),
+ SIW_WQE_REM_INVAL = (1 << 5),
+ SIW_WQE_COMPLETED = (1 << 6)
+};
+struct siw_sqe {
+ __aligned_u64 id;
+ __u16 flags;
+ __u8 num_sge;
+ __u8 opcode;
+ __u32 rkey;
+ union {
+ __aligned_u64 raddr;
+ __aligned_u64 base_mr;
+ };
+ union {
+ struct siw_sge sge[SIW_MAX_SGE];
+ __aligned_u64 access;
+ };
+};
+struct siw_rqe {
+ __aligned_u64 id;
+ __u16 flags;
+ __u8 num_sge;
+ __u8 opcode;
+ __u32 unused;
+ struct siw_sge sge[SIW_MAX_SGE];
+};
+enum siw_notify_flags {
+ SIW_NOTIFY_NOT = (0),
+ SIW_NOTIFY_SOLICITED = (1 << 0),
+ SIW_NOTIFY_NEXT_COMPLETION = (1 << 1),
+ SIW_NOTIFY_MISSED_EVENTS = (1 << 2),
+ SIW_NOTIFY_ALL = SIW_NOTIFY_SOLICITED | SIW_NOTIFY_NEXT_COMPLETION | SIW_NOTIFY_MISSED_EVENTS
+};
+enum siw_wc_status {
+ SIW_WC_SUCCESS,
+ SIW_WC_LOC_LEN_ERR,
+ SIW_WC_LOC_PROT_ERR,
+ SIW_WC_LOC_QP_OP_ERR,
+ SIW_WC_WR_FLUSH_ERR,
+ SIW_WC_BAD_RESP_ERR,
+ SIW_WC_LOC_ACCESS_ERR,
+ SIW_WC_REM_ACCESS_ERR,
+ SIW_WC_REM_INV_REQ_ERR,
+ SIW_WC_GENERAL_ERR,
+ SIW_NUM_WC_STATUS
+};
+struct siw_cqe {
+ __aligned_u64 id;
+ __u8 flags;
+ __u8 opcode;
+ __u16 status;
+ __u32 bytes;
+ union {
+ __aligned_u64 imm_data;
+ __u32 inval_stag;
+ };
+ union {
+ struct ib_qp * base_qp;
+ __aligned_u64 qp_id;
+ };
+};
+struct siw_cq_ctrl {
+ __u32 flags;
+ __u32 pad;
+};
+#endif
diff --git a/libc/kernel/uapi/sound/sof/abi.h b/libc/kernel/uapi/sound/sof/abi.h
index 2111f5c..0948673 100644
--- a/libc/kernel/uapi/sound/sof/abi.h
+++ b/libc/kernel/uapi/sound/sof/abi.h
@@ -19,7 +19,7 @@
#ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
#define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
#define SOF_ABI_MAJOR 3
-#define SOF_ABI_MINOR 6
+#define SOF_ABI_MINOR 8
#define SOF_ABI_PATCH 0
#define SOF_ABI_MAJOR_SHIFT 24
#define SOF_ABI_MAJOR_MASK 0xff
diff --git a/libc/kernel/uapi/sound/sof/eq.h b/libc/kernel/uapi/sound/sof/eq.h
deleted file mode 100644
index c45ba35..0000000
--- a/libc/kernel/uapi/sound/sof/eq.h
+++ /dev/null
@@ -1,67 +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 __INCLUDE_UAPI_SOUND_SOF_USER_EQ_H__
-#define __INCLUDE_UAPI_SOUND_SOF_USER_EQ_H__
-#define SOF_EQ_FIR_IDX_SWITCH 0
-#define SOF_EQ_FIR_MAX_SIZE 4096
-#define SOF_EQ_FIR_MAX_LENGTH 192
-#define SOF_EQ_FIR_MAX_RESPONSES 8
-struct sof_eq_fir_config {
- uint32_t size;
- uint16_t channels_in_config;
- uint16_t number_of_responses;
- uint32_t reserved[4];
- int16_t data[];
-} __packed;
-struct sof_eq_fir_coef_data {
- int16_t length;
- int16_t out_shift;
- uint32_t reserved[4];
- int16_t coef[];
-} __packed;
-#define SOF_EQ_FIR_COEF_NHEADER (sizeof(struct sof_eq_fir_coef_data) / sizeof(int16_t))
-#define SOF_EQ_IIR_IDX_SWITCH 0
-#define SOF_EQ_IIR_MAX_SIZE 1024
-#define SOF_EQ_IIR_MAX_RESPONSES 8
-struct sof_eq_iir_config {
- uint32_t size;
- uint32_t channels_in_config;
- uint32_t number_of_responses;
- uint32_t reserved[4];
- int32_t data[];
-} __packed;
-struct sof_eq_iir_header_df2t {
- uint32_t num_sections;
- uint32_t num_sections_in_series;
- uint32_t reserved[4];
- int32_t biquads[];
-} __packed;
-struct sof_eq_iir_biquad_df2t {
- int32_t a2;
- int32_t a1;
- int32_t b2;
- int32_t b1;
- int32_t b0;
- int32_t output_shift;
- int32_t output_gain;
-} __packed;
-#define SOF_EQ_IIR_DF2T_BIQUADS_MAX 11
-#define SOF_EQ_IIR_NHEADER_DF2T (sizeof(struct sof_eq_iir_header_df2t) / sizeof(int32_t))
-#define SOF_EQ_IIR_NBIQUAD_DF2T (sizeof(struct sof_eq_iir_biquad_df2t) / sizeof(int32_t))
-#endif
diff --git a/libc/kernel/uapi/sound/sof/manifest.h b/libc/kernel/uapi/sound/sof/manifest.h
deleted file mode 100644
index b8bd3e5..0000000
--- a/libc/kernel/uapi/sound/sof/manifest.h
+++ /dev/null
@@ -1,128 +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 __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__
-#define __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__
-#define SOF_MAN_ELF_TEXT_OFFSET 0x2000
-#define SOF_MAN_EXT_HEADER_MAGIC 0x31454124
-#define SOF_MAN_MOD_TYPE_BUILTIN 0
-#define SOF_MAN_MOD_TYPE_MODULE 1
-struct sof_man_module_type {
- uint32_t load_type : 4;
- uint32_t auto_start : 1;
- uint32_t domain_ll : 1;
- uint32_t domain_dp : 1;
- uint32_t rsvd_ : 25;
-};
-#define SOF_MAN_SEGMENT_TEXT 0
-#define SOF_MAN_SEGMENT_RODATA 1
-#define SOF_MAN_SEGMENT_DATA 1
-#define SOF_MAN_SEGMENT_BSS 2
-#define SOF_MAN_SEGMENT_EMPTY 15
-union sof_man_segment_flags {
- uint32_t ul;
- struct {
- uint32_t contents : 1;
- uint32_t alloc : 1;
- uint32_t load : 1;
- uint32_t readonly : 1;
- uint32_t code : 1;
- uint32_t data : 1;
- uint32_t _rsvd0 : 2;
- uint32_t type : 4;
- uint32_t _rsvd1 : 4;
- uint32_t length : 16;
- } r;
-} __packed;
-struct sof_man_segment_desc {
- union sof_man_segment_flags flags;
- uint32_t v_base_addr;
- uint32_t file_offset;
-} __packed;
-#define SOF_MAN_MOD_ID_LEN 4
-#define SOF_MAN_MOD_NAME_LEN 8
-#define SOF_MAN_MOD_SHA256_LEN 32
-#define SOF_MAN_MOD_ID { '$', 'A', 'M', 'E' }
-struct sof_man_module {
- uint8_t struct_id[SOF_MAN_MOD_ID_LEN];
- uint8_t name[SOF_MAN_MOD_NAME_LEN];
- uint8_t uuid[16];
- struct sof_man_module_type type;
- uint8_t hash[SOF_MAN_MOD_SHA256_LEN];
- uint32_t entry_point;
- uint16_t cfg_offset;
- uint16_t cfg_count;
- uint32_t affinity_mask;
- uint16_t instance_max_count;
- uint16_t instance_bss_size;
- struct sof_man_segment_desc segment[3];
-} __packed;
-struct sof_man_mod_config {
- uint32_t par[4];
- uint32_t is_pages;
- uint32_t cps;
- uint32_t ibs;
- uint32_t obs;
- uint32_t module_flags;
- uint32_t cpc;
- uint32_t obls;
-} __packed;
-#define SOF_MAN_FW_HDR_FW_NAME_LEN 8
-#define SOF_MAN_FW_HDR_ID { '$', 'A', 'M', '1' }
-#define SOF_MAN_FW_HDR_NAME "ADSPFW"
-#define SOF_MAN_FW_HDR_FLAGS 0x0
-#define SOF_MAN_FW_HDR_FEATURES 0xff
-struct sof_man_fw_header {
- uint8_t header_id[4];
- uint32_t header_len;
- uint8_t name[SOF_MAN_FW_HDR_FW_NAME_LEN];
- uint32_t preload_page_count;
- uint32_t fw_image_flags;
- uint32_t feature_mask;
- uint16_t major_version;
- uint16_t minor_version;
- uint16_t hotfix_version;
- uint16_t build_version;
- uint32_t num_module_entries;
- uint32_t hw_buf_base_addr;
- uint32_t hw_buf_length;
- uint32_t load_offset;
-} __packed;
-struct sof_man_fw_desc {
- struct sof_man_fw_header header;
-} __packed;
-struct sof_man_component_desc {
- uint32_t reserved[2];
- uint32_t version;
- uint8_t hash[SOF_MAN_MOD_SHA256_LEN];
- uint32_t base_offset;
- uint32_t limit_offset;
- uint32_t attributes[4];
-} __packed;
-struct sof_man_adsp_meta_file_ext {
- uint32_t ext_type;
- uint32_t ext_len;
- uint32_t imr_type;
- uint8_t reserved[16];
- struct sof_man_component_desc comp_desc[1];
-} __packed;
-struct sof_man_module_manifest {
- struct sof_man_module module;
- uint32_t text_size;
-} __packed;
-#endif
diff --git a/libc/kernel/uapi/sound/sof/tokens.h b/libc/kernel/uapi/sound/sof/tokens.h
index 748c5fe..0f80cfa 100644
--- a/libc/kernel/uapi/sound/sof/tokens.h
+++ b/libc/kernel/uapi/sound/sof/tokens.h
@@ -55,6 +55,7 @@
#define SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE 605
#define SOF_TKN_INTEL_DMIC_SAMPLE_RATE 608
#define SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH 609
+#define SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS 610
#define SOF_TKN_INTEL_DMIC_PDM_CTRL_ID 700
#define SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable 701
#define SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable 702
diff --git a/libc/kernel/uapi/sound/sof/tone.h b/libc/kernel/uapi/sound/sof/tone.h
deleted file mode 100644
index a4b745e..0000000
--- a/libc/kernel/uapi/sound/sof/tone.h
+++ /dev/null
@@ -1,29 +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 __INCLUDE_UAPI_SOUND_SOF_USER_TONE_H__
-#define __INCLUDE_UAPI_SOUND_SOF_USER_TONE_H__
-#define SOF_TONE_IDX_FREQUENCY 0
-#define SOF_TONE_IDX_AMPLITUDE 1
-#define SOF_TONE_IDX_FREQ_MULT 2
-#define SOF_TONE_IDX_AMPL_MULT 3
-#define SOF_TONE_IDX_LENGTH 4
-#define SOF_TONE_IDX_PERIOD 5
-#define SOF_TONE_IDX_REPEATS 6
-#define SOF_TONE_IDX_LIN_RAMP_STEP 7
-#endif
diff --git a/libc/kernel/uapi/sound/sof/trace.h b/libc/kernel/uapi/sound/sof/trace.h
deleted file mode 100644
index a5eed43..0000000
--- a/libc/kernel/uapi/sound/sof/trace.h
+++ /dev/null
@@ -1,45 +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 __INCLUDE_UAPI_SOUND_SOF_USER_TRACE_H__
-#define __INCLUDE_UAPI_SOUND_SOF_USER_TRACE_H__
-struct system_time {
- uint32_t val_l;
- uint32_t val_u;
-} __packed;
-#define LOG_ENABLE 1
-#define LOG_DISABLE 0
-#define LOG_LEVEL_CRITICAL 1
-#define LOG_LEVEL_VERBOSE 2
-struct log_buffer_layout {
- uint32_t read_ptr;
- uint32_t write_ptr;
- uint32_t buffer[0];
-} __packed;
-struct log_buffer_status {
- uint32_t core_id;
-} __packed;
-#define TRACE_ID_LENGTH 12
-struct log_entry_header {
- uint32_t id_0 : TRACE_ID_LENGTH;
- uint32_t id_1 : TRACE_ID_LENGTH;
- uint32_t core_id : 8;
- uint64_t timestamp;
- uint32_t log_entry_address;
-} __packed;
-#endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 9b39bb8..a4ab600 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1483,8 +1483,6 @@
LIBC_R { # introduced=R
global:
__mempcpy_chk;
- __open64_2;
- __openat64_2;
__tls_get_addr; # arm64
call_once;
cnd_broadcast;
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 41c4f9d..7340f95 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -39,6 +39,11 @@
"-Werror",
"-Wno-error=format-zero-length",
],
+
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.runtime",
+ ],
}
// ==============================================================
@@ -102,6 +107,15 @@
"-Wno-error=format-zero-length",
"-Wthread-safety",
],
+
+ apex_available: [
+ "com.android.runtime",
+ ],
+ static: {
+ apex_available: [
+ "//apex_available:platform",
+ ],
+ },
}
// ==============================================================
diff --git a/libc/malloc_hooks/Android.bp b/libc/malloc_hooks/Android.bp
index a0f8102..861c371 100644
--- a/libc/malloc_hooks/Android.bp
+++ b/libc/malloc_hooks/Android.bp
@@ -32,6 +32,15 @@
"-Werror",
"-fno-stack-protector",
],
+
+ apex_available: [
+ "com.android.runtime",
+ ],
+ static: {
+ apex_available: [
+ "//apex_available:platform",
+ ],
+ },
}
// ==============================================================
diff --git a/linker/linker_exidx_static.c b/libc/platform/bionic/mte_kernel.h
similarity index 67%
copy from linker/linker_exidx_static.c
copy to libc/platform/bionic/mte_kernel.h
index b38ef17..04f2bb6 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/platform/bionic/mte_kernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,16 @@
* SUCH DAMAGE.
*/
-#include <link.h>
+#pragma once
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
+// Defines constants used as part of the interface in an experimental MTE branch
+// of the Linux kernel, which may be found at:
+//
+// https://github.com/pcc/linux/tree/android-experimental-mte
+//
+// This interface should not be considered to be stable.
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+#ifdef ANDROID_EXPERIMENTAL_MTE
+#define HWCAP2_MTE (1UL << 31)
+#define PROT_MTE 0x10
+#endif
diff --git a/linker/linker_exidx_static.c b/libc/private/bionic_call_ifunc_resolver.h
similarity index 68%
rename from linker/linker_exidx_static.c
rename to libc/private/bionic_call_ifunc_resolver.h
index b38ef17..e0ea35b 100644
--- a/linker/linker_exidx_static.c
+++ b/libc/private/bionic_call_ifunc_resolver.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,21 +26,9 @@
* SUCH DAMAGE.
*/
+#pragma once
+
#include <link.h>
+#include <sys/cdefs.h>
-/* Find the .ARM.exidx section (which in the case of a static executable
- * can be identified through its start and end symbols), and return its
- * beginning and numbe of entries to the caller. Note that for static
- * executables we do not need to use the value of the PC to find the
- * EXIDX section.
- */
-
-extern unsigned __exidx_end;
-extern unsigned __exidx_start;
-
-_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __unused,
- int* pcount)
-{
- *pcount = (__exidx_end-__exidx_start)/8;
- return __exidx_start;
-}
+__LIBC_HIDDEN__ ElfW(Addr) __bionic_call_ifunc_resolver(ElfW(Addr) resolver_addr);
diff --git a/libc/private/bionic_ifuncs.h b/libc/private/bionic_ifuncs.h
index 35961fb..f175bec 100644
--- a/libc/private/bionic_ifuncs.h
+++ b/libc/private/bionic_ifuncs.h
@@ -28,10 +28,22 @@
#pragma once
+#include <stdint.h>
+#include <sys/ifunc.h>
+
+#if defined(__aarch64__)
+#define IFUNC_ARGS (uint64_t hwcap __attribute__((unused)), \
+ __ifunc_arg_t* arg __attribute__((unused)))
+#elif defined(__arm__)
+#define IFUNC_ARGS (unsigned long hwcap __attribute__((unused)))
+#else
+#define IFUNC_ARGS ()
+#endif
+
#define DEFINE_IFUNC_FOR(name) \
name##_func name __attribute__((ifunc(#name "_resolver"))); \
__attribute__((visibility("hidden"))) \
- name##_func* name##_resolver()
+ name##_func* name##_resolver IFUNC_ARGS
#define DECLARE_FUNC(type, name) \
__attribute__((visibility("hidden"))) \
diff --git a/libc/upstream-freebsd/android/include/freebsd-compat.h b/libc/upstream-freebsd/android/include/freebsd-compat.h
index 6f7a3f0..b16a688 100644
--- a/libc/upstream-freebsd/android/include/freebsd-compat.h
+++ b/libc/upstream-freebsd/android/include/freebsd-compat.h
@@ -14,37 +14,13 @@
* limitations under the License.
*/
-#ifndef _BIONIC_FREEBSD_COMPAT_H_included
-#define _BIONIC_FREEBSD_COMPAT_H_included
+#pragma once
#define _BSD_SOURCE
-#include <sys/cdefs.h>
-#include <stddef.h> // For size_t.
-
#define REPLACE_GETOPT
-/*
- * FreeBSD's libc has three symbols for every symbol:
- *
- * __f will be the actual implementation.
- * _f will be a weak reference to __f (used for calls to f from within the library).
- * f will be a weak reference to __f (used for calls to f from outside the library).
- *
- * We collapse this into just the one symbol, f.
- */
-
-/* Prevent weak reference generation. */
-#define __weak_reference(sym,alias)
-
-/* Ensure that the implementation itself gets the underscore-free name. */
-#define __sleep sleep
-#define __usleep usleep
-
-/* Redirect internal C library calls to the public function. */
-#define _nanosleep nanosleep
-
/* FreeBSD has this, but we can't really implement it correctly on Linux. */
#define issetugid() 0
-#endif
+#define __compiler_membar() __asm __volatile(" " : : : "memory")
diff --git a/libc/upstream-freebsd/android/include/machine/atomic.h b/libc/upstream-freebsd/android/include/machine/atomic.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc/upstream-freebsd/android/include/machine/atomic.h
diff --git a/libc/upstream-freebsd/android/include/namespace.h b/libc/upstream-freebsd/android/include/namespace.h
index a3f850e..e69de29 100644
--- a/libc/upstream-freebsd/android/include/namespace.h
+++ b/libc/upstream-freebsd/android/include/namespace.h
@@ -1,20 +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.
- */
-
-#ifndef _BIONIC_FREEBSD_NAMESPACE_H_included
-#define _BIONIC_FREEBSD_NAMESPACE_H_included
-
-#endif
diff --git a/libc/upstream-freebsd/android/include/un-namespace.h b/libc/upstream-freebsd/android/include/un-namespace.h
index a3f850e..e69de29 100644
--- a/libc/upstream-freebsd/android/include/un-namespace.h
+++ b/libc/upstream-freebsd/android/include/un-namespace.h
@@ -1,20 +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.
- */
-
-#ifndef _BIONIC_FREEBSD_NAMESPACE_H_included
-#define _BIONIC_FREEBSD_NAMESPACE_H_included
-
-#endif
diff --git a/libc/upstream-freebsd/lib/libc/gen/sleep.c b/libc/upstream-freebsd/lib/libc/gen/sleep.c
deleted file mode 100644
index b807c2d..0000000
--- a/libc/upstream-freebsd/lib/libc/gen/sleep.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sleep.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <time.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-unsigned int
-__sleep(unsigned int seconds)
-{
- struct timespec time_to_sleep;
- struct timespec time_remaining;
-
- /*
- * Avoid overflow when `seconds' is huge. This assumes that
- * the maximum value for a time_t is >= INT_MAX.
- */
- if (seconds > INT_MAX)
- return (seconds - INT_MAX + __sleep(INT_MAX));
-
- time_to_sleep.tv_sec = seconds;
- time_to_sleep.tv_nsec = 0;
- if (_nanosleep(&time_to_sleep, &time_remaining) != -1)
- return (0);
- if (errno != EINTR)
- return (seconds); /* best guess */
- return (time_remaining.tv_sec +
- (time_remaining.tv_nsec != 0)); /* round up */
-}
-
-__weak_reference(__sleep, sleep);
-__weak_reference(__sleep, _sleep);
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c b/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c
index 9534a2a..6a3067c 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c
@@ -55,7 +55,7 @@
#endif /* LIBC_SCCS and not lint */
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/stdlib/getopt_long.c 342757 2019-01-04 03:13:24Z kevans $");
#include <err.h>
#include <errno.h>
@@ -481,6 +481,8 @@
#endif
if (*place == '-') {
place++; /* --foo long option */
+ if (*place == '\0')
+ return (BADARG); /* malformed option */
#ifdef GNU_COMPATIBLE
dash_prefix = DD_PREFIX;
#endif
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c b/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c
index d512857..b175d34 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2015 Nuxi, https://nuxi.nl/
*
* Redistribution and use in source and binary forms, with or without
@@ -24,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/libc/stdlib/hcreate.c 292767 2015-12-27 07:50:11Z ed $");
+__FBSDID("$FreeBSD: head/lib/libc/stdlib/hcreate.c 326193 2017-11-25 17:12:48Z pfg $");
#include <search.h>
#include <stdbool.h>
diff --git a/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c b/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c
index ef8cdb1..9e4e79d 100644
--- a/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c
+++ b/libc/upstream-freebsd/lib/libc/stdlib/quick_exit.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2011 David Chisnall
* All rights reserved.
*
@@ -23,9 +25,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/libc/stdlib/quick_exit.c 326193 2017-11-25 17:12:48Z pfg $
*/
+#include <sys/types.h>
+#include <machine/atomic.h>
#include <stdlib.h>
#include <pthread.h>
@@ -60,6 +64,7 @@
h->cleanup = func;
pthread_mutex_lock(&atexit_mutex);
h->next = handlers;
+ __compiler_membar();
handlers = h;
pthread_mutex_unlock(&atexit_mutex);
return (0);
@@ -74,7 +79,9 @@
* XXX: The C++ spec requires us to call std::terminate if there is an
* exception here.
*/
- for (h = handlers; NULL != h; h = h->next)
+ for (h = handlers; NULL != h; h = h->next) {
+ __compiler_membar();
h->cleanup();
+ }
_Exit(status);
}
diff --git a/libc/upstream-freebsd/lib/libc/string/wcpcpy.c b/libc/upstream-freebsd/lib/libc/string/wcpcpy.c
index df63d72..e040dba 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcpcpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcpcpy.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1999
* David E. O'Brien
* Copyright (c) 1988, 1993
@@ -33,7 +35,7 @@
static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcpcpy.c 326025 2017-11-20 19:49:47Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcpncpy.c b/libc/upstream-freebsd/lib/libc/string/wcpncpy.c
index 87b361c..8bf6e87 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcpncpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcpncpy.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcpncpy.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c b/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c
index 0143543..5bd468d 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscasecmp.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcscasecmp.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
#include <wctype.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscat.c b/libc/upstream-freebsd/lib/libc/string/wcscat.c
index 7ae4e80..792f61e 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscat.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscat.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcscat.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcschr.c b/libc/upstream-freebsd/lib/libc/string/wcschr.c
index 1df1fe6..ca740c0 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcschr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcschr.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcschr.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscmp.c b/libc/upstream-freebsd/lib/libc/string/wcscmp.c
index c2abe4c..db01892 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscmp.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -37,7 +39,7 @@
__RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcscmp.c 326025 2017-11-20 19:49:47Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscpy.c b/libc/upstream-freebsd/lib/libc/string/wcscpy.c
index 0c6e1f2..a639e74 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscpy.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcscpy.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcscspn.c b/libc/upstream-freebsd/lib/libc/string/wcscspn.c
index 7729dc8..8a7682f 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcscspn.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcscspn.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcscspn.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsdup.c b/libc/upstream-freebsd/lib/libc/string/wcsdup.c
index 1e5db92..b97f766 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsdup.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsdup.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2005 Tim J. Robbins.
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsdup.c 326193 2017-11-25 17:12:48Z pfg $");
#include <stdlib.h>
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcslcat.c b/libc/upstream-freebsd/lib/libc/string/wcslcat.c
index f5f1e1e..9706fa6 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcslcat.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcslcat.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
* All rights reserved.
*
@@ -33,7 +35,7 @@
__RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcslcat.c 326193 2017-11-25 17:12:48Z pfg $");
#include <sys/types.h>
#include <wchar.h>
@@ -54,7 +56,7 @@
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
- while (*d != '\0' && n-- != 0)
+ while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
diff --git a/libc/upstream-freebsd/lib/libc/string/wcslen.c b/libc/upstream-freebsd/lib/libc/string/wcslen.c
index ca3004e..c596825 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcslen.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcslen.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcslen.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c b/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c
index a42d98c..a963444 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncasecmp.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsncasecmp.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
#include <wctype.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncat.c b/libc/upstream-freebsd/lib/libc/string/wcsncat.c
index 44f1ff9..0214af4 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncat.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncat.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsncat.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
@@ -48,7 +50,7 @@
p++;
q = p;
r = s2;
- while (*r && n) {
+ while (n && *r) {
*q++ = *r++;
n--;
}
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncmp.c b/libc/upstream-freebsd/lib/libc/string/wcsncmp.c
index 8236d96..77b709c 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncmp.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -34,7 +36,7 @@
__RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsncmp.c 326025 2017-11-20 19:49:47Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsncpy.c b/libc/upstream-freebsd/lib/libc/string/wcsncpy.c
index 215e9a1..4075ecc 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsncpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsncpy.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -36,7 +38,7 @@
#endif /* LIBC_SCCS and not lint */
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsncpy.c 326025 2017-11-20 19:49:47Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsnlen.c b/libc/upstream-freebsd/lib/libc/string/wcsnlen.c
index f03cf76..271d341 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsnlen.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsnlen.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsnlen.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcspbrk.c b/libc/upstream-freebsd/lib/libc/string/wcspbrk.c
index 2ff71ba..63efb01 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcspbrk.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcspbrk.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcspbrk.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcspbrk.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsrchr.c b/libc/upstream-freebsd/lib/libc/string/wcsrchr.c
index 37c81ec..97665ca 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsrchr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsrchr.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
@@ -25,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsrchr.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsspn.c b/libc/upstream-freebsd/lib/libc/string/wcsspn.c
index 6569206..b08a39e 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsspn.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsspn.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wcsspn.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsspn.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcsstr.c b/libc/upstream-freebsd/lib/libc/string/wcsstr.c
index ce598a6..4309025 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcsstr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcsstr.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -36,7 +38,7 @@
#endif /* LIBC_SCCS and not lint */
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcsstr.c 326025 2017-11-20 19:49:47Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wcstok.c b/libc/upstream-freebsd/lib/libc/string/wcstok.c
index 441fbd4..8d62bf7 100644
--- a/libc/upstream-freebsd/lib/libc/string/wcstok.c
+++ b/libc/upstream-freebsd/lib/libc/string/wcstok.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1998 Softweyr LLC. All rights reserved.
*
* strtok_r, from Berkeley strtok
@@ -33,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wcstok.c 326025 2017-11-20 19:49:47Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemchr.c b/libc/upstream-freebsd/lib/libc/string/wmemchr.c
index cab89c9..412a276 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemchr.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemchr.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wmemchr.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemcmp.c b/libc/upstream-freebsd/lib/libc/string/wmemcmp.c
index fdb1f98..c1e9f3c 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemcmp.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemcmp.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wmemcmp.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wmemcmp.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemcpy.c b/libc/upstream-freebsd/lib/libc/string/wmemcpy.c
index c10770c..e0d6c04 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemcpy.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemcpy.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wmemcpy.c 326193 2017-11-25 17:12:48Z pfg $");
#include <string.h>
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemmove.c b/libc/upstream-freebsd/lib/libc/string/wmemmove.c
index 05cfd10..b84c2c0 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemmove.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemmove.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wmemmove.c 326193 2017-11-25 17:12:48Z pfg $");
#include <string.h>
#include <wchar.h>
diff --git a/libc/upstream-freebsd/lib/libc/string/wmemset.c b/libc/upstream-freebsd/lib/libc/string/wmemset.c
index 0e96356..d4d6308 100644
--- a/libc/upstream-freebsd/lib/libc/string/wmemset.c
+++ b/libc/upstream-freebsd/lib/libc/string/wmemset.c
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
@@ -32,7 +34,7 @@
__RCSID("$NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/libc/string/wmemset.c 326193 2017-11-25 17:12:48Z pfg $");
#include <wchar.h>
diff --git a/libc/upstream-netbsd/android/include/env.h b/libc/upstream-netbsd/android/include/env.h
index 8f99f9d..e69de29 100644
--- a/libc/upstream-netbsd/android/include/env.h
+++ b/libc/upstream-netbsd/android/include/env.h
@@ -1,22 +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.
- */
-
-#ifndef _BIONIC_NETBSD_ENV_H_included
-#define _BIONIC_NETBSD_ENV_H_included
-
-/* Placeholder. */
-
-#endif
diff --git a/libc/upstream-netbsd/android/include/extern.h b/libc/upstream-netbsd/android/include/extern.h
index 616becd..b8e6151 100644
--- a/libc/upstream-netbsd/android/include/extern.h
+++ b/libc/upstream-netbsd/android/include/extern.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _BIONIC_NETBSD_EXTERN_H_included
-#define _BIONIC_NETBSD_EXTERN_H_included
+#pragma once
#include <sys/cdefs.h>
@@ -24,5 +23,3 @@
const char* __strsignal(int, char*, size_t);
__END_DECLS
-
-#endif
diff --git a/libc/upstream-netbsd/android/include/namespace.h b/libc/upstream-netbsd/android/include/namespace.h
index 630ea9b..ae7585c 100644
--- a/libc/upstream-netbsd/android/include/namespace.h
+++ b/libc/upstream-netbsd/android/include/namespace.h
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-#ifndef _BIONIC_NETBSD_NAMESPACE_H_included
-#define _BIONIC_NETBSD_NAMESPACE_H_included
+#pragma once
__LIBC_HIDDEN__ int __res_enable_mt(void);
__LIBC_HIDDEN__ int __res_disable_mt(void);
-
-#endif
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index af5ae29..ea630b2 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _BIONIC_NETBSD_COMPAT_H_included
-#define _BIONIC_NETBSD_COMPAT_H_included
+#pragma once
#define _BSD_SOURCE
#define _GNU_SOURCE
@@ -47,5 +46,3 @@
/* Use appropriate shell depending on process's executable. */
__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
#define _PATH_BSHELL __bionic_get_shell_path()
-
-#endif
diff --git a/libc/upstream-netbsd/android/include/port_after.h b/libc/upstream-netbsd/android/include/port_after.h
index 3f8b6f8..e69de29 100644
--- a/libc/upstream-netbsd/android/include/port_after.h
+++ b/libc/upstream-netbsd/android/include/port_after.h
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included
-#define _BIONIC_NETBSD_PORT_BEFORE_H_included
-
-#endif
diff --git a/libc/upstream-netbsd/android/include/port_before.h b/libc/upstream-netbsd/android/include/port_before.h
index 9fa9487..8266f81 100644
--- a/libc/upstream-netbsd/android/include/port_before.h
+++ b/libc/upstream-netbsd/android/include/port_before.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _BIONIC_NETBSD_PORT_BEFORE_H_included
-#define _BIONIC_NETBSD_PORT_BEFORE_H_included
+#pragma once
#include "namespace.h"
#include <sys/cdefs.h>
@@ -24,5 +23,3 @@
#define ISC_FORMAT_PRINTF(a,b) __printflike(a,b)
#define ISC_SOCKLEN_T socklen_t
-
-#endif
diff --git a/libc/upstream-openbsd/android/include/arith.h b/libc/upstream-openbsd/android/include/arith.h
index cb116d4..554aa85 100644
--- a/libc/upstream-openbsd/android/include/arith.h
+++ b/libc/upstream-openbsd/android/include/arith.h
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#pragma once
+
#define IEEE_8087
#if defined(__LP64__)
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index 2c8c735..afd1077 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -14,34 +14,20 @@
* limitations under the License.
*/
-#ifndef _BIONIC_OPENBSD_COMPAT_H_included
-#define _BIONIC_OPENBSD_COMPAT_H_included
+#pragma once
#define _BSD_SOURCE
#include <sys/cdefs.h>
#include <stddef.h> // For size_t.
-// TODO: libandroid_support uses this file, so we need to wait for
-// <sys/random.h> to be in the NDK headers before we can lose this declaration.
-//#include <sys/random.h> // For getentropy.
-int getentropy(void*, size_t);
+#include <sys/random.h> // For getentropy.
#define __BEGIN_HIDDEN_DECLS _Pragma("GCC visibility push(hidden)")
#define __END_HIDDEN_DECLS _Pragma("GCC visibility pop")
extern const char* __progname;
-/* Redirect internal C library calls to the public function. */
-#define _err err
-#define _errx errx
-#define _verr verr
-#define _verrx verrx
-#define _vwarn vwarn
-#define _vwarnx vwarnx
-#define _warn warn
-#define _warnx warnx
-
/* Ignore all DEF_STRONG/DEF_WEAK in OpenBSD. */
#define DEF_STRONG(sym)
#define DEF_WEAK(sym)
@@ -82,5 +68,3 @@
__LIBC_HIDDEN__ extern char* __findenv(const char*, int, int*);
__LIBC_HIDDEN__ extern char* _mktemp(char*);
-
-#endif
diff --git a/libc/upstream-openbsd/lib/libc/gen/isctype.c b/libc/upstream-openbsd/lib/libc/gen/isctype.c
deleted file mode 100644
index a4e944c..0000000
--- a/libc/upstream-openbsd/lib/libc/gen/isctype.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $OpenBSD: isctype.c,v 1.12 2015/09/13 11:38:08 guenther Exp $ */
-/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#define _ANSI_LIBRARY
-#include <ctype.h>
-#include <stdio.h>
-
-#undef isalnum
-int
-isalnum(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N)));
-}
-DEF_STRONG(isalnum);
-
-#undef isalpha
-int
-isalpha(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L)));
-}
-DEF_STRONG(isalpha);
-
-#undef isblank
-int
-isblank(int c)
-{
- return (c == ' ' || c == '\t');
-}
-DEF_STRONG(isblank);
-
-#undef iscntrl
-int
-iscntrl(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _C));
-}
-DEF_STRONG(iscntrl);
-
-#undef isdigit
-int
-isdigit(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N));
-}
-DEF_STRONG(isdigit);
-
-#undef isgraph
-int
-isgraph(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N)));
-}
-DEF_STRONG(isgraph);
-
-#undef islower
-int
-islower(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _L));
-}
-DEF_STRONG(islower);
-
-#undef isprint
-int
-isprint(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B)));
-}
-DEF_STRONG(isprint);
-
-#undef ispunct
-int
-ispunct(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _P));
-}
-DEF_STRONG(ispunct);
-
-#undef isspace
-int
-isspace(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _S));
-}
-DEF_STRONG(isspace);
-
-#undef isupper
-int
-isupper(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _U));
-}
-DEF_STRONG(isupper);
-
-#undef isxdigit
-int
-isxdigit(int c)
-{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
-}
-DEF_STRONG(isxdigit);
-
-#undef isascii
-int
-isascii(int c)
-{
- return ((unsigned int)c <= 0177);
-}
-DEF_WEAK(isascii);
-
-#undef toascii
-int
-toascii(int c)
-{
- return (c & 0177);
-}
-
-#undef _toupper
-int
-_toupper(int c)
-{
- return (c - 'a' + 'A');
-}
-
-#undef _tolower
-int
-_tolower(int c)
-{
- return (c - 'A' + 'a');
-}
diff --git a/libc/upstream-freebsd/lib/libc/gen/usleep.c b/libc/upstream-openbsd/lib/libc/string/strlen.c
similarity index 69%
rename from libc/upstream-freebsd/lib/libc/gen/usleep.c
rename to libc/upstream-openbsd/lib/libc/string/strlen.c
index 7d6559b..a5721d3 100644
--- a/libc/upstream-freebsd/lib/libc/gen/usleep.c
+++ b/libc/upstream-openbsd/lib/libc/string/strlen.c
@@ -1,5 +1,7 @@
-/*
- * Copyright (c) 1989, 1993
+/* $OpenBSD: strlen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +12,7 @@
* 2. 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -27,26 +29,16 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)usleep.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+#include <string.h>
-#include "namespace.h"
-#include <time.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-int
-__usleep(useconds_t useconds)
+size_t
+strlen(const char *str)
{
- struct timespec time_to_sleep;
+ const char *s;
- time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
- time_to_sleep.tv_sec = useconds / 1000000;
- return (_nanosleep(&time_to_sleep, NULL));
+ for (s = str; *s; ++s)
+ ;
+ return (s - str);
}
-__weak_reference(__usleep, usleep);
-__weak_reference(__usleep, _usleep);
+DEF_STRONG(strlen);
diff --git a/libdl/Android.bp b/libdl/Android.bp
index e36ddc5..15263e9 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -111,6 +111,11 @@
symbol_file: "libdl.map.txt",
versions: ["10000"],
},
+
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.runtime",
+ ],
}
cc_library {
diff --git a/libdl/libdl_static.cpp b/libdl/libdl_static.cpp
index 0a36e6f..3bbf963 100644
--- a/libdl/libdl_static.cpp
+++ b/libdl/libdl_static.cpp
@@ -41,9 +41,3 @@
int dlclose(void* /*handle*/) {
return -1;
}
-
-#if defined(__arm__)
-_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr /*pc*/, int* /*pcount*/) {
- return 0;
-}
-#endif
diff --git a/libm/Android.bp b/libm/Android.bp
index 59466e4..bf05b17 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -463,7 +463,6 @@
cflags: [
"-D__BIONIC_LP32_USE_LONG_DOUBLE",
- "-D__BIONIC_NO_MATH_INLINES",
"-D_BSD_SOURCE",
"-DFLT_EVAL_METHOD=0",
"-include freebsd-compat.h",
@@ -501,6 +500,11 @@
symbol_file: "libm.map.txt",
versions: ["10000"],
},
+
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.runtime",
+ ],
}
ndk_library {
diff --git a/libm/upstream-freebsd/lib/msun/src/e_exp.c b/libm/upstream-freebsd/lib/msun/src/e_exp.c
index 94c9769..dd88d3e 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_exp.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_exp.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_exp.c 352710 2019-09-25 18:50:57Z dim $");
/* __ieee754_exp(x)
* Returns the exponential of x.
@@ -145,9 +145,9 @@
/* x is now in primary range */
t = x*x;
if(k >= -1021)
- INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0);
+ INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0);
else
- INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0);
+ INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0);
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi);
diff --git a/libm/upstream-freebsd/lib/msun/src/e_expf.c b/libm/upstream-freebsd/lib/msun/src/e_expf.c
index b1fe2c5..aaf6d5f 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_expf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_expf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_expf.c 352710 2019-09-25 18:50:57Z dim $");
#include <float.h>
@@ -83,9 +83,9 @@
/* x is now in primary range */
t = x*x;
if(k >= -125)
- SET_FLOAT_WORD(twopk,0x3f800000+(k<<23));
+ SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23);
else
- SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23));
+ SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23);
c = x - t*(P1+t*P2);
if(k==0) return one-((x*c)/(c-(float)2.0)-x);
else y = one-((lo-(x*c)/((float)2.0-c))-hi);
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0.c b/libm/upstream-freebsd/lib/msun/src/e_j0.c
index 6bca542..a008b42 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j0.c 343023 2019-01-14 15:48:35Z pfg $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0.c 343953 2019-02-10 08:46:07Z peterj $");
/* __ieee754_j0(x), __ieee754_y0(x)
* Bessel function of the first and second kinds of order zero.
@@ -93,8 +93,7 @@
if(ix>=0x7ff00000) return one/(x*x);
x = fabs(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
- s = sin(x);
- c = cos(x);
+ sincos(x, &s, &c);
ss = s-c;
cc = s+c;
if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */
@@ -173,8 +172,7 @@
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
* to compute the worse one.
*/
- s = sin(x);
- c = cos(x);
+ sincos(x, &s, &c);
ss = s-c;
cc = s+c;
/*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0f.c b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
index 714caac..495a5e5 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 343023 2019-01-14 15:48:35Z pfg $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 343953 2019-02-10 08:46:07Z peterj $");
/*
* See e_j0.c for complete comments.
@@ -55,8 +55,7 @@
if(ix>=0x7f800000) return one/(x*x);
x = fabsf(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
- s = sinf(x);
- c = cosf(x);
+ sincosf(x, &s, &c);
ss = s-c;
cc = s+c;
if(ix<0x7f000000) { /* Make sure x+x does not overflow. */
@@ -128,8 +127,7 @@
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
* to compute the worse one.
*/
- s = sinf(x);
- c = cosf(x);
+ sincosf(x, &s, &c);
ss = s-c;
cc = s+c;
/*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j1.c b/libm/upstream-freebsd/lib/msun/src/e_j1.c
index 78bb329..6d1c41c 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j1.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j1.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j1.c 336089 2018-07-08 16:26:13Z markj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j1.c 343953 2019-02-10 08:46:07Z peterj $");
/* __ieee754_j1(x), __ieee754_y1(x)
* Bessel function of the first and second kinds of order zero.
@@ -94,8 +94,7 @@
if(ix>=0x7ff00000) return one/x;
y = fabs(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
- s = sin(y);
- c = cos(y);
+ sincos(y, &s, &c);
ss = -s-c;
cc = s-c;
if(ix<0x7fe00000) { /* make sure y+y not overflow */
@@ -159,8 +158,7 @@
/* y1(x<0) = NaN and raise invalid exception. */
if(hx<0) return vzero/vzero;
if(ix >= 0x40000000) { /* |x| >= 2.0 */
- s = sin(x);
- c = cos(x);
+ sincos(x, &s, &c);
ss = -s-c;
cc = s-c;
if(ix<0x7fe00000) { /* make sure x+x not overflow */
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j1f.c b/libm/upstream-freebsd/lib/msun/src/e_j1f.c
index 3abe201..31fc28a 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j1f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j1f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j1f.c 336089 2018-07-08 16:26:13Z markj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j1f.c 343953 2019-02-10 08:46:07Z peterj $");
/*
* See e_j1.c for complete comments.
@@ -56,8 +56,7 @@
if(ix>=0x7f800000) return one/x;
y = fabsf(x);
if(ix >= 0x40000000) { /* |x| >= 2.0 */
- s = sinf(y);
- c = cosf(y);
+ sincosf(y, &s, &c);
ss = -s-c;
cc = s-c;
if(ix<0x7f000000) { /* make sure y+y not overflow */
@@ -114,8 +113,7 @@
if(ix==0) return -one/vzero;
if(hx<0) return vzero/vzero;
if(ix >= 0x40000000) { /* |x| >= 2.0 */
- s = sinf(x);
- c = cosf(x);
+ sincosf(x, &s, &c);
ss = -s-c;
cc = s-c;
if(ix<0x7f000000) { /* make sure x+x not overflow */
diff --git a/libm/upstream-freebsd/lib/msun/src/e_jn.c b/libm/upstream-freebsd/lib/msun/src/e_jn.c
index 58ec905..c039cf2 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_jn.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_jn.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_jn.c 336089 2018-07-08 16:26:13Z markj $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_jn.c 343953 2019-02-10 08:46:07Z peterj $");
/*
* __ieee754_jn(n, x), __ieee754_yn(n, x)
@@ -54,7 +54,7 @@
__ieee754_jn(int n, double x)
{
int32_t i,hx,ix,lx, sgn;
- double a, b, temp, di;
+ double a, b, c, s, temp, di;
double z, w;
/* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
@@ -91,11 +91,12 @@
* 2 -s+c -c-s
* 3 s+c c-s
*/
+ sincos(x, &s, &c);
switch(n&3) {
- case 0: temp = cos(x)+sin(x); break;
- case 1: temp = -cos(x)+sin(x); break;
- case 2: temp = -cos(x)-sin(x); break;
- case 3: temp = cos(x)-sin(x); break;
+ case 0: temp = c+s; break;
+ case 1: temp = -c+s; break;
+ case 2: temp = -c-s; break;
+ case 3: temp = c-s; break;
}
b = invsqrtpi*temp/sqrt(x);
} else {
@@ -216,7 +217,7 @@
{
int32_t i,hx,ix,lx;
int32_t sign;
- double a, b, temp;
+ double a, b, c, s, temp;
EXTRACT_WORDS(hx,lx,x);
ix = 0x7fffffff&hx;
@@ -248,11 +249,12 @@
* 2 -s+c -c-s
* 3 s+c c-s
*/
+ sincos(x, &s, &c);
switch(n&3) {
- case 0: temp = sin(x)-cos(x); break;
- case 1: temp = -sin(x)-cos(x); break;
- case 2: temp = -sin(x)+cos(x); break;
- case 3: temp = sin(x)+cos(x); break;
+ case 0: temp = s-c; break;
+ case 1: temp = -s-c; break;
+ case 2: temp = -s+c; break;
+ case 3: temp = s+c; break;
}
b = invsqrtpi*temp/sqrt(x);
} else {
diff --git a/libm/upstream-freebsd/lib/msun/src/s_expm1.c b/libm/upstream-freebsd/lib/msun/src/s_expm1.c
index 37998a3..21256ce 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_expm1.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_expm1.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1.c 352710 2019-09-25 18:50:57Z dim $");
/* expm1(x)
* Returns exp(x)-1, the exponential of x minus 1.
@@ -188,7 +188,7 @@
e = hxs*((r1-t)/(6.0 - x*t));
if(k==0) return x - (x*e-hxs); /* c is 0 */
else {
- INSERT_WORDS(twopk,0x3ff00000+(k<<20),0); /* 2^k */
+ INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0); /* 2^k */
e = (x*(e-c)-c);
e -= hxs;
if(k== -1) return 0.5*(x-e)-0.5;
diff --git a/libm/upstream-freebsd/lib/msun/src/s_expm1f.c b/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
index c0a3934..4d9ab36 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1f.c 352710 2019-09-25 18:50:57Z dim $");
#include <float.h>
@@ -94,7 +94,7 @@
e = hxs*((r1-t)/((float)6.0 - x*t));
if(k==0) return x - (x*e-hxs); /* c is 0 */
else {
- SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); /* 2^k */
+ SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); /* 2^k */
e = (x*(e-c)-c);
e -= hxs;
if(k== -1) return (float)0.5*(x-e)-(float)0.5;
diff --git a/libm/upstream-freebsd/lib/msun/src/s_lround.c b/libm/upstream-freebsd/lib/msun/src/s_lround.c
index b6a25b7..ce2aee7 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_lround.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_lround.c
@@ -32,7 +32,7 @@
#include <math.h>
#ifndef type
-__FBSDID("$FreeBSD: head/lib/msun/src/s_lround.c 326219 2017-11-26 02:00:33Z pfg $");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_lround.c 353329 2019-10-08 21:39:51Z brooks $");
#define type double
#define roundit round
#define dtype long
@@ -49,9 +49,9 @@
* that everything is in range. At compile time, INRANGE(x) should reduce to
* two floating-point comparisons in the former case, or TRUE otherwise.
*/
-static const type dtype_min = DTYPE_MIN - 0.5;
-static const type dtype_max = DTYPE_MAX + 0.5;
-#define INRANGE(x) (dtype_max - DTYPE_MAX != 0.5 || \
+static const type dtype_min = (type)DTYPE_MIN - 0.5;
+static const type dtype_max = (type)DTYPE_MAX + 0.5;
+#define INRANGE(x) (dtype_max - (type)DTYPE_MAX != 0.5 || \
((x) > dtype_min && (x) < dtype_max))
dtype
diff --git a/linker/Android.bp b/linker/Android.bp
index e2cdd14..bb9d26d 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -96,7 +96,6 @@
name: "linker_sources_arm",
srcs: [
"arch/arm/begin.S",
- "linker_exidx_static.c",
],
}
@@ -233,6 +232,7 @@
arm: {
srcs: [ ":linker_sources_arm" ],
version_script: ":linker_version_script_arm",
+ static_libs: ["libunwind_llvm"],
},
arm64: {
srcs: [":linker_sources_arm64"],
@@ -276,6 +276,17 @@
"liblinker_malloc",
],
+ // Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
+ // definition of the symbol. The linker links against libgcc.a, whose arm32 unwinder has a weak
+ // reference to __gnu_Unwind_Find_exidx, which isn't sufficient to pull in the strong definition
+ // of __gnu_Unwind_Find_exidx from libc. An unresolved weak reference would create a
+ // non-relative dynamic relocation in the linker binary, which complicates linker startup.
+ //
+ // This line should be unnecessary because the linker's dependency on libunwind_llvm.a should
+ // override libgcc.a, but this line provides a simpler guarantee. It can be removed once the
+ // linker stops linking against libgcc.a's arm32 unwinder.
+ whole_static_libs: ["libc_unwind_static"],
+
name: "linker",
symlinks: ["linker_asan"],
recovery_available: true,
@@ -303,6 +314,11 @@
},
compile_multilib: "both",
xom: false,
+
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.runtime",
+ ],
}
sh_binary {
@@ -376,6 +392,11 @@
sanitize: {
never: true,
},
+
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.runtime",
+ ],
}
cc_test {
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 18301e0..228e30a 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -31,6 +31,7 @@
#include "linker_globals.h"
#include "linker_dlwarning.h"
+#include <link.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -193,11 +194,6 @@
return do_dl_iterate_phdr(cb, data);
}
-// This function is needed by libgcc.a
-int dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data) {
- return __loader_dl_iterate_phdr(cb, data);
-}
-
#if defined(__arm__)
_Unwind_Ptr __loader_dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
ScopedPthreadMutexLocker locker(&g_dl_mutex);
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 37a3189..c1bccfe 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -68,6 +68,7 @@
#include "linker_tls.h"
#include "linker_utils.h"
+#include "private/bionic_call_ifunc_resolver.h"
#include "private/bionic_globals.h"
#include "android-base/macros.h"
#include "android-base/strings.h"
@@ -2690,11 +2691,9 @@
ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr) {
if (g_is_ldd) return 0;
- typedef ElfW(Addr) (*ifunc_resolver_t)(void);
- ifunc_resolver_t ifunc_resolver = reinterpret_cast<ifunc_resolver_t>(resolver_addr);
- ElfW(Addr) ifunc_addr = ifunc_resolver();
+ ElfW(Addr) ifunc_addr = __bionic_call_ifunc_resolver(resolver_addr);
TRACE_TYPE(RELO, "Called ifunc_resolver@%p. The result is %p",
- ifunc_resolver, reinterpret_cast<void*>(ifunc_addr));
+ reinterpret_cast<void *>(resolver_addr), reinterpret_cast<void*>(ifunc_addr));
return ifunc_addr;
}
@@ -2931,8 +2930,11 @@
}
#else
static ElfW(Addr) get_addend(ElfW(Rel)* rel, ElfW(Addr) reloc_addr) {
+ // The i386 psABI specifies that R_386_GLOB_DAT doesn't have an addend. The ARM ELF ABI document
+ // (IHI0044F) specifies that R_ARM_GLOB_DAT has an addend, but Bionic isn't adding it.
if (ELFW(R_TYPE)(rel->r_info) == R_GENERIC_RELATIVE ||
ELFW(R_TYPE)(rel->r_info) == R_GENERIC_IRELATIVE ||
+ ELFW(R_TYPE)(rel->r_info) == R_GENERIC_ABSOLUTE ||
ELFW(R_TYPE)(rel->r_info) == R_GENERIC_TLS_DTPREL ||
ELFW(R_TYPE)(rel->r_info) == R_GENERIC_TLS_TPREL) {
return *reinterpret_cast<ElfW(Addr)*>(reloc_addr);
@@ -3056,6 +3058,7 @@
switch (type) {
case R_GENERIC_JUMP_SLOT:
+ case R_GENERIC_ABSOLUTE:
case R_GENERIC_GLOB_DAT:
case R_GENERIC_RELATIVE:
case R_GENERIC_IRELATIVE:
@@ -3063,17 +3066,8 @@
case R_GENERIC_TLS_DTPREL:
case R_GENERIC_TLS_TPREL:
case R_GENERIC_TLSDESC:
-#if defined(__aarch64__)
- case R_AARCH64_ABS64:
- case R_AARCH64_ABS32:
- case R_AARCH64_ABS16:
-#elif defined(__x86_64__)
+#if defined(__x86_64__)
case R_X86_64_32:
- case R_X86_64_64:
-#elif defined(__arm__)
- case R_ARM_ABS32:
-#elif defined(__i386__)
- case R_386_32:
#endif
/*
* The sym_addr was initialized to be zero above, or the relocation
@@ -3153,10 +3147,11 @@
*reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + addend);
break;
+ case R_GENERIC_ABSOLUTE:
case R_GENERIC_GLOB_DAT:
count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO GLOB_DAT %16p <- %16p %s\n",
+ TRACE_TYPE(RELO, "RELO ABSOLUTE/GLOB_DAT %16p <- %16p %s\n",
reinterpret_cast<void*>(reloc),
reinterpret_cast<void*>(sym_addr + addend), sym_name);
*reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + addend);
@@ -3202,6 +3197,17 @@
*reinterpret_cast<ElfW(Addr)*>(reloc) = ifunc_addr;
}
break;
+ case R_GENERIC_COPY:
+ // Copy relocations allow read-only data or code in a non-PIE executable to access a
+ // variable from a DSO. The executable reserves extra space in its .bss section, and the
+ // linker copies the variable into the extra space. The executable then exports its copy
+ // to interpose the copy in the DSO.
+ //
+ // Bionic only supports PIE executables, so copy relocations aren't supported. The ARM and
+ // AArch64 ABI documents only allow them for ET_EXEC (non-PIE) objects. See IHI0056B and
+ // IHI0044F.
+ DL_ERR("%s COPY relocations are not supported", get_realpath());
+ return false;
case R_GENERIC_TLS_TPREL:
count_relocation(kRelocRelative);
MARK(rel->r_offset);
@@ -3296,121 +3302,14 @@
break;
#endif // defined(__aarch64__)
-#if defined(__aarch64__)
- case R_AARCH64_ABS64:
- count_relocation(kRelocAbsolute);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO ABS64 %16llx <- %16llx %s\n",
- reloc, sym_addr + addend, sym_name);
- *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend;
- break;
- case R_AARCH64_ABS32:
- count_relocation(kRelocAbsolute);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO ABS32 %16llx <- %16llx %s\n",
- reloc, sym_addr + addend, sym_name);
- {
- const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT32_MIN);
- const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT32_MAX);
- if ((min_value <= (sym_addr + addend)) &&
- ((sym_addr + addend) <= max_value)) {
- *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend;
- } else {
- DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
- sym_addr + addend, min_value, max_value);
- return false;
- }
- }
- break;
- case R_AARCH64_ABS16:
- count_relocation(kRelocAbsolute);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO ABS16 %16llx <- %16llx %s\n",
- reloc, sym_addr + addend, sym_name);
- {
- const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT16_MIN);
- const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT16_MAX);
- if ((min_value <= (sym_addr + addend)) &&
- ((sym_addr + addend) <= max_value)) {
- *reinterpret_cast<ElfW(Addr)*>(reloc) = (sym_addr + addend);
- } else {
- DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
- sym_addr + addend, min_value, max_value);
- return false;
- }
- }
- break;
- case R_AARCH64_PREL64:
- count_relocation(kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO REL64 %16llx <- %16llx - %16llx %s\n",
- reloc, sym_addr + addend, rel->r_offset, sym_name);
- *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - rel->r_offset;
- break;
- case R_AARCH64_PREL32:
- count_relocation(kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO REL32 %16llx <- %16llx - %16llx %s\n",
- reloc, sym_addr + addend, rel->r_offset, sym_name);
- {
- const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT32_MIN);
- const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT32_MAX);
- if ((min_value <= (sym_addr + addend - rel->r_offset)) &&
- ((sym_addr + addend - rel->r_offset) <= max_value)) {
- *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - rel->r_offset;
- } else {
- DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
- sym_addr + addend - rel->r_offset, min_value, max_value);
- return false;
- }
- }
- break;
- case R_AARCH64_PREL16:
- count_relocation(kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO REL16 %16llx <- %16llx - %16llx %s\n",
- reloc, sym_addr + addend, rel->r_offset, sym_name);
- {
- const ElfW(Addr) min_value = static_cast<ElfW(Addr)>(INT16_MIN);
- const ElfW(Addr) max_value = static_cast<ElfW(Addr)>(UINT16_MAX);
- if ((min_value <= (sym_addr + addend - rel->r_offset)) &&
- ((sym_addr + addend - rel->r_offset) <= max_value)) {
- *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - rel->r_offset;
- } else {
- DL_ERR("0x%016llx out of range 0x%016llx to 0x%016llx",
- sym_addr + addend - rel->r_offset, min_value, max_value);
- return false;
- }
- }
- break;
-
- case R_AARCH64_COPY:
- /*
- * ET_EXEC is not supported so this should not happen.
- *
- * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf
- *
- * Section 4.6.11 "Dynamic relocations"
- * R_AARCH64_COPY may only appear in executable objects where e_type is
- * set to ET_EXEC.
- */
- DL_ERR("%s R_AARCH64_COPY relocations are not supported", get_realpath());
- return false;
-#elif defined(__x86_64__)
+#if defined(__x86_64__)
case R_X86_64_32:
- count_relocation(kRelocRelative);
+ count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO R_X86_64_32 %08zx <- +%08zx %s", static_cast<size_t>(reloc),
static_cast<size_t>(sym_addr), sym_name);
*reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr + addend;
break;
- case R_X86_64_64:
- count_relocation(kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO R_X86_64_64 %08zx <- +%08zx %s", static_cast<size_t>(reloc),
- static_cast<size_t>(sym_addr), sym_name);
- *reinterpret_cast<Elf64_Addr*>(reloc) = sym_addr + addend;
- break;
case R_X86_64_PC32:
count_relocation(kRelocRelative);
MARK(rel->r_offset);
@@ -3419,39 +3318,7 @@
static_cast<size_t>(sym_addr), static_cast<size_t>(reloc), sym_name);
*reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr + addend - reloc;
break;
-#elif defined(__arm__)
- case R_ARM_ABS32:
- count_relocation(kRelocAbsolute);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO ABS %08x <- %08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr;
- break;
- case R_ARM_REL32:
- count_relocation(kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO REL32 %08x <- %08x - %08x %s",
- reloc, sym_addr, rel->r_offset, sym_name);
- *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr - rel->r_offset;
- break;
- case R_ARM_COPY:
- /*
- * ET_EXEC is not supported so this should not happen.
- *
- * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044d/IHI0044D_aaelf.pdf
- *
- * Section 4.6.1.10 "Dynamic relocations"
- * R_ARM_COPY may only appear in executable objects where e_type is
- * set to ET_EXEC.
- */
- DL_ERR("%s R_ARM_COPY relocations are not supported", get_realpath());
- return false;
#elif defined(__i386__)
- case R_386_32:
- count_relocation(kRelocRelative);
- MARK(rel->r_offset);
- TRACE_TYPE(RELO, "RELO R_386_32 %08x <- +%08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<ElfW(Addr)*>(reloc) += sym_addr;
- break;
case R_386_PC32:
count_relocation(kRelocRelative);
MARK(rel->r_offset);
diff --git a/linker/linker_relocs.h b/linker/linker_relocs.h
index 1da5ebe..93d899e 100644
--- a/linker/linker_relocs.h
+++ b/linker/linker_relocs.h
@@ -35,9 +35,12 @@
#if defined (__aarch64__)
#define R_GENERIC_JUMP_SLOT R_AARCH64_JUMP_SLOT
+// R_AARCH64_ABS64 is classified as a static relocation but it is common in DSOs.
+#define R_GENERIC_ABSOLUTE R_AARCH64_ABS64
#define R_GENERIC_GLOB_DAT R_AARCH64_GLOB_DAT
#define R_GENERIC_RELATIVE R_AARCH64_RELATIVE
#define R_GENERIC_IRELATIVE R_AARCH64_IRELATIVE
+#define R_GENERIC_COPY R_AARCH64_COPY
#define R_GENERIC_TLS_DTPMOD R_AARCH64_TLS_DTPMOD
#define R_GENERIC_TLS_DTPREL R_AARCH64_TLS_DTPREL
#define R_GENERIC_TLS_TPREL R_AARCH64_TLS_TPREL
@@ -46,9 +49,12 @@
#elif defined (__arm__)
#define R_GENERIC_JUMP_SLOT R_ARM_JUMP_SLOT
+// R_ARM_ABS32 is classified as a static relocation but it is common in DSOs.
+#define R_GENERIC_ABSOLUTE R_ARM_ABS32
#define R_GENERIC_GLOB_DAT R_ARM_GLOB_DAT
#define R_GENERIC_RELATIVE R_ARM_RELATIVE
#define R_GENERIC_IRELATIVE R_ARM_IRELATIVE
+#define R_GENERIC_COPY R_ARM_COPY
#define R_GENERIC_TLS_DTPMOD R_ARM_TLS_DTPMOD32
#define R_GENERIC_TLS_DTPREL R_ARM_TLS_DTPOFF32
#define R_GENERIC_TLS_TPREL R_ARM_TLS_TPOFF32
@@ -57,9 +63,11 @@
#elif defined (__i386__)
#define R_GENERIC_JUMP_SLOT R_386_JMP_SLOT
+#define R_GENERIC_ABSOLUTE R_386_32
#define R_GENERIC_GLOB_DAT R_386_GLOB_DAT
#define R_GENERIC_RELATIVE R_386_RELATIVE
#define R_GENERIC_IRELATIVE R_386_IRELATIVE
+#define R_GENERIC_COPY R_386_COPY
#define R_GENERIC_TLS_DTPMOD R_386_TLS_DTPMOD32
#define R_GENERIC_TLS_DTPREL R_386_TLS_DTPOFF32
#define R_GENERIC_TLS_TPREL R_386_TLS_TPOFF
@@ -68,9 +76,11 @@
#elif defined (__x86_64__)
#define R_GENERIC_JUMP_SLOT R_X86_64_JUMP_SLOT
+#define R_GENERIC_ABSOLUTE R_X86_64_64
#define R_GENERIC_GLOB_DAT R_X86_64_GLOB_DAT
#define R_GENERIC_RELATIVE R_X86_64_RELATIVE
#define R_GENERIC_IRELATIVE R_X86_64_IRELATIVE
+#define R_GENERIC_COPY R_X86_64_COPY
#define R_GENERIC_TLS_DTPMOD R_X86_64_DTPMOD64
#define R_GENERIC_TLS_DTPREL R_X86_64_DTPOFF64
#define R_GENERIC_TLS_TPREL R_X86_64_TPOFF64
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index d4b2541..14293d9 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -651,10 +651,6 @@
return secondary_namespaces_;
}
-soinfo_tls* soinfo::get_tls() const {
- return has_min_version(5) ? tls_.get() : nullptr;
-}
-
ElfW(Addr) soinfo::resolve_symbol_address(const ElfW(Sym)* s) const {
if (ELF_ST_TYPE(s->st_info) == STT_GNU_IFUNC) {
return call_ifunc_resolver(s->st_value + load_bias);
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 27032c2..dd3817c 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -294,7 +294,9 @@
void add_secondary_namespace(android_namespace_t* secondary_ns);
android_namespace_list_t& get_secondary_namespaces();
- soinfo_tls* get_tls() const;
+ soinfo_tls* get_tls() const {
+ return has_min_version(5) ? tls_.get() : nullptr;
+ }
void set_mapped_by_caller(bool reserved_map);
bool is_mapped_by_caller() const;
diff --git a/tests/Android.bp b/tests/Android.bp
index f0fe5e6..1755053 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -751,6 +751,33 @@
],
}
+cc_test {
+ name: "bionic-stress-tests",
+ defaults: [
+ "bionic_tests_defaults",
+ ],
+
+ // For now, these tests run forever, so do not use the isolation framework.
+ isolated: false,
+
+ srcs: [
+ "malloc_stress_test.cpp",
+ ],
+
+ shared_libs: [
+ "libbase",
+ ],
+
+ target: {
+ android: {
+ static_libs: [
+ "libmeminfo",
+ "libprocinfo",
+ ],
+ },
+ },
+}
+
// -----------------------------------------------------------------------------
// Tests for the device linked against bionic's static library. Run with:
// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
diff --git a/tests/ctype_test.cpp b/tests/ctype_test.cpp
index c12518b..826d39a 100644
--- a/tests/ctype_test.cpp
+++ b/tests/ctype_test.cpp
@@ -18,183 +18,278 @@
#include <ctype.h>
+// We test from -1 (EOF) to 0xff, because that's the range for which behavior
+// is actually defined. (It's explicitly undefined below or above that.) Most
+// of our routines are no longer table-based and behave correctly for the
+// entire int range, but that's not true of other C libraries that we might
+// want to compare against, nor of our isalnum(3) and ispunt(3).
+static constexpr int kMin = -1;
+static constexpr int kMax = 256;
+
TEST(ctype, isalnum) {
- EXPECT_TRUE(isalnum('1'));
- EXPECT_TRUE(isalnum('a'));
- EXPECT_TRUE(isalnum('A'));
- EXPECT_FALSE(isalnum('!'));
- EXPECT_FALSE(isalnum(' '));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '0' && i <= '9') ||
+ (i >= 'A' && i <= 'Z') ||
+ (i >= 'a' && i <= 'z')) {
+ EXPECT_TRUE(isalnum(i)) << i;
+ } else {
+ EXPECT_FALSE(isalnum(i)) << i;
+ }
+ }
}
TEST(ctype, isalnum_l) {
- EXPECT_TRUE(isalnum_l('1', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isalnum_l('a', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isalnum_l('A', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isalnum_l('!', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isalnum_l(' ', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '0' && i <= '9') ||
+ (i >= 'A' && i <= 'Z') ||
+ (i >= 'a' && i <= 'z')) {
+ EXPECT_TRUE(isalnum_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isalnum_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isalpha) {
- EXPECT_FALSE(isalpha('1'));
- EXPECT_TRUE(isalpha('a'));
- EXPECT_TRUE(isalpha('A'));
- EXPECT_FALSE(isalpha('!'));
- EXPECT_FALSE(isalpha(' '));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= 'A' && i <= 'Z') ||
+ (i >= 'a' && i <= 'z')) {
+ EXPECT_TRUE(isalpha(i)) << i;
+ } else {
+ EXPECT_FALSE(isalpha(i)) << i;
+ }
+ }
}
TEST(ctype, isalpha_l) {
- EXPECT_FALSE(isalpha_l('1', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isalpha_l('a', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isalpha_l('A', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isalpha_l('!', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isalpha_l(' ', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= 'A' && i <= 'Z') ||
+ (i >= 'a' && i <= 'z')) {
+ EXPECT_TRUE(isalpha_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isalpha_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isascii) {
- EXPECT_TRUE(isascii('\x7f'));
- EXPECT_FALSE(isascii('\x80'));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= 0 && i <= 0x7f) {
+ EXPECT_TRUE(isascii(i)) << i;
+ } else {
+ EXPECT_FALSE(isascii(i)) << i;
+ }
+ }
}
TEST(ctype, isblank) {
- EXPECT_FALSE(isblank('1'));
- EXPECT_TRUE(isblank(' '));
- EXPECT_TRUE(isblank('\t'));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i == '\t' || i == ' ') {
+ EXPECT_TRUE(isblank(i)) << i;
+ } else {
+ EXPECT_FALSE(isblank(i)) << i;
+ }
+ }
}
TEST(ctype, isblank_l) {
- EXPECT_FALSE(isblank_l('1', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isblank_l(' ', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isblank_l('\t', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i == '\t' || i == ' ') {
+ EXPECT_TRUE(isblank_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isblank_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, iscntrl) {
- EXPECT_FALSE(iscntrl('1'));
- EXPECT_TRUE(iscntrl('\b'));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= 0 && i < ' ') || i == 0x7f) {
+ EXPECT_TRUE(iscntrl(i)) << i;
+ } else {
+ EXPECT_FALSE(iscntrl(i)) << i;
+ }
+ }
}
TEST(ctype, iscntrl_l) {
- EXPECT_FALSE(iscntrl_l('1', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(iscntrl_l('\b', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= 0 && i < ' ') || i == 0x7f) {
+ EXPECT_TRUE(iscntrl_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(iscntrl_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isdigit) {
- EXPECT_TRUE(isdigit('1'));
- EXPECT_FALSE(isdigit('a'));
- EXPECT_FALSE(isdigit('x'));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= '0' && i <= '9') {
+ EXPECT_TRUE(isdigit(i)) << i;
+ } else {
+ EXPECT_FALSE(isdigit(i)) << i;
+ }
+ }
}
TEST(ctype, isdigit_l) {
- EXPECT_TRUE(isdigit_l('1', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isdigit_l('a', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isdigit_l('x', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= '0' && i <= '9') {
+ EXPECT_TRUE(isdigit_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isdigit_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isgraph) {
- EXPECT_TRUE(isgraph('a'));
- EXPECT_TRUE(isgraph('A'));
- EXPECT_TRUE(isgraph('1'));
- EXPECT_TRUE(isgraph('!'));
- EXPECT_FALSE(isgraph(' '));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= '!' && i <= '~') {
+ EXPECT_TRUE(isgraph(i)) << i;
+ } else {
+ EXPECT_FALSE(isgraph(i)) << i;
+ }
+ }
}
TEST(ctype, isgraph_l) {
- EXPECT_TRUE(isgraph_l('a', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isgraph_l('A', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isgraph_l('1', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isgraph_l('!', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isgraph_l(' ', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= '!' && i <= '~') {
+ EXPECT_TRUE(isgraph_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isgraph_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, islower) {
- EXPECT_TRUE(islower('a'));
- EXPECT_FALSE(islower('A'));
- EXPECT_FALSE(islower('!'));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= 'a' && i <= 'z') {
+ EXPECT_TRUE(islower(i)) << i;
+ } else {
+ EXPECT_FALSE(islower(i)) << i;
+ }
+ }
}
TEST(ctype, islower_l) {
- EXPECT_TRUE(islower_l('a', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(islower_l('A', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(islower_l('!', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= 'a' && i <= 'z') {
+ EXPECT_TRUE(islower_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(islower_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isprint) {
- EXPECT_TRUE(isprint('a'));
- EXPECT_TRUE(isprint(' '));
- EXPECT_FALSE(isprint('\b'));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= ' ' && i <= '~') {
+ EXPECT_TRUE(isprint(i)) << i;
+ } else {
+ EXPECT_FALSE(isprint(i)) << i;
+ }
+ }
}
TEST(ctype, isprint_l) {
- EXPECT_TRUE(isprint_l('a', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isprint_l(' ', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isprint_l('\b', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= ' ' && i <= '~') {
+ EXPECT_TRUE(isprint_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isprint_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, ispunct) {
- EXPECT_TRUE(ispunct('!'));
- EXPECT_FALSE(ispunct('a'));
- EXPECT_FALSE(ispunct(' '));
- EXPECT_FALSE(ispunct('\b'));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '!' && i <= '/') ||
+ (i >= ':' && i <= '@') ||
+ (i >= '[' && i <= '`') ||
+ (i >= '{' && i <= '~')) {
+ EXPECT_TRUE(ispunct(i)) << i;
+ } else {
+ EXPECT_FALSE(ispunct(i)) << i;
+ }
+ }
}
TEST(ctype, ispunct_l) {
- EXPECT_TRUE(ispunct_l('!', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(ispunct_l('a', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(ispunct_l(' ', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(ispunct_l('\b', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '!' && i <= '/') ||
+ (i >= ':' && i <= '@') ||
+ (i >= '[' && i <= '`') ||
+ (i >= '{' && i <= '~')) {
+ EXPECT_TRUE(ispunct_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(ispunct_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isspace) {
- EXPECT_TRUE(isspace(' '));
- EXPECT_TRUE(isspace('\f'));
- EXPECT_TRUE(isspace('\n'));
- EXPECT_TRUE(isspace('\r'));
- EXPECT_TRUE(isspace('\t'));
- EXPECT_TRUE(isspace('\v'));
- EXPECT_FALSE(isspace('a'));
- EXPECT_FALSE(isspace('!'));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '\t' && i <= '\r') || i == ' ') {
+ EXPECT_TRUE(isspace(i)) << i;
+ } else {
+ EXPECT_FALSE(isspace(i)) << i;
+ }
+ }
}
TEST(ctype, isspace_l) {
- EXPECT_TRUE(isspace_l(' ', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isspace_l('\f', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isspace_l('\n', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isspace_l('\r', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isspace_l('\t', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isspace_l('\v', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isspace_l('a', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isspace_l('!', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '\t' && i <= '\r') || i == ' ') {
+ EXPECT_TRUE(isspace_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isspace_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isupper) {
- EXPECT_TRUE(isupper('A'));
- EXPECT_FALSE(isupper('a'));
- EXPECT_FALSE(isupper('!'));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= 'A' && i <= 'Z') {
+ EXPECT_TRUE(isupper(i)) << i;
+ } else {
+ EXPECT_FALSE(isupper(i)) << i;
+ }
+ }
}
TEST(ctype, isupper_l) {
- EXPECT_TRUE(isupper_l('A', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isupper_l('a', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isupper_l('!', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if (i >= 'A' && i <= 'Z') {
+ EXPECT_TRUE(isupper_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isupper_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, isxdigit) {
- EXPECT_TRUE(isxdigit('0'));
- EXPECT_FALSE(isxdigit('x'));
- EXPECT_TRUE(isxdigit('1'));
- EXPECT_TRUE(isxdigit('a'));
- EXPECT_TRUE(isxdigit('A'));
- EXPECT_FALSE(isxdigit('g'));
- EXPECT_FALSE(isxdigit(' '));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '0' && i <= '9') ||
+ (i >= 'A' && i <= 'F') ||
+ (i >= 'a' && i <= 'f')) {
+ EXPECT_TRUE(isxdigit(i)) << i;
+ } else {
+ EXPECT_FALSE(isxdigit(i)) << i;
+ }
+ }
}
TEST(ctype, isxdigit_l) {
- EXPECT_TRUE(isxdigit_l('0', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isxdigit_l('x', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isxdigit_l('1', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isxdigit_l('a', LC_GLOBAL_LOCALE));
- EXPECT_TRUE(isxdigit_l('A', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isxdigit_l('g', LC_GLOBAL_LOCALE));
- EXPECT_FALSE(isxdigit_l(' ', LC_GLOBAL_LOCALE));
+ for (int i = kMin; i < kMax; ++i) {
+ if ((i >= '0' && i <= '9') ||
+ (i >= 'A' && i <= 'F') ||
+ (i >= 'a' && i <= 'f')) {
+ EXPECT_TRUE(isxdigit_l(i, LC_GLOBAL_LOCALE)) << i;
+ } else {
+ EXPECT_FALSE(isxdigit_l(i, LC_GLOBAL_LOCALE)) << i;
+ }
+ }
}
TEST(ctype, toascii) {
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index e7274f7..e98d66f 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -600,7 +600,7 @@
void GetPss(bool shared_relro, const char* lib, const char* relro_file, pid_t pid,
size_t* total_pss) {
android::meminfo::ProcMemInfo proc_mem(pid);
- const std::vector<android::meminfo::Vma>& maps = proc_mem.Maps();
+ const std::vector<android::meminfo::Vma>& maps = proc_mem.MapsWithoutUsageStats();
ASSERT_GT(maps.size(), 0UL);
// Calculate total PSS of the library.
@@ -612,7 +612,9 @@
saw_relro_file = true;
}
- *total_pss += vma.usage.pss;
+ android::meminfo::Vma update_vma(vma);
+ ASSERT_TRUE(proc_mem.FillInVmaStats(update_vma));
+ *total_pss += update_vma.usage.pss;
}
}
diff --git a/tests/ifunc_test.cpp b/tests/ifunc_test.cpp
index 7ab5899..e69271f 100644
--- a/tests/ifunc_test.cpp
+++ b/tests/ifunc_test.cpp
@@ -16,12 +16,19 @@
#include <gtest/gtest.h>
+#include <sys/auxv.h>
+#if defined(__BIONIC__)
+#include <sys/ifunc.h>
+#endif
+
+typedef int (*fn_ptr_t)();
+
int ret42() {
return 42;
}
-extern "C" void* resolver() {
- return (void*)ret42;
+extern "C" fn_ptr_t resolver() {
+ return ret42;
}
int ifunc() __attribute__((ifunc("resolver")));
@@ -29,3 +36,51 @@
TEST(ifunc, function) {
ASSERT_EQ(42, ifunc());
}
+
+#if defined(__BIONIC__)
+
+#if defined(__aarch64__)
+
+static uint64_t g_hwcap;
+static __ifunc_arg_t g_arg;
+
+extern "C" fn_ptr_t hwcap_resolver(uint64_t hwcap, __ifunc_arg_t* arg) {
+ g_hwcap = hwcap;
+ g_arg = *arg;
+ return ret42;
+}
+
+#elif defined(__arm__)
+
+static unsigned long g_hwcap;
+
+extern "C" fn_ptr_t hwcap_resolver(unsigned long hwcap) {
+ g_hwcap = hwcap;
+ return ret42;
+}
+
+#else
+
+extern "C" fn_ptr_t hwcap_resolver() {
+ return ret42;
+}
+
+#endif
+
+int hwcap() __attribute__((ifunc("hwcap_resolver")));
+
+TEST(ifunc, hwcap) {
+ ASSERT_EQ(42, hwcap());
+
+#if defined(__aarch64__)
+ EXPECT_EQ(getauxval(AT_HWCAP) | _IFUNC_ARG_HWCAP, g_hwcap);
+
+ EXPECT_EQ(sizeof(__ifunc_arg_t), g_arg._size);
+ EXPECT_EQ(getauxval(AT_HWCAP), g_arg._hwcap);
+ EXPECT_EQ(getauxval(AT_HWCAP2), g_arg._hwcap2);
+#elif defined(__arm__)
+ EXPECT_EQ(getauxval(AT_HWCAP), g_hwcap);
+#endif
+}
+
+#endif // defined(__BIONIC__)
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 87ec942..6a82eb6 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -94,9 +94,9 @@
static void VerifyPtrs(TestDataType* test_data) {
test_data->total_allocated_bytes = 0;
- // Find all of the maps that are [anon:libc_malloc].
+ // Find all of the maps that are from the native allocator.
auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
- if (strcmp(name, "[anon:libc_malloc]") == 0) {
+ if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0) {
malloc_iterate(start, end - start, SavePointers, test_data);
}
};
@@ -192,7 +192,7 @@
// Only attempt to get memory data for maps that are not from the native allocator.
auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
- if (strcmp(name, "[anon:libc_malloc]") != 0) {
+ if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0) {
size_t total = test_data.total_allocated_bytes;
malloc_iterate(start, end - start, SavePointers, &test_data);
total = test_data.total_allocated_bytes - total;
diff --git a/tests/malloc_stress_test.cpp b/tests/malloc_stress_test.cpp
new file mode 100644
index 0000000..6c5cc06
--- /dev/null
+++ b/tests/malloc_stress_test.cpp
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2019 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 <gtest/gtest.h>
+
+#include <inttypes.h>
+#include <malloc.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <thread>
+#include <vector>
+
+#include <android-base/strings.h>
+#if defined(__BIONIC__)
+#include <meminfo/procmeminfo.h>
+#include <procinfo/process_map.h>
+#endif
+
+TEST(malloc_stress, multiple_threads_forever) {
+ constexpr size_t kMaxThreads = 256;
+ constexpr size_t kAllocSize = 4096;
+#if defined(__BIONIC__)
+ uint64_t rss_min = UINT64_MAX;
+ uint64_t rss_max = 0;
+ uint64_t vss_min = UINT64_MAX;
+ uint64_t vss_max = 0;
+ ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
+#endif
+ uint64_t mallinfo_min = UINT64_MAX;
+ uint64_t mallinfo_max = 0;
+ for (size_t i = 0; ; i++) {
+ printf("Pass %zu\n", i);
+
+ std::vector<std::thread*> threads;
+ for (size_t i = 0; i < kMaxThreads; i++) {
+ threads.push_back(new std::thread([]() {
+ void* buf = malloc(4096);
+ if (buf == nullptr) {
+ printf("Failed to allocate memory\n");
+ _exit(1);
+ }
+ memset(buf, 0, kAllocSize);
+ sleep(1);
+ free(buf);
+ }));
+ }
+
+ for (auto thread : threads) {
+ thread->join();
+ delete thread;
+ }
+ threads.clear();
+
+#if defined(__BIONIC__)
+ android::meminfo::ProcMemInfo proc_mem(getpid());
+ const std::vector<android::meminfo::Vma>& maps = proc_mem.MapsWithoutUsageStats();
+ uint64_t rss_bytes = 0;
+ uint64_t vss_bytes = 0;
+ for (auto& vma : maps) {
+ if (vma.name == "[anon:libc_malloc]" || android::base::StartsWith(vma.name, "[anon:scudo:")) {
+ android::meminfo::Vma update_vma(vma);
+ ASSERT_TRUE(proc_mem.FillInVmaStats(update_vma));
+ rss_bytes += update_vma.usage.rss;
+ vss_bytes += update_vma.usage.vss;
+ }
+ }
+ if (rss_bytes < rss_min) {
+ rss_min = rss_bytes;
+ }
+ if (rss_bytes > rss_max) {
+ rss_max = rss_bytes;
+ }
+ if (vss_bytes < vss_min) {
+ vss_min = vss_bytes;
+ }
+ if (vss_bytes > vss_max) {
+ vss_max = vss_bytes;
+ }
+ printf("RSS %" PRIu64 " %0.2fMB\n", rss_bytes, rss_bytes / (1024.0 * 1024.0));
+ printf(" Min %" PRIu64 " %0.2fMB\n", rss_min, rss_min / (1024.0 * 1024.0));
+ printf(" Max %" PRIu64 " %0.2fMB\n", rss_max, rss_max / (1024.0 * 1024.0));
+ printf("VSS %" PRIu64 " %0.2f MB\n", vss_bytes, vss_bytes / (1024.0 * 1024.0));
+ printf(" Min %" PRIu64 " %0.2fMB\n", vss_min, vss_min / (1024.0 * 1024.0));
+ printf(" Max %" PRIu64 " %0.2fMB\n", vss_max, vss_max / (1024.0 * 1024.0));
+#endif
+
+ size_t mallinfo_bytes = mallinfo().uordblks;
+ if (mallinfo_bytes < mallinfo_min) {
+ mallinfo_min = mallinfo_bytes;
+ }
+ if (mallinfo_bytes > mallinfo_max) {
+ mallinfo_max = mallinfo_bytes;
+ }
+ printf("Allocated memory %zu %0.2fMB\n", mallinfo_bytes, mallinfo_bytes / (1024.0 * 1024.0));
+ printf(" Min %" PRIu64 " %0.2fMB\n", mallinfo_min, mallinfo_min / (1024.0 * 1024.0));
+ printf(" Max %" PRIu64 " %0.2fMB\n", mallinfo_max, mallinfo_max / (1024.0 * 1024.0));
+ }
+}
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 989e2d0..0407553 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -371,7 +371,8 @@
auto root = doc.FirstChildElement();
ASSERT_NE(nullptr, root);
ASSERT_STREQ("malloc", root->Name());
- if (std::string(root->Attribute("version")) == "jemalloc-1") {
+ std::string version(root->Attribute("version"));
+ if (version == "jemalloc-1") {
// Verify jemalloc version of this data.
ASSERT_STREQ("jemalloc-1", root->Attribute("version"));
@@ -404,9 +405,9 @@
}
}
} else {
- // Only verify that this is debug-malloc-1, the malloc debug unit tests
- // verify the output.
- ASSERT_STREQ("debug-malloc-1", root->Attribute("version"));
+ // Do not verify output for scudo or debug malloc.
+ ASSERT_TRUE(version == "scudo-1" || version == "debug-malloc-1")
+ << "Unknown version: " << version;
}
#endif
}
@@ -431,7 +432,8 @@
auto root = doc.FirstChildElement();
ASSERT_NE(nullptr, root);
ASSERT_STREQ("malloc", root->Name());
- if (std::string(root->Attribute("version")) == "jemalloc-1") {
+ std::string version(root->Attribute("version"));
+ if (version == "jemalloc-1") {
// Verify jemalloc version of this data.
ASSERT_STREQ("jemalloc-1", root->Attribute("version"));
@@ -458,9 +460,9 @@
EXPECT_LE(mallinfo_before_allocated_bytes, total_allocated_bytes);
EXPECT_GE(mallinfo_after_allocated_bytes, total_allocated_bytes);
} else {
- // Only verify that this is debug-malloc-1, the malloc debug unit tests
- // verify the output.
- ASSERT_STREQ("debug-malloc-1", root->Attribute("version"));
+ // Do not verify output for scudo or debug malloc.
+ ASSERT_TRUE(version == "scudo-1" || version == "debug-malloc-1")
+ << "Unknown version: " << version;
}
#endif
}
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 1ae174a..6db7751 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <chrono>
#include <thread>
#include <android-base/macros.h>
@@ -27,6 +28,8 @@
#include "SignalUtils.h"
+using namespace std::chrono_literals;
+
static int SIGNAL_MIN() {
return 1; // Signals start at 1 (SIGHUP), not 0.
}
@@ -753,12 +756,6 @@
ASSERT_EQ(0, errno);
}
-static int64_t NanoTime() {
- timespec t;
- clock_gettime(CLOCK_MONOTONIC, &t);
- return static_cast<int64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;
-}
-
TEST(signal, sigtimedwait_timeout) {
// Block SIGALRM.
sigset_t just_SIGALRM;
@@ -768,13 +765,14 @@
ASSERT_EQ(0, sigprocmask(SIG_BLOCK, &just_SIGALRM, &original_set));
// Wait timeout.
- int64_t start_time = NanoTime();
+ auto t0 = std::chrono::steady_clock::now();
siginfo_t info;
timespec timeout = { .tv_sec = 0, .tv_nsec = 1000000 };
errno = 0;
ASSERT_EQ(-1, sigtimedwait(&just_SIGALRM, &info, &timeout));
ASSERT_EQ(EAGAIN, errno);
- ASSERT_GE(NanoTime() - start_time, 1000000);
+ auto t1 = std::chrono::steady_clock::now();
+ ASSERT_GE(t1-t0, 1000000ns);
ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &original_set, nullptr));
}
diff --git a/tests/system_properties_test2.cpp b/tests/system_properties_test2.cpp
index c061faa..b9936dd 100644
--- a/tests/system_properties_test2.cpp
+++ b/tests/system_properties_test2.cpp
@@ -19,16 +19,16 @@
#include <errno.h>
#include <sys/wait.h>
#include <unistd.h>
+
+#include <chrono>
#include <sstream>
#include <string>
#if defined(__BIONIC__)
#include <sys/system_properties.h>
-
-static uint64_t NanoTime() {
- timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
- return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + now.tv_nsec;
+int64_t NanoTime() {
+ auto t = std::chrono::time_point_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now());
+ return t.time_since_epoch().count();
}
#endif
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 4e17242..378b4ac 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -24,13 +24,17 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+
#include <atomic>
+#include <chrono>
#include "SignalUtils.h"
#include "utils.h"
#include "private/bionic_constants.h"
+using namespace std::chrono_literals;
+
TEST(time, time) {
// Acquire time
time_t p1, t1 = time(&p1);
@@ -797,7 +801,7 @@
ASSERT_EQ(EINVAL, errno);
}
-TEST(time, clock_nanosleep) {
+TEST(time, clock_nanosleep_EINVAL) {
timespec in;
timespec out;
ASSERT_EQ(EINVAL, clock_nanosleep(-1, 0, &in, &out));
@@ -810,6 +814,29 @@
ASSERT_EQ(EINVAL, clock_nanosleep(CLOCK_THREAD_CPUTIME_ID, 0, &in, nullptr));
}
+TEST(time, clock_nanosleep) {
+ auto t0 = std::chrono::steady_clock::now();
+ const timespec ts = {.tv_nsec = 5000000};
+ ASSERT_EQ(0, clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, nullptr));
+ auto t1 = std::chrono::steady_clock::now();
+ ASSERT_GE(t1-t0, 5000000ns);
+}
+
+TEST(time, nanosleep) {
+ auto t0 = std::chrono::steady_clock::now();
+ const timespec ts = {.tv_nsec = 5000000};
+ ASSERT_EQ(0, nanosleep(&ts, nullptr));
+ auto t1 = std::chrono::steady_clock::now();
+ ASSERT_GE(t1-t0, 5000000ns);
+}
+
+TEST(time, nanosleep_EINVAL) {
+ timespec ts = {.tv_sec = -1};
+ errno = 0;
+ ASSERT_EQ(-1, nanosleep(&ts, nullptr));
+ ASSERT_EQ(EINVAL, errno);
+}
+
TEST(time, bug_31938693) {
// User-visible symptoms in N:
// http://b/31938693
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 10c1710..99d92e6 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -33,6 +33,8 @@
#include <sys/wait.h>
#include <unistd.h>
+#include <chrono>
+
#include <android-base/file.h>
#include <android-base/strings.h>
@@ -46,6 +48,8 @@
#define UNISTD_DEATHTEST unistd_DeathTest
#endif
+using namespace std::chrono_literals;
+
static void* get_brk() {
return sbrk(0);
}
@@ -1516,3 +1520,17 @@
swab("hello", buf, -1);
ASSERT_EQ('x', buf[0]);
}
+
+TEST(UNISTD_TEST, usleep) {
+ auto t0 = std::chrono::steady_clock::now();
+ ASSERT_EQ(0, usleep(5000));
+ auto t1 = std::chrono::steady_clock::now();
+ ASSERT_GE(t1-t0, 5000us);
+}
+
+TEST(UNISTD_TEST, sleep) {
+ auto t0 = std::chrono::steady_clock::now();
+ ASSERT_EQ(0U, sleep(1));
+ auto t1 = std::chrono::steady_clock::now();
+ ASSERT_GE(t1-t0, 1s);
+}
diff --git a/tests/utils.h b/tests/utils.h
index fe41019..1f4cece 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef __TEST_UTILS_H
-#define __TEST_UTILS_H
+#pragma once
#include <dlfcn.h>
#include <fcntl.h>
@@ -254,5 +253,3 @@
std::string output_;
};
#endif
-
-#endif