Merge "Update posix_memalign testing."
diff --git a/benchmarks/string_benchmark.cpp b/benchmarks/string_benchmark.cpp
index aa1e8c9..e6c6570 100644
--- a/benchmarks/string_benchmark.cpp
+++ b/benchmarks/string_benchmark.cpp
@@ -123,3 +123,53 @@
delete[] s;
}
BENCHMARK(BM_string_strlen)->AT_COMMON_SIZES;
+
+static void BM_string_strcat_copy_only(benchmark::State& state) {
+ const size_t nbytes = state.range(0);
+ std::vector<char> src(nbytes, 'x');
+ std::vector<char> dst(nbytes + 2);
+ src[nbytes - 1] = '\0';
+ dst[0] = 'y';
+ dst[1] = 'y';
+ dst[2] = '\0';
+
+ while (state.KeepRunning()) {
+ strcat(dst.data(), src.data());
+ dst[2] = '\0';
+ }
+
+ state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
+}
+BENCHMARK(BM_string_strcat_copy_only)->AT_COMMON_SIZES;
+
+static void BM_string_strcat_seek_only(benchmark::State& state) {
+ const size_t nbytes = state.range(0);
+ std::vector<char> src(3, 'x');
+ std::vector<char> dst(nbytes + 2, 'y');
+ src[2] = '\0';
+ dst[nbytes - 1] = '\0';
+
+ while (state.KeepRunning()) {
+ strcat(dst.data(), src.data());
+ dst[nbytes - 1] = '\0';
+ }
+
+ state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
+}
+BENCHMARK(BM_string_strcat_seek_only)->AT_COMMON_SIZES;
+
+static void BM_string_strcat_half_copy_half_seek(benchmark::State& state) {
+ const size_t nbytes = state.range(0);
+ std::vector<char> src(nbytes / 2, 'x');
+ std::vector<char> dst(nbytes / 2, 'y');
+ src[nbytes / 2 - 1] = '\0';
+ dst[nbytes / 2 - 1] = '\0';
+
+ while (state.KeepRunning()) {
+ strcat(dst.data(), src.data());
+ dst[nbytes / 2 - 1] = '\0';
+ }
+
+ state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
+}
+BENCHMARK(BM_string_strcat_half_copy_half_seek)->AT_COMMON_SIZES;
diff --git a/libc/SECCOMP_WHITELIST.TXT b/libc/SECCOMP_WHITELIST.TXT
index d2ab20e..4cc4f6f 100644
--- a/libc/SECCOMP_WHITELIST.TXT
+++ b/libc/SECCOMP_WHITELIST.TXT
@@ -36,6 +36,9 @@
int rt_tgsigqueueinfo:int rt_tgsigqueueinfo(pid_t tgid, pid_t tid, int sig, siginfo_t *uinfo) all
int restart_syscall:int restart_syscall() all
int getrandom:int getrandom(void *buf, size_t buflen, unsigned int flags) all
+int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int) mips64
+int fstat64|fstat:fstat(int, struct stat*) mips64
+int _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips64
# Needed for performance tools
int perf_event_open:perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags) all
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 5ff3c64..d674630 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -143,7 +143,7 @@
int ___fchmodat:fchmodat(int, const char*, mode_t) all
int fchownat(int, const char*, uid_t, gid_t, int) all
int fstatat64|fstatat:fstatat64(int, const char*, struct stat*, int) arm,mips,x86
-int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int) arm64,mips64,x86_64
+int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int) arm64,x86_64
int linkat(int, const char*, int, const char*, int) all
int mkdirat(int, const char*, mode_t) all
int mknodat(int, const char*, mode_t, dev_t) all
@@ -187,7 +187,7 @@
int __statfs:statfs(const char*, struct statfs*) arm64,mips64,x86_64
int fstat64|fstat:fstat64(int, struct stat*) arm,mips,x86
-int fstat64|fstat:fstat(int, struct stat*) arm64,mips64,x86_64
+int fstat64|fstat:fstat(int, struct stat*) arm64,x86_64
# file system
int chdir(const char*) all
@@ -343,7 +343,7 @@
int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) arm
# MIPS-specific
-int _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips,mips64
+int _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips
int __set_tls:set_thread_area(void*) mips,mips64
# x86-specific
diff --git a/libc/bionic/wctype.cpp b/libc/bionic/wctype.cpp
index 77f8dde..8e2acef 100644
--- a/libc/bionic/wctype.cpp
+++ b/libc/bionic/wctype.cpp
@@ -36,6 +36,23 @@
#include "private/icu.h"
+enum {
+ WC_TYPE_INVALID = 0,
+ WC_TYPE_ALNUM,
+ WC_TYPE_ALPHA,
+ WC_TYPE_BLANK,
+ WC_TYPE_CNTRL,
+ WC_TYPE_DIGIT,
+ WC_TYPE_GRAPH,
+ WC_TYPE_LOWER,
+ WC_TYPE_PRINT,
+ WC_TYPE_PUNCT,
+ WC_TYPE_SPACE,
+ WC_TYPE_UPPER,
+ WC_TYPE_XDIGIT,
+ WC_TYPE_MAX
+};
+
static bool __icu_hasBinaryProperty(wint_t wc, UProperty property, int (*fallback)(int)) {
typedef UBool (*FnT)(UChar32, UProperty);
static auto u_hasBinaryProperty = reinterpret_cast<FnT>(__find_icu_symbol("u_hasBinaryProperty"));
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index d3e9f5c..c9a78be 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -42,23 +42,6 @@
__BEGIN_DECLS
-enum {
- WC_TYPE_INVALID = 0,
- WC_TYPE_ALNUM,
- WC_TYPE_ALPHA,
- WC_TYPE_BLANK,
- WC_TYPE_CNTRL,
- WC_TYPE_DIGIT,
- WC_TYPE_GRAPH,
- WC_TYPE_LOWER,
- WC_TYPE_PRINT,
- WC_TYPE_PUNCT,
- WC_TYPE_SPACE,
- WC_TYPE_UPPER,
- WC_TYPE_XDIGIT,
- WC_TYPE_MAX
-};
-
wint_t btowc(int);
int fwprintf(FILE *, const wchar_t *, ...);
int fwscanf(FILE *, const wchar_t *, ...);