From 9ebacb78921f496b988f3dce11d70487b3bc48ae Mon Sep 17 00:00:00 2001 From: Gautham <41098605+ahgamut@users.noreply.github.com> Date: Thu, 1 Aug 2024 23:42:40 -0500 Subject: [PATCH 01/39] Convert GCC 14 errors back to warnings (#1247) https://gcc.gnu.org/gcc-14/porting_to.html#warnings-as-errors Changing these to warnings helps build code with `cosmocc`. Perhaps this can be a patch to `cosmocc` or skipped entirely. --- libc/integral/c.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libc/integral/c.inc b/libc/integral/c.inc index 0f29ff5f0..34c8a443b 100644 --- a/libc/integral/c.inc +++ b/libc/integral/c.inc @@ -6,6 +6,12 @@ #define COSMOPOLITAN_CXX_USING_ #endif +#ifndef __cplusplus +#pragma GCC diagnostic warning "-Wimplicit-function-declaration" +#pragma GCC diagnostic warning "-Wincompatible-pointer-types" +#pragma GCC diagnostic warning "-Wint-conversion" +#endif + #if !defined(__GNUC__) && __cplusplus + 0 >= 201103L #define typeof(x) decltype(x) #elif !defined(__GNUC__) && __STDC_VERSION__ + 0 < 201112 From a80ab3f8fe92752f492e6a4833cd9a71ab1b2cf2 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 1 Aug 2024 19:42:14 -0700 Subject: [PATCH 02/39] Implement bf16 compiler runtime library --- libc/intrin/extendbfsf2.c | 39 +++++++++++ libc/intrin/truncdfbf2.c | 24 +++++++ libc/intrin/truncsfbf2.c | 40 +++++++++++ test/libc/tinymath/fdot_test.cc | 47 +++++++++++-- test/math/bf16_test.c | 113 ++++++++++++++++++++++++++++++++ 5 files changed, 256 insertions(+), 7 deletions(-) create mode 100644 libc/intrin/extendbfsf2.c create mode 100644 libc/intrin/truncdfbf2.c create mode 100644 libc/intrin/truncsfbf2.c create mode 100644 test/math/bf16_test.c diff --git a/libc/intrin/extendbfsf2.c b/libc/intrin/extendbfsf2.c new file mode 100644 index 000000000..1773bac67 --- /dev/null +++ b/libc/intrin/extendbfsf2.c @@ -0,0 +1,39 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ + +float __extendbfsf2(__bf16 f) { + union { + __bf16 f; + unsigned short i; + } ub = {f}; + + // convert brain16 to binary32 + unsigned x = (unsigned)ub.i << 16; + + // force nan to quiet + if ((x & 0x7fffffff) > 0x7f800000) + x |= 0x00400000; + + // pun to float + union { + unsigned i; + float f; + } uf = {x}; + return uf.f; +} diff --git a/libc/intrin/truncdfbf2.c b/libc/intrin/truncdfbf2.c new file mode 100644 index 000000000..65dfff08c --- /dev/null +++ b/libc/intrin/truncdfbf2.c @@ -0,0 +1,24 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ + +__bf16 __truncsfbf2(float); +__bf16 __truncdfbf2(double f) { + // TODO(jart): What else are we supposed to do here? + return __truncsfbf2(f); +} diff --git a/libc/intrin/truncsfbf2.c b/libc/intrin/truncsfbf2.c new file mode 100644 index 000000000..b2d12e33d --- /dev/null +++ b/libc/intrin/truncsfbf2.c @@ -0,0 +1,40 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ + +__bf16 __truncsfbf2(float f) { + union { + float f; + unsigned i; + } uf = {f}; + unsigned x = uf.i; + + if ((x & 0x7fffffff) > 0x7f800000) + // force nan to quiet + x = (x | 0x00400000) >> 16; + else + // convert binary32 to brain16 with nearest rounding + x = (x + (0x7fff + ((x >> 16) & 1))) >> 16; + + // pun to bf16 + union { + unsigned short i; + __bf16 f; + } ub = {x}; + return ub.f; +} diff --git a/test/libc/tinymath/fdot_test.cc b/test/libc/tinymath/fdot_test.cc index 4d2543196..b5b6ab6ca 100644 --- a/test/libc/tinymath/fdot_test.cc +++ b/test/libc/tinymath/fdot_test.cc @@ -10,6 +10,8 @@ #include "libc/stdio/stdio.h" #include "libc/testlib/benchmark.h" #include "libc/x/xasprintf.h" +#include "third_party/aarch64/arm_neon.internal.h" +#include "third_party/intel/immintrin.internal.h" #define EXPENSIVE_TESTS 0 @@ -18,12 +20,11 @@ #define FASTMATH __attribute__((__optimize__("-O3,-ffast-math"))) #define PORTABLE __target_clones("avx512f,avx") -static unsigned long long lcg = 1; - int rand32(void) { /* Knuth, D.E., "The Art of Computer Programming," Vol 2, Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998, p. 106 (line 26) & p. 108 */ + static unsigned long long lcg = 1; lcg *= 6364136223846793005; lcg += 1442695040888963407; return lcg >> 32; @@ -122,6 +123,34 @@ float fdotf_recursive(const float *A, const float *B, size_t n) { } } +optimizespeed float fdotf_intrin(const float *A, const float *B, size_t n) { + size_t i = 0; +#ifdef __AVX512F__ + __m512 vec[CHUNK] = {}; + for (; i + CHUNK * 16 <= n; i += CHUNK * 16) + for (int j = 0; j < CHUNK; ++j) + vec[j] = _mm512_fmadd_ps(_mm512_loadu_ps(A + i + j * 16), + _mm512_loadu_ps(B + i + j * 16), vec[j]); + float res = 0; + for (int j = 0; j < CHUNK; ++j) + res += _mm512_reduce_add_ps(vec[j]); +#elif defined(__aarch64__) + float32x4_t vec[CHUNK] = {}; + for (; i + CHUNK * 4 <= n; i += CHUNK * 4) + for (int j = 0; j < CHUNK; ++j) + vec[j] = + vfmaq_f32(vec[j], vld1q_f32(A + i + j * 4), vld1q_f32(B + i + j * 4)); + float res = 0; + for (int j = 0; j < CHUNK; ++j) + res += vaddvq_f32(vec[j]); +#else + float res = 0; +#endif + for (; i < n; ++i) + res += A[i] * B[i]; + return res; +} + FASTMATH float fdotf_ruler(const float *A, const float *B, size_t n) { int rule, step = 2; size_t chunk, sp = 0; @@ -179,6 +208,8 @@ void test_fdotf_ruler(void) { } PORTABLE float fdotf_hefty(const float *A, const float *B, size_t n) { + if (1) + return 0; unsigned i, par, len = 0; float sum, res[n / CHUNK + 1]; for (res[0] = i = 0; i + CHUNK <= n; i += CHUNK) @@ -244,7 +275,7 @@ int main() { #if EXPENSIVE_TESTS size_t n = 512 * 1024; #else - size_t n = 1024; + size_t n = 4096; #endif float *A = new float[n]; @@ -253,22 +284,24 @@ int main() { A[i] = numba(); B[i] = numba(); } - float kahan, naive, dubble, recursive, hefty, ruler; + float kahan, naive, dubble, recursive, ruler, intrin; test_fdotf_naive(); - test_fdotf_hefty(); + // test_fdotf_hefty(); test_fdotf_ruler(); BENCHMARK(20, 1, (kahan = barrier(fdotf_kahan(A, B, n)))); BENCHMARK(20, 1, (dubble = barrier(fdotf_dubble(A, B, n)))); BENCHMARK(20, 1, (naive = barrier(fdotf_naive(A, B, n)))); BENCHMARK(20, 1, (recursive = barrier(fdotf_recursive(A, B, n)))); + BENCHMARK(20, 1, (intrin = barrier(fdotf_intrin(A, B, n)))); BENCHMARK(20, 1, (ruler = barrier(fdotf_ruler(A, B, n)))); - BENCHMARK(20, 1, (hefty = barrier(fdotf_hefty(A, B, n)))); + // BENCHMARK(20, 1, (hefty = barrier(fdotf_hefty(A, B, n)))); printf("dubble = %f (%g)\n", dubble, fabs(dubble - dubble)); printf("kahan = %f (%g)\n", kahan, fabs(kahan - dubble)); printf("naive = %f (%g)\n", naive, fabs(naive - dubble)); printf("recursive = %f (%g)\n", recursive, fabs(recursive - dubble)); + printf("intrin = %f (%g)\n", intrin, fabs(intrin - dubble)); printf("ruler = %f (%g)\n", ruler, fabs(ruler - dubble)); - printf("hefty = %f (%g)\n", hefty, fabs(hefty - dubble)); + // printf("hefty = %f (%g)\n", hefty, fabs(hefty - dubble)); delete[] B; delete[] A; diff --git a/test/math/bf16_test.c b/test/math/bf16_test.c new file mode 100644 index 000000000..532cebda5 --- /dev/null +++ b/test/math/bf16_test.c @@ -0,0 +1,113 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/math.h" + +#define CHECK(x) \ + if (!(x)) \ + return __LINE__ +#define FALSE(x) \ + { \ + volatile bool x_ = x; \ + if (x_) \ + return __LINE__; \ + } +#define TRUE(x) \ + { \ + volatile bool x_ = x; \ + if (!x_) \ + return __LINE__; \ + } + +__bf16 identity(__bf16 x) { + return x; +} +__bf16 (*half)(__bf16) = identity; + +unsigned toint(float f) { + union { + float f; + unsigned i; + } u = {f}; + return u.i; +} + +int main() { + volatile float f; + volatile double d; + volatile __bf16 pi = 3.141; + + // half → float → half + f = pi; + pi = f; + + // half → float + float __extendbfsf2(__bf16); + CHECK(0.f == __extendbfsf2(0)); + CHECK(3.140625f == __extendbfsf2(pi)); + CHECK(3.140625f == pi); + + // half → double → half + d = pi; + pi = d; + + // float → half + __bf16 __truncsfbf2(float); + CHECK(0 == (float)__truncsfbf2(0)); + CHECK(pi == (float)__truncsfbf2(3.141f)); + CHECK(3.140625f == (float)__truncsfbf2(3.141f)); + + // double → half + __bf16 __truncdfbf2(double); + CHECK(0 == (double)__truncdfbf2(0)); + CHECK(3.140625 == (double)__truncdfbf2(3.141)); + + // specials + volatile __bf16 nan = NAN; + volatile __bf16 positive_infinity = +INFINITY; + volatile __bf16 negative_infinity = -INFINITY; + CHECK(isnan(nan)); + CHECK(!isinf(pi)); + CHECK(!isnan(pi)); + CHECK(isinf(positive_infinity)); + CHECK(isinf(negative_infinity)); + CHECK(!isnan(positive_infinity)); + CHECK(!isnan(negative_infinity)); + CHECK(!signbit(pi)); + CHECK(signbit(half(-pi))); + CHECK(!signbit(half(+0.))); + CHECK(signbit(half(-0.))); + + // arithmetic + CHECK(half(-3) == -half(3)); + CHECK(half(9) == half(3) * half(3)); + CHECK(half(0) == half(pi) - half(pi)); + CHECK(half(6.28125) == half(pi) + half(pi)); + + // comparisons + CHECK(half(3) > half(2)); + CHECK(half(3) < half(4)); + CHECK(half(3) <= half(3)); + CHECK(half(3) >= half(3)); + TRUE(half(NAN) != half(NAN)); + FALSE(half(NAN) == half(NAN)); + TRUE(half(3) != half(NAN)); + FALSE(half(3) == half(NAN)); + TRUE(half(NAN) != half(3)); + FALSE(half(NAN) == half(3)); +} From 761c6ad6155b30b0446f81f19e875ba2f10c566d Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 3 Aug 2024 01:24:46 -0700 Subject: [PATCH 03/39] Share file offset across processes This change ensures that if a file descriptor for an open disk file gets shared by multiple processes within a process tree, then lseek() changes will be visible across processes, and read() / write() are synchronized. Note this only applies to Windows, because UNIX kernels already do this. --- libc/calls/close-nt.c | 5 +- libc/calls/dup-nt.c | 2 + libc/calls/fcntl-nt.c | 15 ++-- libc/calls/lseek-nt.c | 13 ++-- libc/calls/open-nt.c | 5 +- libc/calls/readwrite-nt.c | 51 ++++++++----- libc/intrin/fds.c | 22 +++++- libc/intrin/fds.h | 14 +++- libc/intrin/fds_lock.c | 22 ++++++ libc/{runtime => intrin}/mapshared.c | 0 libc/proc/describefds.c | 9 ++- libc/sock/sendfile.c | 17 +++-- test/libc/intrin/munmap_test.c | 2 +- test/math/bf16_test.c | 35 ++++----- test/posix/file_offset_shared_test.c | 107 +++++++++++++++++++++++++++ 15 files changed, 256 insertions(+), 63 deletions(-) rename libc/{runtime => intrin}/mapshared.c (100%) create mode 100644 test/posix/file_offset_shared_test.c diff --git a/libc/calls/close-nt.c b/libc/calls/close-nt.c index 74475c8d3..180f03f4a 100644 --- a/libc/calls/close-nt.c +++ b/libc/calls/close-nt.c @@ -17,13 +17,14 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" -#include "libc/intrin/fds.h" #include "libc/calls/syscall-nt.internal.h" #include "libc/calls/syscall_support-nt.internal.h" +#include "libc/intrin/fds.h" #include "libc/intrin/weaken.h" #include "libc/nt/enum/filetype.h" #include "libc/nt/files.h" #include "libc/nt/runtime.h" +#include "libc/runtime/runtime.h" #include "libc/runtime/zipos.internal.h" #include "libc/sock/syscall_fd.internal.h" #include "libc/sysv/consts/o.h" @@ -64,5 +65,7 @@ textwindows int sys_close_nt(int fd, int fildes) { default: break; } + if (f->shared && !f->isdup) + munmap(f->shared, sizeof(struct Cursor)); return CloseHandle(f->handle) ? 0 : __winerr(); } diff --git a/libc/calls/dup-nt.c b/libc/calls/dup-nt.c index 35a07a223..898a653d3 100644 --- a/libc/calls/dup-nt.c +++ b/libc/calls/dup-nt.c @@ -82,6 +82,8 @@ static textwindows int sys_dup_nt_impl(int oldfd, int newfd, int flags, g_fds.p[newfd] = g_fds.p[oldfd]; g_fds.p[newfd].handle = handle; + g_fds.p[newfd].isdup = true; + g_fds.p[oldfd].isdup = true; // TODO(jart): is it possible to avoid leak? if (flags & _O_CLOEXEC) { g_fds.p[newfd].flags |= _O_CLOEXEC; } else { diff --git a/libc/calls/fcntl-nt.c b/libc/calls/fcntl-nt.c index a94130412..5c746b487 100644 --- a/libc/calls/fcntl-nt.c +++ b/libc/calls/fcntl-nt.c @@ -20,13 +20,13 @@ #include "libc/calls/calls.h" #include "libc/calls/createfileflags.internal.h" #include "libc/calls/internal.h" -#include "libc/intrin/fds.h" #include "libc/calls/struct/flock.h" #include "libc/calls/struct/sigset.internal.h" #include "libc/calls/syscall-nt.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/calls/wincrash.internal.h" #include "libc/errno.h" +#include "libc/intrin/fds.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/weaken.h" #include "libc/limits.h" @@ -151,7 +151,7 @@ static textwindows int sys_fcntl_nt_lock(struct Fd *f, int fd, int cmd, case SEEK_SET: break; case SEEK_CUR: - off = f->pointer + off; + off = f->shared->pointer + off; break; case SEEK_END: { int64_t size; @@ -351,9 +351,14 @@ textwindows int sys_fcntl_nt(int fd, int cmd, uintptr_t arg) { } rc = 0; } else if (cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK) { - pthread_mutex_lock(&g_locks.mu); - rc = sys_fcntl_nt_lock(g_fds.p + fd, fd, cmd, arg); - pthread_mutex_unlock(&g_locks.mu); + struct Fd *f = g_fds.p + fd; + if (f->shared) { + pthread_mutex_lock(&g_locks.mu); + rc = sys_fcntl_nt_lock(f, fd, cmd, arg); + pthread_mutex_unlock(&g_locks.mu); + } else { + rc = ebadf(); + } } else if (cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC) { rc = sys_fcntl_nt_dupfd(fd, cmd, arg); } else { diff --git a/libc/calls/lseek-nt.c b/libc/calls/lseek-nt.c index 11ef3471f..9ca3342e9 100644 --- a/libc/calls/lseek-nt.c +++ b/libc/calls/lseek-nt.c @@ -31,7 +31,7 @@ static textwindows int64_t GetPosition(struct Fd *f, int whence) { case SEEK_SET: return 0; case SEEK_CUR: - return f->pointer; + return f->shared->pointer; case SEEK_END: { struct NtByHandleFileInformation wst; if (!GetFileInformationByHandle(f->handle, &wst)) { @@ -67,11 +67,14 @@ textwindows int64_t sys_lseek_nt(int fd, int64_t offset, int whence) { } else if (__isfdkind(fd, kFdFile)) { struct Fd *f = g_fds.p + fd; int filetype = GetFileType(f->handle); - if (filetype != kNtFileTypePipe && filetype != kNtFileTypeChar) { + if (filetype != kNtFileTypePipe && // + filetype != kNtFileTypeChar && // + f->shared) { int64_t res; - if ((res = Seek(f, offset, whence)) != -1) { - f->pointer = res; - } + __fd_lock(f); + if ((res = Seek(f, offset, whence)) != -1) + f->shared->pointer = res; + __fd_unlock(f); return res; } else { return espipe(); diff --git a/libc/calls/open-nt.c b/libc/calls/open-nt.c index c7339171b..58d0cefc5 100644 --- a/libc/calls/open-nt.c +++ b/libc/calls/open-nt.c @@ -138,6 +138,7 @@ static textwindows int sys_open_nt_file(int dirfd, const char *file, int64_t handle; if ((handle = sys_open_nt_impl(dirfd, file, flags, mode, kNtFileFlagOverlapped)) != -1) { + g_fds.p[fd].shared = __cursor_new(); g_fds.p[fd].handle = handle; g_fds.p[fd].kind = kFdFile; g_fds.p[fd].flags = flags; @@ -170,14 +171,14 @@ static textwindows int sys_open_nt_no_handle(int fd, int flags, int mode, static textwindows int sys_open_nt_dup(int fd, int flags, int mode, int oldfd) { int64_t handle; - if (!__isfdopen(oldfd)) { + if (!__isfdopen(oldfd)) return enoent(); - } if (DuplicateHandle(GetCurrentProcess(), g_fds.p[oldfd].handle, GetCurrentProcess(), &handle, 0, true, kNtDuplicateSameAccess)) { g_fds.p[fd] = g_fds.p[oldfd]; g_fds.p[fd].handle = handle; + g_fds.p[fd].isdup = true; g_fds.p[fd].mode = mode; if (!sys_fcntl_nt_setfl(fd, flags)) { return fd; diff --git a/libc/calls/readwrite-nt.c b/libc/calls/readwrite-nt.c index 6fbfc1075..5ad587ac3 100644 --- a/libc/calls/readwrite-nt.c +++ b/libc/calls/readwrite-nt.c @@ -19,9 +19,9 @@ #include "libc/calls/createfileflags.internal.h" #include "libc/calls/internal.h" #include "libc/calls/sig.internal.h" -#include "libc/intrin/fds.h" #include "libc/calls/struct/sigset.h" #include "libc/calls/syscall_support-nt.internal.h" +#include "libc/intrin/fds.h" #include "libc/intrin/weaken.h" #include "libc/nt/enum/filetype.h" #include "libc/nt/errors.h" @@ -51,20 +51,19 @@ sys_readwrite_nt(int fd, void *data, size_t size, ssize_t offset, uint32_t exchanged; struct Fd *f = g_fds.p + fd; - // win32 i/o apis generally take 32-bit values thus we implicitly - // truncate outrageously large sizes. linux actually does it too! - size = MIN(size, 0x7ffff000); - // pread() and pwrite() perform an implicit lseek() operation, so // similar to the lseek() system call, they too raise ESPIPE when // operating on a non-seekable file. bool pwriting = offset != -1; - bool seekable = - (f->kind == kFdFile && GetFileType(handle) == kNtFileTypeDisk) || - f->kind == kFdDevNull || f->kind == kFdDevRandom; - if (pwriting && !seekable) { + bool isdisk = f->kind == kFdFile && GetFileType(handle) == kNtFileTypeDisk; + bool seekable = isdisk || f->kind == kFdDevNull || f->kind == kFdDevRandom; + if (pwriting && !seekable) return espipe(); - } + + // determine if we need to lock a file descriptor across processes + bool locked = isdisk && !pwriting && f->shared; + if (locked) + __fd_lock(f); // when a file is opened in overlapped mode win32 requires that we // take over full responsibility for managing our own file pointer @@ -72,8 +71,8 @@ sys_readwrite_nt(int fd, void *data, size_t size, ssize_t offset, // the sense that it behaves so differently from linux, that using // win32 i/o required more compatibilty toil than doing it by hand if (!pwriting) { - if (seekable) { - offset = f->pointer; + if (seekable && f->shared) { + offset = f->shared->pointer; } else { offset = 0; } @@ -82,8 +81,11 @@ sys_readwrite_nt(int fd, void *data, size_t size, ssize_t offset, RestartOperation: bool eagained = false; // check for signals and cancelation - if (_check_cancel() == -1) + if (_check_cancel() == -1) { + if (locked) + __fd_unlock(f); return -1; // ECANCELED + } if (_weaken(__sig_get) && (sig = _weaken(__sig_get)(waitmask))) { goto HandleInterrupt; } @@ -114,16 +116,16 @@ RestartOperation: } ok = true; } - if (ok) { + if (ok) ok = GetOverlappedResult(handle, &overlap, &exchanged, true); - } CloseHandle(overlap.hEvent); // if i/o succeeded then return its result if (ok) { - if (!pwriting && seekable) { - f->pointer = offset + exchanged; - } + if (!pwriting && seekable && f->shared) + f->shared->pointer = offset + exchanged; + if (locked) + __fd_unlock(f); return exchanged; } @@ -131,23 +133,32 @@ RestartOperation: if (GetLastError() == kNtErrorOperationAborted) { // raise EAGAIN if it's due to O_NONBLOCK mmode if (eagained) { + if (locked) + __fd_unlock(f); return eagain(); } // otherwise it must be due to a kill() via __sig_cancel() if (_weaken(__sig_relay) && (sig = _weaken(__sig_get)(waitmask))) { HandleInterrupt: + if (locked) + __fd_unlock(f); int handler_was_called = _weaken(__sig_relay)(sig, SI_KERNEL, waitmask); if (_check_cancel() == -1) return -1; // possible if we SIGTHR'd + if (locked) + __fd_lock(f); // read() is @restartable unless non-SA_RESTART hands were called - if (!(handler_was_called & SIG_HANDLED_NO_RESTART)) { + if (!(handler_was_called & SIG_HANDLED_NO_RESTART)) goto RestartOperation; - } } + if (locked) + __fd_unlock(f); return eintr(); } // read() and write() have generally different error-handling paths + if (locked) + __fd_unlock(f); return -2; } diff --git a/libc/intrin/fds.c b/libc/intrin/fds.c index f70abfb92..6f830dfbb 100644 --- a/libc/intrin/fds.c +++ b/libc/intrin/fds.c @@ -16,13 +16,13 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/intrin/fds.h" #include "libc/calls/internal.h" #include "libc/calls/state.internal.h" #include "libc/calls/ttydefaults.h" #include "libc/dce.h" #include "libc/intrin/atomic.h" #include "libc/intrin/extend.h" -#include "libc/intrin/fds.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/nomultics.h" #include "libc/intrin/pushpop.h" @@ -40,6 +40,7 @@ #include "libc/sock/sock.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/o.h" +#include "libc/sysv/consts/prot.h" #include "libc/thread/thread.h" #define OPEN_MAX 16 @@ -156,12 +157,29 @@ textstartup void __init_fds(int argc, char **argv, char **envp) { f->kind = kind; f->flags = flags; f->mode = mode; - f->pointer = pointer; f->type = type; f->family = family; f->protocol = protocol; atomic_store_explicit(&fds->f, fd + 1, memory_order_relaxed); + + // + // - v1 abi: This field was originally the file pointer. + // + // - v2 abi: This field is the negated shared memory address. + // + if (f->kind == kFdFile) { + if (pointer < 0) { + f->shared = (struct Cursor *)(uintptr_t)-pointer; + } else if ((f->shared = __cursor_new())) { + f->shared->pointer = pointer; + } + } } } + for (int i = 0; i < 3; ++i) { + struct Fd *f = fds->p + i; + if (f->kind == kFdFile && !f->shared) + f->shared = __cursor_new(); + } } } diff --git a/libc/intrin/fds.h b/libc/intrin/fds.h index e3ff36fc5..dc6ac70f4 100644 --- a/libc/intrin/fds.h +++ b/libc/intrin/fds.h @@ -1,5 +1,7 @@ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ +#include "libc/atomic.h" +#include "libc/thread/thread.h" COSMOPOLITAN_C_START_ #define kFdEmpty 0 @@ -13,19 +15,25 @@ COSMOPOLITAN_C_START_ #define kFdDevNull 9 #define kFdDevRandom 10 +struct Cursor { + pthread_mutex_t lock; + long pointer; +}; + struct Fd { char kind; + bool isdup; bool isbound; unsigned flags; unsigned mode; long handle; - long pointer; int family; int type; int protocol; unsigned rcvtimeo; /* millis; 0 means wait forever */ unsigned sndtimeo; /* millis; 0 means wait forever */ void *connect_op; + struct Cursor *shared; }; struct Fds { @@ -34,5 +42,9 @@ struct Fds { struct Fd *p, *e; }; +void __fd_lock(struct Fd *); +void __fd_unlock(struct Fd *); +struct Cursor *__cursor_new(void); + COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ */ diff --git a/libc/intrin/fds_lock.c b/libc/intrin/fds_lock.c index c32367d85..dd3d28491 100644 --- a/libc/intrin/fds_lock.c +++ b/libc/intrin/fds_lock.c @@ -17,6 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/state.internal.h" +#include "libc/intrin/fds.h" +#include "libc/runtime/runtime.h" #include "libc/thread/thread.h" void __fds_lock(void) { @@ -26,3 +28,23 @@ void __fds_lock(void) { void __fds_unlock(void) { pthread_mutex_unlock(&__fds_lock_obj); } + +void __fd_lock(struct Fd *f) { + pthread_mutex_lock(&f->shared->lock); +} + +void __fd_unlock(struct Fd *f) { + pthread_mutex_unlock(&f->shared->lock); +} + +struct Cursor *__cursor_new(void) { + struct Cursor *c; + if ((c = _mapshared(sizeof(struct Cursor)))) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&c->lock, &attr); + pthread_mutexattr_destroy(&attr); + } + return c; +} diff --git a/libc/runtime/mapshared.c b/libc/intrin/mapshared.c similarity index 100% rename from libc/runtime/mapshared.c rename to libc/intrin/mapshared.c diff --git a/libc/proc/describefds.c b/libc/proc/describefds.c index d2cee918c..e54615a2f 100644 --- a/libc/proc/describefds.c +++ b/libc/proc/describefds.c @@ -17,9 +17,9 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" -#include "libc/intrin/fds.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/fmt/itoa.h" +#include "libc/intrin/fds.h" #include "libc/intrin/strace.h" #include "libc/mem/mem.h" #include "libc/nt/files.h" @@ -151,7 +151,12 @@ textwindows char *__describe_fds(const struct Fd *fds, size_t fdslen, *p++ = '_'; p = FormatInt64(p, f->mode); *p++ = '_'; - p = FormatInt64(p, f->pointer); + // + // - v1 abi: This field was originally the file pointer. + // + // - v2 abi: This field is the negated shared memory address. + // + p = FormatInt64(p, -(uintptr_t)f->shared); *p++ = '_'; p = FormatInt64(p, f->type); *p++ = '_'; diff --git a/libc/sock/sendfile.c b/libc/sock/sendfile.c index 26d7cef55..249793784 100644 --- a/libc/sock/sendfile.c +++ b/libc/sock/sendfile.c @@ -62,9 +62,10 @@ static dontinline textwindows ssize_t sys_sendfile_nt( int outfd, int infd, int64_t *opt_in_out_inoffset, uint32_t uptobytes) { ssize_t rc; uint32_t flags = 0; + bool locked = false; int64_t ih, oh, eof, offset; struct NtByHandleFileInformation wst; - if (!__isfdkind(infd, kFdFile)) + if (!__isfdkind(infd, kFdFile) || !g_fds.p[infd].shared) return ebadf(); if (!__isfdkind(outfd, kFdSocket)) return ebadf(); @@ -73,7 +74,9 @@ static dontinline textwindows ssize_t sys_sendfile_nt( if (opt_in_out_inoffset) { offset = *opt_in_out_inoffset; } else { - offset = g_fds.p[infd].pointer; + locked = true; + __fd_lock(&g_fds.p[infd]); + offset = g_fds.p[infd].shared->pointer; } if (GetFileInformationByHandle(ih, &wst)) { // TransmitFile() returns EINVAL if `uptobytes` goes past EOF. @@ -82,9 +85,10 @@ static dontinline textwindows ssize_t sys_sendfile_nt( uptobytes = eof - offset; } } else { + if (locked) + __fd_unlock(&g_fds.p[infd]); return ebadf(); } - BLOCK_SIGNALS; struct NtOverlapped ov = {.hEvent = WSACreateEvent(), .Pointer = offset}; cosmo_once(&g_transmitfile.once, transmitfile_init); if (g_transmitfile.lpTransmitFile(oh, ih, uptobytes, 0, &ov, 0, 0) || @@ -95,7 +99,7 @@ static dontinline textwindows ssize_t sys_sendfile_nt( if (opt_in_out_inoffset) { *opt_in_out_inoffset = offset + rc; } else { - g_fds.p[infd].pointer = offset + rc; + g_fds.p[infd].shared->pointer = offset + rc; } } else { rc = __winsockerr(); @@ -103,8 +107,9 @@ static dontinline textwindows ssize_t sys_sendfile_nt( } else { rc = __winsockerr(); } + if (locked) + __fd_unlock(&g_fds.p[infd]); WSACloseEvent(ov.hEvent); - ALLOW_SIGNALS; return rc; } @@ -186,7 +191,9 @@ ssize_t sendfile(int outfd, int infd, int64_t *opt_in_out_inoffset, } else if (IsFreebsd() || IsXnu()) { rc = sys_sendfile_bsd(outfd, infd, opt_in_out_inoffset, uptobytes); } else if (IsWindows()) { + BLOCK_SIGNALS; rc = sys_sendfile_nt(outfd, infd, opt_in_out_inoffset, uptobytes); + ALLOW_SIGNALS; } else { rc = enosys(); } diff --git a/test/libc/intrin/munmap_test.c b/test/libc/intrin/munmap_test.c index 9bf2ef344..eb61bb282 100644 --- a/test/libc/intrin/munmap_test.c +++ b/test/libc/intrin/munmap_test.c @@ -185,8 +185,8 @@ TEST(munmap, tinyFile_preciseUnmapSize) { TEST(munmap, tinyFile_mapThriceUnmapOnce) { char *p; ASSERT_NE(MAP_FAILED, (p = mmap(0, gransz*5, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0))); - ASSERT_SYS(0, 0, munmap(p, gransz*5)); ASSERT_SYS(0, 3, open("doge", O_RDWR | O_CREAT | O_TRUNC, 0644)); + ASSERT_SYS(0, 0, munmap(p, gransz*5)); ASSERT_SYS (0, 5, write(3, "hello", 5)); ASSERT_EQ(p+gransz*0, mmap(p+gransz*0, gransz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0)); ASSERT_EQ(p+gransz*1, mmap(p+gransz*1, 5, PROT_READ, MAP_PRIVATE|MAP_FIXED, 3, 0)); diff --git a/test/math/bf16_test.c b/test/math/bf16_test.c index 532cebda5..05df1f63f 100644 --- a/test/math/bf16_test.c +++ b/test/math/bf16_test.c @@ -1,22 +1,19 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2024 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/math.h" +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include #define CHECK(x) \ if (!(x)) \ diff --git a/test/posix/file_offset_shared_test.c b/test/posix/file_offset_shared_test.c new file mode 100644 index 000000000..5124de186 --- /dev/null +++ b/test/posix/file_offset_shared_test.c @@ -0,0 +1,107 @@ +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include +#include + +// test that file offset is shared across multiple processes + +atomic_int *phase; + +int main() { + + if ((phase = mmap(0, sizeof(atomic_int), PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) + return 1; + + int fd; + char path[] = "/tmp/fd_test.XXXXXX"; + if ((fd = mkstemp(path)) == -1) + return 2; + if (lseek(fd, 0, SEEK_CUR) != 0) + return 22; + + if (write(fd, "0", 1) != 1) + return 3; + if (lseek(fd, 0, SEEK_CUR) != 1) + return 33; + + int pid; + if ((pid = fork()) == -1) + return 4; + + if (!pid) { + if (write(fd, "1", 1) != 1) + _Exit(100); + if (lseek(fd, 0, SEEK_CUR) != 2) + _Exit(101); + + *phase = 1; + for (;;) + if (*phase == 2) + break; + + if (write(fd, "3", 1) != 1) + _Exit(102); + if (lseek(fd, 0, SEEK_CUR) != 4) + _Exit(103); + *phase = 3; + _Exit(0); + } + + for (;;) + if (*phase == 1) + break; + + if (write(fd, "2", 1) != 1) + return 5; + if (lseek(fd, 0, SEEK_CUR) != 3) + return 55; + + *phase = 2; + for (;;) + if (*phase == 3) + break; + + if (write(fd, "4", 1) != 1) + return 6; + if (lseek(fd, 0, SEEK_CUR) != 5) + return 66; + + int ws; + if (wait(&ws) == -1) + return 7; + if (!WIFEXITED(ws)) + return 8; + if (WEXITSTATUS(ws)) + return WEXITSTATUS(ws); + + char buf[16] = {0}; + if (pread(fd, buf, 15, 0) != 5) + return 12; + if (lseek(fd, 0, SEEK_CUR) != 5) + return 77; + + if (close(fd)) + return 13; + + if (unlink(path)) + return 14; + + if (strcmp(buf, "01234")) + return 15; +} From 3f26dfbb310d0a9f9f399b2832f288808d5c95b2 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 3 Aug 2024 17:48:00 -0700 Subject: [PATCH 04/39] Share file offset across execve() on Windows This is a breaking change. It defines the new environment variable named _COSMO_FDS_V2 which is used for inheriting non-stdio file descriptors on execve() or posix_spawn(). No effort has been spent thus far integrating with the older variable. If a new binary launches the older ones or vice versa they'll only be able to pass stdin / stdout / stderr to each other therefore it's important that you upgrade all your cosmo binaries if you depend on this functionality. You'll be glad you did because inheritance of file descriptors is more aligned with the POSIX standard than before. --- libc/calls/close-nt.c | 4 +- libc/calls/dup-nt.c | 4 +- libc/calls/fcntl-nt.c | 4 +- libc/calls/isapemagic.c | 3 +- libc/calls/lseek-nt.c | 11 +- libc/calls/open-nt.c | 5 +- libc/calls/readwrite-nt.c | 28 +-- libc/calls/write-nt.c | 2 +- libc/integral/c.inc | 6 - libc/intrin/BUILD.mk | 1 + libc/intrin/cursor.c | 64 +++++++ libc/intrin/fds.c | 51 ++++-- libc/intrin/fds.h | 17 +- libc/intrin/fds_lock.c | 22 --- libc/{runtime => intrin}/mapanon.c | 0 libc/intrin/maps.h | 1 + libc/intrin/mmap.c | 8 +- libc/intrin/strace.h | 2 +- libc/proc/describefds.c | 37 ++-- libc/proc/describefds.internal.h | 2 + libc/runtime/straceinit.greg.c | 5 +- libc/runtime/winmain.greg.c | 1 + libc/runtime/zipos-get.c | 15 +- libc/sock/sendfile.c | 12 +- test/libc/calls/lseek_test.c | 142 ++++++++------- test/posix/BUILD.mk | 78 +++++---- test/posix/file_offset_exec_prog.c | 63 +++++++ test/posix/file_offset_exec_test.c | 162 ++++++++++++++++++ ..._shared_test.c => file_offset_fork_test.c} | 71 +++++--- 29 files changed, 572 insertions(+), 249 deletions(-) create mode 100644 libc/intrin/cursor.c rename libc/{runtime => intrin}/mapanon.c (100%) create mode 100644 test/posix/file_offset_exec_prog.c create mode 100644 test/posix/file_offset_exec_test.c rename test/posix/{file_offset_shared_test.c => file_offset_fork_test.c} (75%) diff --git a/libc/calls/close-nt.c b/libc/calls/close-nt.c index 180f03f4a..1952e4daa 100644 --- a/libc/calls/close-nt.c +++ b/libc/calls/close-nt.c @@ -65,7 +65,7 @@ textwindows int sys_close_nt(int fd, int fildes) { default: break; } - if (f->shared && !f->isdup) - munmap(f->shared, sizeof(struct Cursor)); + if (f->cursor) + __cursor_unref(f->cursor); return CloseHandle(f->handle) ? 0 : __winerr(); } diff --git a/libc/calls/dup-nt.c b/libc/calls/dup-nt.c index 898a653d3..4bf3f68fc 100644 --- a/libc/calls/dup-nt.c +++ b/libc/calls/dup-nt.c @@ -24,6 +24,7 @@ #include "libc/calls/struct/sigset.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/errno.h" +#include "libc/intrin/fds.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/weaken.h" #include "libc/nt/files.h" @@ -82,8 +83,7 @@ static textwindows int sys_dup_nt_impl(int oldfd, int newfd, int flags, g_fds.p[newfd] = g_fds.p[oldfd]; g_fds.p[newfd].handle = handle; - g_fds.p[newfd].isdup = true; - g_fds.p[oldfd].isdup = true; // TODO(jart): is it possible to avoid leak? + __cursor_ref(g_fds.p[newfd].cursor); if (flags & _O_CLOEXEC) { g_fds.p[newfd].flags |= _O_CLOEXEC; } else { diff --git a/libc/calls/fcntl-nt.c b/libc/calls/fcntl-nt.c index 5c746b487..f18945ce8 100644 --- a/libc/calls/fcntl-nt.c +++ b/libc/calls/fcntl-nt.c @@ -151,7 +151,7 @@ static textwindows int sys_fcntl_nt_lock(struct Fd *f, int fd, int cmd, case SEEK_SET: break; case SEEK_CUR: - off = f->shared->pointer + off; + off = f->cursor->shared->pointer + off; break; case SEEK_END: { int64_t size; @@ -352,7 +352,7 @@ textwindows int sys_fcntl_nt(int fd, int cmd, uintptr_t arg) { rc = 0; } else if (cmd == F_SETLK || cmd == F_SETLKW || cmd == F_GETLK) { struct Fd *f = g_fds.p + fd; - if (f->shared) { + if (f->cursor) { pthread_mutex_lock(&g_locks.mu); rc = sys_fcntl_nt_lock(f, fd, cmd, arg); pthread_mutex_unlock(&g_locks.mu); diff --git a/libc/calls/isapemagic.c b/libc/calls/isapemagic.c index a1ca56460..e387880cc 100644 --- a/libc/calls/isapemagic.c +++ b/libc/calls/isapemagic.c @@ -25,6 +25,5 @@ bool IsApeLoadable(char buf[8]) { return READ32LE(buf) == READ32LE("\177ELF") || READ64LE(buf) == READ64LE("MZqFpD='") || - READ64LE(buf) == READ64LE("jartsr='") || - READ64LE(buf) == READ64LE("APEDBG='"); + READ64LE(buf) == READ64LE("jartsr='"); } diff --git a/libc/calls/lseek-nt.c b/libc/calls/lseek-nt.c index 9ca3342e9..9e073b8c4 100644 --- a/libc/calls/lseek-nt.c +++ b/libc/calls/lseek-nt.c @@ -19,6 +19,7 @@ #include "libc/calls/calls.h" #include "libc/calls/internal.h" #include "libc/calls/syscall_support-nt.internal.h" +#include "libc/intrin/fds.h" #include "libc/nt/enum/filetype.h" #include "libc/nt/files.h" #include "libc/nt/struct/byhandlefileinformation.h" @@ -31,7 +32,7 @@ static textwindows int64_t GetPosition(struct Fd *f, int whence) { case SEEK_SET: return 0; case SEEK_CUR: - return f->shared->pointer; + return f->cursor->shared->pointer; case SEEK_END: { struct NtByHandleFileInformation wst; if (!GetFileInformationByHandle(f->handle, &wst)) { @@ -69,12 +70,12 @@ textwindows int64_t sys_lseek_nt(int fd, int64_t offset, int whence) { int filetype = GetFileType(f->handle); if (filetype != kNtFileTypePipe && // filetype != kNtFileTypeChar && // - f->shared) { + f->cursor->shared) { int64_t res; - __fd_lock(f); + __cursor_lock(f->cursor); if ((res = Seek(f, offset, whence)) != -1) - f->shared->pointer = res; - __fd_unlock(f); + f->cursor->shared->pointer = res; + __cursor_unlock(f->cursor); return res; } else { return espipe(); diff --git a/libc/calls/open-nt.c b/libc/calls/open-nt.c index 58d0cefc5..9a2f5808f 100644 --- a/libc/calls/open-nt.c +++ b/libc/calls/open-nt.c @@ -24,6 +24,7 @@ #include "libc/calls/syscall-nt.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/errno.h" +#include "libc/intrin/fds.h" #include "libc/macros.internal.h" #include "libc/nt/console.h" #include "libc/nt/createfile.h" @@ -138,7 +139,7 @@ static textwindows int sys_open_nt_file(int dirfd, const char *file, int64_t handle; if ((handle = sys_open_nt_impl(dirfd, file, flags, mode, kNtFileFlagOverlapped)) != -1) { - g_fds.p[fd].shared = __cursor_new(); + g_fds.p[fd].cursor = __cursor_new(); g_fds.p[fd].handle = handle; g_fds.p[fd].kind = kFdFile; g_fds.p[fd].flags = flags; @@ -178,8 +179,8 @@ static textwindows int sys_open_nt_dup(int fd, int flags, int mode, int oldfd) { kNtDuplicateSameAccess)) { g_fds.p[fd] = g_fds.p[oldfd]; g_fds.p[fd].handle = handle; - g_fds.p[fd].isdup = true; g_fds.p[fd].mode = mode; + __cursor_ref(g_fds.p[fd].cursor); if (!sys_fcntl_nt_setfl(fd, flags)) { return fd; } else { diff --git a/libc/calls/readwrite-nt.c b/libc/calls/readwrite-nt.c index 5ad587ac3..6ef3f376c 100644 --- a/libc/calls/readwrite-nt.c +++ b/libc/calls/readwrite-nt.c @@ -61,29 +61,29 @@ sys_readwrite_nt(int fd, void *data, size_t size, ssize_t offset, return espipe(); // determine if we need to lock a file descriptor across processes - bool locked = isdisk && !pwriting && f->shared; + bool locked = isdisk && !pwriting && f->cursor; if (locked) - __fd_lock(f); + __cursor_lock(f->cursor); +RestartOperation: // when a file is opened in overlapped mode win32 requires that we // take over full responsibility for managing our own file pointer // which is fine, because the one win32 has was never very good in // the sense that it behaves so differently from linux, that using // win32 i/o required more compatibilty toil than doing it by hand if (!pwriting) { - if (seekable && f->shared) { - offset = f->shared->pointer; + if (seekable && f->cursor) { + offset = f->cursor->shared->pointer; } else { offset = 0; } } -RestartOperation: bool eagained = false; // check for signals and cancelation if (_check_cancel() == -1) { if (locked) - __fd_unlock(f); + __cursor_unlock(f->cursor); return -1; // ECANCELED } if (_weaken(__sig_get) && (sig = _weaken(__sig_get)(waitmask))) { @@ -122,10 +122,10 @@ RestartOperation: // if i/o succeeded then return its result if (ok) { - if (!pwriting && seekable && f->shared) - f->shared->pointer = offset + exchanged; + if (!pwriting && seekable && f->cursor) + f->cursor->shared->pointer = offset + exchanged; if (locked) - __fd_unlock(f); + __cursor_unlock(f->cursor); return exchanged; } @@ -134,31 +134,31 @@ RestartOperation: // raise EAGAIN if it's due to O_NONBLOCK mmode if (eagained) { if (locked) - __fd_unlock(f); + __cursor_unlock(f->cursor); return eagain(); } // otherwise it must be due to a kill() via __sig_cancel() if (_weaken(__sig_relay) && (sig = _weaken(__sig_get)(waitmask))) { HandleInterrupt: if (locked) - __fd_unlock(f); + __cursor_unlock(f->cursor); int handler_was_called = _weaken(__sig_relay)(sig, SI_KERNEL, waitmask); if (_check_cancel() == -1) return -1; // possible if we SIGTHR'd if (locked) - __fd_lock(f); + __cursor_lock(f->cursor); // read() is @restartable unless non-SA_RESTART hands were called if (!(handler_was_called & SIG_HANDLED_NO_RESTART)) goto RestartOperation; } if (locked) - __fd_unlock(f); + __cursor_unlock(f->cursor); return eintr(); } // read() and write() have generally different error-handling paths if (locked) - __fd_unlock(f); + __cursor_unlock(f->cursor); return -2; } diff --git a/libc/calls/write-nt.c b/libc/calls/write-nt.c index 3e5eb0163..528c28332 100644 --- a/libc/calls/write-nt.c +++ b/libc/calls/write-nt.c @@ -18,7 +18,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" #include "libc/calls/sig.internal.h" -#include "libc/intrin/fds.h" #include "libc/calls/struct/iovec.h" #include "libc/calls/struct/sigset.h" #include "libc/calls/struct/sigset.internal.h" @@ -26,6 +25,7 @@ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/errno.h" #include "libc/intrin/atomic.h" +#include "libc/intrin/fds.h" #include "libc/intrin/nomultics.h" #include "libc/intrin/weaken.h" #include "libc/nt/console.h" diff --git a/libc/integral/c.inc b/libc/integral/c.inc index 34c8a443b..0f29ff5f0 100644 --- a/libc/integral/c.inc +++ b/libc/integral/c.inc @@ -6,12 +6,6 @@ #define COSMOPOLITAN_CXX_USING_ #endif -#ifndef __cplusplus -#pragma GCC diagnostic warning "-Wimplicit-function-declaration" -#pragma GCC diagnostic warning "-Wincompatible-pointer-types" -#pragma GCC diagnostic warning "-Wint-conversion" -#endif - #if !defined(__GNUC__) && __cplusplus + 0 >= 201103L #define typeof(x) decltype(x) #elif !defined(__GNUC__) && __STDC_VERSION__ + 0 < 201112 diff --git a/libc/intrin/BUILD.mk b/libc/intrin/BUILD.mk index 99b0cdf89..16a5526f7 100644 --- a/libc/intrin/BUILD.mk +++ b/libc/intrin/BUILD.mk @@ -62,6 +62,7 @@ o/$(MODE)/libc/intrin/kprintf.o: private \ -Wframe-larger-than=128 \ -Walloca-larger-than=128 +o/$(MODE)/libc/intrin/cursor.o \ o/$(MODE)/libc/intrin/mmap.o \ o/$(MODE)/libc/intrin/tree.o: private \ CFLAGS += \ diff --git a/libc/intrin/cursor.c b/libc/intrin/cursor.c new file mode 100644 index 000000000..e0c686d4f --- /dev/null +++ b/libc/intrin/cursor.c @@ -0,0 +1,64 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/assert.h" +#include "libc/intrin/atomic.h" +#include "libc/intrin/fds.h" +#include "libc/runtime/runtime.h" + +struct Cursor *__cursor_new(void) { + struct Cursor *c; + if ((c = _mapanon(sizeof(struct Cursor)))) { + if ((c->shared = _mapshared(sizeof(struct CursorShared)))) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&c->shared->lock, &attr); + pthread_mutexattr_destroy(&attr); + } else { + munmap(c, sizeof(struct Cursor)); + c = 0; + } + } + return c; +} + +void __cursor_ref(struct Cursor *c) { + if (!c) + return; + unassert(atomic_fetch_add_explicit(&c->refs, 1, memory_order_relaxed) >= 0); +} + +int __cursor_unref(struct Cursor *c) { + if (!c) + return 0; + if (atomic_fetch_sub_explicit(&c->refs, 1, memory_order_release)) + return 0; + atomic_thread_fence(memory_order_acquire); + int rc = munmap(c->shared, sizeof(struct CursorShared)); + rc |= munmap(c, sizeof(struct Cursor)); + return rc; +} + +void __cursor_lock(struct Cursor *c) { + pthread_mutex_lock(&c->shared->lock); +} + +void __cursor_unlock(struct Cursor *c) { + pthread_mutex_unlock(&c->shared->lock); +} diff --git a/libc/intrin/fds.c b/libc/intrin/fds.c index 6f830dfbb..d2883cccf 100644 --- a/libc/intrin/fds.c +++ b/libc/intrin/fds.c @@ -23,7 +23,7 @@ #include "libc/dce.h" #include "libc/intrin/atomic.h" #include "libc/intrin/extend.h" -#include "libc/intrin/kprintf.h" +#include "libc/intrin/maps.h" #include "libc/intrin/nomultics.h" #include "libc/intrin/pushpop.h" #include "libc/intrin/weaken.h" @@ -32,7 +32,9 @@ #include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/creationdisposition.h" #include "libc/nt/enum/fileflagandattributes.h" +#include "libc/nt/enum/filemapflags.h" #include "libc/nt/enum/filesharemode.h" +#include "libc/nt/memory.h" #include "libc/nt/runtime.h" #include "libc/runtime/internal.h" #include "libc/runtime/memtrack.internal.h" @@ -55,7 +57,11 @@ static struct Fd g_fds_static[OPEN_MAX]; static bool TokAtoi(const char **str, long *res) { int c, d; unsigned long x = 0; - d = **str == '-' ? -1 : 1; + d = 1; + if (**str == '-') { + (*str)++; + d = -1; + } while ((c = *(*str)++)) { if (('0' <= c && c <= '9')) { x *= 10; @@ -122,10 +128,11 @@ textstartup void __init_fds(int argc, char **argv, char **envp) { // inherit file descriptors from cosmo parent process if (IsWindows()) { const char *fdspec; - if ((fdspec = getenv("_COSMO_FDS"))) { + if ((fdspec = getenv("_COSMO_FDS_V2"))) { unsetenv("_COSMO_FDS"); + unsetenv("_COSMO_FDS_V2"); for (;;) { - long fd, kind, flags, mode, handle, pointer, type, family, protocol; + long fd, kind, flags, mode, handle, shand, type, family, protocol; if (!TokAtoi(&fdspec, &fd)) break; if (!TokAtoi(&fdspec, &handle)) @@ -136,7 +143,7 @@ textstartup void __init_fds(int argc, char **argv, char **envp) { break; if (!TokAtoi(&fdspec, &mode)) break; - if (!TokAtoi(&fdspec, &pointer)) + if (!TokAtoi(&fdspec, &shand)) break; if (!TokAtoi(&fdspec, &type)) break; @@ -149,9 +156,8 @@ textstartup void __init_fds(int argc, char **argv, char **envp) { struct Fd *f = fds->p + fd; if (f->handle && f->handle != -1 && f->handle != handle) { CloseHandle(f->handle); - if (fd < 3) { + if (fd < 3) SetStdHandle(kNtStdio[fd], handle); - } } f->handle = handle; f->kind = kind; @@ -162,24 +168,31 @@ textstartup void __init_fds(int argc, char **argv, char **envp) { f->protocol = protocol; atomic_store_explicit(&fds->f, fd + 1, memory_order_relaxed); - // - // - v1 abi: This field was originally the file pointer. - // - // - v2 abi: This field is the negated shared memory address. - // - if (f->kind == kFdFile) { - if (pointer < 0) { - f->shared = (struct Cursor *)(uintptr_t)-pointer; - } else if ((f->shared = __cursor_new())) { - f->shared->pointer = pointer; + if (shand) { + struct Map *map; + struct CursorShared *shared; + if ((shared = MapViewOfFileEx(shand, kNtFileMapWrite, 0, 0, + sizeof(struct CursorShared), 0))) { + if ((f->cursor = _mapanon(sizeof(struct Cursor)))) { + f->cursor->shared = shared; + if ((map = __maps_alloc())) { + map->addr = (char *)shared; + map->size = sizeof(struct CursorShared); + map->off = 0; + map->prot = PROT_READ | PROT_WRITE; + map->flags = MAP_SHARED | MAP_ANONYMOUS; + map->hand = shand; + __maps_insert(map); + } + } } } } } for (int i = 0; i < 3; ++i) { struct Fd *f = fds->p + i; - if (f->kind == kFdFile && !f->shared) - f->shared = __cursor_new(); + if (f->kind == kFdFile && !f->cursor) + f->cursor = __cursor_new(); } } } diff --git a/libc/intrin/fds.h b/libc/intrin/fds.h index dc6ac70f4..b9d0f490a 100644 --- a/libc/intrin/fds.h +++ b/libc/intrin/fds.h @@ -1,6 +1,5 @@ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ -#include "libc/atomic.h" #include "libc/thread/thread.h" COSMOPOLITAN_C_START_ @@ -15,14 +14,18 @@ COSMOPOLITAN_C_START_ #define kFdDevNull 9 #define kFdDevRandom 10 -struct Cursor { +struct CursorShared { pthread_mutex_t lock; long pointer; }; +struct Cursor { + struct CursorShared *shared; + _Atomic(int) refs; +}; + struct Fd { char kind; - bool isdup; bool isbound; unsigned flags; unsigned mode; @@ -33,7 +36,7 @@ struct Fd { unsigned rcvtimeo; /* millis; 0 means wait forever */ unsigned sndtimeo; /* millis; 0 means wait forever */ void *connect_op; - struct Cursor *shared; + struct Cursor *cursor; }; struct Fds { @@ -42,9 +45,11 @@ struct Fds { struct Fd *p, *e; }; -void __fd_lock(struct Fd *); -void __fd_unlock(struct Fd *); struct Cursor *__cursor_new(void); +void __cursor_ref(struct Cursor *); +int __cursor_unref(struct Cursor *); +void __cursor_lock(struct Cursor *); +void __cursor_unlock(struct Cursor *); COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ */ diff --git a/libc/intrin/fds_lock.c b/libc/intrin/fds_lock.c index dd3d28491..c32367d85 100644 --- a/libc/intrin/fds_lock.c +++ b/libc/intrin/fds_lock.c @@ -17,8 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/state.internal.h" -#include "libc/intrin/fds.h" -#include "libc/runtime/runtime.h" #include "libc/thread/thread.h" void __fds_lock(void) { @@ -28,23 +26,3 @@ void __fds_lock(void) { void __fds_unlock(void) { pthread_mutex_unlock(&__fds_lock_obj); } - -void __fd_lock(struct Fd *f) { - pthread_mutex_lock(&f->shared->lock); -} - -void __fd_unlock(struct Fd *f) { - pthread_mutex_unlock(&f->shared->lock); -} - -struct Cursor *__cursor_new(void) { - struct Cursor *c; - if ((c = _mapshared(sizeof(struct Cursor)))) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); - pthread_mutex_init(&c->lock, &attr); - pthread_mutexattr_destroy(&attr); - } - return c; -} diff --git a/libc/runtime/mapanon.c b/libc/intrin/mapanon.c similarity index 100% rename from libc/runtime/mapanon.c rename to libc/intrin/mapanon.c diff --git a/libc/intrin/maps.h b/libc/intrin/maps.h index ee18dbcb3..5fc9b721b 100644 --- a/libc/intrin/maps.h +++ b/libc/intrin/maps.h @@ -52,6 +52,7 @@ void *__maps_randaddr(void); void *__maps_pickaddr(size_t); void __maps_add(struct Map *); void __maps_free(struct Map *); +void __maps_insert(struct Map *); struct Map *__maps_alloc(void); struct Map *__maps_floor(const char *); void __maps_stack(char *, int, int, size_t, int, intptr_t); diff --git a/libc/intrin/mmap.c b/libc/intrin/mmap.c index 55fef3d38..4a1c02486 100644 --- a/libc/intrin/mmap.c +++ b/libc/intrin/mmap.c @@ -138,7 +138,7 @@ StartOver: __maps.count -= 1; __maps_check(); } else if (IsWindows()) { - // you can't carve up memory maps on windows ;_; + STRACE("you can't carve up memory maps on windows ;_;"); rc = einval(); } else if (addr <= map_addr) { // shave off lefthand side of mapping @@ -246,7 +246,7 @@ static void __maps_free_all(struct Map *list) { } } -static void __maps_insert(struct Map *map) { +void __maps_insert(struct Map *map) { map->flags &= MAP_TYPE | MAP_ANONYMOUS | MAP_NOFORK; // coalesce adjacent mappings @@ -351,12 +351,12 @@ static int __munmap(char *addr, size_t size) { } // untrack mappings + int rc; struct Map *deleted = 0; - __muntrack(addr, pgup_size, pagesz, &deleted); + rc = __muntrack(addr, pgup_size, pagesz, &deleted); __maps_unlock(); // delete mappings - int rc = 0; for (struct Map *map = deleted; map; map = map->freed) { if (!IsWindows()) { if (sys_munmap(map->addr, map->size)) diff --git a/libc/intrin/strace.h b/libc/intrin/strace.h index 3c521857f..adda49caa 100644 --- a/libc/intrin/strace.h +++ b/libc/intrin/strace.h @@ -5,7 +5,7 @@ #define SYSDEBUG 0 #endif -#define _NTTRACE 0 /* not configurable w/ flag yet */ +#define _NTTRACE 1 /* not configurable w/ flag yet */ #define _POLLTRACE 0 /* not configurable w/ flag yet */ #define _DATATRACE 1 /* not configurable w/ flag yet */ #define _LOCKTRACE 0 /* not configurable w/ flag yet */ diff --git a/libc/proc/describefds.c b/libc/proc/describefds.c index e54615a2f..6cf25d78b 100644 --- a/libc/proc/describefds.c +++ b/libc/proc/describefds.c @@ -18,8 +18,10 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/calls/syscall_support-nt.internal.h" +#include "libc/errno.h" #include "libc/fmt/itoa.h" #include "libc/intrin/fds.h" +#include "libc/intrin/maps.h" #include "libc/intrin/strace.h" #include "libc/mem/mem.h" #include "libc/nt/files.h" @@ -27,7 +29,7 @@ #include "libc/nt/struct/startupinfo.h" #include "libc/sysv/consts/o.h" -#define FDS_VAR "_COSMO_FDS=" +#define FDS_VAR "_COSMO_FDS_V2=" #define MAX_ENTRY_BYTES 256 @@ -99,6 +101,8 @@ textwindows char *__describe_fds(const struct Fd *fds, size_t fdslen, if (__is_cloexec(f)) continue; ++handlecount; + if (f->cursor) + ++handlecount; } if (!(handles = calloc(handlecount, sizeof(*handles)))) { OnFailure: @@ -116,17 +120,31 @@ textwindows char *__describe_fds(const struct Fd *fds, size_t fdslen, // make inheritable version of handle exist in creator process if (!DuplicateHandle(GetCurrentProcess(), f->handle, hCreatorProcess, &handle, 0, true, kNtDuplicateSameAccess)) { - STRACE("__describe_fds() DuplicateHandle() failed w/ %d", GetLastError()); __winerr(); goto OnFailure; } - for (uint32_t i = 0; i < 3; ++i) { - if (lpStartupInfo->stdiofds[i] == f->handle) { + for (uint32_t i = 0; i < 3; ++i) + if (lpStartupInfo->stdiofds[i] == f->handle) lpStartupInfo->stdiofds[i] = handle; - } - } handles[hi++] = handle; + // get shared memory handle for the file offset pointer + intptr_t shand = 0; + if (f->cursor) { + struct Map *map; + if (!(map = __maps_floor((const char *)f->cursor->shared)) || + map->addr != (const char *)f->cursor->shared) { + errno = EFAULT; + goto OnFailure; + } + if (!DuplicateHandle(GetCurrentProcess(), map->hand, hCreatorProcess, + &shand, 0, true, kNtDuplicateSameAccess)) { + __winerr(); + goto OnFailure; + } + handles[hi++] = shand; + } + // ensure output string has enough space for new entry if (sb.i + MAX_ENTRY_BYTES > sb.n) { char *p2; @@ -151,12 +169,7 @@ textwindows char *__describe_fds(const struct Fd *fds, size_t fdslen, *p++ = '_'; p = FormatInt64(p, f->mode); *p++ = '_'; - // - // - v1 abi: This field was originally the file pointer. - // - // - v2 abi: This field is the negated shared memory address. - // - p = FormatInt64(p, -(uintptr_t)f->shared); + p = FormatInt64(p, shand); *p++ = '_'; p = FormatInt64(p, f->type); *p++ = '_'; diff --git a/libc/proc/describefds.internal.h b/libc/proc/describefds.internal.h index dd192630a..1cde5234b 100644 --- a/libc/proc/describefds.internal.h +++ b/libc/proc/describefds.internal.h @@ -4,6 +4,8 @@ #include "libc/nt/struct/startupinfo.h" COSMOPOLITAN_C_START_ +#define CURSOR_ADDRESS_FLAG 0x4000000000000000 + bool __is_cloexec(const struct Fd *) libcesque; void __undescribe_fds(int64_t, int64_t *, uint32_t) libcesque; char *__describe_fds(const struct Fd *, size_t, struct NtStartupInfo *, int64_t, diff --git a/libc/runtime/straceinit.greg.c b/libc/runtime/straceinit.greg.c index 7817b547a..92bf2ce18 100644 --- a/libc/runtime/straceinit.greg.c +++ b/libc/runtime/straceinit.greg.c @@ -28,9 +28,8 @@ */ textstartup int __strace_init(int argc, char **argv, char **envp, long *auxv) { /* asan isn't initialized yet at runlevel 300 */ - if ((__intercept_flag(&argc, argv, "--strace") || - __atoul(nulltoempty(__getenv(envp, "STRACE").s))) && - !issetugid()) { + if (__intercept_flag(&argc, argv, "--strace") || + __atoul(nulltoempty(__getenv(envp, "STRACE").s))) { strace_enabled(+1); } return (__argc = argc); diff --git a/libc/runtime/winmain.greg.c b/libc/runtime/winmain.greg.c index 77ebd63c2..6ecbaa16d 100644 --- a/libc/runtime/winmain.greg.c +++ b/libc/runtime/winmain.greg.c @@ -21,6 +21,7 @@ #include "libc/calls/sig.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/intrin/dll.h" +#include "libc/intrin/kprintf.h" #include "libc/intrin/maps.h" #include "libc/intrin/nomultics.h" #include "libc/intrin/weaken.h" diff --git a/libc/runtime/zipos-get.c b/libc/runtime/zipos-get.c index c9b39737f..e97918d14 100644 --- a/libc/runtime/zipos-get.c +++ b/libc/runtime/zipos-get.c @@ -21,6 +21,7 @@ #include "libc/calls/metalfile.internal.h" #include "libc/calls/struct/stat.h" #include "libc/cosmo.h" +#include "libc/dce.h" #include "libc/fmt/conv.h" #include "libc/intrin/cmpxchg.h" #include "libc/intrin/promises.h" @@ -62,15 +63,11 @@ static void __zipos_dismiss(uint8_t *map, const uint8_t *cdir, long pg) { } // unmap the executable portion beneath the local files - mo = ROUNDDOWN(lo, __gransize); - if (mo) - munmap(map, mo); - - // this is supposed to reduce our rss usage but does it really? - lo = ROUNDDOWN(lo, pg); - hi = MIN(ROUNDUP(hi, pg), ROUNDDOWN(c, pg)); - if (hi > lo) - posix_madvise(map + lo, hi - lo, POSIX_MADV_DONTNEED); + if (!IsWindows()) { + mo = ROUNDDOWN(lo, __gransize); + if (mo) + munmap(map, mo); + } } static int __zipos_compare_names(const void *a, const void *b, void *c) { diff --git a/libc/sock/sendfile.c b/libc/sock/sendfile.c index 249793784..e10611006 100644 --- a/libc/sock/sendfile.c +++ b/libc/sock/sendfile.c @@ -65,7 +65,7 @@ static dontinline textwindows ssize_t sys_sendfile_nt( bool locked = false; int64_t ih, oh, eof, offset; struct NtByHandleFileInformation wst; - if (!__isfdkind(infd, kFdFile) || !g_fds.p[infd].shared) + if (!__isfdkind(infd, kFdFile) || !g_fds.p[infd].cursor) return ebadf(); if (!__isfdkind(outfd, kFdSocket)) return ebadf(); @@ -75,8 +75,8 @@ static dontinline textwindows ssize_t sys_sendfile_nt( offset = *opt_in_out_inoffset; } else { locked = true; - __fd_lock(&g_fds.p[infd]); - offset = g_fds.p[infd].shared->pointer; + __cursor_lock(g_fds.p[infd].cursor); + offset = g_fds.p[infd].cursor->shared->pointer; } if (GetFileInformationByHandle(ih, &wst)) { // TransmitFile() returns EINVAL if `uptobytes` goes past EOF. @@ -86,7 +86,7 @@ static dontinline textwindows ssize_t sys_sendfile_nt( } } else { if (locked) - __fd_unlock(&g_fds.p[infd]); + __cursor_unlock(g_fds.p[infd].cursor); return ebadf(); } struct NtOverlapped ov = {.hEvent = WSACreateEvent(), .Pointer = offset}; @@ -99,7 +99,7 @@ static dontinline textwindows ssize_t sys_sendfile_nt( if (opt_in_out_inoffset) { *opt_in_out_inoffset = offset + rc; } else { - g_fds.p[infd].shared->pointer = offset + rc; + g_fds.p[infd].cursor->shared->pointer = offset + rc; } } else { rc = __winsockerr(); @@ -108,7 +108,7 @@ static dontinline textwindows ssize_t sys_sendfile_nt( rc = __winsockerr(); } if (locked) - __fd_unlock(&g_fds.p[infd]); + __cursor_unlock(g_fds.p[infd].cursor); WSACloseEvent(ov.hEvent); return rc; } diff --git a/test/libc/calls/lseek_test.c b/test/libc/calls/lseek_test.c index bff1cbdd4..72214fdb3 100644 --- a/test/libc/calls/lseek_test.c +++ b/test/libc/calls/lseek_test.c @@ -17,12 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/calls/internal.h" -#include "libc/dce.h" #include "libc/errno.h" -#include "libc/limits.h" -#include "libc/log/check.h" -#include "libc/runtime/runtime.h" #include "libc/sock/sock.h" #include "libc/sysv/consts/af.h" #include "libc/sysv/consts/ipproto.h" @@ -30,23 +25,22 @@ #include "libc/sysv/consts/sock.h" #include "libc/testlib/subprocess.h" #include "libc/testlib/testlib.h" -#include "libc/x/x.h" void SetUpOnce(void) { testlib_enable_tmp_setup_teardown(); ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr proc inet", 0)); } -/* TEST(lseek, ebadf) { */ -/* ASSERT_SYS(EBADF, -1, lseek(-1, 0, SEEK_SET)); */ -/* ASSERT_SYS(EBADF, -1, lseek(+3, 0, SEEK_SET)); */ -/* } */ +TEST(lseek, ebadf) { + ASSERT_SYS(EBADF, -1, lseek(-1, 0, SEEK_SET)); + ASSERT_SYS(EBADF, -1, lseek(+3, 0, SEEK_SET)); +} -/* TEST(lseek, badWhence_einval) { */ -/* ASSERT_SYS(0, 3, creat("foo", 0644)); */ -/* ASSERT_SYS(EINVAL, -1, lseek(3, 0, -1)); */ -/* EXPECT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, badWhence_einval) { + ASSERT_SYS(0, 3, creat("foo", 0644)); + ASSERT_SYS(EINVAL, -1, lseek(3, 0, -1)); + EXPECT_SYS(0, 0, close(3)); +} TEST(lseek, negativeComputedOffset_einval) { ASSERT_SYS(0, 3, creat("foo", 0644)); @@ -59,68 +53,66 @@ TEST(lseek, negativeComputedOffset_einval) { EXPECT_SYS(0, 0, close(3)); } -/* TEST(lseek, 64bit) { */ -/* ASSERT_SYS(0, 3, creat("foo", 0644)); */ -/* ASSERT_SYS(0, 0x100000001, lseek(3, 0x100000001, SEEK_SET)); */ -/* EXPECT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, 64bit) { + ASSERT_SYS(0, 3, creat("foo", 0644)); + ASSERT_SYS(0, 0x100000001, lseek(3, 0x100000001, SEEK_SET)); + EXPECT_SYS(0, 0, close(3)); +} -/* TEST(lseek, isPipe_ESPIPE) { */ -/* int fds[2]; */ -/* char buf[2]; */ -/* ASSERT_SYS(0, 0, pipe(fds)); */ -/* ASSERT_SYS(ESPIPE, -1, lseek(3, 0, SEEK_SET)); */ -/* ASSERT_SYS(ESPIPE, -1, pwrite(4, "hi", 2, 0)); */ -/* ASSERT_SYS(ESPIPE, -1, pread(3, buf, 2, 0)); */ -/* EXPECT_SYS(0, 0, close(4)); */ -/* EXPECT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, isPipe_ESPIPE) { + int fds[2]; + char buf[2]; + ASSERT_SYS(0, 0, pipe(fds)); + ASSERT_SYS(ESPIPE, -1, lseek(3, 0, SEEK_SET)); + ASSERT_SYS(ESPIPE, -1, pwrite(4, "hi", 2, 0)); + ASSERT_SYS(ESPIPE, -1, pread(3, buf, 2, 0)); + EXPECT_SYS(0, 0, close(4)); + EXPECT_SYS(0, 0, close(3)); +} -/* TEST(lseek, isSocket_ESPIPE) { */ -/* char buf[2]; */ -/* ASSERT_SYS(0, 3, socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); */ -/* ASSERT_SYS(ESPIPE, -1, lseek(3, 0, SEEK_SET)); */ -/* ASSERT_SYS(ESPIPE, -1, pwrite(3, "hi", 2, 0)); */ -/* ASSERT_SYS(ESPIPE, -1, pread(3, buf, 2, 0)); */ -/* EXPECT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, isSocket_ESPIPE) { + char buf[2]; + ASSERT_SYS(0, 3, socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); + ASSERT_SYS(ESPIPE, -1, lseek(3, 0, SEEK_SET)); + ASSERT_SYS(ESPIPE, -1, pwrite(3, "hi", 2, 0)); + ASSERT_SYS(ESPIPE, -1, pread(3, buf, 2, 0)); + EXPECT_SYS(0, 0, close(3)); +} -/* TEST(lseek, filePositionChanges_areObservableAcrossDup) { */ -/* if (IsWindows()) return; // do not want to support */ -/* ASSERT_SYS(0, 3, creat("wut", 0644)); */ -/* ASSERT_SYS(0, 4, dup(3)); */ -/* ASSERT_SYS(0, 0, lseek(3, 0, SEEK_CUR)); */ -/* ASSERT_SYS(0, 1, lseek(4, 1, SEEK_SET)); */ -/* ASSERT_SYS(0, 1, lseek(3, 0, SEEK_CUR)); */ -/* EXPECT_SYS(0, 0, close(4)); */ -/* EXPECT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, filePositionChanges_areObservableAcrossDup) { + ASSERT_SYS(0, 3, creat("wut", 0644)); + ASSERT_SYS(0, 4, dup(3)); + ASSERT_SYS(0, 0, lseek(3, 0, SEEK_CUR)); + ASSERT_SYS(0, 1, lseek(4, 1, SEEK_SET)); + ASSERT_SYS(0, 1, lseek(3, 0, SEEK_CUR)); + EXPECT_SYS(0, 0, close(4)); + EXPECT_SYS(0, 0, close(3)); +} -/* TEST(lseek, filePositionChanges_areObservableAcrossProcesses) { */ -/* if (IsWindows()) return; // do not want to support */ -/* char buf[8] = {0}; */ -/* ASSERT_SYS(0, 3, open("wut", O_RDWR | O_CREAT, 0644)); */ -/* ASSERT_SYS(0, 3, write(3, "wut", 3)); */ -/* ASSERT_SYS(0, 0, lseek(3, 0, SEEK_SET)); */ -/* SPAWN(fork); */ -/* ASSERT_SYS(0, 1, lseek(3, 1, SEEK_SET)); */ -/* EXITS(0); */ -/* EXPECT_SYS(0, 1, read(3, buf, 1)); */ -/* EXPECT_EQ('u', buf[0]); */ -/* EXPECT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, filePositionChanges_areObservableAcrossProcesses) { + char buf[8] = {0}; + ASSERT_SYS(0, 3, open("wut", O_RDWR | O_CREAT, 0644)); + ASSERT_SYS(0, 3, write(3, "wut", 3)); + ASSERT_SYS(0, 0, lseek(3, 0, SEEK_SET)); + SPAWN(fork); + ASSERT_SYS(0, 1, lseek(3, 1, SEEK_SET)); + EXITS(0); + EXPECT_SYS(0, 1, read(3, buf, 1)); + EXPECT_EQ('u', buf[0]); + EXPECT_SYS(0, 0, close(3)); +} -/* TEST(lseek, beyondEndOfFile_isZeroExtendedUponSubsequentWrite) { */ -/* char buf[8] = {1, 1}; */ -/* ASSERT_SYS(0, 3, open("foo", O_RDWR | O_CREAT | O_TRUNC, 0644)); */ -/* ASSERT_SYS(0, 2, lseek(3, 2, SEEK_SET)); */ -/* ASSERT_SYS(0, 2, lseek(3, 0, SEEK_CUR)); */ -/* ASSERT_SYS(0, 0, pread(3, buf, 8, 0)); // lseek() alone doesn't extend */ -/* ASSERT_SYS(0, 2, write(3, buf, 2)); // does extend once i/o happens */ -/* ASSERT_SYS(0, 4, pread(3, buf, 8, 0)); */ -/* ASSERT_EQ(0, buf[0]); */ -/* ASSERT_EQ(0, buf[1]); */ -/* ASSERT_EQ(1, buf[2]); */ -/* ASSERT_EQ(1, buf[3]); */ -/* ASSERT_SYS(0, 0, close(3)); */ -/* } */ +TEST(lseek, beyondEndOfFile_isZeroExtendedUponSubsequentWrite) { + char buf[8] = {1, 1}; + ASSERT_SYS(0, 3, open("foo", O_RDWR | O_CREAT | O_TRUNC, 0644)); + ASSERT_SYS(0, 2, lseek(3, 2, SEEK_SET)); + ASSERT_SYS(0, 2, lseek(3, 0, SEEK_CUR)); + ASSERT_SYS(0, 0, pread(3, buf, 8, 0)); // lseek() alone doesn't extend + ASSERT_SYS(0, 2, write(3, buf, 2)); // does extend once i/o happens + ASSERT_SYS(0, 4, pread(3, buf, 8, 0)); + ASSERT_EQ(0, buf[0]); + ASSERT_EQ(0, buf[1]); + ASSERT_EQ(1, buf[2]); + ASSERT_EQ(1, buf[3]); + ASSERT_SYS(0, 0, close(3)); +} diff --git a/test/posix/BUILD.mk b/test/posix/BUILD.mk index 0c1209cf5..420d6ea31 100644 --- a/test/posix/BUILD.mk +++ b/test/posix/BUILD.mk @@ -3,60 +3,74 @@ PKGS += TEST_POSIX -TEST_POSIX_SRCS := \ +TEST_POSIX_SRCS := \ $(wildcard test/posix/*.c) -TEST_POSIX_SRCS_TEST = \ +TEST_POSIX_SRCS_TEST = \ $(filter %_test.c,$(TEST_POSIX_SRCS)) -TEST_POSIX_OBJS = \ +TEST_POSIX_OBJS = \ $(TEST_POSIX_SRCS:%.c=o/$(MODE)/%.o) -TEST_POSIX_COMS = \ - $(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%) +TEST_POSIX_COMS = \ + $(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%) \ + o/$(MODE)/test/posix/file_offset_exec_prog -TEST_POSIX_BINS = \ - $(TEST_POSIX_COMS) \ +TEST_POSIX_BINS = \ + $(TEST_POSIX_COMS) \ $(TEST_POSIX_COMS:%=%.dbg) -TEST_POSIX_TESTS = \ +TEST_POSIX_TESTS = \ $(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.ok) -TEST_POSIX_CHECKS = \ +TEST_POSIX_CHECKS = \ $(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.runs) -TEST_POSIX_DIRECTDEPS = \ - LIBC_CALLS \ - LIBC_FMT \ - LIBC_INTRIN \ - LIBC_MEM \ - LIBC_PROC \ - LIBC_RUNTIME \ - LIBC_STDIO \ - LIBC_STR \ - LIBC_SYSV \ - LIBC_THREAD \ - THIRD_PARTY_MUSL \ +TEST_POSIX_DIRECTDEPS = \ + LIBC_CALLS \ + LIBC_FMT \ + LIBC_INTRIN \ + LIBC_MEM \ + LIBC_PROC \ + LIBC_RUNTIME \ + LIBC_STDIO \ + LIBC_STR \ + LIBC_SYSV \ + LIBC_THREAD \ + THIRD_PARTY_MUSL \ -TEST_POSIX_DEPS := \ +TEST_POSIX_DEPS := \ $(call uniq,$(foreach x,$(TEST_POSIX_DIRECTDEPS),$($(x)))) -o/$(MODE)/test/posix/posix.pkg: \ - $(TEST_POSIX_OBJS) \ +o/$(MODE)/test/posix/posix.pkg: \ + $(TEST_POSIX_OBJS) \ $(foreach x,$(TEST_POSIX_DIRECTDEPS),$($(x)_A).pkg) -o/$(MODE)/test/posix/%.dbg: \ - $(TEST_POSIX_DEPS) \ - o/$(MODE)/test/posix/%.o \ - o/$(MODE)/test/posix/posix.pkg \ - $(CRT) \ +o/$(MODE)/test/posix/%.dbg: \ + $(TEST_POSIX_DEPS) \ + o/$(MODE)/test/posix/%.o \ + o/$(MODE)/test/posix/posix.pkg \ + $(CRT) \ $(APE_NO_MODIFY_SELF) @$(APELINK) -o/$(MODE)/test/posix/fread3gb_test.runs: \ +o/$(MODE)/test/posix/file_offset_exec_test.dbg: \ + $(TEST_POSIX_DEPS) \ + o/$(MODE)/test/posix/file_offset_exec_test.o \ + o/$(MODE)/test/posix/file_offset_exec_prog.zip.o \ + o/$(MODE)/test/posix/posix.pkg \ + $(CRT) \ + $(APE_NO_MODIFY_SELF) + @$(APELINK) + +o/$(MODE)/test/posix/file_offset_exec_prog.zip.o: private \ + ZIPOBJ_FLAGS += \ + -B + +o/$(MODE)/test/posix/fread3gb_test.runs: \ private QUOTA += -F5gb -M5gb .PHONY: o/$(MODE)/test/posix -o/$(MODE)/test/posix: \ - $(TEST_POSIX_BINS) \ +o/$(MODE)/test/posix: \ + $(TEST_POSIX_BINS) \ $(TEST_POSIX_CHECKS) diff --git a/test/posix/file_offset_exec_prog.c b/test/posix/file_offset_exec_prog.c new file mode 100644 index 000000000..31f19560b --- /dev/null +++ b/test/posix/file_offset_exec_prog.c @@ -0,0 +1,63 @@ +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include +#include + +// subprogram for testing that lseek() is shared across execve() + +atomic_int *phase; + +int main(int argc, char *argv[]) { + + if (argc != 3) + return 101; + + int fd = atoi(argv[1]); + int mapfd = atoi(argv[2]); + + if ((phase = mmap(0, sizeof(atomic_int), PROT_READ | PROT_WRITE, MAP_SHARED, + mapfd, 0)) == MAP_FAILED) + return 102; + + if (write(fd, "1", 1) != 1) + return 103; + if (lseek(fd, 0, SEEK_CUR) != 2) + return 104; + + *phase = 1; + for (;;) + if (*phase == 2) + break; + + if (write(fd, "3", 1) != 1) + return 105; + if (lseek(fd, 0, SEEK_CUR) != 4) + return 106; + + *phase = 3; + for (;;) + if (*phase == 4) + break; + + if (munmap(phase, sizeof(atomic_int))) + return 107; + if (close(mapfd)) + return 108; + if (close(fd)) + return 109; +} diff --git a/test/posix/file_offset_exec_test.c b/test/posix/file_offset_exec_test.c new file mode 100644 index 000000000..aafc9061a --- /dev/null +++ b/test/posix/file_offset_exec_test.c @@ -0,0 +1,162 @@ +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include +#include +#include +#include + +// test that lseek() is shared across execve() + +__static_yoink("zipos"); + +void on_unexpected_death(int sig) { + int ws; + if (wait(&ws) == -1) + _Exit(33); + if (!WIFEXITED(ws)) + _Exit(34); + if (!(WEXITSTATUS(ws) & 255)) + _Exit(35); + _Exit(WEXITSTATUS(ws)); +} + +int main() { + signal(SIGCHLD, on_unexpected_death); + + // extract test program + int exefd; + int zipfd; + ssize_t got; + char exepath[] = "/tmp/file_offset_exec_prog.XXXXXX"; + if ((exefd = mkstemp(exepath)) == -1) + return 2; + if (fchmod(exefd, 0755)) + return 3; + if ((zipfd = open("/zip/file_offset_exec_prog", O_RDONLY)) == -1) + return 4; + for (;;) { + char chunk[512]; + if ((got = read(zipfd, chunk, sizeof(chunk))) == -1) + return 5; + if (!got) + break; + if (write(exefd, chunk, got) != got) + return 6; + } + if (close(zipfd)) + return 7; + if (close(exefd)) + return 8; + + // create file shared memory mapping for synchronization + int mapfd; + atomic_int *phase; + char mappath[] = "/tmp/file_offset_exec_phase.XXXXXX"; + if ((mapfd = mkstemp(mappath)) == -1) + return 9; + if (ftruncate(mapfd, sizeof(atomic_int))) + return 10; + if ((phase = mmap(0, sizeof(atomic_int), PROT_READ | PROT_WRITE, MAP_SHARED, + mapfd, 0)) == MAP_FAILED) + return 11; + + // create test file to which both processes shall be writing + int fd; + char path[] = "/tmp/file_offset_exec_file.XXXXXX"; + if ((fd = mkstemp(path)) == -1) + return 12; + if (lseek(fd, 0, SEEK_CUR) != 0) + return 13; + + // start writing to file + if (write(fd, "0", 1) != 1) + return 14; + if (lseek(fd, 0, SEEK_CUR) != 1) + return 15; + + // spawn program + int pid; + if ((pid = fork()) == -1) + return 16; + if (!pid) { + char str[2][12]; + char *envs[] = {0}; + char *args[] = {exepath, str[0], str[1], 0}; + sprintf(str[0], "%d", fd); + sprintf(str[1], "%d", mapfd); + execve(exepath, args, envs); + _Exit(17); + } + + for (;;) + if (*phase == 1) + break; + + if (write(fd, "2", 1) != 1) + return 18; + if (lseek(fd, 0, SEEK_CUR) != 3) + return 19; + + *phase = 2; + for (;;) + if (*phase == 3) + break; + + if (write(fd, "4", 1) != 1) + return 20; + if (lseek(fd, 0, SEEK_CUR) != 5) + return 21; + + signal(SIGCHLD, SIG_DFL); + *phase = 4; + + int ws; + if (wait(&ws) == -1) + return 22; + if (!WIFEXITED(ws)) + return 23; + if (WEXITSTATUS(ws)) + return WEXITSTATUS(ws); + + char buf[16] = {0}; + if (pread(fd, buf, 15, 0) != 5) + return 24; + if (lseek(fd, 0, SEEK_CUR) != 5) + return 25; + + if (close(fd)) + return 26; + + if (unlink(path)) + return 27; + + if (unlink(exepath)) + return 28; + + if (munmap(phase, sizeof(atomic_int))) + return 29; + + if (close(mapfd)) + return 30; + + if (unlink(mappath)) + return 31; + + if (strcmp(buf, "01234")) + return 32; +} diff --git a/test/posix/file_offset_shared_test.c b/test/posix/file_offset_fork_test.c similarity index 75% rename from test/posix/file_offset_shared_test.c rename to test/posix/file_offset_fork_test.c index 5124de186..72a02014b 100644 --- a/test/posix/file_offset_shared_test.c +++ b/test/posix/file_offset_fork_test.c @@ -13,42 +13,54 @@ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include #include #include #include #include -// test that file offset is shared across multiple processes +// test that lseek() is shared across fork() -atomic_int *phase; +void on_unexpected_death(int sig) { + int ws; + if (wait(&ws) == -1) + _Exit(33); + if (!WIFEXITED(ws)) + _Exit(34); + if (!(WEXITSTATUS(ws) & 255)) + _Exit(35); + _Exit(WEXITSTATUS(ws)); +} int main() { + signal(SIGCHLD, on_unexpected_death); + atomic_int *phase; if ((phase = mmap(0, sizeof(atomic_int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) - return 1; + return 2; int fd; - char path[] = "/tmp/fd_test.XXXXXX"; + char path[] = "/tmp/file_offset_fork_test.XXXXXX"; if ((fd = mkstemp(path)) == -1) - return 2; + return 3; if (lseek(fd, 0, SEEK_CUR) != 0) - return 22; + return 4; if (write(fd, "0", 1) != 1) - return 3; + return 5; if (lseek(fd, 0, SEEK_CUR) != 1) - return 33; + return 6; int pid; if ((pid = fork()) == -1) - return 4; + return 7; if (!pid) { if (write(fd, "1", 1) != 1) - _Exit(100); + _Exit(8); if (lseek(fd, 0, SEEK_CUR) != 2) - _Exit(101); + _Exit(9); *phase = 1; for (;;) @@ -56,10 +68,15 @@ int main() { break; if (write(fd, "3", 1) != 1) - _Exit(102); + _Exit(10); if (lseek(fd, 0, SEEK_CUR) != 4) - _Exit(103); + _Exit(11); + *phase = 3; + for (;;) + if (*phase == 4) + break; + _Exit(0); } @@ -68,9 +85,9 @@ int main() { break; if (write(fd, "2", 1) != 1) - return 5; + return 12; if (lseek(fd, 0, SEEK_CUR) != 3) - return 55; + return 13; *phase = 2; for (;;) @@ -78,30 +95,36 @@ int main() { break; if (write(fd, "4", 1) != 1) - return 6; + return 14; if (lseek(fd, 0, SEEK_CUR) != 5) - return 66; + return 15; + + signal(SIGCHLD, SIG_DFL); + *phase = 4; int ws; if (wait(&ws) == -1) - return 7; + return 16; if (!WIFEXITED(ws)) - return 8; + return 17; if (WEXITSTATUS(ws)) return WEXITSTATUS(ws); char buf[16] = {0}; if (pread(fd, buf, 15, 0) != 5) - return 12; + return 18; if (lseek(fd, 0, SEEK_CUR) != 5) - return 77; + return 19; if (close(fd)) - return 13; + return 20; + + if (munmap(phase, sizeof(atomic_int))) + return 21; if (unlink(path)) - return 14; + return 22; if (strcmp(buf, "01234")) - return 15; + return 23; } From 749936706038ea856524535bf28093b990146aad Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 3 Aug 2024 21:36:36 -0700 Subject: [PATCH 05/39] Ignore -Wimplicit-function-declaration in cosmocc --- libc/integral/c.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libc/integral/c.inc b/libc/integral/c.inc index 0f29ff5f0..ca078d5f5 100644 --- a/libc/integral/c.inc +++ b/libc/integral/c.inc @@ -531,6 +531,10 @@ typedef struct { #pragma GCC diagnostic ignored "-Wold-style-definition" /* orwellian bullsh */ #endif +#if defined __GNUC__ && __GNUC__ >= 14 +#pragma GCC diagnostic warning "-Wimplicit-function-declaration" +#endif + #ifdef __x86_64__ #define DebugBreak() __asm__("int3") #elif defined(__aarch64__) From c265c17d54f8bca723ea49182f1aff896f320fcd Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 4 Aug 2024 07:08:28 -0700 Subject: [PATCH 06/39] Fix the build --- libc/integral/c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/integral/c.inc b/libc/integral/c.inc index ca078d5f5..9a253e41e 100644 --- a/libc/integral/c.inc +++ b/libc/integral/c.inc @@ -531,8 +531,8 @@ typedef struct { #pragma GCC diagnostic ignored "-Wold-style-definition" /* orwellian bullsh */ #endif -#if defined __GNUC__ && __GNUC__ >= 14 -#pragma GCC diagnostic warning "-Wimplicit-function-declaration" +#if !defined(__cplusplus) && defined(__GNUC__) && __GNUC__ >= 14 +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" #endif #ifdef __x86_64__ From 31194165d2afca36c2315a6e7ca2f0797dde09e3 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 4 Aug 2024 12:52:25 -0700 Subject: [PATCH 07/39] Remove .internal from more header filenames --- ape/ape.S | 2 +- ape/launch.S | 2 +- ape/loader-macho.S | 4 ++-- ape/macros.internal.h | 2 +- ape/start.S | 2 +- ape/systemcall.S | 2 +- dsp/core/c161.h | 2 +- dsp/core/c161s.h | 2 +- dsp/core/double2byte.c | 2 +- dsp/core/float2short.c | 2 +- dsp/core/getintegercoefficients.c | 2 +- dsp/core/getintegercoefficients8.c | 2 +- dsp/core/half.h | 2 +- dsp/core/ks8.h | 2 +- dsp/core/kss8.h | 2 +- dsp/core/q.h | 2 +- dsp/core/sad16x8n.c | 2 +- dsp/mpeg/clamp4int256-core.S | 2 +- dsp/mpeg/mpeg1.c | 2 +- dsp/mpeg/slowrgb.c | 2 +- dsp/scale/gyarados.c | 2 +- dsp/scale/magikarp.c | 2 +- dsp/tty/mpsadbw.S | 2 +- dsp/tty/rgb2ansi.c | 2 +- dsp/tty/rgb2ttyi2f.c | 2 +- dsp/tty/rgb2xterm24.c | 2 +- dsp/tty/rgb2xterm24f.c | 2 +- dsp/tty/ttyraster.c | 2 +- dsp/tty/ttyraw.c | 2 +- dsp/tty/windex-avx2.S | 2 +- dsp/tty/windex-sse4.S | 2 +- examples/date.c | 2 +- examples/nc.c | 2 +- examples/nesemu1.cc | 4 ++-- examples/package/lib/myasm.S | 2 +- examples/script.c | 2 +- libc/calls/CPU_AND.c | 2 +- libc/calls/CPU_COUNT.c | 2 +- libc/calls/CPU_OR.c | 2 +- libc/calls/CPU_XOR.c | 2 +- libc/calls/chdir-nt.c | 2 +- libc/calls/clock_gettime-xnu.c | 2 +- libc/calls/copy.c | 2 +- libc/calls/fcntl-nt.c | 2 +- libc/calls/fstat-nt.c | 2 +- libc/calls/fstatfs-nt.c | 2 +- libc/calls/getcontext.S | 2 +- libc/calls/getdomainname.c | 2 +- libc/calls/getdtablesize.c | 2 +- libc/calls/gethostname-nt.c | 2 +- libc/calls/getloadavg-nt.c | 2 +- libc/calls/getntsyspath.S | 2 +- libc/calls/getprogramexecutablename.greg.c | 2 +- libc/calls/getrandom.c | 2 +- libc/calls/getuid-nt.c | 2 +- libc/calls/getuid.c | 2 +- libc/calls/internal.h | 2 +- libc/calls/ioctl.c | 2 +- libc/calls/kntsystemdirectory.S | 2 +- libc/calls/kntwindowsdirectory.S | 2 +- libc/calls/metalfile.c | 2 +- libc/calls/metalfile_init.S | 2 +- libc/calls/mkntpath.c | 2 +- libc/calls/mkntpathat.c | 2 +- libc/calls/netbsdtramp.S | 2 +- libc/calls/ntspawn.c | 2 +- libc/calls/open-nt.c | 2 +- libc/calls/openat-metal.c | 2 +- libc/calls/parsepromises.c | 2 +- libc/calls/pledge-linux.c | 2 +- libc/calls/poll-nt.c | 2 +- libc/calls/pread.c | 2 +- libc/calls/program_executable_name_init.S | 2 +- libc/calls/pwrite.c | 2 +- libc/calls/read-nt.c | 2 +- libc/calls/readv-metal.c | 2 +- libc/calls/releasefd.c | 2 +- libc/calls/restore.S | 2 +- libc/calls/rusage_add.c | 2 +- libc/calls/select-nt.c | 2 +- libc/calls/setrlimit.c | 2 +- libc/calls/sigaction.c | 2 +- libc/calls/sigaltstack.c | 2 +- libc/calls/sigcrashsig.c | 2 +- libc/calls/sigenter-freebsd.c | 2 +- libc/calls/sigenter-netbsd.c | 2 +- libc/calls/sigenter-openbsd.c | 2 +- libc/calls/swapcontext.S | 2 +- libc/calls/sysinfo.c | 2 +- libc/calls/tailcontext.S | 2 +- libc/calls/tmpdir.c | 2 +- libc/calls/uname.c | 2 +- libc/calls/unveil.c | 2 +- libc/calls/winexec.c | 2 +- libc/crt/crt.S | 2 +- libc/dlopen/foreign_tramp.S | 2 +- libc/{dos.internal.h => dos.h} | 0 libc/fmt/bing.c | 2 +- libc/fmt/itoa64radix16.greg.c | 2 +- libc/fmt/unbing.c | 2 +- libc/fmt/unzleb64.c | 2 +- libc/fmt/wcstol.c | 2 +- libc/fmt/wcstoul.c | 2 +- libc/{imag.internal.h => imag.h} | 0 libc/intrin/aarch64/asmdefs.h | 2 +- libc/intrin/cxaatexit.c | 2 +- libc/intrin/describecapability.c | 2 +- libc/intrin/describecontrolkeystate.c | 2 +- libc/intrin/describednotify.c | 2 +- libc/intrin/describegidlist.c | 2 +- libc/intrin/describeiovec.c | 2 +- libc/intrin/describeiovnt.c | 2 +- libc/intrin/describemapflags.c | 2 +- libc/intrin/describemremapflags.c | 2 +- libc/intrin/describemsyncflags.c | 2 +- libc/intrin/describentconsolemodeinputflags.c | 2 +- libc/intrin/describentconsolemodeoutputflags.c | 2 +- libc/intrin/describentfileaccessflags.c | 2 +- libc/intrin/describentfileflagattr.c | 2 +- libc/intrin/describentfilemapflags.c | 2 +- libc/intrin/describentfileshareflags.c | 2 +- libc/intrin/describentfiletypeflags.c | 2 +- libc/intrin/describentlockfileflags.c | 2 +- libc/intrin/describentmovfileinpflags.c | 2 +- libc/intrin/describentoverlapped.c | 2 +- libc/intrin/describentpageflags.c | 2 +- libc/intrin/describentpipemodeflags.c | 2 +- libc/intrin/describentpipeopenflags.c | 2 +- libc/intrin/describentprocaccessflags.c | 2 +- libc/intrin/describentstartflags.c | 2 +- libc/intrin/describentsymlinkflags.c | 2 +- libc/intrin/describeopenflags.c | 2 +- libc/intrin/describepersonalityflags.c | 2 +- libc/intrin/describepollfds.c | 2 +- libc/intrin/describepollflags.c | 2 +- libc/intrin/describeprotflags.c | 2 +- libc/intrin/describeschedpolicy.c | 2 +- libc/intrin/describesigaction.c | 2 +- libc/intrin/describesigaltstackflags.c | 2 +- libc/intrin/describetermios.c | 2 +- libc/intrin/describethreadcreationflags.c | 2 +- libc/intrin/describevirtualkeycode.c | 2 +- libc/intrin/describewinsize.c | 2 +- libc/intrin/directmap-metal.c | 2 +- libc/intrin/dsohandle.S | 2 +- libc/intrin/fds_init.S | 2 +- libc/intrin/fenv.S | 2 +- libc/intrin/formathex64.c | 2 +- libc/intrin/futex.S | 2 +- libc/intrin/gcov.S | 2 +- libc/intrin/getcpuidbrand.S | 2 +- libc/intrin/getmainstack.c | 2 +- libc/intrin/getminsigstksz.c | 2 +- libc/intrin/interrupts.S | 2 +- libc/intrin/kclocknames.S | 2 +- libc/intrin/kdos2errno.S | 2 +- libc/intrin/kerrnodocs.S | 2 +- libc/intrin/kerrnonames.S | 2 +- libc/intrin/kfcntlcmds.S | 2 +- libc/intrin/kipoptnames.S | 2 +- libc/intrin/kmonthname.S | 2 +- libc/intrin/kmonthnameshort.S | 2 +- libc/intrin/kopenflags.S | 2 +- libc/intrin/kpollnames.S | 2 +- libc/intrin/kprintf.greg.c | 2 +- libc/intrin/krlimitnames.S | 2 +- libc/intrin/ksignalnames.S | 2 +- libc/intrin/ksockoptnames.S | 2 +- libc/intrin/ktcpoptnames.S | 2 +- libc/intrin/kweekdayname.S | 2 +- libc/intrin/kweekdaynameshort.S | 2 +- libc/intrin/leaky.S | 2 +- libc/intrin/maps_init.S | 2 +- libc/intrin/mman.greg.c | 2 +- libc/intrin/msync.c | 2 +- libc/intrin/packsswb.c | 2 +- libc/intrin/packuswb.c | 2 +- libc/intrin/pagesize_init.S | 2 +- libc/intrin/palignr.c | 2 +- libc/intrin/palignrs.S | 2 +- libc/intrin/pmaddubsw.c | 2 +- libc/intrin/printmaps.c | 2 +- libc/intrin/pthread_atfork_actual.c | 2 +- libc/intrin/pushpop.h | 2 +- libc/intrin/reservefd.c | 2 +- libc/intrin/safemacros.h | 2 +- libc/intrin/sizefmt.c | 2 +- libc/intrin/stackcall.S | 2 +- libc/intrin/stackchkguard.S | 2 +- libc/intrin/strerror.c | 2 +- libc/intrin/sys_sched_yield.S | 2 +- libc/intrin/sys_set_tls.S | 2 +- libc/intrin/typeinfo.S | 2 +- libc/irq/acpi-fadt-init.S | 2 +- libc/irq/acpi-madt-init.S | 2 +- libc/irq/acpi-xsdt-init.S | 2 +- libc/irq/acpi-xsdt.c | 2 +- libc/{iso646.internal.h => iso646.h} | 0 libc/isystem/complex.h | 2 +- libc/isystem/iso646.h | 2 +- libc/isystem/stdalign.h | 2 +- libc/isystem/tgmath.h | 2 +- libc/log/backtrace3.c | 2 +- libc/log/check.h | 2 +- libc/log/countbranch.h | 2 +- libc/log/countbranch_data.S | 2 +- libc/log/countbranch_report.c | 2 +- libc/log/countexpr.h | 2 +- libc/log/countexpr_data.S | 2 +- libc/log/countexpr_report.c | 2 +- libc/log/libfatal.internal.h | 2 +- libc/log/oncrash_amd64.c | 2 +- libc/log/oncrash_arm64.c | 2 +- libc/log/printwindowsmemory.c | 2 +- libc/log/showcrashreportsearly.S | 2 +- libc/log/watch-hook.S | 2 +- libc/{mach.internal.h => mach.h} | 0 libc/{macho.internal.h => macho.h} | 0 libc/{macros.internal.h => macros.h} | 0 libc/mem/aligned_alloc.c | 2 +- libc/mem/mergesort.c | 2 +- libc/mem/posix_memalign.c | 2 +- libc/mem/putenv.c | 2 +- libc/mem/qsort.c | 2 +- libc/mem/tinymalloc.inc | 2 +- libc/nexgen32e/argc.S | 2 +- libc/nexgen32e/argv.S | 2 +- libc/nexgen32e/auxv.S | 2 +- libc/nexgen32e/checkstackalign.S | 2 +- libc/nexgen32e/djbsort-avx2.S | 2 +- libc/nexgen32e/environ.S | 2 +- libc/nexgen32e/gc.S | 2 +- libc/nexgen32e/gclongjmp.S | 2 +- libc/nexgen32e/identity.S | 2 +- libc/nexgen32e/kbase36.c | 4 ++-- libc/nexgen32e/kcp437.S | 4 ++-- libc/nexgen32e/kcpuids.S | 2 +- libc/nexgen32e/khalfcache3.S | 2 +- libc/nexgen32e/ksha256.S | 2 +- libc/nexgen32e/ksha512.S | 2 +- libc/nexgen32e/ktensindex.S | 2 +- libc/nexgen32e/ktolower.c | 4 ++-- libc/nexgen32e/ktoupper.c | 4 ++-- libc/nexgen32e/longjmp.S | 2 +- libc/nexgen32e/mcount.S | 2 +- libc/nexgen32e/mul4x4adx.S | 2 +- libc/nexgen32e/mul6x6adx.S | 2 +- libc/nexgen32e/mul8x8adx.S | 2 +- libc/nexgen32e/nt2sysv.S | 2 +- libc/nexgen32e/program_invocation_name.S | 2 +- libc/nexgen32e/rldecode.S | 2 +- libc/nexgen32e/setjmp.S | 2 +- libc/nexgen32e/sha1.S | 2 +- libc/nexgen32e/sha1ni.S | 2 +- libc/nexgen32e/sha256.S | 2 +- libc/nexgen32e/sha256ni.S | 2 +- libc/nexgen32e/sha512.S | 2 +- libc/nexgen32e/xmm.S | 2 +- libc/nexgen32e/zip.S | 4 ++-- libc/nt/ntdllimport.S | 2 +- libc/nt/ntdllimport.h | 2 +- libc/proc/cocmd.c | 2 +- libc/proc/fork-nt.c | 2 +- libc/proc/nice.c | 2 +- libc/proc/posix_spawnattr_getrlimit.c | 2 +- libc/proc/posix_spawnattr_setrlimit.c | 2 +- libc/proc/vfork.S | 2 +- libc/runtime/at_quick_exit.c | 2 +- libc/runtime/clone-linux.S | 2 +- libc/runtime/clone-openbsd.S | 2 +- libc/runtime/clone-xnu.S | 2 +- libc/runtime/clone.c | 4 ++-- libc/runtime/cosmo.S | 2 +- libc/runtime/cosmo2.c | 2 +- libc/runtime/efimain.greg.c | 2 +- libc/runtime/efipostboot.S | 2 +- libc/runtime/enable_tls.c | 4 ++-- libc/runtime/findcombinary.c | 2 +- libc/runtime/fpreset.S | 2 +- libc/runtime/ftrace-hook.S | 2 +- libc/runtime/ftracer.c | 2 +- libc/runtime/getargmax.c | 2 +- libc/runtime/getinterpreterexecutablename.c | 2 +- libc/runtime/getlogin.c | 2 +- libc/runtime/getlogin_r.c | 2 +- libc/runtime/getresourcelimit.c | 2 +- libc/runtime/getsymboltable.c | 4 ++-- libc/runtime/grow.c | 2 +- libc/runtime/hook.greg.c | 2 +- libc/runtime/inflate.c | 2 +- libc/runtime/init.S | 8 ++++---- libc/runtime/isstackoverflow.c | 2 +- libc/runtime/opensymboltable.greg.c | 2 +- libc/runtime/progname.S | 2 +- libc/runtime/sigsetjmp.S | 2 +- libc/runtime/sysconf.c | 2 +- libc/runtime/valist.c | 2 +- libc/runtime/winmain.greg.c | 2 +- libc/runtime/zipos-access.c | 2 +- libc/runtime/zipos-find.c | 4 ++-- libc/runtime/zipos-get.c | 4 ++-- libc/runtime/zipos-inode.c | 2 +- libc/runtime/zipos-mmap.c | 2 +- libc/runtime/zipos-open.c | 2 +- libc/runtime/zipos-read.c | 2 +- libc/runtime/zipos-stat-impl.c | 2 +- libc/runtime/zipos.S | 2 +- libc/sock/epoll.c | 2 +- libc/sock/gethostips.c | 2 +- libc/sock/inet_pton.c | 2 +- libc/sock/iovec2nt.c | 2 +- libc/sock/send.c | 2 +- libc/sock/sendto.c | 2 +- libc/sock/sockaddr.c | 2 +- libc/sock/sockaddr2linux.c | 2 +- libc/sock/sockdebug.c | 2 +- libc/sock/sys_sendfile_freebsd.S | 2 +- libc/sock/sys_sendfile_xnu.S | 2 +- libc/{stdalign.internal.h => stdalign.h} | 6 +++--- libc/stdio/appendd.c | 2 +- libc/stdio/appendr.c | 2 +- libc/stdio/appendw.c | 2 +- libc/stdio/dirstream.c | 4 ++-- libc/stdio/dumphexc.c | 2 +- libc/stdio/fgets_unlocked.c | 2 +- libc/stdio/fmt.c | 4 ++-- libc/stdio/fread_unlocked.c | 2 +- libc/stdio/fseek_unlocked.c | 2 +- libc/stdio/fwrite_unlocked.c | 2 +- libc/stdio/kvappendf.c | 2 +- libc/stdio/mt19937.c | 2 +- libc/stdio/printargs.c | 2 +- libc/stdio/vappendf.c | 2 +- libc/stdio/vcscanf.c | 2 +- libc/stdio/vdprintf.c | 2 +- libc/stdio/vsnprintf.c | 2 +- libc/str/blake2.c | 2 +- libc/str/compareslices.c | 2 +- libc/str/compareslicescase.c | 2 +- libc/str/dosdatetimetounix.c | 2 +- libc/str/getzipcdircomment.c | 2 +- libc/str/getzipcdircommentsize.c | 2 +- libc/str/getzipcdiroffset.c | 2 +- libc/str/getzipcdirrecords.c | 2 +- libc/str/getzipcdirsize.c | 2 +- libc/str/getzipcfilecompressedsize.c | 2 +- libc/str/getzipcfilemode.c | 2 +- libc/str/getzipcfileoffset.c | 2 +- libc/str/getzipcfiletimestamps.c | 2 +- libc/str/getzipcfileuncompressedsize.c | 2 +- libc/str/getzipeocd.c | 2 +- libc/str/getziplfilecompressedsize.c | 2 +- libc/str/getziplfileuncompressedsize.c | 2 +- libc/str/iswctype.c | 2 +- libc/str/iszipeocd32.c | 2 +- libc/str/iszipeocd64.c | 2 +- libc/str/khextoint.c | 4 ++-- libc/str/kx86processormodels.c | 2 +- libc/str/memcasecmp.c | 2 +- libc/str/startswithi.c | 2 +- libc/str/stpncpy.c | 2 +- libc/str/strcasecmp.c | 2 +- libc/str/strcasestr.c | 2 +- libc/str/strncasecmp.c | 2 +- libc/str/strncpy.c | 2 +- libc/str/strnwidth.c | 2 +- libc/str/strtol.c | 2 +- libc/str/strtoul.c | 2 +- libc/str/{tab.internal.h => tab.h} | 6 +++--- libc/str/towlower.c | 2 +- libc/str/towupper.c | 2 +- libc/str/wctype.c | 2 +- libc/str/wcwidth_osx.c | 2 +- libc/sysv/consts/syscon.internal.h | 2 +- libc/sysv/errfun.S | 2 +- libc/sysv/errfuns/e2big.S | 2 +- libc/sysv/errfuns/eacces.S | 2 +- libc/sysv/errfuns/eaddrinuse.S | 2 +- libc/sysv/errfuns/eaddrnotavail.S | 2 +- libc/sysv/errfuns/eadv.S | 2 +- libc/sysv/errfuns/eafnosupport.S | 2 +- libc/sysv/errfuns/eagain.S | 2 +- libc/sysv/errfuns/ealready.S | 2 +- libc/sysv/errfuns/ebade.S | 2 +- libc/sysv/errfuns/ebadf.S | 2 +- libc/sysv/errfuns/ebadfd.S | 2 +- libc/sysv/errfuns/ebadmsg.S | 2 +- libc/sysv/errfuns/ebadr.S | 2 +- libc/sysv/errfuns/ebadrqc.S | 2 +- libc/sysv/errfuns/ebadslt.S | 2 +- libc/sysv/errfuns/ebusy.S | 2 +- libc/sysv/errfuns/ecanceled.S | 2 +- libc/sysv/errfuns/echild.S | 2 +- libc/sysv/errfuns/echrng.S | 2 +- libc/sysv/errfuns/ecomm.S | 2 +- libc/sysv/errfuns/econnaborted.S | 2 +- libc/sysv/errfuns/econnrefused.S | 2 +- libc/sysv/errfuns/econnreset.S | 2 +- libc/sysv/errfuns/edeadlk.S | 2 +- libc/sysv/errfuns/edestaddrreq.S | 2 +- libc/sysv/errfuns/edom.S | 2 +- libc/sysv/errfuns/edotdot.S | 2 +- libc/sysv/errfuns/edquot.S | 2 +- libc/sysv/errfuns/eexist.S | 2 +- libc/sysv/errfuns/efault.S | 2 +- libc/sysv/errfuns/efbig.S | 2 +- libc/sysv/errfuns/ehostdown.S | 2 +- libc/sysv/errfuns/ehostunreach.S | 2 +- libc/sysv/errfuns/ehwpoison.S | 2 +- libc/sysv/errfuns/eidrm.S | 2 +- libc/sysv/errfuns/eilseq.S | 2 +- libc/sysv/errfuns/einprogress.S | 2 +- libc/sysv/errfuns/eintr.S | 2 +- libc/sysv/errfuns/einval.S | 2 +- libc/sysv/errfuns/eio.S | 2 +- libc/sysv/errfuns/eisconn.S | 2 +- libc/sysv/errfuns/eisdir.S | 2 +- libc/sysv/errfuns/eisnam.S | 2 +- libc/sysv/errfuns/ekeyexpired.S | 2 +- libc/sysv/errfuns/ekeyrejected.S | 2 +- libc/sysv/errfuns/ekeyrevoked.S | 2 +- libc/sysv/errfuns/el2hlt.S | 2 +- libc/sysv/errfuns/el2nsync.S | 2 +- libc/sysv/errfuns/el3hlt.S | 2 +- libc/sysv/errfuns/el3rst.S | 2 +- libc/sysv/errfuns/elibacc.S | 2 +- libc/sysv/errfuns/elibbad.S | 2 +- libc/sysv/errfuns/elibexec.S | 2 +- libc/sysv/errfuns/elibmax.S | 2 +- libc/sysv/errfuns/elibscn.S | 2 +- libc/sysv/errfuns/elnrng.S | 2 +- libc/sysv/errfuns/eloop.S | 2 +- libc/sysv/errfuns/emediumtype.S | 2 +- libc/sysv/errfuns/emfile.S | 2 +- libc/sysv/errfuns/emlink.S | 2 +- libc/sysv/errfuns/emsgsize.S | 2 +- libc/sysv/errfuns/emultihop.S | 2 +- libc/sysv/errfuns/enametoolong.S | 2 +- libc/sysv/errfuns/enavail.S | 2 +- libc/sysv/errfuns/enetdown.S | 2 +- libc/sysv/errfuns/enetreset.S | 2 +- libc/sysv/errfuns/enetunreach.S | 2 +- libc/sysv/errfuns/enfile.S | 2 +- libc/sysv/errfuns/enoano.S | 2 +- libc/sysv/errfuns/enobufs.S | 2 +- libc/sysv/errfuns/enocsi.S | 2 +- libc/sysv/errfuns/enodata.S | 2 +- libc/sysv/errfuns/enodev.S | 2 +- libc/sysv/errfuns/enoent.S | 2 +- libc/sysv/errfuns/enoexec.S | 2 +- libc/sysv/errfuns/enokey.S | 2 +- libc/sysv/errfuns/enolck.S | 2 +- libc/sysv/errfuns/enolink.S | 2 +- libc/sysv/errfuns/enomedium.S | 2 +- libc/sysv/errfuns/enomem.S | 2 +- libc/sysv/errfuns/enomsg.S | 2 +- libc/sysv/errfuns/enonet.S | 2 +- libc/sysv/errfuns/enopkg.S | 2 +- libc/sysv/errfuns/enoprotoopt.S | 2 +- libc/sysv/errfuns/enospc.S | 2 +- libc/sysv/errfuns/enosr.S | 2 +- libc/sysv/errfuns/enostr.S | 2 +- libc/sysv/errfuns/enosys.S | 2 +- libc/sysv/errfuns/enotblk.S | 2 +- libc/sysv/errfuns/enotconn.S | 2 +- libc/sysv/errfuns/enotdir.S | 2 +- libc/sysv/errfuns/enotempty.S | 2 +- libc/sysv/errfuns/enotnam.S | 2 +- libc/sysv/errfuns/enotrecoverable.S | 2 +- libc/sysv/errfuns/enotsock.S | 2 +- libc/sysv/errfuns/enotsup.S | 2 +- libc/sysv/errfuns/enotty.S | 2 +- libc/sysv/errfuns/enotuniq.S | 2 +- libc/sysv/errfuns/enxio.S | 2 +- libc/sysv/errfuns/eopnotsupp.S | 2 +- libc/sysv/errfuns/eoverflow.S | 2 +- libc/sysv/errfuns/eownerdead.S | 2 +- libc/sysv/errfuns/eperm.S | 2 +- libc/sysv/errfuns/epfnosupport.S | 2 +- libc/sysv/errfuns/epipe.S | 2 +- libc/sysv/errfuns/eproto.S | 2 +- libc/sysv/errfuns/eprotonosupport.S | 2 +- libc/sysv/errfuns/eprototype.S | 2 +- libc/sysv/errfuns/erange.S | 2 +- libc/sysv/errfuns/eremchg.S | 2 +- libc/sysv/errfuns/eremote.S | 2 +- libc/sysv/errfuns/eremoteio.S | 2 +- libc/sysv/errfuns/erestart.S | 2 +- libc/sysv/errfuns/erfkill.S | 2 +- libc/sysv/errfuns/erofs.S | 2 +- libc/sysv/errfuns/eshutdown.S | 2 +- libc/sysv/errfuns/esocktnosupport.S | 2 +- libc/sysv/errfuns/espipe.S | 2 +- libc/sysv/errfuns/esrch.S | 2 +- libc/sysv/errfuns/esrmnt.S | 2 +- libc/sysv/errfuns/estale.S | 2 +- libc/sysv/errfuns/estrpipe.S | 2 +- libc/sysv/errfuns/etime.S | 2 +- libc/sysv/errfuns/etimedout.S | 2 +- libc/sysv/errfuns/etoomanyrefs.S | 2 +- libc/sysv/errfuns/etxtbsy.S | 2 +- libc/sysv/errfuns/euclean.S | 2 +- libc/sysv/errfuns/eunatch.S | 2 +- libc/sysv/errfuns/eusers.S | 2 +- libc/sysv/errfuns/exdev.S | 2 +- libc/sysv/errfuns/exfull.S | 2 +- libc/sysv/gen.sh | 2 +- libc/sysv/hostos.S | 2 +- libc/sysv/macros.internal.h | 2 +- libc/sysv/restorert.S | 2 +- libc/sysv/syscall2.S | 2 +- libc/sysv/syscall3.S | 2 +- libc/sysv/syscall4.S | 2 +- libc/sysv/syscon.S | 2 +- libc/sysv/syscount.S | 2 +- libc/sysv/syslib.S | 2 +- libc/sysv/systemfive.S | 2 +- libc/testlib/bench.S | 2 +- libc/testlib/binequals.c | 2 +- libc/testlib/blake2b256_tests.S | 2 +- libc/testlib/blocktronics.S | 2 +- libc/testlib/ezbench.h | 2 +- libc/testlib/fixture.S | 2 +- libc/testlib/hexequals.c | 2 +- libc/testlib/hyperion.S | 2 +- libc/testlib/moby.S | 2 +- libc/testlib/polluteregisters.S | 2 +- libc/testlib/subprocess.h | 2 +- libc/testlib/testcase.S | 2 +- libc/testlib/testmain.c | 2 +- libc/testlib/testrunner.c | 2 +- libc/testlib/viewables.S | 2 +- libc/thread/makecontext.c | 2 +- libc/thread/mktls.c | 2 +- libc/thread/pthread_create.c | 2 +- libc/thread/pthread_detach.c | 2 +- libc/thread/pthread_getattr_np.c | 2 +- libc/thread/pthread_getname_np.c | 2 +- libc/vga/rlinit-init-vga.S | 2 +- libc/vga/rlinit-vesa.S | 2 +- libc/vga/tty-graph.c | 2 +- libc/vga/tty-graph.inc | 2 +- libc/vga/tty-klog.greg.c | 2 +- libc/x/syslog.c | 2 +- libc/{zip.internal.h => zip.h} | 0 net/finger/fingersyn.c | 2 +- net/http/base32.c | 2 +- net/http/decodebase64.c | 2 +- net/http/encodeurl.c | 2 +- net/http/findcontenttype.c | 4 ++-- net/http/formathttpdatetime.c | 2 +- net/http/gethttpheader.inc | 2 +- net/http/gethttpreason.c | 2 +- net/http/ismimetype.c | 2 +- net/http/isnocompressext.c | 4 ++-- net/http/parsehttpmessage.c | 3 ++- net/http/parsehttpmethod.c | 2 +- net/http/parsehttprange.c | 2 +- net/http/parseurl.c | 2 +- net/http/unchunk.c | 4 ++-- net/https/describesslverifyfailure.c | 2 +- net/turfwar/turfwar.c | 4 ++-- test/dsp/core/alaw_test.c | 2 +- test/dsp/core/getintegercoefficients_test.c | 2 +- test/dsp/core/mulaw_test.c | 2 +- test/dsp/core/scalevolume_test.c | 2 +- test/dsp/scale/scale_test.c | 2 +- test/libc/calls/cachestat_test.c | 2 +- test/libc/calls/fchmodat_test.c | 2 +- test/libc/calls/fcntl_test.c | 2 +- test/libc/calls/getcwd_test.c | 2 +- test/libc/calls/getgroups_test.c | 2 +- test/libc/calls/getrandom_test.c | 4 ++-- test/libc/calls/lock_ofd_test.c | 2 +- test/libc/calls/lock_test.c | 2 +- test/libc/calls/open_test.c | 2 +- test/libc/calls/pledge_test.c | 2 +- test/libc/calls/reservefd_test.c | 2 +- test/libc/calls/writev_test.c | 2 +- test/libc/fmt/formatint64thousands_test.c | 2 +- test/libc/intrin/demangle_test.c | 2 +- test/libc/intrin/describeflags_test.c | 2 +- test/libc/intrin/kprintf_test.c | 2 +- test/libc/intrin/lockipc_test.c | 2 +- test/libc/intrin/magicu_test.c | 2 +- test/libc/intrin/memmove_test.c | 2 +- test/libc/intrin/pthread_mutex_lock_test.c | 2 +- test/libc/intrin/rand64_test.c | 2 +- test/libc/intrin/strcmp_test.c | 2 +- test/libc/intrin/strlen_test.c | 2 +- test/libc/intrin/tree_test.c | 2 +- test/libc/log/backtrace.c | 2 +- test/libc/mem/djbsort_test.c | 2 +- test/libc/mem/malloc_test.c | 2 +- test/libc/mem/qsort_test.c | 2 +- test/libc/nexgen32e/kbase36_test.c | 2 +- test/libc/nexgen32e/kcp437_test.c | 2 +- test/libc/nexgen32e/memmove_test.c | 2 +- test/libc/proc/fork_test.c | 2 +- test/libc/stdio/dtoa_test.c | 2 +- test/libc/stdio/getentropy_test.c | 4 ++-- test/libc/stdio/mt19937_test.c | 2 +- test/libc/stdio/zipdir_test.c | 2 +- test/libc/str/blake2_test.c | 2 +- test/libc/str/hexpcpy_test.c | 2 +- test/libc/str/strcasestr_test.c | 2 +- test/libc/thread/pthread_create_test.c | 2 +- test/libc/tinymath/fdot_test.cc | 2 +- test/libc/tinymath/fsum_test.cc | 2 +- test/libc/tinymath/powl_test.c | 2 +- test/libc/tinymath/strtod_test.c | 2 +- test/libc/tinymath/tanh_test.c | 2 +- test/libc/xed/x86ild_lib.c | 2 +- test/net/https/mbedtls_test.c | 2 +- test/tool/net/sqlite_test.c | 2 +- test/tool/plinko/plinko_test.c | 2 +- test/tool/viz/lib/fun_test.c | 2 +- test/tool/viz/lib/ycbcr2rgb2_test.c | 2 +- third_party/chibicc/as.c | 4 ++-- third_party/chibicc/chibicc.h | 2 +- third_party/chibicc/test/vla_test.c | 2 +- third_party/chibicc/tokenize.c | 2 +- third_party/compiler_rt/comprt.S | 2 +- third_party/dlmalloc/dlmalloc.c | 2 +- third_party/dlmalloc/threaded.inc | 2 +- third_party/gdtoa/misc.c | 2 +- third_party/linenoise/linenoise.c | 4 ++-- third_party/lua/lrepl.c | 2 +- third_party/lua/luacallwithtrace.c | 2 +- third_party/lua/lunix.c | 2 +- third_party/maxmind/getmetroname.c | 2 +- third_party/mbedtls/bigmul.c | 2 +- third_party/mbedtls/bignum.c | 2 +- third_party/mbedtls/bigshift.c | 2 +- third_party/mbedtls/fastdiv.h | 2 +- third_party/mbedtls/formatclientciphers.c | 2 +- third_party/mbedtls/sha1.c | 2 +- third_party/mbedtls/sha256.c | 2 +- third_party/mbedtls/sha512.c | 2 +- third_party/mbedtls/sha512t.c | 2 +- third_party/mbedtls/ssl_srv.c | 2 +- third_party/mbedtls/test/test.inc | 2 +- third_party/musl/strptime.c | 2 +- third_party/nsync/common.c | 4 ++-- third_party/nsync/compat.S | 2 +- third_party/python/Include/pyctype.h | 2 +- third_party/python/Modules/_hashmbedtls.c | 2 +- third_party/python/Modules/tlsmodule.c | 2 +- third_party/python/Modules/tokenbucket.c | 2 +- third_party/python/Python/cosmomodule.c | 2 +- third_party/python/Python/import.c | 2 +- third_party/python/Python/random.c | 2 +- third_party/python/pyobj.c | 4 ++-- third_party/python/runpythonmodule.c | 2 +- third_party/stb/stb_image.c | 2 +- third_party/stb/stb_image_resize.c | 2 +- third_party/stb/stb_image_write.c | 2 +- third_party/stb/stb_truetype.c | 2 +- third_party/tree/tree.h | 2 +- third_party/tz/difftime.c | 2 +- third_party/xed/x86ild.greg.c | 2 +- third_party/xxhash/xxhash.h | 2 +- third_party/zstd/lib/common/compiler.h | 2 +- third_party/zstd/lib/common/xxhash.h | 2 +- tool/build/apelink.c | 10 +++++----- tool/build/ar.c | 2 +- tool/build/assimilate.c | 4 ++-- tool/build/bigmul.c | 2 +- tool/build/compile.c | 2 +- tool/build/elf2pe.c | 2 +- tool/build/fixupobj.c | 6 +++--- tool/build/helpop.c | 2 +- tool/build/killall.c | 2 +- tool/build/lib/buffer.c | 2 +- tool/build/lib/elfwriter.c | 2 +- tool/build/lib/elfwriter_zip.c | 4 ++-- tool/build/lib/eztls.c | 2 +- tool/build/lib/getargs.c | 2 +- tool/build/lz4toasm.c | 6 +++--- tool/build/mkdeps.c | 4 ++-- tool/build/objbincopy.c | 4 ++-- tool/build/package.c | 2 +- tool/build/pledge.c | 2 +- tool/build/runitd.c | 2 +- tool/build/sha256sum.c | 2 +- tool/build/zipcopy.c | 2 +- tool/build/zipobj.c | 2 +- tool/curl/curl.c | 2 +- tool/decode/elf.c | 2 +- tool/decode/lib/bitabuilder.c | 2 +- tool/decode/lib/disassemblehex.c | 2 +- tool/decode/lib/machoidnames.c | 2 +- tool/decode/lib/zipnames.c | 2 +- tool/decode/macho.c | 6 +++--- tool/decode/unhex.c | 2 +- tool/decode/x86opinfo.c | 4 ++-- tool/decode/zip.c | 2 +- tool/net/getadaptersaddresses.c | 2 +- tool/net/lfuncs.c | 4 ++-- tool/net/ljson.c | 2 +- tool/net/lre.c | 2 +- tool/net/redbean.c | 6 +++--- tool/net/winbench.c | 2 +- tool/plinko/lib/gc.c | 2 +- tool/plinko/lib/histo.h | 2 +- tool/plinko/lib/iswide.c | 2 +- tool/plinko/lib/plinko.c | 2 +- tool/viz/bin2asm.c | 2 +- tool/viz/bing.c | 2 +- tool/viz/derasterize.c | 2 +- tool/viz/dumphexc.c | 2 +- tool/viz/fontspace.c | 2 +- tool/viz/getglyph.c | 2 +- tool/viz/lib/bilinearscale.c | 2 +- tool/viz/lib/dither.c | 2 +- tool/viz/lib/doublechrominance.S | 2 +- tool/viz/lib/formatstringtable-testlib.h | 2 +- tool/viz/lib/gaussian.c | 2 +- tool/viz/lib/getxtermcodes.c | 2 +- tool/viz/lib/perlin3.c | 2 +- tool/viz/lib/sharpen.c | 2 +- tool/viz/lib/sobel.c | 2 +- tool/viz/lib/stringbuilder.c | 2 +- tool/viz/lib/unsharp.c | 2 +- tool/viz/lib/writetoframebuffer.c | 2 +- tool/viz/lib/ycbcr2rgb3.c | 2 +- tool/viz/life.c | 2 +- tool/viz/memzoom.c | 4 ++-- tool/viz/printansi.c | 2 +- tool/viz/printvideo.c | 2 +- tool/viz/rlimit.c | 2 +- tool/viz/tailf.c | 2 +- tool/viz/unbing.c | 2 +- tool/viz/virtualquery.c | 2 +- 734 files changed, 779 insertions(+), 778 deletions(-) rename libc/{dos.internal.h => dos.h} (100%) rename libc/{imag.internal.h => imag.h} (100%) rename libc/{iso646.internal.h => iso646.h} (100%) rename libc/{mach.internal.h => mach.h} (100%) rename libc/{macho.internal.h => macho.h} (100%) rename libc/{macros.internal.h => macros.h} (100%) rename libc/{stdalign.internal.h => stdalign.h} (52%) rename libc/str/{tab.internal.h => tab.h} (77%) rename libc/{zip.internal.h => zip.h} (100%) diff --git a/ape/ape.S b/ape/ape.S index 2ec05e963..f274e31f6 100644 --- a/ape/ape.S +++ b/ape/ape.S @@ -37,7 +37,7 @@ #include "libc/calls/metalfile.internal.h" #include "libc/dce.h" #include "libc/elf/def.h" -#include "libc/macho.internal.h" +#include "libc/macho.h" #include "libc/nexgen32e/uart.internal.h" #include "libc/nt/pedef.internal.h" #include "libc/runtime/pc.internal.h" diff --git a/ape/launch.S b/ape/launch.S index ae2cb58a1..f710fdec7 100644 --- a/ape/launch.S +++ b/ape/launch.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Calls _start() function of loaded program. // diff --git a/ape/loader-macho.S b/ape/loader-macho.S index bcecf9dac..e484f0686 100644 --- a/ape/loader-macho.S +++ b/ape/loader-macho.S @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macho.internal.h" +#include "libc/macho.h" #include "libc/sysv/consts/prot.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" // Apple Mach-O Executable Headers // Fixups are applied by objbincopy diff --git a/ape/macros.internal.h b/ape/macros.internal.h index ad354e474..dcfdc75a0 100644 --- a/ape/macros.internal.h +++ b/ape/macros.internal.h @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #ifndef APE_MACROS_H_ #define APE_MACROS_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __ASSEMBLER__ /* clang-format off */ diff --git a/ape/start.S b/ape/start.S index c148966e1..e497fc852 100644 --- a/ape/start.S +++ b/ape/start.S @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "ape/ape.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __aarch64__ diff --git a/ape/systemcall.S b/ape/systemcall.S index c98632fd5..91daedc95 100644 --- a/ape/systemcall.S +++ b/ape/systemcall.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Invokes system call. // diff --git a/dsp/core/c161.h b/dsp/core/c161.h index 40753eefa..ddadcaa7f 100644 --- a/dsp/core/c161.h +++ b/dsp/core/c161.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_DSP_CORE_C161_H_ #define COSMOPOLITAN_DSP_CORE_C161_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #define EXTRA_SHARP 2 diff --git a/dsp/core/c161s.h b/dsp/core/c161s.h index 325278ee2..cd7018727 100644 --- a/dsp/core/c161s.h +++ b/dsp/core/c161s.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_DSP_CORE_C161S_H_ #define COSMOPOLITAN_DSP_CORE_C161S_H_ #include "dsp/core/c161.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" __funline signed char C161S(signed char al, signed char bl, signed char cl) { short ax, bx, cx; diff --git a/dsp/core/double2byte.c b/dsp/core/double2byte.c index 1ac894e9b..95bcad14c 100644 --- a/dsp/core/double2byte.c +++ b/dsp/core/double2byte.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/core/core.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" diff --git a/dsp/core/float2short.c b/dsp/core/float2short.c index 2c35fb17e..5efbcb4ee 100644 --- a/dsp/core/float2short.c +++ b/dsp/core/float2short.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/str/str.h" diff --git a/dsp/core/getintegercoefficients.c b/dsp/core/getintegercoefficients.c index b8b377d3d..fc8cd77bb 100644 --- a/dsp/core/getintegercoefficients.c +++ b/dsp/core/getintegercoefficients.c @@ -20,7 +20,7 @@ #include "libc/assert.h" #include "libc/dce.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/str/str.h" diff --git a/dsp/core/getintegercoefficients8.c b/dsp/core/getintegercoefficients8.c index 1ba9e5081..defafc058 100644 --- a/dsp/core/getintegercoefficients8.c +++ b/dsp/core/getintegercoefficients8.c @@ -19,7 +19,7 @@ #include "dsp/core/core.h" #include "dsp/core/q.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/str/str.h" diff --git a/dsp/core/half.h b/dsp/core/half.h index 0955ddfba..0165ad76b 100644 --- a/dsp/core/half.h +++ b/dsp/core/half.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_DSP_CORE_HALF_H_ #define COSMOPOLITAN_DSP_CORE_HALF_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Divides integer in half w/ rounding. diff --git a/dsp/core/ks8.h b/dsp/core/ks8.h index 100b3decc..4a0c81f72 100644 --- a/dsp/core/ks8.h +++ b/dsp/core/ks8.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_DSP_CORE_KS8_H_ #define COSMOPOLITAN_DSP_CORE_KS8_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Performs 16-bit scaled rounded madd w/ eight coefficients or fewer. diff --git a/dsp/core/kss8.h b/dsp/core/kss8.h index 54bff129c..c86ae1a85 100644 --- a/dsp/core/kss8.h +++ b/dsp/core/kss8.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_DSP_CORE_KSS8_H_ #define COSMOPOLITAN_DSP_CORE_KSS8_H_ #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Performs 16-bit scaled rounded saturated madd w/ eight coefficients or fewer. diff --git a/dsp/core/q.h b/dsp/core/q.h index 3d122bf49..c23fa5f30 100644 --- a/dsp/core/q.h +++ b/dsp/core/q.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_DSP_CORE_Q_H_ #define COSMOPOLITAN_DSP_CORE_Q_H_ #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" /** diff --git a/dsp/core/sad16x8n.c b/dsp/core/sad16x8n.c index 802836164..c8e6f4fff 100644 --- a/dsp/core/sad16x8n.c +++ b/dsp/core/sad16x8n.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/core/core.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "third_party/aarch64/arm_neon.internal.h" #include "third_party/intel/emmintrin.internal.h" diff --git a/dsp/mpeg/clamp4int256-core.S b/dsp/mpeg/clamp4int256-core.S index 3cd6797b1..db3b97c2e 100644 --- a/dsp/mpeg/clamp4int256-core.S +++ b/dsp/mpeg/clamp4int256-core.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" clamp4int256$core: .leafprologue diff --git a/dsp/mpeg/mpeg1.c b/dsp/mpeg/mpeg1.c index 5b9eb0b82..457dad4bc 100644 --- a/dsp/mpeg/mpeg1.c +++ b/dsp/mpeg/mpeg1.c @@ -35,7 +35,7 @@ #include "libc/calls/struct/timespec.h" #include "libc/fmt/conv.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/str/str.h" diff --git a/dsp/mpeg/slowrgb.c b/dsp/mpeg/slowrgb.c index 7472d82f3..35971f17f 100644 --- a/dsp/mpeg/slowrgb.c +++ b/dsp/mpeg/slowrgb.c @@ -28,7 +28,7 @@ │ SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/mpeg/mpeg.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" __static_yoink("pl_mpeg_notice"); /** diff --git a/dsp/scale/gyarados.c b/dsp/scale/gyarados.c index 61beace01..adbf5d5d5 100644 --- a/dsp/scale/gyarados.c +++ b/dsp/scale/gyarados.c @@ -25,7 +25,7 @@ #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/dsp/scale/magikarp.c b/dsp/scale/magikarp.c index ca5d3cf8c..f1f84b2ed 100644 --- a/dsp/scale/magikarp.c +++ b/dsp/scale/magikarp.c @@ -20,7 +20,7 @@ #include "dsp/core/ks8.h" #include "dsp/core/kss8.h" #include "dsp/scale/cdecimate2xuint8x8.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/x86feature.h" #include "libc/str/str.h" #include "libc/x/x.h" diff --git a/dsp/tty/mpsadbw.S b/dsp/tty/mpsadbw.S index 833824ea4..165e17edd 100644 --- a/dsp/tty/mpsadbw.S +++ b/dsp/tty/mpsadbw.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // TODO(jart): write me diff --git a/dsp/tty/rgb2ansi.c b/dsp/tty/rgb2ansi.c index baece9e8a..4ae5c54fa 100644 --- a/dsp/tty/rgb2ansi.c +++ b/dsp/tty/rgb2ansi.c @@ -21,7 +21,7 @@ #include "libc/assert.h" #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/str/str.h" diff --git a/dsp/tty/rgb2ttyi2f.c b/dsp/tty/rgb2ttyi2f.c index e323c57f2..55472a40a 100644 --- a/dsp/tty/rgb2ttyi2f.c +++ b/dsp/tty/rgb2ttyi2f.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/tty/quant.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" struct TtyRgb rgb2ttyi2f_(int r, int g, int b) { return rgb2ttyf((ttyrgb_m128){r, g, b} / 255); diff --git a/dsp/tty/rgb2xterm24.c b/dsp/tty/rgb2xterm24.c index afbb6e9f5..166412a32 100644 --- a/dsp/tty/rgb2xterm24.c +++ b/dsp/tty/rgb2xterm24.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/tty/quant.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" struct TtyRgb rgb2xterm24_(int r, int g, int b) { return (struct TtyRgb){MAX(MIN(r, 255), 0), MAX(MIN(g, 255), 0), diff --git a/dsp/tty/rgb2xterm24f.c b/dsp/tty/rgb2xterm24f.c index 5a3b59594..6cad0f3cc 100644 --- a/dsp/tty/rgb2xterm24f.c +++ b/dsp/tty/rgb2xterm24f.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/tty/quant.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "third_party/intel/xmmintrin.internal.h" diff --git a/dsp/tty/ttyraster.c b/dsp/tty/ttyraster.c index a4e5e98fd..3bdb5ae97 100644 --- a/dsp/tty/ttyraster.c +++ b/dsp/tty/ttyraster.c @@ -26,7 +26,7 @@ #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/nexgen32e/x86feature.h" #include "libc/runtime/runtime.h" diff --git a/dsp/tty/ttyraw.c b/dsp/tty/ttyraw.c index 333c641f0..bfb03f84f 100644 --- a/dsp/tty/ttyraw.c +++ b/dsp/tty/ttyraw.c @@ -24,7 +24,7 @@ #include "libc/calls/termios.h" #include "libc/calls/ucontext.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/dsp/tty/windex-avx2.S b/dsp/tty/windex-avx2.S index 4ebf2931e..f106fab29 100644 --- a/dsp/tty/windex-avx2.S +++ b/dsp/tty/windex-avx2.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Returns index of minimum uint16 in array. // diff --git a/dsp/tty/windex-sse4.S b/dsp/tty/windex-sse4.S index 0347cb763..40ef0d856 100644 --- a/dsp/tty/windex-sse4.S +++ b/dsp/tty/windex-sse4.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Returns index of minimum positive int16 in array. // diff --git a/examples/date.c b/examples/date.c index fbee50f5d..7bfeaca5d 100644 --- a/examples/date.c +++ b/examples/date.c @@ -10,7 +10,7 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/timespec.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/timezoneid.h" #include "libc/nt/struct/timezoneinformation.h" #include "libc/nt/time.h" diff --git a/examples/nc.c b/examples/nc.c index 3e29a51d2..34483cf01 100644 --- a/examples/nc.c +++ b/examples/nc.c @@ -10,7 +10,7 @@ #include "libc/calls/calls.h" #include "libc/fmt/conv.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sock/sock.h" #include "libc/sock/struct/linger.h" diff --git a/examples/nesemu1.cc b/examples/nesemu1.cc index a7799bff0..2dd2f7949 100644 --- a/examples/nesemu1.cc +++ b/examples/nesemu1.cc @@ -23,7 +23,7 @@ #include "libc/inttypes.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/arraylist2.internal.h" #include "libc/mem/mem.h" @@ -47,7 +47,7 @@ #include "libc/time.h" #include "libc/x/xasprintf.h" #include "libc/x/xsigaction.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/getopt/getopt.internal.h" #include "third_party/libcxx/vector" #include "tool/viz/lib/knobs.h" diff --git a/examples/package/lib/myasm.S b/examples/package/lib/myasm.S index acb21b98e..f0e0cad66 100644 --- a/examples/package/lib/myasm.S +++ b/examples/package/lib/myasm.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Example assembly function. // diff --git a/examples/script.c b/examples/script.c index e6559e626..12ad64a26 100644 --- a/examples/script.c +++ b/examples/script.c @@ -41,7 +41,7 @@ #include "libc/fmt/conv.h" #include "libc/intrin/bswap.h" #include "libc/log/bsd.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/paths.h" #include "libc/runtime/runtime.h" diff --git a/libc/calls/CPU_AND.c b/libc/calls/CPU_AND.c index b90a0d1e4..bfe7ef2cc 100644 --- a/libc/calls/CPU_AND.c +++ b/libc/calls/CPU_AND.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/cpuset.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" void CPU_AND(cpu_set_t *d, cpu_set_t *x, cpu_set_t *y) { int i; diff --git a/libc/calls/CPU_COUNT.c b/libc/calls/CPU_COUNT.c index 0e2348cb7..792cbfc7d 100644 --- a/libc/calls/CPU_COUNT.c +++ b/libc/calls/CPU_COUNT.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/cpuset.h" #include "libc/intrin/popcnt.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" int CPU_COUNT(cpu_set_t *set) { int i, c; diff --git a/libc/calls/CPU_OR.c b/libc/calls/CPU_OR.c index 8218b9158..11fcaf20e 100644 --- a/libc/calls/CPU_OR.c +++ b/libc/calls/CPU_OR.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/cpuset.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" void CPU_OR(cpu_set_t *d, cpu_set_t *x, cpu_set_t *y) { int i; diff --git a/libc/calls/CPU_XOR.c b/libc/calls/CPU_XOR.c index db5ced87a..08277e43f 100644 --- a/libc/calls/CPU_XOR.c +++ b/libc/calls/CPU_XOR.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/cpuset.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" void CPU_XOR(cpu_set_t *d, cpu_set_t *x, cpu_set_t *y) { int i; diff --git a/libc/calls/chdir-nt.c b/libc/calls/chdir-nt.c index ebc052c5a..2c1b40eed 100644 --- a/libc/calls/chdir-nt.c +++ b/libc/calls/chdir-nt.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/errors.h" #include "libc/nt/files.h" #include "libc/nt/process.h" diff --git a/libc/calls/clock_gettime-xnu.c b/libc/calls/clock_gettime-xnu.c index e9548884e..f7a6f5e41 100644 --- a/libc/calls/clock_gettime-xnu.c +++ b/libc/calls/clock_gettime-xnu.c @@ -21,7 +21,7 @@ #include "libc/calls/struct/timeval.h" #include "libc/calls/struct/timeval.internal.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/clock.h" #ifdef __x86_64__ diff --git a/libc/calls/copy.c b/libc/calls/copy.c index 8be9d5c36..9140d40e9 100644 --- a/libc/calls/copy.c +++ b/libc/calls/copy.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" /** diff --git a/libc/calls/fcntl-nt.c b/libc/calls/fcntl-nt.c index f18945ce8..a10b585f3 100644 --- a/libc/calls/fcntl-nt.c +++ b/libc/calls/fcntl-nt.c @@ -31,7 +31,7 @@ #include "libc/intrin/weaken.h" #include "libc/limits.h" #include "libc/log/backtrace.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/leaks.h" #include "libc/mem/mem.h" #include "libc/nt/createfile.h" diff --git a/libc/calls/fstat-nt.c b/libc/calls/fstat-nt.c index 3c6b8c1cd..a15c42bb2 100644 --- a/libc/calls/fstat-nt.c +++ b/libc/calls/fstat-nt.c @@ -27,7 +27,7 @@ #include "libc/intrin/atomic.h" #include "libc/intrin/bsr.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alloca.h" #include "libc/nt/enum/fileflagandattributes.h" #include "libc/nt/enum/fileinfobyhandleclass.h" diff --git a/libc/calls/fstatfs-nt.c b/libc/calls/fstatfs-nt.c index 06c0ce515..f7d0229bc 100644 --- a/libc/calls/fstatfs-nt.c +++ b/libc/calls/fstatfs-nt.c @@ -23,7 +23,7 @@ #include "libc/calls/struct/statfs.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/fsinformationclass.h" #include "libc/nt/enum/status.h" #include "libc/nt/files.h" diff --git a/libc/calls/getcontext.S b/libc/calls/getcontext.S index bf3400f43..a05f5c83c 100644 --- a/libc/calls/getcontext.S +++ b/libc/calls/getcontext.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Gets machine state. // diff --git a/libc/calls/getdomainname.c b/libc/calls/getdomainname.c index 9cfb722f6..988cbdd2e 100644 --- a/libc/calls/getdomainname.c +++ b/libc/calls/getdomainname.c @@ -20,7 +20,7 @@ #include "libc/calls/syscall_support-sysv.internal.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/computernameformat.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" diff --git a/libc/calls/getdtablesize.c b/libc/calls/getdtablesize.c index fdfd06ac5..cc5a7460e 100644 --- a/libc/calls/getdtablesize.c +++ b/libc/calls/getdtablesize.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/rlimit.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/rlimit.h" diff --git a/libc/calls/gethostname-nt.c b/libc/calls/gethostname-nt.c index e1c9e1f0b..a39b0d013 100644 --- a/libc/calls/gethostname-nt.c +++ b/libc/calls/gethostname-nt.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/calls/syscall_support-nt.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/computernameformat.h" #include "libc/nt/systeminfo.h" #include "libc/str/str.h" diff --git a/libc/calls/getloadavg-nt.c b/libc/calls/getloadavg-nt.c index 4e8d6d847..08d733536 100644 --- a/libc/calls/getloadavg-nt.c +++ b/libc/calls/getloadavg-nt.c @@ -21,7 +21,7 @@ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" #include "libc/fmt/conv.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/accounting.h" #include "libc/runtime/runtime.h" #include "libc/thread/thread.h" diff --git a/libc/calls/getntsyspath.S b/libc/calls/getntsyspath.S index 62bd818f0..b8f2b65cd 100644 --- a/libc/calls/getntsyspath.S +++ b/libc/calls/getntsyspath.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" // Obtains WIN32 magic path, e.g. GetTempPathA. // diff --git a/libc/calls/getprogramexecutablename.greg.c b/libc/calls/getprogramexecutablename.greg.c index 12f02933c..8e6e9e1c7 100644 --- a/libc/calls/getprogramexecutablename.greg.c +++ b/libc/calls/getprogramexecutablename.greg.c @@ -27,7 +27,7 @@ #include "libc/intrin/getenv.h" #include "libc/intrin/strace.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/runtime.h" #include "libc/runtime/runtime.h" #include "libc/serialize.h" diff --git a/libc/calls/getrandom.c b/libc/calls/getrandom.c index 957c7bc18..2b16815d4 100644 --- a/libc/calls/getrandom.c +++ b/libc/calls/getrandom.c @@ -32,7 +32,7 @@ #include "libc/intrin/asmflag.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/kcpuids.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/nexgen32e/vendor.internal.h" diff --git a/libc/calls/getuid-nt.c b/libc/calls/getuid-nt.c index 7f191db4e..c6acd2a91 100644 --- a/libc/calls/getuid-nt.c +++ b/libc/calls/getuid-nt.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" #include "libc/intrin/atomic.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/accounting.h" #include "libc/str/str.h" diff --git a/libc/calls/getuid.c b/libc/calls/getuid.c index 483be9c15..3be6e8245 100644 --- a/libc/calls/getuid.c +++ b/libc/calls/getuid.c @@ -25,7 +25,7 @@ #include "libc/intrin/atomic.h" #include "libc/intrin/strace.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/calls/internal.h b/libc/calls/internal.h index 8a9b54819..04e87a36c 100644 --- a/libc/calls/internal.h +++ b/libc/calls/internal.h @@ -4,7 +4,7 @@ #include "libc/intrin/fds.h" #include "libc/calls/struct/sigval.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdbool.h" #define kSigactionMinRva 8 /* >SIG_{ERR,DFL,IGN,...} */ diff --git a/libc/calls/ioctl.c b/libc/calls/ioctl.c index 7eaa44a00..1130a6c34 100644 --- a/libc/calls/ioctl.c +++ b/libc/calls/ioctl.c @@ -27,7 +27,7 @@ #include "libc/intrin/fds.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alloca.h" #include "libc/mem/mem.h" #include "libc/nt/console.h" diff --git a/libc/calls/kntsystemdirectory.S b/libc/calls/kntsystemdirectory.S index 85338d555..e50cc3485 100644 --- a/libc/calls/kntsystemdirectory.S +++ b/libc/calls/kntsystemdirectory.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #define BYTES 64 diff --git a/libc/calls/kntwindowsdirectory.S b/libc/calls/kntwindowsdirectory.S index de7418a62..0a20e3183 100644 --- a/libc/calls/kntwindowsdirectory.S +++ b/libc/calls/kntwindowsdirectory.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #define BYTES 64 diff --git a/libc/calls/metalfile.c b/libc/calls/metalfile.c index cdfb6bc5f..d20736e35 100644 --- a/libc/calls/metalfile.c +++ b/libc/calls/metalfile.c @@ -32,7 +32,7 @@ #include "libc/intrin/directmap.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/pc.internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/calls/metalfile_init.S b/libc/calls/metalfile_init.S index 72e7f8972..0f5466fc5 100644 --- a/libc/calls/metalfile_init.S +++ b/libc/calls/metalfile_init.S @@ -24,7 +24,7 @@ │ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR │ │ OTHER DEALINGS IN THE SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/calls/metalfile.internal.h" .init.start 102,_init_metalfile diff --git a/libc/calls/mkntpath.c b/libc/calls/mkntpath.c index f1ca7d153..c3116d794 100644 --- a/libc/calls/mkntpath.c +++ b/libc/calls/mkntpath.c @@ -20,7 +20,7 @@ #include "libc/dce.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/systeminfo.h" #include "libc/str/str.h" #include "libc/sysv/consts/o.h" diff --git a/libc/calls/mkntpathat.c b/libc/calls/mkntpathat.c index e1e845b55..81a80ecc8 100644 --- a/libc/calls/mkntpathat.c +++ b/libc/calls/mkntpathat.c @@ -19,7 +19,7 @@ #include "libc/calls/internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/fileflagandattributes.h" #include "libc/nt/files.h" #include "libc/nt/thunk/msabi.h" diff --git a/libc/calls/netbsdtramp.S b/libc/calls/netbsdtramp.S index 01fdca769..dddd3536b 100644 --- a/libc/calls/netbsdtramp.S +++ b/libc/calls/netbsdtramp.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .privileged __restore_rt_netbsd: diff --git a/libc/calls/ntspawn.c b/libc/calls/ntspawn.c index 392531915..1db070f19 100644 --- a/libc/calls/ntspawn.c +++ b/libc/calls/ntspawn.c @@ -39,7 +39,7 @@ #include "libc/nt/struct/startupinfo.h" #include "libc/nt/struct/startupinfoex.h" #include "libc/proc/ntspawn.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" #ifdef __x86_64__ diff --git a/libc/calls/open-nt.c b/libc/calls/open-nt.c index 9a2f5808f..09061eb8a 100644 --- a/libc/calls/open-nt.c +++ b/libc/calls/open-nt.c @@ -25,7 +25,7 @@ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/errno.h" #include "libc/intrin/fds.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/console.h" #include "libc/nt/createfile.h" #include "libc/nt/enum/accessmask.h" diff --git a/libc/calls/openat-metal.c b/libc/calls/openat-metal.c index ec958f4c0..16650f4b3 100644 --- a/libc/calls/openat-metal.c +++ b/libc/calls/openat-metal.c @@ -23,7 +23,7 @@ #include "libc/calls/metalfile.internal.h" #include "libc/intrin/directmap.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/pc.internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/calls/parsepromises.c b/libc/calls/parsepromises.c index af4770e06..c12b2ee33 100644 --- a/libc/calls/parsepromises.c +++ b/libc/calls/parsepromises.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/pledge.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" static int FindPromise(const char *name) { diff --git a/libc/calls/pledge-linux.c b/libc/calls/pledge-linux.c index fbafd3d1e..1dfeb7b8f 100644 --- a/libc/calls/pledge-linux.c +++ b/libc/calls/pledge-linux.c @@ -29,7 +29,7 @@ #include "libc/intrin/bsr.h" #include "libc/intrin/likely.h" #include "libc/intrin/promises.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" #include "libc/sysv/consts/audit.h" diff --git a/libc/calls/poll-nt.c b/libc/calls/poll-nt.c index ac1e64c7e..4735c7f40 100644 --- a/libc/calls/poll-nt.c +++ b/libc/calls/poll-nt.c @@ -28,7 +28,7 @@ #include "libc/errno.h" #include "libc/intrin/atomic.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/console.h" #include "libc/nt/enum/filetype.h" diff --git a/libc/calls/pread.c b/libc/calls/pread.c index 0064397cb..ee42b55bd 100644 --- a/libc/calls/pread.c +++ b/libc/calls/pread.c @@ -26,7 +26,7 @@ #include "libc/dce.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/zipos.internal.h" #include "libc/stdio/sysparam.h" diff --git a/libc/calls/program_executable_name_init.S b/libc/calls/program_executable_name_init.S index 99ed4db3e..262018e25 100644 --- a/libc/calls/program_executable_name_init.S +++ b/libc/calls/program_executable_name_init.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .init.start 305,_init_program_executable_name push %rdi diff --git a/libc/calls/pwrite.c b/libc/calls/pwrite.c index e1f030def..c76c1d01a 100644 --- a/libc/calls/pwrite.c +++ b/libc/calls/pwrite.c @@ -26,7 +26,7 @@ #include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/sysparam.h" #include "libc/sysv/errfuns.h" diff --git a/libc/calls/read-nt.c b/libc/calls/read-nt.c index 146adec20..47ea08294 100644 --- a/libc/calls/read-nt.c +++ b/libc/calls/read-nt.c @@ -34,7 +34,7 @@ #include "libc/intrin/nomultics.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/console.h" #include "libc/nt/createfile.h" #include "libc/nt/enum/accessmask.h" diff --git a/libc/calls/readv-metal.c b/libc/calls/readv-metal.c index 5de8ace91..926d6fbc8 100644 --- a/libc/calls/readv-metal.c +++ b/libc/calls/readv-metal.c @@ -22,7 +22,7 @@ #include "libc/calls/struct/iovec.h" #include "libc/calls/struct/iovec.internal.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" #include "libc/vga/vga.internal.h" diff --git a/libc/calls/releasefd.c b/libc/calls/releasefd.c index f6947d22d..ccf2664bd 100644 --- a/libc/calls/releasefd.c +++ b/libc/calls/releasefd.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" #include "libc/intrin/atomic.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" // really want to avoid locking here so close() needn't block signals diff --git a/libc/calls/restore.S b/libc/calls/restore.S index 6ce347160..596b01f7c 100644 --- a/libc/calls/restore.S +++ b/libc/calls/restore.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.windows // Restores thread to state before signal. diff --git a/libc/calls/rusage_add.c b/libc/calls/rusage_add.c index 38a831aac..254b04169 100644 --- a/libc/calls/rusage_add.c +++ b/libc/calls/rusage_add.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/rusage.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Accumulates resource statistics in `y` to `x`. diff --git a/libc/calls/select-nt.c b/libc/calls/select-nt.c index 8245f9f32..a669cae37 100644 --- a/libc/calls/select-nt.c +++ b/libc/calls/select-nt.c @@ -21,7 +21,7 @@ #include "libc/calls/state.internal.h" #include "libc/calls/struct/timeval.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/select.h" #include "libc/sock/sock.h" #include "libc/sock/struct/pollfd.h" diff --git a/libc/calls/setrlimit.c b/libc/calls/setrlimit.c index 7cfaeccc6..6b8328489 100644 --- a/libc/calls/setrlimit.c +++ b/libc/calls/setrlimit.c @@ -24,7 +24,7 @@ #include "libc/errno.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/syslib.internal.h" #include "libc/sysv/consts/rlimit.h" diff --git a/libc/calls/sigaction.c b/libc/calls/sigaction.c index d3f46e71b..be67e817c 100644 --- a/libc/calls/sigaction.c +++ b/libc/calls/sigaction.c @@ -36,7 +36,7 @@ #include "libc/limits.h" #include "libc/log/backtrace.internal.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/runtime/syslib.internal.h" diff --git a/libc/calls/sigaltstack.c b/libc/calls/sigaltstack.c index 0e246d749..dac5f4526 100644 --- a/libc/calls/sigaltstack.c +++ b/libc/calls/sigaltstack.c @@ -23,7 +23,7 @@ #include "libc/dce.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/syslib.internal.h" #include "libc/sysv/consts/ss.h" diff --git a/libc/calls/sigcrashsig.c b/libc/calls/sigcrashsig.c index 21e0d0203..060c2b310 100644 --- a/libc/calls/sigcrashsig.c +++ b/libc/calls/sigcrashsig.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/sig.internal.h" #include "libc/intrin/pushpop.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/signal.h" #include "libc/nt/enum/status.h" #include "libc/nt/struct/ntexceptionpointers.h" diff --git a/libc/calls/sigenter-freebsd.c b/libc/calls/sigenter-freebsd.c index 0f29ad547..d895f630c 100644 --- a/libc/calls/sigenter-freebsd.c +++ b/libc/calls/sigenter-freebsd.c @@ -28,7 +28,7 @@ #include "libc/calls/struct/ucontext-freebsd.internal.h" #include "libc/calls/ucontext.h" #include "libc/log/libfatal.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" #include "libc/str/str.h" diff --git a/libc/calls/sigenter-netbsd.c b/libc/calls/sigenter-netbsd.c index 9e20817df..09f8ff90c 100644 --- a/libc/calls/sigenter-netbsd.c +++ b/libc/calls/sigenter-netbsd.c @@ -27,7 +27,7 @@ #include "libc/calls/struct/ucontext-netbsd.internal.h" #include "libc/calls/ucontext.h" #include "libc/log/libfatal.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" #include "libc/str/str.h" diff --git a/libc/calls/sigenter-openbsd.c b/libc/calls/sigenter-openbsd.c index 5be46f32a..ac3819740 100644 --- a/libc/calls/sigenter-openbsd.c +++ b/libc/calls/sigenter-openbsd.c @@ -27,7 +27,7 @@ #include "libc/calls/struct/ucontext-openbsd.internal.h" #include "libc/calls/ucontext.h" #include "libc/log/libfatal.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" #include "libc/str/str.h" diff --git a/libc/calls/swapcontext.S b/libc/calls/swapcontext.S index 6dd78947f..d7b96556f 100644 --- a/libc/calls/swapcontext.S +++ b/libc/calls/swapcontext.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Saves machine to 𝑥 and activates 𝑦, i.e. // diff --git a/libc/calls/sysinfo.c b/libc/calls/sysinfo.c index cf7ce29d3..e67de5921 100644 --- a/libc/calls/sysinfo.c +++ b/libc/calls/sysinfo.c @@ -23,7 +23,7 @@ #include "libc/calls/struct/timeval.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" diff --git a/libc/calls/tailcontext.S b/libc/calls/tailcontext.S index a55163dce..071f98067 100644 --- a/libc/calls/tailcontext.S +++ b/libc/calls/tailcontext.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // tailed called by setcontext() implementation __tailcontext: diff --git a/libc/calls/tmpdir.c b/libc/calls/tmpdir.c index 552467167..946bf2bbf 100644 --- a/libc/calls/tmpdir.c +++ b/libc/calls/tmpdir.c @@ -21,7 +21,7 @@ #include "libc/cosmo.h" #include "libc/dce.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/systeminfo.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/calls/uname.c b/libc/calls/uname.c index 8569c7839..0f3f0e2d4 100644 --- a/libc/calls/uname.c +++ b/libc/calls/uname.c @@ -27,7 +27,7 @@ #include "libc/fmt/itoa.h" #include "libc/intrin/strace.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/computernameformat.h" #include "libc/nt/systeminfo.h" #include "libc/runtime/runtime.h" diff --git a/libc/calls/unveil.c b/libc/calls/unveil.c index 8112fc721..c4bcbb559 100644 --- a/libc/calls/unveil.c +++ b/libc/calls/unveil.c @@ -33,7 +33,7 @@ #include "libc/fmt/libgen.h" #include "libc/intrin/strace.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/vendor.internal.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/calls/winexec.c b/libc/calls/winexec.c index cdb41dd72..ca52372c5 100644 --- a/libc/calls/winexec.c +++ b/libc/calls/winexec.c @@ -24,7 +24,7 @@ #include "libc/nt/runtime.h" #include "libc/nt/struct/overlapped.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "third_party/linenoise/linenoise.h" #define Read32(s) (s[3] << 24 | s[2] << 16 | s[1] << 8 | s[0]) diff --git a/libc/crt/crt.S b/libc/crt/crt.S index b5ba61a59..d34bc83b8 100644 --- a/libc/crt/crt.S +++ b/libc/crt/crt.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .section .start,"ax",@progbits #if SupportsXnu() && defined(__x86_64__) diff --git a/libc/dlopen/foreign_tramp.S b/libc/dlopen/foreign_tramp.S index dbd036306..38dc914f1 100644 --- a/libc/dlopen/foreign_tramp.S +++ b/libc/dlopen/foreign_tramp.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #define SIZE 0x0200 #define SKEW 0x10 diff --git a/libc/dos.internal.h b/libc/dos.h similarity index 100% rename from libc/dos.internal.h rename to libc/dos.h diff --git a/libc/fmt/bing.c b/libc/fmt/bing.c index 3ccfb87c6..8280685cb 100644 --- a/libc/fmt/bing.c +++ b/libc/fmt/bing.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/fmt/bing.internal.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Turns binary octet into unicode glyph representation. diff --git a/libc/fmt/itoa64radix16.greg.c b/libc/fmt/itoa64radix16.greg.c index 25c5e55a9..28555685d 100644 --- a/libc/fmt/itoa64radix16.greg.c +++ b/libc/fmt/itoa64radix16.greg.c @@ -19,7 +19,7 @@ #include "libc/fmt/conv.h" #include "libc/fmt/itoa.h" #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" size_t uint64toarray_radix16(uint64_t x, char b[hasatleast 17]) { return uint64toarray_fixed16(x, b, ROUNDUP(x ? bsrl(x) + 1 : 1, 4)); diff --git a/libc/fmt/unbing.c b/libc/fmt/unbing.c index ddee8e828..66ae63d7f 100644 --- a/libc/fmt/unbing.c +++ b/libc/fmt/unbing.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/bing.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" static const int kCp437i[] = { 0x000a << 8 | 10, // \n NEWLINE diff --git a/libc/fmt/unzleb64.c b/libc/fmt/unzleb64.c index edc7c71c7..4627da678 100644 --- a/libc/fmt/unzleb64.c +++ b/libc/fmt/unzleb64.c @@ -28,7 +28,7 @@ ░███▓▀ ▀▓▓██▀▀░ ░▀░ */ #include "libc/fmt/leb128.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Decodes array to signed integer w/ zig-zag encoding. diff --git a/libc/fmt/wcstol.c b/libc/fmt/wcstol.c index f95000e1c..ac3037325 100644 --- a/libc/fmt/wcstol.c +++ b/libc/fmt/wcstol.c @@ -22,7 +22,7 @@ #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Decodes signed long integer from wide string. diff --git a/libc/fmt/wcstoul.c b/libc/fmt/wcstoul.c index 9085a8000..b953c1366 100644 --- a/libc/fmt/wcstoul.c +++ b/libc/fmt/wcstoul.c @@ -22,7 +22,7 @@ #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Decodes unsigned integer from wide string. diff --git a/libc/imag.internal.h b/libc/imag.h similarity index 100% rename from libc/imag.internal.h rename to libc/imag.h diff --git a/libc/intrin/aarch64/asmdefs.h b/libc/intrin/aarch64/asmdefs.h index f18eb2bc1..e8d677849 100644 --- a/libc/intrin/aarch64/asmdefs.h +++ b/libc/intrin/aarch64/asmdefs.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_INTRIN_AARCH64_ASMDEFS_H_ #define COSMOPOLITAN_LIBC_INTRIN_AARCH64_ASMDEFS_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __ASSEMBLER__ // clang-format off diff --git a/libc/intrin/cxaatexit.c b/libc/intrin/cxaatexit.c index 7f13261bf..eca0952ce 100644 --- a/libc/intrin/cxaatexit.c +++ b/libc/intrin/cxaatexit.c @@ -20,7 +20,7 @@ #include "libc/intrin/cxaatexit.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/sysv/errfuns.h" diff --git a/libc/intrin/describecapability.c b/libc/intrin/describecapability.c index 6e072f4dd..7ef9e97fd 100644 --- a/libc/intrin/describecapability.c +++ b/libc/intrin/describecapability.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/itoa.h" #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/sysv/consts/cap.h" diff --git a/libc/intrin/describecontrolkeystate.c b/libc/intrin/describecontrolkeystate.c index c46d859a2..f8231d108 100644 --- a/libc/intrin/describecontrolkeystate.c +++ b/libc/intrin/describecontrolkeystate.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/struct/inputrecord.h" static const struct DescribeFlags kControlKeyState[] = { diff --git a/libc/intrin/describednotify.c b/libc/intrin/describednotify.c index b4b719940..2739ccca1 100644 --- a/libc/intrin/describednotify.c +++ b/libc/intrin/describednotify.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/processaccess.h" #include "libc/sysv/consts/dn.h" diff --git a/libc/intrin/describegidlist.c b/libc/intrin/describegidlist.c index d35e9db87..c2c106136 100644 --- a/libc/intrin/describegidlist.c +++ b/libc/intrin/describegidlist.c @@ -20,7 +20,7 @@ #include "libc/dce.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/popcnt.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #define N 128 diff --git a/libc/intrin/describeiovec.c b/libc/intrin/describeiovec.c index 2f1e97350..a39c69c3f 100644 --- a/libc/intrin/describeiovec.c +++ b/libc/intrin/describeiovec.c @@ -21,7 +21,7 @@ #include "libc/dce.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #define N 300 diff --git a/libc/intrin/describeiovnt.c b/libc/intrin/describeiovnt.c index 8229301d2..58e60ec41 100644 --- a/libc/intrin/describeiovnt.c +++ b/libc/intrin/describeiovnt.c @@ -19,7 +19,7 @@ #include "libc/dce.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/winsock.h" void DescribeIovNt(const struct NtIovec *iov, uint32_t iovlen, ssize_t rem) { diff --git a/libc/intrin/describemapflags.c b/libc/intrin/describemapflags.c index 770798ac0..e46b28a3d 100644 --- a/libc/intrin/describemapflags.c +++ b/libc/intrin/describemapflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/consolemodeflags.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/prot.h" diff --git a/libc/intrin/describemremapflags.c b/libc/intrin/describemremapflags.c index 185206e3c..a4505131a 100644 --- a/libc/intrin/describemremapflags.c +++ b/libc/intrin/describemremapflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/mremap.h" static const struct DescribeFlags kMremapFlags[] = { diff --git a/libc/intrin/describemsyncflags.c b/libc/intrin/describemsyncflags.c index 481493489..2223afe62 100644 --- a/libc/intrin/describemsyncflags.c +++ b/libc/intrin/describemsyncflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/msync.h" const char *(DescribeMsyncFlags)(char buf[48], int x) { diff --git a/libc/intrin/describentconsolemodeinputflags.c b/libc/intrin/describentconsolemodeinputflags.c index caeeae037..fdea2e249 100644 --- a/libc/intrin/describentconsolemodeinputflags.c +++ b/libc/intrin/describentconsolemodeinputflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/consolemodeflags.h" static const struct DescribeFlags kConsoleModeInputFlags[] = { diff --git a/libc/intrin/describentconsolemodeoutputflags.c b/libc/intrin/describentconsolemodeoutputflags.c index 68ab4c2c1..78f1d39d5 100644 --- a/libc/intrin/describentconsolemodeoutputflags.c +++ b/libc/intrin/describentconsolemodeoutputflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/consolemodeflags.h" static const struct DescribeFlags kConsoleModeOutputFlags[] = { diff --git a/libc/intrin/describentfileaccessflags.c b/libc/intrin/describentfileaccessflags.c index 996c9f36b..b1d935a55 100644 --- a/libc/intrin/describentfileaccessflags.c +++ b/libc/intrin/describentfileaccessflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/filesharemode.h" // clang-format off diff --git a/libc/intrin/describentfileflagattr.c b/libc/intrin/describentfileflagattr.c index a27024fbd..5dc9ee8cc 100644 --- a/libc/intrin/describentfileflagattr.c +++ b/libc/intrin/describentfileflagattr.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/fileflagandattributes.h" #include "libc/runtime/runtime.h" diff --git a/libc/intrin/describentfilemapflags.c b/libc/intrin/describentfilemapflags.c index 11d28d561..316fb0894 100644 --- a/libc/intrin/describentfilemapflags.c +++ b/libc/intrin/describentfilemapflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/filemapflags.h" static const struct DescribeFlags kFileMapFlags[] = { diff --git a/libc/intrin/describentfileshareflags.c b/libc/intrin/describentfileshareflags.c index 865cda1d7..49e771979 100644 --- a/libc/intrin/describentfileshareflags.c +++ b/libc/intrin/describentfileshareflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/filesharemode.h" static const struct DescribeFlags kFileShareflags[] = { diff --git a/libc/intrin/describentfiletypeflags.c b/libc/intrin/describentfiletypeflags.c index 8e720f302..5f7c9d134 100644 --- a/libc/intrin/describentfiletypeflags.c +++ b/libc/intrin/describentfiletypeflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/filetype.h" #include "libc/sysv/consts/mremap.h" diff --git a/libc/intrin/describentlockfileflags.c b/libc/intrin/describentlockfileflags.c index 69f0875bc..a32a75bca 100644 --- a/libc/intrin/describentlockfileflags.c +++ b/libc/intrin/describentlockfileflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/filelockflags.h" static const struct DescribeFlags kNtLockFileFlags[] = { diff --git a/libc/intrin/describentmovfileinpflags.c b/libc/intrin/describentmovfileinpflags.c index 1b301cd6a..e4ba860ca 100644 --- a/libc/intrin/describentmovfileinpflags.c +++ b/libc/intrin/describentmovfileinpflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/movefileexflags.h" static const struct DescribeFlags kMoveFileInputFlags[] = { diff --git a/libc/intrin/describentoverlapped.c b/libc/intrin/describentoverlapped.c index d6727424d..c516c51d8 100644 --- a/libc/intrin/describentoverlapped.c +++ b/libc/intrin/describentoverlapped.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describentoverlapped.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" const char *(DescribeNtOverlapped)(char b[128], const struct NtOverlapped *o) { int i = 0, n = 128; diff --git a/libc/intrin/describentpageflags.c b/libc/intrin/describentpageflags.c index 30acb62bc..55ef2e63c 100644 --- a/libc/intrin/describentpageflags.c +++ b/libc/intrin/describentpageflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/pageflags.h" static const struct DescribeFlags kPageFlags[] = { diff --git a/libc/intrin/describentpipemodeflags.c b/libc/intrin/describentpipemodeflags.c index 4bab699f4..f64125eb8 100644 --- a/libc/intrin/describentpipemodeflags.c +++ b/libc/intrin/describentpipemodeflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/filemapflags.h" #include "libc/nt/ipc.h" diff --git a/libc/intrin/describentpipeopenflags.c b/libc/intrin/describentpipeopenflags.c index bc8134229..8f4b0d783 100644 --- a/libc/intrin/describentpipeopenflags.c +++ b/libc/intrin/describentpipeopenflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/fileflagandattributes.h" #include "libc/nt/enum/filemapflags.h" diff --git a/libc/intrin/describentprocaccessflags.c b/libc/intrin/describentprocaccessflags.c index a7f5db917..732f7df18 100644 --- a/libc/intrin/describentprocaccessflags.c +++ b/libc/intrin/describentprocaccessflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/processaccess.h" static const struct DescribeFlags kProcessAccessflags[] = { diff --git a/libc/intrin/describentstartflags.c b/libc/intrin/describentstartflags.c index 6a46b736c..082dd026f 100644 --- a/libc/intrin/describentstartflags.c +++ b/libc/intrin/describentstartflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/startf.h" #include "libc/sysv/consts/prot.h" diff --git a/libc/intrin/describentsymlinkflags.c b/libc/intrin/describentsymlinkflags.c index 85e5d5896..2da9dfb10 100644 --- a/libc/intrin/describentsymlinkflags.c +++ b/libc/intrin/describentsymlinkflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/symboliclink.h" static const struct DescribeFlags kSymbolicLinkflags[] = { diff --git a/libc/intrin/describeopenflags.c b/libc/intrin/describeopenflags.c index 984ecd76e..c8741e9ef 100644 --- a/libc/intrin/describeopenflags.c +++ b/libc/intrin/describeopenflags.c @@ -20,7 +20,7 @@ #include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/sol.h" diff --git a/libc/intrin/describepersonalityflags.c b/libc/intrin/describepersonalityflags.c index 86d5563cf..ea2ce49ee 100644 --- a/libc/intrin/describepersonalityflags.c +++ b/libc/intrin/describepersonalityflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/filesharemode.h" #include "libc/sysv/consts/personality.h" diff --git a/libc/intrin/describepollfds.c b/libc/intrin/describepollfds.c index dd1b8a19a..60691a984 100644 --- a/libc/intrin/describepollfds.c +++ b/libc/intrin/describepollfds.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/struct/pollfd.h" #include "libc/sock/struct/pollfd.internal.h" diff --git a/libc/intrin/describepollflags.c b/libc/intrin/describepollflags.c index e902914a3..f552d9651 100644 --- a/libc/intrin/describepollflags.c +++ b/libc/intrin/describepollflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/filemapflags.h" #include "libc/sysv/consts/poll.h" diff --git a/libc/intrin/describeprotflags.c b/libc/intrin/describeprotflags.c index 33baf5fcf..03492a9b2 100644 --- a/libc/intrin/describeprotflags.c +++ b/libc/intrin/describeprotflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/prot.h" const char *(DescribeProtFlags)(char buf[48], int x) { diff --git a/libc/intrin/describeschedpolicy.c b/libc/intrin/describeschedpolicy.c index 687636ae3..5e65a554f 100644 --- a/libc/intrin/describeschedpolicy.c +++ b/libc/intrin/describeschedpolicy.c @@ -19,7 +19,7 @@ #include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/sysv/consts/sched.h" diff --git a/libc/intrin/describesigaction.c b/libc/intrin/describesigaction.c index a9b1fb8d6..e9c0413d3 100644 --- a/libc/intrin/describesigaction.c +++ b/libc/intrin/describesigaction.c @@ -23,7 +23,7 @@ #include "libc/dce.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alloca.h" #include "libc/sysv/consts/sa.h" diff --git a/libc/intrin/describesigaltstackflags.c b/libc/intrin/describesigaltstackflags.c index e9c7c6e8b..537ebae65 100644 --- a/libc/intrin/describesigaltstackflags.c +++ b/libc/intrin/describesigaltstackflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/ss.h" const char *(DescribeSigaltstackFlags)(char buf[22], int x) { diff --git a/libc/intrin/describetermios.c b/libc/intrin/describetermios.c index 6a76a2234..36ad691bd 100644 --- a/libc/intrin/describetermios.c +++ b/libc/intrin/describetermios.c @@ -22,7 +22,7 @@ #include "libc/dce.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/termios.h" #define N 1024 diff --git a/libc/intrin/describethreadcreationflags.c b/libc/intrin/describethreadcreationflags.c index 1b0e75b62..a53064a27 100644 --- a/libc/intrin/describethreadcreationflags.c +++ b/libc/intrin/describethreadcreationflags.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/processcreationflags.h" static const struct DescribeFlags kThreadCreationFlags[] = { diff --git a/libc/intrin/describevirtualkeycode.c b/libc/intrin/describevirtualkeycode.c index 2e4bc1b05..4131b31f3 100644 --- a/libc/intrin/describevirtualkeycode.c +++ b/libc/intrin/describevirtualkeycode.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/vk.h" // clang-format off diff --git a/libc/intrin/describewinsize.c b/libc/intrin/describewinsize.c index 994ade424..de671b7ea 100644 --- a/libc/intrin/describewinsize.c +++ b/libc/intrin/describewinsize.c @@ -22,7 +22,7 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #define N 64 diff --git a/libc/intrin/directmap-metal.c b/libc/intrin/directmap-metal.c index 77c0ee8b9..8ed352fef 100644 --- a/libc/intrin/directmap-metal.c +++ b/libc/intrin/directmap-metal.c @@ -20,7 +20,7 @@ #include "libc/calls/internal.h" #include "libc/calls/metalfile.internal.h" #include "libc/intrin/directmap.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/pc.internal.h" #include "libc/str/str.h" #include "libc/sysv/consts/prot.h" diff --git a/libc/intrin/dsohandle.S b/libc/intrin/dsohandle.S index 39cc3e989..37108e8a3 100644 --- a/libc/intrin/dsohandle.S +++ b/libc/intrin/dsohandle.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .underrun // Uniquely identifies each artifact linked in an address space. diff --git a/libc/intrin/fds_init.S b/libc/intrin/fds_init.S index d0fa0b96d..f86569b6f 100644 --- a/libc/intrin/fds_init.S +++ b/libc/intrin/fds_init.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .init.start 305,_init_fds push %rdi diff --git a/libc/intrin/fenv.S b/libc/intrin/fenv.S index ae00d8684..697d19999 100644 --- a/libc/intrin/fenv.S +++ b/libc/intrin/fenv.S @@ -25,7 +25,7 @@ │ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Clears floating point exception status, e.g. // diff --git a/libc/intrin/formathex64.c b/libc/intrin/formathex64.c index 33ba78f8e..e54a1b2c7 100644 --- a/libc/intrin/formathex64.c +++ b/libc/intrin/formathex64.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/itoa.h" #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" static inline int PickGoodWidth(unsigned x, char z) { if (z) { diff --git a/libc/intrin/futex.S b/libc/intrin/futex.S index 73971e959..67c1d9822 100644 --- a/libc/intrin/futex.S +++ b/libc/intrin/futex.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/sysv/consts/nr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .privileged _futex: diff --git a/libc/intrin/gcov.S b/libc/intrin/gcov.S index c32da3b85..410e30da2 100644 --- a/libc/intrin/gcov.S +++ b/libc/intrin/gcov.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Magic words to unbreak build if GCOV flags are passed. diff --git a/libc/intrin/getcpuidbrand.S b/libc/intrin/getcpuidbrand.S index 0f4c397f4..255d34a48 100644 --- a/libc/intrin/getcpuidbrand.S +++ b/libc/intrin/getcpuidbrand.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" GetCpuidBrand: mov %esi,%eax diff --git a/libc/intrin/getmainstack.c b/libc/intrin/getmainstack.c index af6e901ba..5aa21a6d6 100644 --- a/libc/intrin/getmainstack.c +++ b/libc/intrin/getmainstack.c @@ -22,7 +22,7 @@ #include "libc/intrin/getauxval.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/maps.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/rlim.h" diff --git a/libc/intrin/getminsigstksz.c b/libc/intrin/getminsigstksz.c index cb87e441c..2718aa13d 100644 --- a/libc/intrin/getminsigstksz.c +++ b/libc/intrin/getminsigstksz.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/getauxval.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/ss.h" diff --git a/libc/intrin/interrupts.S b/libc/intrin/interrupts.S index 837973a18..f1b4298c5 100644 --- a/libc/intrin/interrupts.S +++ b/libc/intrin/interrupts.S @@ -26,7 +26,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/intrin/kprintf.h" #include "libc/runtime/pc.internal.h" diff --git a/libc/intrin/kclocknames.S b/libc/intrin/kclocknames.S index 9a4ba9d6a..aed7d28c4 100644 --- a/libc/intrin/kclocknames.S +++ b/libc/intrin/kclocknames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kClockNames diff --git a/libc/intrin/kdos2errno.S b/libc/intrin/kdos2errno.S index 8d3e824a7..e753485c4 100644 --- a/libc/intrin/kdos2errno.S +++ b/libc/intrin/kdos2errno.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // @fileoverview data structure for __dos2errno() // @see libc/sysv/dos2errno.sh for the numbers diff --git a/libc/intrin/kerrnodocs.S b/libc/intrin/kerrnodocs.S index 5bae4dd56..e2947b79a 100644 --- a/libc/intrin/kerrnodocs.S +++ b/libc/intrin/kerrnodocs.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kErrnoDocs diff --git a/libc/intrin/kerrnonames.S b/libc/intrin/kerrnonames.S index a79a52a13..078a60306 100644 --- a/libc/intrin/kerrnonames.S +++ b/libc/intrin/kerrnonames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e .long \e - kErrnoNames diff --git a/libc/intrin/kfcntlcmds.S b/libc/intrin/kfcntlcmds.S index 6eb1db6e1..6de1f427e 100644 --- a/libc/intrin/kfcntlcmds.S +++ b/libc/intrin/kfcntlcmds.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kFcntlCmds diff --git a/libc/intrin/kipoptnames.S b/libc/intrin/kipoptnames.S index f2a2ede1f..b8cd57dc3 100644 --- a/libc/intrin/kipoptnames.S +++ b/libc/intrin/kipoptnames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kIpOptnames diff --git a/libc/intrin/kmonthname.S b/libc/intrin/kmonthname.S index e9a4984d0..bf47c7622 100644 --- a/libc/intrin/kmonthname.S +++ b/libc/intrin/kmonthname.S @@ -7,7 +7,7 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif -#include "libc/macros.internal.h" +#include "libc/macros.h" // extern const char kMonthName[12][10]; .section .rodata,"a",@progbits diff --git a/libc/intrin/kmonthnameshort.S b/libc/intrin/kmonthnameshort.S index 4f1874086..573f1bc6a 100644 --- a/libc/intrin/kmonthnameshort.S +++ b/libc/intrin/kmonthnameshort.S @@ -7,7 +7,7 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif -#include "libc/macros.internal.h" +#include "libc/macros.h" // Type #1: // - Indexable C-String Array diff --git a/libc/intrin/kopenflags.S b/libc/intrin/kopenflags.S index bc6691990..7927fbacd 100644 --- a/libc/intrin/kopenflags.S +++ b/libc/intrin/kopenflags.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kOpenFlags diff --git a/libc/intrin/kpollnames.S b/libc/intrin/kpollnames.S index 21e0d4038..76fbc4b00 100644 --- a/libc/intrin/kpollnames.S +++ b/libc/intrin/kpollnames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kPollNames diff --git a/libc/intrin/kprintf.greg.c b/libc/intrin/kprintf.greg.c index 21eac26a6..ee9f6a539 100644 --- a/libc/intrin/kprintf.greg.c +++ b/libc/intrin/kprintf.greg.c @@ -53,7 +53,7 @@ #include "libc/stdckdint.h" #include "libc/stdio/sysparam.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/utf16.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/consts/f.h" diff --git a/libc/intrin/krlimitnames.S b/libc/intrin/krlimitnames.S index 46c6f5dd1..e7f0e788b 100644 --- a/libc/intrin/krlimitnames.S +++ b/libc/intrin/krlimitnames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kRlimitNames diff --git a/libc/intrin/ksignalnames.S b/libc/intrin/ksignalnames.S index 19ad59e9c..6dbc09c01 100644 --- a/libc/intrin/ksignalnames.S +++ b/libc/intrin/ksignalnames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kSignalNames diff --git a/libc/intrin/ksockoptnames.S b/libc/intrin/ksockoptnames.S index 90d592788..4ac81066c 100644 --- a/libc/intrin/ksockoptnames.S +++ b/libc/intrin/ksockoptnames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kSockOptnames diff --git a/libc/intrin/ktcpoptnames.S b/libc/intrin/ktcpoptnames.S index d4ab2fdbe..314c6b16b 100644 --- a/libc/intrin/ktcpoptnames.S +++ b/libc/intrin/ktcpoptnames.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .macro .e e s .long \e - kTcpOptnames diff --git a/libc/intrin/kweekdayname.S b/libc/intrin/kweekdayname.S index 0fa2d967c..835b8bfe9 100644 --- a/libc/intrin/kweekdayname.S +++ b/libc/intrin/kweekdayname.S @@ -7,7 +7,7 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif -#include "libc/macros.internal.h" +#include "libc/macros.h" // extern const char kWeekdayName[7][10]; .section .rodata,"a",@progbits diff --git a/libc/intrin/kweekdaynameshort.S b/libc/intrin/kweekdaynameshort.S index 14a37b1bd..05886838f 100644 --- a/libc/intrin/kweekdaynameshort.S +++ b/libc/intrin/kweekdaynameshort.S @@ -7,7 +7,7 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif -#include "libc/macros.internal.h" +#include "libc/macros.h" // Type #1: // - Indexable C-String Array diff --git a/libc/intrin/leaky.S b/libc/intrin/leaky.S index b9ba43ed2..45b034ffd 100644 --- a/libc/intrin/leaky.S +++ b/libc/intrin/leaky.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Decentralized section for leaky functions. .section .piro.relo.sort.leaky.1,"aw",@progbits diff --git a/libc/intrin/maps_init.S b/libc/intrin/maps_init.S index 56f2c7f63..134ed77f7 100644 --- a/libc/intrin/maps_init.S +++ b/libc/intrin/maps_init.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .init.start 301,_init_maps push %rdi diff --git a/libc/intrin/mman.greg.c b/libc/intrin/mman.greg.c index 8d7f17449..07059f919 100644 --- a/libc/intrin/mman.greg.c +++ b/libc/intrin/mman.greg.c @@ -36,7 +36,7 @@ #include "libc/assert.h" #include "libc/elf/def.h" #include "libc/elf/struct/phdr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/uart.internal.h" #include "libc/runtime/e820.internal.h" #include "libc/runtime/metalprintf.internal.h" diff --git a/libc/intrin/msync.c b/libc/intrin/msync.c index d3e43e26d..3d241c7a2 100644 --- a/libc/intrin/msync.c +++ b/libc/intrin/msync.c @@ -25,7 +25,7 @@ #include "libc/dce.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/errfuns.h" /** diff --git a/libc/intrin/packsswb.c b/libc/intrin/packsswb.c index da3fa67b9..84ae0b712 100644 --- a/libc/intrin/packsswb.c +++ b/libc/intrin/packsswb.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/packsswb.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" /** diff --git a/libc/intrin/packuswb.c b/libc/intrin/packuswb.c index 66d9c766f..c4200a3e8 100644 --- a/libc/intrin/packuswb.c +++ b/libc/intrin/packuswb.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/packuswb.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" /** diff --git a/libc/intrin/pagesize_init.S b/libc/intrin/pagesize_init.S index 5c1cda3fa..bb9a8188e 100644 --- a/libc/intrin/pagesize_init.S +++ b/libc/intrin/pagesize_init.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .init.start 251,_init_pagesize push %rdi diff --git a/libc/intrin/palignr.c b/libc/intrin/palignr.c index 2f4474076..549d339aa 100644 --- a/libc/intrin/palignr.c +++ b/libc/intrin/palignr.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/palignr.h" #include "libc/assert.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Overlaps vectors. diff --git a/libc/intrin/palignrs.S b/libc/intrin/palignrs.S index 9eeee072f..6d8b8225f 100644 --- a/libc/intrin/palignrs.S +++ b/libc/intrin/palignrs.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Jump table for palignr() with non-constexpr immediate parameter. // diff --git a/libc/intrin/pmaddubsw.c b/libc/intrin/pmaddubsw.c index f2bdc9b58..9f730f029 100644 --- a/libc/intrin/pmaddubsw.c +++ b/libc/intrin/pmaddubsw.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/pmaddubsw.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" /** diff --git a/libc/intrin/printmaps.c b/libc/intrin/printmaps.c index d9eaa32af..48a84127d 100644 --- a/libc/intrin/printmaps.c +++ b/libc/intrin/printmaps.c @@ -21,7 +21,7 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/maps.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/memtrack.internal.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/auxv.h" diff --git a/libc/intrin/pthread_atfork_actual.c b/libc/intrin/pthread_atfork_actual.c index 815517206..505cbdc96 100644 --- a/libc/intrin/pthread_atfork_actual.c +++ b/libc/intrin/pthread_atfork_actual.c @@ -24,7 +24,7 @@ #include "libc/intrin/atomic.h" #include "libc/intrin/dll.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/proc/proc.internal.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/intrin/pushpop.h b/libc/intrin/pushpop.h index 2f693e542..17f551ac4 100644 --- a/libc/intrin/pushpop.h +++ b/libc/intrin/pushpop.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_ #define COSMOPOLITAN_LIBC_BITS_PUSHPOP_H_ #ifdef _COSMO_SOURCE -#include "libc/macros.internal.h" +#include "libc/macros.h" #if !defined(__GNUC__) || defined(__STRICT_ANSI__) || !defined(__x86_64__) || \ !defined(__MNO_RED_ZONE__) diff --git a/libc/intrin/reservefd.c b/libc/intrin/reservefd.c index e751c1dd6..84345b23d 100644 --- a/libc/intrin/reservefd.c +++ b/libc/intrin/reservefd.c @@ -22,7 +22,7 @@ #include "libc/intrin/atomic.h" #include "libc/intrin/cmpxchg.h" #include "libc/intrin/extend.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/memtrack.internal.h" #include "libc/str/str.h" #include "libc/sysv/consts/map.h" diff --git a/libc/intrin/safemacros.h b/libc/intrin/safemacros.h index 443843f37..8fe6613f4 100644 --- a/libc/intrin/safemacros.h +++ b/libc/intrin/safemacros.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ #define COSMOPOLITAN_LIBC_BITS_SAFEMACROS_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" COSMOPOLITAN_C_START_ diff --git a/libc/intrin/sizefmt.c b/libc/intrin/sizefmt.c index a3cb8ea6b..14e52c9f9 100644 --- a/libc/intrin/sizefmt.c +++ b/libc/intrin/sizefmt.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/itoa.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Represents size as readable string. diff --git a/libc/intrin/stackcall.S b/libc/intrin/stackcall.S index 6ad9bc8ec..6e3658a47 100644 --- a/libc/intrin/stackcall.S +++ b/libc/intrin/stackcall.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Calls function on different stack. // diff --git a/libc/intrin/stackchkguard.S b/libc/intrin/stackchkguard.S index b78117a5d..f35484a8e 100644 --- a/libc/intrin/stackchkguard.S +++ b/libc/intrin/stackchkguard.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Canary for -fstack-protector. // diff --git a/libc/intrin/strerror.c b/libc/intrin/strerror.c index a465c5c7d..89110783e 100644 --- a/libc/intrin/strerror.c +++ b/libc/intrin/strerror.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/fmt/magnumstrs.internal.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/str/str.h" alignas(1) static char strerror_buf[128]; diff --git a/libc/intrin/sys_sched_yield.S b/libc/intrin/sys_sched_yield.S index eab709511..2bfaa7ccb 100644 --- a/libc/intrin/sys_sched_yield.S +++ b/libc/intrin/sys_sched_yield.S @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/sysv/consts/nr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" // Relinquishes scheduled quantum. // diff --git a/libc/intrin/sys_set_tls.S b/libc/intrin/sys_set_tls.S index e013014b5..4f8130521 100644 --- a/libc/intrin/sys_set_tls.S +++ b/libc/intrin/sys_set_tls.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // we can't allow ftrace here since ftrace needs tls sys_set_tls: diff --git a/libc/intrin/typeinfo.S b/libc/intrin/typeinfo.S index e195c73c3..0b35f0f72 100644 --- a/libc/intrin/typeinfo.S +++ b/libc/intrin/typeinfo.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // __cxxabiv1::__function_type_info (?) // Because Clang in MODE=dbg doesn't respect -fno-rtti diff --git a/libc/irq/acpi-fadt-init.S b/libc/irq/acpi-fadt-init.S index e58410cc3..de1038be3 100644 --- a/libc/irq/acpi-fadt-init.S +++ b/libc/irq/acpi-fadt-init.S @@ -26,7 +26,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/irq/acpi.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/pc.internal.h" .init.start 312,_init_acpi_fadt diff --git a/libc/irq/acpi-madt-init.S b/libc/irq/acpi-madt-init.S index 3a3b473d1..6bfbddbf5 100644 --- a/libc/irq/acpi-madt-init.S +++ b/libc/irq/acpi-madt-init.S @@ -26,7 +26,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/irq/acpi.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/pc.internal.h" .init.start 311,_init_acpi_madt diff --git a/libc/irq/acpi-xsdt-init.S b/libc/irq/acpi-xsdt-init.S index 2275dc8d3..98f7db6a3 100644 --- a/libc/irq/acpi-xsdt-init.S +++ b/libc/irq/acpi-xsdt-init.S @@ -26,7 +26,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/irq/acpi.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/pc.internal.h" .init.start 310,_init_acpi_xsdt diff --git a/libc/irq/acpi-xsdt.c b/libc/irq/acpi-xsdt.c index 94dc50a82..44c2a6da5 100644 --- a/libc/irq/acpi-xsdt.c +++ b/libc/irq/acpi-xsdt.c @@ -30,7 +30,7 @@ #include "libc/intrin/kprintf.h" #include "libc/irq/acpi.internal.h" #include "libc/log/color.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/efi.h" #include "libc/runtime/pc.internal.h" #include "libc/serialize.h" diff --git a/libc/iso646.internal.h b/libc/iso646.h similarity index 100% rename from libc/iso646.internal.h rename to libc/iso646.h diff --git a/libc/isystem/complex.h b/libc/isystem/complex.h index bd8c4569b..80c28cbf4 100644 --- a/libc/isystem/complex.h +++ b/libc/isystem/complex.h @@ -1,6 +1,6 @@ #ifndef _COMPLEX_H #define _COMPLEX_H #include "libc/complex.h" -#include "libc/imag.internal.h" +#include "libc/imag.h" #include "libc/math.h" #endif /* _COMPLEX_H */ diff --git a/libc/isystem/iso646.h b/libc/isystem/iso646.h index 5d203df5f..11e3a77c9 100644 --- a/libc/isystem/iso646.h +++ b/libc/isystem/iso646.h @@ -1,4 +1,4 @@ #ifndef _ISO646_H #define _ISO646_H -#include "libc/iso646.internal.h" +#include "libc/iso646.h" #endif /* _ISO646_H */ diff --git a/libc/isystem/stdalign.h b/libc/isystem/stdalign.h index 16874814a..9aeebe101 100644 --- a/libc/isystem/stdalign.h +++ b/libc/isystem/stdalign.h @@ -1,4 +1,4 @@ #ifndef _STDALIGN_H #define _STDALIGN_H -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #endif /* _STDALIGN_H */ diff --git a/libc/isystem/tgmath.h b/libc/isystem/tgmath.h index 28d124486..8721bb944 100644 --- a/libc/isystem/tgmath.h +++ b/libc/isystem/tgmath.h @@ -1,7 +1,7 @@ #ifndef _TGMATH_H #define _TGMATH_H #include "libc/complex.h" -#include "libc/imag.internal.h" +#include "libc/imag.h" #include "libc/math.h" #if __STDC_VERSION__ + 0 >= 201112 diff --git a/libc/log/backtrace3.c b/libc/log/backtrace3.c index a49240bce..967a31a2b 100644 --- a/libc/log/backtrace3.c +++ b/libc/log/backtrace3.c @@ -24,7 +24,7 @@ #include "libc/intrin/kprintf.h" #include "libc/intrin/weaken.h" #include "libc/log/backtrace.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/gc.internal.h" #include "libc/nexgen32e/stackframe.h" #include "libc/runtime/memtrack.internal.h" diff --git a/libc/log/check.h b/libc/log/check.h index f4fda0c01..fa482304b 100644 --- a/libc/log/check.h +++ b/libc/log/check.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_LIBC_LOG_CHECK_H_ #define COSMOPOLITAN_LIBC_LOG_CHECK_H_ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" COSMOPOLITAN_C_START_ #define CHECK(X, ...) __CHK(ne, !=, false, "false", !!(X), #X, "" __VA_ARGS__) diff --git a/libc/log/countbranch.h b/libc/log/countbranch.h index 403a0c98e..7476e7b41 100644 --- a/libc/log/countbranch.h +++ b/libc/log/countbranch.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_LOG_COUNTBRANCH_H_ #define COSMOPOLITAN_LIBC_LOG_COUNTBRANCH_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdbool.h" COSMOPOLITAN_C_START_ diff --git a/libc/log/countbranch_data.S b/libc/log/countbranch_data.S index eaf3dc078..a0063f7a4 100644 --- a/libc/log/countbranch_data.S +++ b/libc/log/countbranch_data.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .yoink countbranch_report diff --git a/libc/log/countbranch_report.c b/libc/log/countbranch_report.c index a152dbc07..2e1c88158 100644 --- a/libc/log/countbranch_report.c +++ b/libc/log/countbranch_report.c @@ -19,7 +19,7 @@ #include "libc/calls/calls.h" #include "libc/intrin/kprintf.h" #include "libc/log/countbranch.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/alg.h" #include "libc/runtime/runtime.h" diff --git a/libc/log/countexpr.h b/libc/log/countexpr.h index 51104bcbe..84e0be7fc 100644 --- a/libc/log/countexpr.h +++ b/libc/log/countexpr.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_LOG_COUNTEXPR_H_ #define COSMOPOLITAN_LIBC_LOG_COUNTEXPR_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/bench.h" COSMOPOLITAN_C_START_ diff --git a/libc/log/countexpr_data.S b/libc/log/countexpr_data.S index 72db2252f..2546e06a1 100644 --- a/libc/log/countexpr_data.S +++ b/libc/log/countexpr_data.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .yoink countexpr_report diff --git a/libc/log/countexpr_report.c b/libc/log/countexpr_report.c index 75be60857..e8f151d7f 100644 --- a/libc/log/countexpr_report.c +++ b/libc/log/countexpr_report.c @@ -21,7 +21,7 @@ #include "libc/intrin/kprintf.h" #include "libc/limits.h" #include "libc/log/countexpr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/runtime/runtime.h" #include "libc/stdckdint.h" diff --git a/libc/log/libfatal.internal.h b/libc/log/libfatal.internal.h index 4c55269c4..bd10073a1 100644 --- a/libc/log/libfatal.internal.h +++ b/libc/log/libfatal.internal.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_LOG_LIBFATAL_INTERNAL_H_ #define COSMOPOLITAN_LIBC_LOG_LIBFATAL_INTERNAL_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" COSMOPOLITAN_C_START_ forceinline unsigned long __strlen(const char *s) { diff --git a/libc/log/oncrash_amd64.c b/libc/log/oncrash_amd64.c index e55cfa7e5..3d174a947 100644 --- a/libc/log/oncrash_amd64.c +++ b/libc/log/oncrash_amd64.c @@ -41,7 +41,7 @@ #include "libc/log/gdb.h" #include "libc/log/internal.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/alloca.h" #include "libc/nexgen32e/stackframe.h" diff --git a/libc/log/oncrash_arm64.c b/libc/log/oncrash_arm64.c index d22062c71..6658a7c84 100644 --- a/libc/log/oncrash_arm64.c +++ b/libc/log/oncrash_arm64.c @@ -41,7 +41,7 @@ #include "libc/intrin/kprintf.h" #include "libc/log/internal.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/stackframe.h" #include "libc/runtime/memtrack.internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/log/printwindowsmemory.c b/libc/log/printwindowsmemory.c index ed9a4a145..a305aae67 100644 --- a/libc/log/printwindowsmemory.c +++ b/libc/log/printwindowsmemory.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/memflags.h" #include "libc/nt/memory.h" #include "libc/nt/struct/memorybasicinformation.h" diff --git a/libc/log/showcrashreportsearly.S b/libc/log/showcrashreportsearly.S index 757414263..dfc41fe19 100644 --- a/libc/log/showcrashreportsearly.S +++ b/libc/log/showcrashreportsearly.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Normally we call ShowCrashReports() from main, but if // there's a crash in a constructor, this will help with diff --git a/libc/log/watch-hook.S b/libc/log/watch-hook.S index e73da1dc8..c8b99ba55 100644 --- a/libc/log/watch-hook.S +++ b/libc/log/watch-hook.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" __watch_hook: push %rbp diff --git a/libc/mach.internal.h b/libc/mach.h similarity index 100% rename from libc/mach.internal.h rename to libc/mach.h diff --git a/libc/macho.internal.h b/libc/macho.h similarity index 100% rename from libc/macho.internal.h rename to libc/macho.h diff --git a/libc/macros.internal.h b/libc/macros.h similarity index 100% rename from libc/macros.internal.h rename to libc/macros.h diff --git a/libc/mem/aligned_alloc.c b/libc/mem/aligned_alloc.c index 3432bfbc7..27090f73e 100644 --- a/libc/mem/aligned_alloc.c +++ b/libc/mem/aligned_alloc.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" /** diff --git a/libc/mem/mergesort.c b/libc/mem/mergesort.c index 400b6dfe3..b79e67756 100644 --- a/libc/mem/mergesort.c +++ b/libc/mem/mergesort.c @@ -28,7 +28,7 @@ │ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF │ │ SUCH DAMAGE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/mem.h" #include "libc/str/str.h" diff --git a/libc/mem/posix_memalign.c b/libc/mem/posix_memalign.c index 32f9411aa..4cc5b65cb 100644 --- a/libc/mem/posix_memalign.c +++ b/libc/mem/posix_memalign.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" /** diff --git a/libc/mem/putenv.c b/libc/mem/putenv.c index 9a096673c..423b3eb69 100644 --- a/libc/mem/putenv.c +++ b/libc/mem/putenv.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/getenv.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/internal.h" #include "libc/mem/leaks.h" #include "libc/mem/mem.h" diff --git a/libc/mem/qsort.c b/libc/mem/qsort.c index 361f26a86..0a2c1e550 100644 --- a/libc/mem/qsort.c +++ b/libc/mem/qsort.c @@ -28,7 +28,7 @@ │ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF │ │ SUCH DAMAGE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/str/str.h" __static_yoink("openbsd_sorting_notice"); diff --git a/libc/mem/tinymalloc.inc b/libc/mem/tinymalloc.inc index f726fcd76..450bb3c5e 100644 --- a/libc/mem/tinymalloc.inc +++ b/libc/mem/tinymalloc.inc @@ -17,7 +17,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/mem/mem.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/stdckdint.h" #include "libc/str/str.h" diff --git a/libc/nexgen32e/argc.S b/libc/nexgen32e/argc.S index 9e85f4409..165c05447 100644 --- a/libc/nexgen32e/argc.S +++ b/libc/nexgen32e/argc.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .initbss 300,_init_argc // Global variable holding _start(argc) parameter. diff --git a/libc/nexgen32e/argv.S b/libc/nexgen32e/argv.S index 9ee093476..7963698c8 100644 --- a/libc/nexgen32e/argv.S +++ b/libc/nexgen32e/argv.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .initbss 300,_init_argv // Global variable holding _start(argv) parameter. diff --git a/libc/nexgen32e/auxv.S b/libc/nexgen32e/auxv.S index e750b74fe..52381e1c6 100644 --- a/libc/nexgen32e/auxv.S +++ b/libc/nexgen32e/auxv.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .initbss 250,_init_auxv // Global variable holding _start(auxv) parameter. diff --git a/libc/nexgen32e/checkstackalign.S b/libc/nexgen32e/checkstackalign.S index 18d360507..abe8dae61 100644 --- a/libc/nexgen32e/checkstackalign.S +++ b/libc/nexgen32e/checkstackalign.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Checks that stack is 16-byte aligned. // diff --git a/libc/nexgen32e/djbsort-avx2.S b/libc/nexgen32e/djbsort-avx2.S index 70e24cbdd..8f51d678e 100644 --- a/libc/nexgen32e/djbsort-avx2.S +++ b/libc/nexgen32e/djbsort-avx2.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" // D.J. Bernstein's outrageously fast integer sorting algorithm. // diff --git a/libc/nexgen32e/environ.S b/libc/nexgen32e/environ.S index d1419a52c..dc3cb2d34 100644 --- a/libc/nexgen32e/environ.S +++ b/libc/nexgen32e/environ.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Environment variable pointer list. .bss diff --git a/libc/nexgen32e/gc.S b/libc/nexgen32e/gc.S index 6b60ae240..4fb1ebff5 100644 --- a/libc/nexgen32e/gc.S +++ b/libc/nexgen32e/gc.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/dce.h" nop diff --git a/libc/nexgen32e/gclongjmp.S b/libc/nexgen32e/gclongjmp.S index 1fb68131b..88f534e10 100644 --- a/libc/nexgen32e/gclongjmp.S +++ b/libc/nexgen32e/gclongjmp.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Jumps up stack to previous setjmp() invocation. // diff --git a/libc/nexgen32e/identity.S b/libc/nexgen32e/identity.S index 7fc23e4d8..804b65bda 100644 --- a/libc/nexgen32e/identity.S +++ b/libc/nexgen32e/identity.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // The identity() function. // @return first argument diff --git a/libc/nexgen32e/kbase36.c b/libc/nexgen32e/kbase36.c index 8a105da1c..d490a966b 100644 --- a/libc/nexgen32e/kbase36.c +++ b/libc/nexgen32e/kbase36.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/stdalign.internal.h" -#include "libc/str/tab.internal.h" +#include "libc/stdalign.h" +#include "libc/str/tab.h" alignas(uint8_t) const uint8_t kBase36[256] = { ['0'] = 1, // diff --git a/libc/nexgen32e/kcp437.S b/libc/nexgen32e/kcp437.S index 084313d8e..36f5bf28d 100644 --- a/libc/nexgen32e/kcp437.S +++ b/libc/nexgen32e/kcp437.S @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/str/tab.internal.h" -#include "libc/macros.internal.h" +#include "libc/str/tab.h" +#include "libc/macros.h" .rodata .balign 2 diff --git a/libc/nexgen32e/kcpuids.S b/libc/nexgen32e/kcpuids.S index adc6ef5d1..6cb2f1248 100644 --- a/libc/nexgen32e/kcpuids.S +++ b/libc/nexgen32e/kcpuids.S @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/runtime/pc.internal.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/kcpuids.h" #include "libc/nexgen32e/x86feature.h" diff --git a/libc/nexgen32e/khalfcache3.S b/libc/nexgen32e/khalfcache3.S index 2d53f7167..b6e6c7a3b 100644 --- a/libc/nexgen32e/khalfcache3.S +++ b/libc/nexgen32e/khalfcache3.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __x86_64__ diff --git a/libc/nexgen32e/ksha256.S b/libc/nexgen32e/ksha256.S index 0df26986e..58056ee47 100644 --- a/libc/nexgen32e/ksha256.S +++ b/libc/nexgen32e/ksha256.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata .balign 64 diff --git a/libc/nexgen32e/ksha512.S b/libc/nexgen32e/ksha512.S index 1d9450a8c..f039aa0c2 100644 --- a/libc/nexgen32e/ksha512.S +++ b/libc/nexgen32e/ksha512.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata .balign 64 diff --git a/libc/nexgen32e/ktensindex.S b/libc/nexgen32e/ktensindex.S index 0840a17db..7d9081c0c 100644 --- a/libc/nexgen32e/ktensindex.S +++ b/libc/nexgen32e/ktensindex.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata kTensIndex: diff --git a/libc/nexgen32e/ktolower.c b/libc/nexgen32e/ktolower.c index db169897e..40bf0127c 100644 --- a/libc/nexgen32e/ktolower.c +++ b/libc/nexgen32e/ktolower.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/stdalign.internal.h" -#include "libc/str/tab.internal.h" +#include "libc/stdalign.h" +#include "libc/str/tab.h" alignas(uint8_t) const uint8_t kToLower[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, diff --git a/libc/nexgen32e/ktoupper.c b/libc/nexgen32e/ktoupper.c index 86e688a85..4c57cda9b 100644 --- a/libc/nexgen32e/ktoupper.c +++ b/libc/nexgen32e/ktoupper.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/stdalign.internal.h" -#include "libc/str/tab.internal.h" +#include "libc/stdalign.h" +#include "libc/str/tab.h" alignas(uint8_t) const uint8_t kToUpper[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, diff --git a/libc/nexgen32e/longjmp.S b/libc/nexgen32e/longjmp.S index 985a2d657..aa4e0cfc7 100644 --- a/libc/nexgen32e/longjmp.S +++ b/libc/nexgen32e/longjmp.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Loads previously saved processor state. // diff --git a/libc/nexgen32e/mcount.S b/libc/nexgen32e/mcount.S index 27076f1f6..f95b46cee 100644 --- a/libc/nexgen32e/mcount.S +++ b/libc/nexgen32e/mcount.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Function Profiling Hook. // cc -pg adds this to the start of global functions. diff --git a/libc/nexgen32e/mul4x4adx.S b/libc/nexgen32e/mul4x4adx.S index 67d7f7216..55643f75a 100644 --- a/libc/nexgen32e/mul4x4adx.S +++ b/libc/nexgen32e/mul4x4adx.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Computes 512-bit product of 256-bit and 256-bit numbers. // diff --git a/libc/nexgen32e/mul6x6adx.S b/libc/nexgen32e/mul6x6adx.S index e0213a389..204bb4444 100644 --- a/libc/nexgen32e/mul6x6adx.S +++ b/libc/nexgen32e/mul6x6adx.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Computes 768-bit product of 384-bit and 384-bit numbers. // diff --git a/libc/nexgen32e/mul8x8adx.S b/libc/nexgen32e/mul8x8adx.S index f83450d22..d4eeb0269 100644 --- a/libc/nexgen32e/mul8x8adx.S +++ b/libc/nexgen32e/mul8x8adx.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Computes 1024-bit product of 512-bit and 512-bit numbers. // diff --git a/libc/nexgen32e/nt2sysv.S b/libc/nexgen32e/nt2sysv.S index ca9d87c19..e4461d1bb 100644 --- a/libc/nexgen32e/nt2sysv.S +++ b/libc/nexgen32e/nt2sysv.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.windows // Translates function call from code built w/ MS-style compiler. diff --git a/libc/nexgen32e/program_invocation_name.S b/libc/nexgen32e/program_invocation_name.S index a5cd491d6..ab82db0b5 100644 --- a/libc/nexgen32e/program_invocation_name.S +++ b/libc/nexgen32e/program_invocation_name.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .initbss 300,_init_program_invocation_name // Supplies argv[0] the GNU way. diff --git a/libc/nexgen32e/rldecode.S b/libc/nexgen32e/rldecode.S index 06fcba57e..74d150faf 100644 --- a/libc/nexgen32e/rldecode.S +++ b/libc/nexgen32e/rldecode.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.startup // Thirteen byte decompressor. diff --git a/libc/nexgen32e/setjmp.S b/libc/nexgen32e/setjmp.S index 0dfac7df9..7f795ed4a 100644 --- a/libc/nexgen32e/setjmp.S +++ b/libc/nexgen32e/setjmp.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Saves cpu state. // diff --git a/libc/nexgen32e/sha1.S b/libc/nexgen32e/sha1.S index 1016c0498..34ecfd2fe 100644 --- a/libc/nexgen32e/sha1.S +++ b/libc/nexgen32e/sha1.S @@ -31,7 +31,7 @@ │ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .section .notice,"aR",@progbits .asciz "\n\n\ diff --git a/libc/nexgen32e/sha1ni.S b/libc/nexgen32e/sha1ni.S index 223f5f25d..cfbc9f7bd 100644 --- a/libc/nexgen32e/sha1ni.S +++ b/libc/nexgen32e/sha1ni.S @@ -31,7 +31,7 @@ │ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .section .notice,"aR",@progbits .asciz "\n\n\ diff --git a/libc/nexgen32e/sha256.S b/libc/nexgen32e/sha256.S index df175bf5b..fd5e42030 100644 --- a/libc/nexgen32e/sha256.S +++ b/libc/nexgen32e/sha256.S @@ -47,7 +47,7 @@ ///////////////////////////////////////////////////////////////////////// // This code schedules 2 blocks at a time, with 4 lanes per block ///////////////////////////////////////////////////////////////////////// -#include "libc/macros.internal.h" +#include "libc/macros.h" .section .notice,"aR",@progbits .asciz "\n\n\ diff --git a/libc/nexgen32e/sha256ni.S b/libc/nexgen32e/sha256ni.S index eb020d706..736524822 100644 --- a/libc/nexgen32e/sha256ni.S +++ b/libc/nexgen32e/sha256ni.S @@ -31,7 +31,7 @@ │ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .section .notice,"aR",@progbits .asciz "\n\n\ diff --git a/libc/nexgen32e/sha512.S b/libc/nexgen32e/sha512.S index 6e36d6d1b..34f7c5fbb 100644 --- a/libc/nexgen32e/sha512.S +++ b/libc/nexgen32e/sha512.S @@ -48,7 +48,7 @@ ///////////////////////////////////////////////////////////////////////// // This code schedules 1 blocks at a time, with 4 lanes per block ///////////////////////////////////////////////////////////////////////// -#include "libc/macros.internal.h" +#include "libc/macros.h" .section .notice,"aR",@progbits .asciz "\n\n\ diff --git a/libc/nexgen32e/xmm.S b/libc/nexgen32e/xmm.S index ef3658a2b..e944d6253 100644 --- a/libc/nexgen32e/xmm.S +++ b/libc/nexgen32e/xmm.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .privileged __xmm_save: diff --git a/libc/nexgen32e/zip.S b/libc/nexgen32e/zip.S index 313f84e2d..b15142f06 100644 --- a/libc/nexgen32e/zip.S +++ b/libc/nexgen32e/zip.S @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "ape/relocations.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" .section .zip.eocd,"",@progbits // ZIP End Of Central Directory (EOCD) record. diff --git a/libc/nt/ntdllimport.S b/libc/nt/ntdllimport.S index b84411560..438f340f9 100644 --- a/libc/nt/ntdllimport.S +++ b/libc/nt/ntdllimport.S @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/nt/enum/status.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __x86_64__ // @fileoverview NTDLL.DLL Non-Mandatory Importer diff --git a/libc/nt/ntdllimport.h b/libc/nt/ntdllimport.h index 6eb8e93f6..657ed05ea 100644 --- a/libc/nt/ntdllimport.h +++ b/libc/nt/ntdllimport.h @@ -19,7 +19,7 @@ #ifndef COSMOPOLITAN_LIBC_NT_NTDLLIMPORT_H_ #define COSMOPOLITAN_LIBC_NT_NTDLLIMPORT_H_ #include "ape/relocations.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __ASSEMBLER__ /* clang-format off */ diff --git a/libc/proc/cocmd.c b/libc/proc/cocmd.c index 4632ab559..5345b13b8 100644 --- a/libc/proc/cocmd.c +++ b/libc/proc/cocmd.c @@ -29,7 +29,7 @@ #include "libc/intrin/getenv.h" #include "libc/intrin/weaken.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/serialize.h" #include "libc/stdio/stdio.h" diff --git a/libc/proc/fork-nt.c b/libc/proc/fork-nt.c index 19a22a16e..996aff0fa 100644 --- a/libc/proc/fork-nt.c +++ b/libc/proc/fork-nt.c @@ -32,7 +32,7 @@ #include "libc/intrin/strace.h" #include "libc/intrin/tree.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/createfile.h" #include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/creationdisposition.h" diff --git a/libc/proc/nice.c b/libc/proc/nice.c index 783ed4936..de243b93c 100644 --- a/libc/proc/nice.c +++ b/libc/proc/nice.c @@ -19,7 +19,7 @@ #include "libc/calls/calls.h" #include "libc/fmt/conv.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/prio.h" static int clamp(int p) { diff --git a/libc/proc/posix_spawnattr_getrlimit.c b/libc/proc/posix_spawnattr_getrlimit.c index 941e40889..cc2265998 100644 --- a/libc/proc/posix_spawnattr_getrlimit.c +++ b/libc/proc/posix_spawnattr_getrlimit.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/rlimit.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/proc/posix_spawn.h" #include "libc/proc/posix_spawn.internal.h" #include "libc/stdio/sysparam.h" diff --git a/libc/proc/posix_spawnattr_setrlimit.c b/libc/proc/posix_spawnattr_setrlimit.c index 0d0a7970b..dd15a74ec 100644 --- a/libc/proc/posix_spawnattr_setrlimit.c +++ b/libc/proc/posix_spawnattr_setrlimit.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/rlimit.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/proc/posix_spawn.h" #include "libc/proc/posix_spawn.internal.h" #include "libc/sysv/consts/rlim.h" diff --git a/libc/proc/vfork.S b/libc/proc/vfork.S index 39d7ae6e2..e9b791127 100644 --- a/libc/proc/vfork.S +++ b/libc/proc/vfork.S @@ -19,7 +19,7 @@ #include "libc/dce.h" #include "libc/intrin/strace.h" #include "libc/thread/tls.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" // Forks process without copying page tables. // diff --git a/libc/runtime/at_quick_exit.c b/libc/runtime/at_quick_exit.c index 4786d801b..26c1c86af 100644 --- a/libc/runtime/at_quick_exit.c +++ b/libc/runtime/at_quick_exit.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/atomic.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/thread/thread.h" diff --git a/libc/runtime/clone-linux.S b/libc/runtime/clone-linux.S index 2863daac8..8ac10c89b 100644 --- a/libc/runtime/clone-linux.S +++ b/libc/runtime/clone-linux.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .privileged // Invokes clone() system call on GNU/Systemd. diff --git a/libc/runtime/clone-openbsd.S b/libc/runtime/clone-openbsd.S index a1a9feb78..daa3cde0c 100644 --- a/libc/runtime/clone-openbsd.S +++ b/libc/runtime/clone-openbsd.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #define SYS___tfork 8 diff --git a/libc/runtime/clone-xnu.S b/libc/runtime/clone-xnu.S index fea63d203..66b1c4283 100644 --- a/libc/runtime/clone-xnu.S +++ b/libc/runtime/clone-xnu.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" sys_clone_xnu: mov $0x02000168,%eax # bsdthread_create diff --git a/libc/runtime/clone.c b/libc/runtime/clone.c index a1918a1c7..3f2f822dd 100644 --- a/libc/runtime/clone.c +++ b/libc/runtime/clone.c @@ -32,7 +32,7 @@ #include "libc/intrin/ulock.h" #include "libc/intrin/weaken.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alloca.h" #include "libc/nt/enum/processcreationflags.h" #include "libc/nt/runtime.h" @@ -45,7 +45,7 @@ #include "libc/runtime/stack.h" #include "libc/runtime/syslib.internal.h" #include "libc/sock/internal.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/stdio/sysparam.h" #include "libc/str/str.h" #include "libc/sysv/consts/arch.h" diff --git a/libc/runtime/cosmo.S b/libc/runtime/cosmo.S index 07b6c459f..0b52e57d6 100644 --- a/libc/runtime/cosmo.S +++ b/libc/runtime/cosmo.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/map.h" #include "libc/intrin/strace.h" diff --git a/libc/runtime/cosmo2.c b/libc/runtime/cosmo2.c index ccd926192..d2a80c66e 100644 --- a/libc/runtime/cosmo2.c +++ b/libc/runtime/cosmo2.c @@ -24,7 +24,7 @@ #include "libc/intrin/maps.h" #include "libc/intrin/strace.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/runtime/internal.h" #include "libc/runtime/memtrack.internal.h" diff --git a/libc/runtime/efimain.greg.c b/libc/runtime/efimain.greg.c index 4ecda0eca..33aefcb21 100644 --- a/libc/runtime/efimain.greg.c +++ b/libc/runtime/efimain.greg.c @@ -21,7 +21,7 @@ #include "libc/dce.h" #include "libc/intrin/newbie.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/efi.h" #include "libc/nt/thunk/msabi.h" #include "libc/runtime/e820.internal.h" diff --git a/libc/runtime/efipostboot.S b/libc/runtime/efipostboot.S index 4a2f715de..6b3561562 100644 --- a/libc/runtime/efipostboot.S +++ b/libc/runtime/efipostboot.S @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "ape/relocations.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/pc.internal.h" .real diff --git a/libc/runtime/enable_tls.c b/libc/runtime/enable_tls.c index fb94950ff..3fc35201e 100644 --- a/libc/runtime/enable_tls.c +++ b/libc/runtime/enable_tls.c @@ -26,7 +26,7 @@ #include "libc/intrin/kprintf.h" #include "libc/intrin/maps.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/files.h" #include "libc/nt/process.h" #include "libc/nt/runtime.h" @@ -35,7 +35,7 @@ #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" #include "libc/runtime/syslib.internal.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/str/locale.h" #include "libc/str/locale.internal.h" #include "libc/str/str.h" diff --git a/libc/runtime/findcombinary.c b/libc/runtime/findcombinary.c index 4c0084456..bc2214f8b 100644 --- a/libc/runtime/findcombinary.c +++ b/libc/runtime/findcombinary.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" #include "libc/sysv/consts/auxv.h" diff --git a/libc/runtime/fpreset.S b/libc/runtime/fpreset.S index 1a130ae18..ec817a942 100644 --- a/libc/runtime/fpreset.S +++ b/libc/runtime/fpreset.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Re-initializes FPU. .ftrace1 diff --git a/libc/runtime/ftrace-hook.S b/libc/runtime/ftrace-hook.S index 9340d7f73..3878c506d 100644 --- a/libc/runtime/ftrace-hook.S +++ b/libc/runtime/ftrace-hook.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .privileged ftrace_hook: diff --git a/libc/runtime/ftracer.c b/libc/runtime/ftracer.c index d2e686d3b..ca09b1d5a 100644 --- a/libc/runtime/ftracer.c +++ b/libc/runtime/ftracer.c @@ -21,7 +21,7 @@ #include "libc/fmt/itoa.h" #include "libc/intrin/cmpxchg.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/stackframe.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/runtime/getargmax.c b/libc/runtime/getargmax.c index 37ce64c83..a94a3fa7c 100644 --- a/libc/runtime/getargmax.c +++ b/libc/runtime/getargmax.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/sysparam.h" #include "libc/sysv/consts/_posix.h" diff --git a/libc/runtime/getinterpreterexecutablename.c b/libc/runtime/getinterpreterexecutablename.c index 6a93514d0..ba4069ccb 100644 --- a/libc/runtime/getinterpreterexecutablename.c +++ b/libc/runtime/getinterpreterexecutablename.c @@ -20,7 +20,7 @@ #include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" #include "libc/sysv/consts/at.h" diff --git a/libc/runtime/getlogin.c b/libc/runtime/getlogin.c index 73b8dec59..72f92bbb6 100644 --- a/libc/runtime/getlogin.c +++ b/libc/runtime/getlogin.c @@ -19,7 +19,7 @@ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/accounting.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/runtime/getlogin_r.c b/libc/runtime/getlogin_r.c index 4b2311b07..53950be9a 100644 --- a/libc/runtime/getlogin_r.c +++ b/libc/runtime/getlogin_r.c @@ -19,7 +19,7 @@ #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/accounting.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/runtime/getresourcelimit.c b/libc/runtime/getresourcelimit.c index d68b256b3..48e10be8e 100644 --- a/libc/runtime/getresourcelimit.c +++ b/libc/runtime/getresourcelimit.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/rlimit.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/rlim.h" long __get_rlimit(int resource) { diff --git a/libc/runtime/getsymboltable.c b/libc/runtime/getsymboltable.c index c3ad9552c..3ee47d5a3 100644 --- a/libc/runtime/getsymboltable.c +++ b/libc/runtime/getsymboltable.c @@ -23,14 +23,14 @@ #include "libc/intrin/promises.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" #include "libc/runtime/symbols.internal.h" #include "libc/runtime/zipos.internal.h" #include "libc/str/str.h" #include "libc/x/x.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/puff/puff.h" __static_yoink("__get_symbol"); diff --git a/libc/runtime/grow.c b/libc/runtime/grow.c index 1b865d499..27564d3c4 100644 --- a/libc/runtime/grow.c +++ b/libc/runtime/grow.c @@ -20,7 +20,7 @@ #include "libc/assert.h" #include "libc/fmt/conv.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdckdint.h" diff --git a/libc/runtime/hook.greg.c b/libc/runtime/hook.greg.c index 16596bf6a..d736eade2 100644 --- a/libc/runtime/hook.greg.c +++ b/libc/runtime/hook.greg.c @@ -19,7 +19,7 @@ #include "ape/sections.internal.h" #include "libc/calls/struct/sigset.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/symbols.internal.h" diff --git a/libc/runtime/inflate.c b/libc/runtime/inflate.c index c7a82fa0b..f3264a3fe 100644 --- a/libc/runtime/inflate.c +++ b/libc/runtime/inflate.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" #include "third_party/puff/puff.h" diff --git a/libc/runtime/init.S b/libc/runtime/init.S index a3922476b..1cf5e035b 100644 --- a/libc/runtime/init.S +++ b/libc/runtime/init.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/prot.h" #include "libc/dce.h" @@ -42,7 +42,7 @@ // @param r15 is envp (still callee saved) // @note rdi is __init_bss_start (callee monotonic lockstep) // @note rsi is __init_rodata_start (callee monotonic lockstep) -// @see .init.start & .init.end (libc/macros.internal.h) +// @see .init.start & .init.end (libc/macros.h) // @see ape/ape.lds .section .initprologue,"ax",@progbits .type _init,@function @@ -86,7 +86,7 @@ _init_check_rdi_rsi: // Decentralized section for packed data structures & initializers. // -// @see .initro (libc/macros.internal.h) +// @see .initro (libc/macros.h) // @see ape/ape.lds .section .initroprologue,"a",@progbits .type __init_rodata_start,@object @@ -110,7 +110,7 @@ __init_rodata_end: // // Data in this section becomes read-only after initialization. // -// @see .piro.bss.init (libc/macros.internal.h) +// @see .piro.bss.init (libc/macros.h) // @see libc/runtime/piro.c // @see ape/ape.lds .section .piro.bss.init.1,"aw",@nobits diff --git a/libc/runtime/isstackoverflow.c b/libc/runtime/isstackoverflow.c index cb1068a9c..35c646dd9 100644 --- a/libc/runtime/isstackoverflow.c +++ b/libc/runtime/isstackoverflow.c @@ -19,7 +19,7 @@ #include "libc/calls/struct/siginfo.h" #include "libc/calls/struct/ucontext.internal.h" #include "libc/calls/ucontext.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/sig.h" diff --git a/libc/runtime/opensymboltable.greg.c b/libc/runtime/opensymboltable.greg.c index 2a54eb7b6..5da44f023 100644 --- a/libc/runtime/opensymboltable.greg.c +++ b/libc/runtime/opensymboltable.greg.c @@ -25,7 +25,7 @@ #include "libc/intrin/strace.h" #include "libc/limits.h" #include "libc/log/libfatal.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/runtime/progname.S b/libc/runtime/progname.S index c2f807dcc..e98f0fb3c 100644 --- a/libc/runtime/progname.S +++ b/libc/runtime/progname.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Provides argv[0] The BSD Way. .initbss 300,_init___progname diff --git a/libc/runtime/sigsetjmp.S b/libc/runtime/sigsetjmp.S index 98598bd50..1ef838cce 100644 --- a/libc/runtime/sigsetjmp.S +++ b/libc/runtime/sigsetjmp.S @@ -25,7 +25,7 @@ │ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Saves caller CPU state and signal mask. // diff --git a/libc/runtime/sysconf.c b/libc/runtime/sysconf.c index f0c32dd90..17ff15c54 100644 --- a/libc/runtime/sysconf.c +++ b/libc/runtime/sysconf.c @@ -24,7 +24,7 @@ #include "libc/dce.h" #include "libc/intrin/maps.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/clktck.h" #include "libc/runtime/runtime.h" #include "libc/runtime/sysconf.h" diff --git a/libc/runtime/valist.c b/libc/runtime/valist.c index 47294559b..b996e2732 100644 --- a/libc/runtime/valist.c +++ b/libc/runtime/valist.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" /* */ struct __va_list { diff --git a/libc/runtime/winmain.greg.c b/libc/runtime/winmain.greg.c index 6ecbaa16d..5bf331879 100644 --- a/libc/runtime/winmain.greg.c +++ b/libc/runtime/winmain.greg.c @@ -26,7 +26,7 @@ #include "libc/intrin/nomultics.h" #include "libc/intrin/weaken.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/nt/accounting.h" #include "libc/nt/console.h" diff --git a/libc/runtime/zipos-access.c b/libc/runtime/zipos-access.c index 291000d27..eb3807b0f 100644 --- a/libc/runtime/zipos-access.c +++ b/libc/runtime/zipos-access.c @@ -22,7 +22,7 @@ #include "libc/sysv/consts/ok.h" #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" // TODO: this should check parent directory components diff --git a/libc/runtime/zipos-find.c b/libc/runtime/zipos-find.c index 2fc30d442..15443064e 100644 --- a/libc/runtime/zipos-find.c +++ b/libc/runtime/zipos-find.c @@ -17,12 +17,12 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/zipos.internal.h" #include "libc/str/str.h" #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" static ssize_t __zipos_match(struct Zipos *z, struct ZiposUri *name, int len, int i) { diff --git a/libc/runtime/zipos-get.c b/libc/runtime/zipos-get.c index e97918d14..55660e285 100644 --- a/libc/runtime/zipos-get.c +++ b/libc/runtime/zipos-get.c @@ -26,7 +26,7 @@ #include "libc/intrin/cmpxchg.h" #include "libc/intrin/promises.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/runtime/runtime.h" #include "libc/runtime/zipos.internal.h" @@ -38,7 +38,7 @@ #include "libc/sysv/consts/posix.h" #include "libc/sysv/consts/prot.h" #include "libc/thread/thread.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #ifdef __x86_64__ __static_yoink(APE_COM_NAME); diff --git a/libc/runtime/zipos-inode.c b/libc/runtime/zipos-inode.c index c4f26ae27..480d999c4 100644 --- a/libc/runtime/zipos-inode.c +++ b/libc/runtime/zipos-inode.c @@ -21,7 +21,7 @@ #include "libc/runtime/zipos.internal.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" uint64_t __zipos_inode(struct Zipos *zipos, int64_t cfile, // const void *name, size_t namelen) { diff --git a/libc/runtime/zipos-mmap.c b/libc/runtime/zipos-mmap.c index d2551ed3d..d137d372d 100644 --- a/libc/runtime/zipos-mmap.c +++ b/libc/runtime/zipos-mmap.c @@ -29,7 +29,7 @@ #include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #define IP(X) (intptr_t)(X) #define VIP(X) (void *)IP(X) diff --git a/libc/runtime/zipos-open.c b/libc/runtime/zipos-open.c index 46707b179..af01a567c 100644 --- a/libc/runtime/zipos-open.c +++ b/libc/runtime/zipos-open.c @@ -37,7 +37,7 @@ #include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" struct ZiposHandle *__zipos_keep(struct ZiposHandle *h) { atomic_fetch_add_explicit(&h->refs, 1, memory_order_relaxed); diff --git a/libc/runtime/zipos-read.c b/libc/runtime/zipos-read.c index 8fae44da4..9b90c987b 100644 --- a/libc/runtime/zipos-read.c +++ b/libc/runtime/zipos-read.c @@ -27,7 +27,7 @@ #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" #include "libc/thread/tls.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" static ssize_t __zipos_read_impl(struct ZiposHandle *h, const struct iovec *iov, size_t iovlen, ssize_t opt_offset) { diff --git a/libc/runtime/zipos-stat-impl.c b/libc/runtime/zipos-stat-impl.c index ff0a4b316..ef47bb207 100644 --- a/libc/runtime/zipos-stat-impl.c +++ b/libc/runtime/zipos-stat-impl.c @@ -24,7 +24,7 @@ #include "libc/runtime/zipos.internal.h" #include "libc/str/str.h" #include "libc/sysv/consts/s.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" int __zipos_stat_impl(struct Zipos *zipos, size_t cf, struct stat *st) { size_t lf; diff --git a/libc/runtime/zipos.S b/libc/runtime/zipos.S index 507db9efe..df0ba39ff 100644 --- a/libc/runtime/zipos.S +++ b/libc/runtime/zipos.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // static_yoink this symbol for open(/zip/...) support. zipos = 0 diff --git a/libc/sock/epoll.c b/libc/sock/epoll.c index 818ddf19e..c5d809150 100644 --- a/libc/sock/epoll.c +++ b/libc/sock/epoll.c @@ -43,7 +43,7 @@ #include "libc/errno.h" #include "libc/intrin/strace.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/enum/accessmask.h" #include "libc/nt/enum/afd.h" diff --git a/libc/sock/gethostips.c b/libc/sock/gethostips.c index 0e956c1b0..6a1234f0b 100644 --- a/libc/sock/gethostips.c +++ b/libc/sock/gethostips.c @@ -20,7 +20,7 @@ #include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/errors.h" #include "libc/nt/iphlpapi.h" diff --git a/libc/sock/inet_pton.c b/libc/sock/inet_pton.c index dd226eaae..8ad1bbd24 100644 --- a/libc/sock/inet_pton.c +++ b/libc/sock/inet_pton.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/ctype.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/internal.h" #include "libc/sock/sock.h" #include "libc/sysv/consts/af.h" diff --git a/libc/sock/iovec2nt.c b/libc/sock/iovec2nt.c index cba7dce6b..b433e9dbe 100644 --- a/libc/sock/iovec2nt.c +++ b/libc/sock/iovec2nt.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/iovec.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/internal.h" #include "libc/sysv/consts/iov.h" diff --git a/libc/sock/send.c b/libc/sock/send.c index 4d9df49ad..4050a2fba 100644 --- a/libc/sock/send.c +++ b/libc/sock/send.c @@ -22,7 +22,7 @@ #include "libc/calls/struct/iovec.internal.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/internal.h" #include "libc/sock/sock.h" #include "libc/sysv/errfuns.h" diff --git a/libc/sock/sendto.c b/libc/sock/sendto.c index 803e48fa0..b533fdc3e 100644 --- a/libc/sock/sendto.c +++ b/libc/sock/sendto.c @@ -23,7 +23,7 @@ #include "libc/calls/struct/iovec.internal.h" #include "libc/dce.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/internal.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h" diff --git a/libc/sock/sockaddr.c b/libc/sock/sockaddr.c index f72f664ac..36973bde3 100644 --- a/libc/sock/sockaddr.c +++ b/libc/sock/sockaddr.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/sock/struct/sockaddr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h" #include "libc/sock/struct/sockaddr.internal.h" diff --git a/libc/sock/sockaddr2linux.c b/libc/sock/sockaddr2linux.c index 69efdb9f1..26fd4e0f4 100644 --- a/libc/sock/sockaddr2linux.c +++ b/libc/sock/sockaddr2linux.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/internal.h" #include "libc/sock/struct/sockaddr.internal.h" #include "libc/sock/struct/sockaddr6-bsd.internal.h" diff --git a/libc/sock/sockdebug.c b/libc/sock/sockdebug.c index fd98aeb30..d26bc3a4b 100644 --- a/libc/sock/sockdebug.c +++ b/libc/sock/sockdebug.c @@ -19,7 +19,7 @@ #include "libc/errno.h" #include "libc/fmt/itoa.h" #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h" #include "libc/sock/struct/sockaddr6.h" diff --git a/libc/sock/sys_sendfile_freebsd.S b/libc/sock/sys_sendfile_freebsd.S index 6e7a97334..a8443b42b 100644 --- a/libc/sock/sys_sendfile_freebsd.S +++ b/libc/sock/sys_sendfile_freebsd.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" sys_sendfile_freebsd: jmp sys_sendfile diff --git a/libc/sock/sys_sendfile_xnu.S b/libc/sock/sys_sendfile_xnu.S index 99d28b1e4..ca04c39a7 100644 --- a/libc/sock/sys_sendfile_xnu.S +++ b/libc/sock/sys_sendfile_xnu.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" sys_sendfile_xnu: jmp sys_sendfile diff --git a/libc/stdalign.internal.h b/libc/stdalign.h similarity index 52% rename from libc/stdalign.internal.h rename to libc/stdalign.h index 9b4d39de4..293b33799 100644 --- a/libc/stdalign.internal.h +++ b/libc/stdalign.h @@ -1,5 +1,5 @@ -#ifndef COSMOPOLITAN_LIBC_STDALIGN_INTERNAL_H_ -#define COSMOPOLITAN_LIBC_STDALIGN_INTERNAL_H_ +#ifndef COSMOPOLITAN_LIBC_STDALIGN_H_ +#define COSMOPOLITAN_LIBC_STDALIGN_H_ #ifndef __cplusplus #define alignas _Alignas @@ -9,4 +9,4 @@ #define __alignas_is_defined 1 #define __alignof_is_defined 1 -#endif /* COSMOPOLITAN_LIBC_STDALIGN_INTERNAL_H_ */ +#endif /* COSMOPOLITAN_LIBC_STDALIGN_H_ */ diff --git a/libc/stdio/appendd.c b/libc/stdio/appendd.c index 409f5d550..025a67055 100644 --- a/libc/stdio/appendd.c +++ b/libc/stdio/appendd.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" #include "libc/str/str.h" diff --git a/libc/stdio/appendr.c b/libc/stdio/appendr.c index d5554531a..fbe47be03 100644 --- a/libc/stdio/appendr.c +++ b/libc/stdio/appendr.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/dce.h" #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" #include "libc/str/str.h" diff --git a/libc/stdio/appendw.c b/libc/stdio/appendw.c index 9c90ff6d0..ffff19be9 100644 --- a/libc/stdio/appendw.c +++ b/libc/stdio/appendw.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/dce.h" #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/serialize.h" #include "libc/stdio/append.h" diff --git a/libc/stdio/dirstream.c b/libc/stdio/dirstream.c index 215eb9093..ef11b674b 100644 --- a/libc/stdio/dirstream.c +++ b/libc/stdio/dirstream.c @@ -29,7 +29,7 @@ #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/critbit0.h" #include "libc/mem/mem.h" #include "libc/nt/createfile.h" @@ -51,7 +51,7 @@ #include "libc/sysv/errfuns.h" #include "libc/thread/thread.h" #include "libc/thread/tls.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * @fileoverview Directory Streams for Linux+Mac+Windows+FreeBSD+OpenBSD. diff --git a/libc/stdio/dumphexc.c b/libc/stdio/dumphexc.c index 3bf900cb6..90bab43eb 100644 --- a/libc/stdio/dumphexc.c +++ b/libc/stdio/dumphexc.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" #include "libc/stdio/hex.internal.h" diff --git a/libc/stdio/fgets_unlocked.c b/libc/stdio/fgets_unlocked.c index 9fb38e00c..0210dc829 100644 --- a/libc/stdio/fgets_unlocked.c +++ b/libc/stdio/fgets_unlocked.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/internal.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/libc/stdio/fmt.c b/libc/stdio/fmt.c index e52bfaf7c..5ef9b4209 100644 --- a/libc/stdio/fmt.c +++ b/libc/stdio/fmt.c @@ -49,7 +49,7 @@ #include "libc/intrin/nomultics.h" #include "libc/intrin/safemacros.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/mem/reverse.internal.h" @@ -57,7 +57,7 @@ #include "libc/serialize.h" #include "libc/str/str.h" #include "libc/str/strwidth.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/thompike.h" #include "libc/str/unicode.h" #include "libc/str/utf16.h" diff --git a/libc/stdio/fread_unlocked.c b/libc/stdio/fread_unlocked.c index d76bd3216..2ebc08713 100644 --- a/libc/stdio/fread_unlocked.c +++ b/libc/stdio/fread_unlocked.c @@ -20,7 +20,7 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/iovec.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdckdint.h" #include "libc/stdio/internal.h" #include "libc/stdio/stdio.h" diff --git a/libc/stdio/fseek_unlocked.c b/libc/stdio/fseek_unlocked.c index 6703a59ec..f2acddc26 100644 --- a/libc/stdio/fseek_unlocked.c +++ b/libc/stdio/fseek_unlocked.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/internal.h" #include "libc/stdio/stdio.h" #include "libc/sysv/consts/o.h" diff --git a/libc/stdio/fwrite_unlocked.c b/libc/stdio/fwrite_unlocked.c index ef29022fe..4fa7c4d04 100644 --- a/libc/stdio/fwrite_unlocked.c +++ b/libc/stdio/fwrite_unlocked.c @@ -20,7 +20,7 @@ #include "libc/calls/struct/iovec.internal.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdckdint.h" #include "libc/stdio/internal.h" #include "libc/stdio/stdio.h" diff --git a/libc/stdio/kvappendf.c b/libc/stdio/kvappendf.c index 5c171a1c4..cdbf85b9c 100644 --- a/libc/stdio/kvappendf.c +++ b/libc/stdio/kvappendf.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/dce.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" diff --git a/libc/stdio/mt19937.c b/libc/stdio/mt19937.c index 72fd5fce7..778cf2f1f 100644 --- a/libc/stdio/mt19937.c +++ b/libc/stdio/mt19937.c @@ -35,7 +35,7 @@ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/likely.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/rand.h" __notice(mt19937_notice, "mt19937 (BSD-3)\n\ diff --git a/libc/stdio/printargs.c b/libc/stdio/printargs.c index 3e2ba0bb7..16226c8c2 100644 --- a/libc/stdio/printargs.c +++ b/libc/stdio/printargs.c @@ -32,7 +32,7 @@ #include "libc/intrin/promises.h" #include "libc/intrin/strace.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/cpuid4.internal.h" #include "libc/nexgen32e/kcpuids.h" #include "libc/nexgen32e/x86feature.h" diff --git a/libc/stdio/vappendf.c b/libc/stdio/vappendf.c index 726e59450..5ed5ab10f 100644 --- a/libc/stdio/vappendf.c +++ b/libc/stdio/vappendf.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" #include "libc/stdio/stdio.h" diff --git a/libc/stdio/vcscanf.c b/libc/stdio/vcscanf.c index 130670cce..ddfa01097 100644 --- a/libc/stdio/vcscanf.c +++ b/libc/stdio/vcscanf.c @@ -23,7 +23,7 @@ #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/tpdecodecb.internal.h" #include "libc/str/utf16.h" #include "libc/sysv/errfuns.h" diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 0e9ef1c76..15d2d7909 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -20,7 +20,7 @@ #include "libc/dce.h" #include "libc/fmt/internal.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/files.h" #include "libc/sock/sock.h" #include "libc/str/str.h" diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c index f46bc0e26..a113335df 100644 --- a/libc/stdio/vsnprintf.c +++ b/libc/stdio/vsnprintf.c @@ -20,7 +20,7 @@ #include "libc/dce.h" #include "libc/fmt/internal.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/libc/str/blake2.c b/libc/str/blake2.c index acbeb1b70..f2e10416a 100644 --- a/libc/str/blake2.c +++ b/libc/str/blake2.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/blake2.h" #include "libc/assert.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #define ROR(v, n) (((v) >> (n)) | ((v) << (64 - (n)))) diff --git a/libc/str/compareslices.c b/libc/str/compareslices.c index b57b902a6..0bca09438 100644 --- a/libc/str/compareslices.c +++ b/libc/str/compareslices.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/slice.h" int CompareSlices(const char *a, size_t n, const char *b, size_t m) { diff --git a/libc/str/compareslicescase.c b/libc/str/compareslicescase.c index a4f881450..129d9b22c 100644 --- a/libc/str/compareslicescase.c +++ b/libc/str/compareslicescase.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/slice.h" int CompareSlicesCase(const char *a, size_t n, const char *b, size_t m) { diff --git a/libc/str/dosdatetimetounix.c b/libc/str/dosdatetimetounix.c index 7cc956fd3..a4cd18109 100644 --- a/libc/str/dosdatetimetounix.c +++ b/libc/str/dosdatetimetounix.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/time.h" /** diff --git a/libc/str/getzipcdircomment.c b/libc/str/getzipcdircomment.c index 35ca8b38f..85d8d8ce7 100644 --- a/libc/str/getzipcdircomment.c +++ b/libc/str/getzipcdircomment.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns comment of zip central directory. diff --git a/libc/str/getzipcdircommentsize.c b/libc/str/getzipcdircommentsize.c index ac83f995b..c4fbc77d8 100644 --- a/libc/str/getzipcdircommentsize.c +++ b/libc/str/getzipcdircommentsize.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns comment of zip central directory. diff --git a/libc/str/getzipcdiroffset.c b/libc/str/getzipcdiroffset.c index 6698290ce..0aaefb03d 100644 --- a/libc/str/getzipcdiroffset.c +++ b/libc/str/getzipcdiroffset.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns offset of zip central directory. diff --git a/libc/str/getzipcdirrecords.c b/libc/str/getzipcdirrecords.c index 20f0cef59..f127dd299 100644 --- a/libc/str/getzipcdirrecords.c +++ b/libc/str/getzipcdirrecords.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns number of records in zip central directory. diff --git a/libc/str/getzipcdirsize.c b/libc/str/getzipcdirsize.c index 3ea16c201..c8a1e3da9 100644 --- a/libc/str/getzipcdirsize.c +++ b/libc/str/getzipcdirsize.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns size of zip central directory. diff --git a/libc/str/getzipcfilecompressedsize.c b/libc/str/getzipcfilecompressedsize.c index f2c26ba36..96a492e84 100644 --- a/libc/str/getzipcfilecompressedsize.c +++ b/libc/str/getzipcfilecompressedsize.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns compressed size in bytes from zip central directory header. diff --git a/libc/str/getzipcfilemode.c b/libc/str/getzipcfilemode.c index f4a944301..d73e708a4 100644 --- a/libc/str/getzipcfilemode.c +++ b/libc/str/getzipcfilemode.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/nt/enum/fileflagandattributes.h" #include "libc/sysv/consts/s.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" static int ConvertWindowsToUnixMode(int x) { int m; diff --git a/libc/str/getzipcfileoffset.c b/libc/str/getzipcfileoffset.c index 5a18f6a92..66726cea8 100644 --- a/libc/str/getzipcfileoffset.c +++ b/libc/str/getzipcfileoffset.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns offset of local file header. diff --git a/libc/str/getzipcfiletimestamps.c b/libc/str/getzipcfiletimestamps.c index 0a06b6992..4d246c4ab 100644 --- a/libc/str/getzipcfiletimestamps.c +++ b/libc/str/getzipcfiletimestamps.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/wintime.internal.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" static inline int pop(int x) { return !!(x & 1) + !!(x & 2) + !!(x & 4); diff --git a/libc/str/getzipcfileuncompressedsize.c b/libc/str/getzipcfileuncompressedsize.c index 3a38bd29e..d129b55e5 100644 --- a/libc/str/getzipcfileuncompressedsize.c +++ b/libc/str/getzipcfileuncompressedsize.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns uncompressed size in bytes from zip central directory header. diff --git a/libc/str/getzipeocd.c b/libc/str/getzipeocd.c index ee862cc19..86c1cc1e7 100644 --- a/libc/str/getzipeocd.c +++ b/libc/str/getzipeocd.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" typedef char v16qi __attribute__((__vector_size__(16))); typedef short v8hi __attribute__((__vector_size__(16))); diff --git a/libc/str/getziplfilecompressedsize.c b/libc/str/getziplfilecompressedsize.c index 26403d300..5147c8934 100644 --- a/libc/str/getziplfilecompressedsize.c +++ b/libc/str/getziplfilecompressedsize.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns compressed size in bytes from zip local file header. diff --git a/libc/str/getziplfileuncompressedsize.c b/libc/str/getziplfileuncompressedsize.c index 86a6b3621..e76b74bc9 100644 --- a/libc/str/getziplfileuncompressedsize.c +++ b/libc/str/getziplfileuncompressedsize.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns uncompressed size in bytes from zip local file header. diff --git a/libc/str/iswctype.c b/libc/str/iswctype.c index 0c2b83fab..553e82820 100644 --- a/libc/str/iswctype.c +++ b/libc/str/iswctype.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/wctype.h" typedef int (*isw_f)(wint_t); diff --git a/libc/str/iszipeocd32.c b/libc/str/iszipeocd32.c index 883bf93db..fedc00242 100644 --- a/libc/str/iszipeocd32.c +++ b/libc/str/iszipeocd32.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/stdckdint.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Determines if ZIP EOCD record seems legit. diff --git a/libc/str/iszipeocd64.c b/libc/str/iszipeocd64.c index cbc37af29..ff29795d6 100644 --- a/libc/str/iszipeocd64.c +++ b/libc/str/iszipeocd64.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/stdckdint.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" /** * Returns kZipOk if zip64 end of central directory header seems legit. diff --git a/libc/str/khextoint.c b/libc/str/khextoint.c index 53e2093d0..fd30e72cf 100644 --- a/libc/str/khextoint.c +++ b/libc/str/khextoint.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/stdalign.internal.h" -#include "libc/str/tab.internal.h" +#include "libc/stdalign.h" +#include "libc/str/tab.h" alignas(int8_t) const int8_t kHexToInt[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0x00 diff --git a/libc/str/kx86processormodels.c b/libc/str/kx86processormodels.c index d5f62ea3c..9bf5c196e 100644 --- a/libc/str/kx86processormodels.c +++ b/libc/str/kx86processormodels.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/x86info.h" const struct X86ProcessorModel kX86ProcessorModels[] = { diff --git a/libc/str/memcasecmp.c b/libc/str/memcasecmp.c index 05e552f0b..28a221c5f 100644 --- a/libc/str/memcasecmp.c +++ b/libc/str/memcasecmp.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/serialize.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Compares memory case-insensitively. diff --git a/libc/str/startswithi.c b/libc/str/startswithi.c index 974ece794..136192abf 100644 --- a/libc/str/startswithi.c +++ b/libc/str/startswithi.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Checks if string starts with prefix, case insensitively. diff --git a/libc/str/stpncpy.c b/libc/str/stpncpy.c index 30b6f2bb9..66d2d3e55 100644 --- a/libc/str/stpncpy.c +++ b/libc/str/stpncpy.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" /** diff --git a/libc/str/strcasecmp.c b/libc/str/strcasecmp.c index 2443afd93..8510f6034 100644 --- a/libc/str/strcasecmp.c +++ b/libc/str/strcasecmp.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Compares NUL-terminated strings ascii case-insensitively. diff --git a/libc/str/strcasestr.c b/libc/str/strcasestr.c index 26f969c09..ec40c16f1 100644 --- a/libc/str/strcasestr.c +++ b/libc/str/strcasestr.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/str.h" #include "libc/dce.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(16))); diff --git a/libc/str/strncasecmp.c b/libc/str/strncasecmp.c index 419b7eec8..756732454 100644 --- a/libc/str/strncasecmp.c +++ b/libc/str/strncasecmp.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Compares NUL-terminated strings case-insensitively w/ limit. diff --git a/libc/str/strncpy.c b/libc/str/strncpy.c index 26ac33e02..052b00217 100644 --- a/libc/str/strncpy.c +++ b/libc/str/strncpy.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" /** diff --git a/libc/str/strnwidth.c b/libc/str/strnwidth.c index 0e39fc70a..761994e80 100644 --- a/libc/str/strnwidth.c +++ b/libc/str/strnwidth.c @@ -19,7 +19,7 @@ #include "libc/intrin/bsf.h" #include "libc/intrin/pcmpgtb.h" #include "libc/intrin/pmovmskb.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/str/thompike.h" #include "libc/str/unicode.h" diff --git a/libc/str/strtol.c b/libc/str/strtol.c index 0548bb265..aa7bdd3b2 100644 --- a/libc/str/strtol.c +++ b/libc/str/strtol.c @@ -22,7 +22,7 @@ #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Decodes signed integer from ASCII string. diff --git a/libc/str/strtoul.c b/libc/str/strtoul.c index ee8f01fbd..37f28fe1e 100644 --- a/libc/str/strtoul.c +++ b/libc/str/strtoul.c @@ -22,7 +22,7 @@ #include "libc/limits.h" #include "libc/stdckdint.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * Decodes unsigned integer from ASCII string. diff --git a/libc/str/tab.internal.h b/libc/str/tab.h similarity index 77% rename from libc/str/tab.internal.h rename to libc/str/tab.h index c40d9f663..ea1310bbc 100644 --- a/libc/str/tab.internal.h +++ b/libc/str/tab.h @@ -1,5 +1,5 @@ -#ifndef COSMOPOLITAN_LIBC_STR_TAB_INTERNAL_H_ -#define COSMOPOLITAN_LIBC_STR_TAB_INTERNAL_H_ +#ifndef COSMOPOLITAN_LIBC_STR_TAB_H_ +#define COSMOPOLITAN_LIBC_STR_TAB_H_ #define kHexToInt __kHexToInt #define kToLower __kToLower @@ -20,4 +20,4 @@ extern const char16_t kCp437[256]; COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -#endif /* COSMOPOLITAN_LIBC_STR_TAB_INTERNAL_H_ */ +#endif /* COSMOPOLITAN_LIBC_STR_TAB_H_ */ diff --git a/libc/str/towlower.c b/libc/str/towlower.c index 313a53079..eb791adbc 100644 --- a/libc/str/towlower.c +++ b/libc/str/towlower.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" /* clang-format off */ diff --git a/libc/str/towupper.c b/libc/str/towupper.c index e946cd142..42dd6f374 100644 --- a/libc/str/towupper.c +++ b/libc/str/towupper.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" // clang-format off diff --git a/libc/str/wctype.c b/libc/str/wctype.c index 20516dc47..e20ef27be 100644 --- a/libc/str/wctype.c +++ b/libc/str/wctype.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/wctype.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/serialize.h" static const char kWcTypeNames[][8] = { diff --git a/libc/str/wcwidth_osx.c b/libc/str/wcwidth_osx.c index 6a2b64c01..43a1bda9d 100644 --- a/libc/str/wcwidth_osx.c +++ b/libc/str/wcwidth_osx.c @@ -20,7 +20,7 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/wcwidth_osx.internal.h" const uint8_t kWcwidthOsxIndex1[] = { diff --git a/libc/sysv/consts/syscon.internal.h b/libc/sysv/consts/syscon.internal.h index 33b97c9a0..396f0b671 100644 --- a/libc/sysv/consts/syscon.internal.h +++ b/libc/sysv/consts/syscon.internal.h @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" // clang-format off #ifdef __x86_64__ diff --git a/libc/sysv/errfun.S b/libc/sysv/errfun.S index debb98d2f..e1ef6908a 100644 --- a/libc/sysv/errfun.S +++ b/libc/sysv/errfun.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely __errfun: diff --git a/libc/sysv/errfuns/e2big.S b/libc/sysv/errfuns/e2big.S index 32ac86542..7b6fd6a20 100644 --- a/libc/sysv/errfuns/e2big.S +++ b/libc/sysv/errfuns/e2big.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eacces.S b/libc/sysv/errfuns/eacces.S index 2ba289170..5657ed497 100644 --- a/libc/sysv/errfuns/eacces.S +++ b/libc/sysv/errfuns/eacces.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eaddrinuse.S b/libc/sysv/errfuns/eaddrinuse.S index 4d8c41d34..77dee3e32 100644 --- a/libc/sysv/errfuns/eaddrinuse.S +++ b/libc/sysv/errfuns/eaddrinuse.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eaddrnotavail.S b/libc/sysv/errfuns/eaddrnotavail.S index 101b936a6..28a3a3998 100644 --- a/libc/sysv/errfuns/eaddrnotavail.S +++ b/libc/sysv/errfuns/eaddrnotavail.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eadv.S b/libc/sysv/errfuns/eadv.S index aeadda509..acf8e5f86 100644 --- a/libc/sysv/errfuns/eadv.S +++ b/libc/sysv/errfuns/eadv.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eafnosupport.S b/libc/sysv/errfuns/eafnosupport.S index 0f4fa0b5a..4e4787cc8 100644 --- a/libc/sysv/errfuns/eafnosupport.S +++ b/libc/sysv/errfuns/eafnosupport.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eagain.S b/libc/sysv/errfuns/eagain.S index 5124a43f1..e19df5a4f 100644 --- a/libc/sysv/errfuns/eagain.S +++ b/libc/sysv/errfuns/eagain.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ealready.S b/libc/sysv/errfuns/ealready.S index e8b32b0eb..4f39c44d8 100644 --- a/libc/sysv/errfuns/ealready.S +++ b/libc/sysv/errfuns/ealready.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebade.S b/libc/sysv/errfuns/ebade.S index 8d0a0c19f..0eb25fca3 100644 --- a/libc/sysv/errfuns/ebade.S +++ b/libc/sysv/errfuns/ebade.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebadf.S b/libc/sysv/errfuns/ebadf.S index 693fe7c46..34318ce18 100644 --- a/libc/sysv/errfuns/ebadf.S +++ b/libc/sysv/errfuns/ebadf.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebadfd.S b/libc/sysv/errfuns/ebadfd.S index fb4fc502d..a2900bc3d 100644 --- a/libc/sysv/errfuns/ebadfd.S +++ b/libc/sysv/errfuns/ebadfd.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebadmsg.S b/libc/sysv/errfuns/ebadmsg.S index e650ed296..5781527bd 100644 --- a/libc/sysv/errfuns/ebadmsg.S +++ b/libc/sysv/errfuns/ebadmsg.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebadr.S b/libc/sysv/errfuns/ebadr.S index e8f9ab68d..f80316c45 100644 --- a/libc/sysv/errfuns/ebadr.S +++ b/libc/sysv/errfuns/ebadr.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebadrqc.S b/libc/sysv/errfuns/ebadrqc.S index e5fd44915..1debb93f5 100644 --- a/libc/sysv/errfuns/ebadrqc.S +++ b/libc/sysv/errfuns/ebadrqc.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebadslt.S b/libc/sysv/errfuns/ebadslt.S index 4bc407c0e..38a091a3e 100644 --- a/libc/sysv/errfuns/ebadslt.S +++ b/libc/sysv/errfuns/ebadslt.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ebusy.S b/libc/sysv/errfuns/ebusy.S index 54a436001..a677d254b 100644 --- a/libc/sysv/errfuns/ebusy.S +++ b/libc/sysv/errfuns/ebusy.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ecanceled.S b/libc/sysv/errfuns/ecanceled.S index 58007cb2d..ac974c3f4 100644 --- a/libc/sysv/errfuns/ecanceled.S +++ b/libc/sysv/errfuns/ecanceled.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/echild.S b/libc/sysv/errfuns/echild.S index e3e79409b..7733922f5 100644 --- a/libc/sysv/errfuns/echild.S +++ b/libc/sysv/errfuns/echild.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/echrng.S b/libc/sysv/errfuns/echrng.S index 0ffa5c922..0f20dda56 100644 --- a/libc/sysv/errfuns/echrng.S +++ b/libc/sysv/errfuns/echrng.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ecomm.S b/libc/sysv/errfuns/ecomm.S index 1a9a98286..4afe7326b 100644 --- a/libc/sysv/errfuns/ecomm.S +++ b/libc/sysv/errfuns/ecomm.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/econnaborted.S b/libc/sysv/errfuns/econnaborted.S index ec62e3e67..7f8c2737f 100644 --- a/libc/sysv/errfuns/econnaborted.S +++ b/libc/sysv/errfuns/econnaborted.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/econnrefused.S b/libc/sysv/errfuns/econnrefused.S index b16e4ce73..20adf6b88 100644 --- a/libc/sysv/errfuns/econnrefused.S +++ b/libc/sysv/errfuns/econnrefused.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/econnreset.S b/libc/sysv/errfuns/econnreset.S index 0c8fd94f4..8255f0bdc 100644 --- a/libc/sysv/errfuns/econnreset.S +++ b/libc/sysv/errfuns/econnreset.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/edeadlk.S b/libc/sysv/errfuns/edeadlk.S index caf4dbc2f..b812e07e9 100644 --- a/libc/sysv/errfuns/edeadlk.S +++ b/libc/sysv/errfuns/edeadlk.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/edestaddrreq.S b/libc/sysv/errfuns/edestaddrreq.S index 74dd51f96..bd3b8d56f 100644 --- a/libc/sysv/errfuns/edestaddrreq.S +++ b/libc/sysv/errfuns/edestaddrreq.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/edom.S b/libc/sysv/errfuns/edom.S index c26449ac2..a3f40bb7c 100644 --- a/libc/sysv/errfuns/edom.S +++ b/libc/sysv/errfuns/edom.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/edotdot.S b/libc/sysv/errfuns/edotdot.S index e1a347a3a..6cdc94739 100644 --- a/libc/sysv/errfuns/edotdot.S +++ b/libc/sysv/errfuns/edotdot.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/edquot.S b/libc/sysv/errfuns/edquot.S index 0e3e6fe79..2d62f6124 100644 --- a/libc/sysv/errfuns/edquot.S +++ b/libc/sysv/errfuns/edquot.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eexist.S b/libc/sysv/errfuns/eexist.S index d1fb3a314..65cc2e363 100644 --- a/libc/sysv/errfuns/eexist.S +++ b/libc/sysv/errfuns/eexist.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/efault.S b/libc/sysv/errfuns/efault.S index a219fff84..802d9f12f 100644 --- a/libc/sysv/errfuns/efault.S +++ b/libc/sysv/errfuns/efault.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/efbig.S b/libc/sysv/errfuns/efbig.S index 0d614e720..32be5b137 100644 --- a/libc/sysv/errfuns/efbig.S +++ b/libc/sysv/errfuns/efbig.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ehostdown.S b/libc/sysv/errfuns/ehostdown.S index 55a766ca9..b472f021a 100644 --- a/libc/sysv/errfuns/ehostdown.S +++ b/libc/sysv/errfuns/ehostdown.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ehostunreach.S b/libc/sysv/errfuns/ehostunreach.S index bc5c311f0..8fa84fca1 100644 --- a/libc/sysv/errfuns/ehostunreach.S +++ b/libc/sysv/errfuns/ehostunreach.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ehwpoison.S b/libc/sysv/errfuns/ehwpoison.S index d1d261565..d7df790b1 100644 --- a/libc/sysv/errfuns/ehwpoison.S +++ b/libc/sysv/errfuns/ehwpoison.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eidrm.S b/libc/sysv/errfuns/eidrm.S index 0c0d72542..3ba2f2bca 100644 --- a/libc/sysv/errfuns/eidrm.S +++ b/libc/sysv/errfuns/eidrm.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eilseq.S b/libc/sysv/errfuns/eilseq.S index d34482cea..25fdac2c6 100644 --- a/libc/sysv/errfuns/eilseq.S +++ b/libc/sysv/errfuns/eilseq.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/einprogress.S b/libc/sysv/errfuns/einprogress.S index 9d356fd2a..db22b1bc6 100644 --- a/libc/sysv/errfuns/einprogress.S +++ b/libc/sysv/errfuns/einprogress.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eintr.S b/libc/sysv/errfuns/eintr.S index e6a3f88d3..96d03d28a 100644 --- a/libc/sysv/errfuns/eintr.S +++ b/libc/sysv/errfuns/eintr.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/einval.S b/libc/sysv/errfuns/einval.S index 537af95c8..1b23f8ba1 100644 --- a/libc/sysv/errfuns/einval.S +++ b/libc/sysv/errfuns/einval.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eio.S b/libc/sysv/errfuns/eio.S index cdf541c95..dade87a54 100644 --- a/libc/sysv/errfuns/eio.S +++ b/libc/sysv/errfuns/eio.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eisconn.S b/libc/sysv/errfuns/eisconn.S index 148423224..36db72604 100644 --- a/libc/sysv/errfuns/eisconn.S +++ b/libc/sysv/errfuns/eisconn.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eisdir.S b/libc/sysv/errfuns/eisdir.S index 83e775f51..533071086 100644 --- a/libc/sysv/errfuns/eisdir.S +++ b/libc/sysv/errfuns/eisdir.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eisnam.S b/libc/sysv/errfuns/eisnam.S index 4450ca1ea..a8b632d20 100644 --- a/libc/sysv/errfuns/eisnam.S +++ b/libc/sysv/errfuns/eisnam.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ekeyexpired.S b/libc/sysv/errfuns/ekeyexpired.S index 89f4507bc..810d2078f 100644 --- a/libc/sysv/errfuns/ekeyexpired.S +++ b/libc/sysv/errfuns/ekeyexpired.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ekeyrejected.S b/libc/sysv/errfuns/ekeyrejected.S index fda4019bd..874b25707 100644 --- a/libc/sysv/errfuns/ekeyrejected.S +++ b/libc/sysv/errfuns/ekeyrejected.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/ekeyrevoked.S b/libc/sysv/errfuns/ekeyrevoked.S index d8e2e11c2..fa5b4ce5c 100644 --- a/libc/sysv/errfuns/ekeyrevoked.S +++ b/libc/sysv/errfuns/ekeyrevoked.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/el2hlt.S b/libc/sysv/errfuns/el2hlt.S index 5462d3ec9..b8400dca8 100644 --- a/libc/sysv/errfuns/el2hlt.S +++ b/libc/sysv/errfuns/el2hlt.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/el2nsync.S b/libc/sysv/errfuns/el2nsync.S index bb249b131..bbf443613 100644 --- a/libc/sysv/errfuns/el2nsync.S +++ b/libc/sysv/errfuns/el2nsync.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/el3hlt.S b/libc/sysv/errfuns/el3hlt.S index 40535b6d6..c527a2cf4 100644 --- a/libc/sysv/errfuns/el3hlt.S +++ b/libc/sysv/errfuns/el3hlt.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/el3rst.S b/libc/sysv/errfuns/el3rst.S index 036afd48e..b277a12dd 100644 --- a/libc/sysv/errfuns/el3rst.S +++ b/libc/sysv/errfuns/el3rst.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/elibacc.S b/libc/sysv/errfuns/elibacc.S index b598c2e47..ecaa787ce 100644 --- a/libc/sysv/errfuns/elibacc.S +++ b/libc/sysv/errfuns/elibacc.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/elibbad.S b/libc/sysv/errfuns/elibbad.S index 4a0f7f72b..6929d6c18 100644 --- a/libc/sysv/errfuns/elibbad.S +++ b/libc/sysv/errfuns/elibbad.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/elibexec.S b/libc/sysv/errfuns/elibexec.S index 6b5093216..141f1acef 100644 --- a/libc/sysv/errfuns/elibexec.S +++ b/libc/sysv/errfuns/elibexec.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/elibmax.S b/libc/sysv/errfuns/elibmax.S index 73dc1d570..5738b1ebd 100644 --- a/libc/sysv/errfuns/elibmax.S +++ b/libc/sysv/errfuns/elibmax.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/elibscn.S b/libc/sysv/errfuns/elibscn.S index fd3fbe245..730a3da62 100644 --- a/libc/sysv/errfuns/elibscn.S +++ b/libc/sysv/errfuns/elibscn.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/elnrng.S b/libc/sysv/errfuns/elnrng.S index 0e0e37ed4..7db38cca6 100644 --- a/libc/sysv/errfuns/elnrng.S +++ b/libc/sysv/errfuns/elnrng.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eloop.S b/libc/sysv/errfuns/eloop.S index faef0e95c..e7edbbc92 100644 --- a/libc/sysv/errfuns/eloop.S +++ b/libc/sysv/errfuns/eloop.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/emediumtype.S b/libc/sysv/errfuns/emediumtype.S index 448080938..0d7de3b51 100644 --- a/libc/sysv/errfuns/emediumtype.S +++ b/libc/sysv/errfuns/emediumtype.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/emfile.S b/libc/sysv/errfuns/emfile.S index 6adb57077..a7f1d6e2b 100644 --- a/libc/sysv/errfuns/emfile.S +++ b/libc/sysv/errfuns/emfile.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/emlink.S b/libc/sysv/errfuns/emlink.S index 8c6b7d95a..e0d810f9c 100644 --- a/libc/sysv/errfuns/emlink.S +++ b/libc/sysv/errfuns/emlink.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/emsgsize.S b/libc/sysv/errfuns/emsgsize.S index 9870b85a1..d2c22cb06 100644 --- a/libc/sysv/errfuns/emsgsize.S +++ b/libc/sysv/errfuns/emsgsize.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/emultihop.S b/libc/sysv/errfuns/emultihop.S index 27140db9f..cb54b9520 100644 --- a/libc/sysv/errfuns/emultihop.S +++ b/libc/sysv/errfuns/emultihop.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enametoolong.S b/libc/sysv/errfuns/enametoolong.S index d46f2bfa1..d085fc6bf 100644 --- a/libc/sysv/errfuns/enametoolong.S +++ b/libc/sysv/errfuns/enametoolong.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enavail.S b/libc/sysv/errfuns/enavail.S index d7aa15d49..a86a5b386 100644 --- a/libc/sysv/errfuns/enavail.S +++ b/libc/sysv/errfuns/enavail.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enetdown.S b/libc/sysv/errfuns/enetdown.S index 7850a5892..fe4f2f908 100644 --- a/libc/sysv/errfuns/enetdown.S +++ b/libc/sysv/errfuns/enetdown.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enetreset.S b/libc/sysv/errfuns/enetreset.S index fd6cf0c53..31126c73b 100644 --- a/libc/sysv/errfuns/enetreset.S +++ b/libc/sysv/errfuns/enetreset.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enetunreach.S b/libc/sysv/errfuns/enetunreach.S index 36a6ee69e..ec730c637 100644 --- a/libc/sysv/errfuns/enetunreach.S +++ b/libc/sysv/errfuns/enetunreach.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enfile.S b/libc/sysv/errfuns/enfile.S index a2b5157dd..5df56837a 100644 --- a/libc/sysv/errfuns/enfile.S +++ b/libc/sysv/errfuns/enfile.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enoano.S b/libc/sysv/errfuns/enoano.S index f3a713901..81724c4b3 100644 --- a/libc/sysv/errfuns/enoano.S +++ b/libc/sysv/errfuns/enoano.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enobufs.S b/libc/sysv/errfuns/enobufs.S index 7936a1e1f..3ba3a8b9c 100644 --- a/libc/sysv/errfuns/enobufs.S +++ b/libc/sysv/errfuns/enobufs.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enocsi.S b/libc/sysv/errfuns/enocsi.S index ab63ad071..c6e6fdd22 100644 --- a/libc/sysv/errfuns/enocsi.S +++ b/libc/sysv/errfuns/enocsi.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enodata.S b/libc/sysv/errfuns/enodata.S index e5fd06425..4394c5f8b 100644 --- a/libc/sysv/errfuns/enodata.S +++ b/libc/sysv/errfuns/enodata.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enodev.S b/libc/sysv/errfuns/enodev.S index 1be5d5846..da1741b1d 100644 --- a/libc/sysv/errfuns/enodev.S +++ b/libc/sysv/errfuns/enodev.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enoent.S b/libc/sysv/errfuns/enoent.S index 3929a214d..4bd569d9d 100644 --- a/libc/sysv/errfuns/enoent.S +++ b/libc/sysv/errfuns/enoent.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enoexec.S b/libc/sysv/errfuns/enoexec.S index 30cee1e8a..4b6f00228 100644 --- a/libc/sysv/errfuns/enoexec.S +++ b/libc/sysv/errfuns/enoexec.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enokey.S b/libc/sysv/errfuns/enokey.S index 399aa97c9..5c5c20048 100644 --- a/libc/sysv/errfuns/enokey.S +++ b/libc/sysv/errfuns/enokey.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enolck.S b/libc/sysv/errfuns/enolck.S index ceda33862..9d5b995e9 100644 --- a/libc/sysv/errfuns/enolck.S +++ b/libc/sysv/errfuns/enolck.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enolink.S b/libc/sysv/errfuns/enolink.S index 189d8ad7b..e35ae060e 100644 --- a/libc/sysv/errfuns/enolink.S +++ b/libc/sysv/errfuns/enolink.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enomedium.S b/libc/sysv/errfuns/enomedium.S index c7a6893ec..3bf1573fb 100644 --- a/libc/sysv/errfuns/enomedium.S +++ b/libc/sysv/errfuns/enomedium.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enomem.S b/libc/sysv/errfuns/enomem.S index d9a7050c8..62a49eb7c 100644 --- a/libc/sysv/errfuns/enomem.S +++ b/libc/sysv/errfuns/enomem.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enomsg.S b/libc/sysv/errfuns/enomsg.S index 0307c3ec2..49d558667 100644 --- a/libc/sysv/errfuns/enomsg.S +++ b/libc/sysv/errfuns/enomsg.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enonet.S b/libc/sysv/errfuns/enonet.S index fc2e5468c..e84f00121 100644 --- a/libc/sysv/errfuns/enonet.S +++ b/libc/sysv/errfuns/enonet.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enopkg.S b/libc/sysv/errfuns/enopkg.S index 3b08e87a5..5431b0c9e 100644 --- a/libc/sysv/errfuns/enopkg.S +++ b/libc/sysv/errfuns/enopkg.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enoprotoopt.S b/libc/sysv/errfuns/enoprotoopt.S index 80fca7bb5..8ffec6963 100644 --- a/libc/sysv/errfuns/enoprotoopt.S +++ b/libc/sysv/errfuns/enoprotoopt.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enospc.S b/libc/sysv/errfuns/enospc.S index 69023893d..afbe6a497 100644 --- a/libc/sysv/errfuns/enospc.S +++ b/libc/sysv/errfuns/enospc.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enosr.S b/libc/sysv/errfuns/enosr.S index 9d7119e53..289c4b645 100644 --- a/libc/sysv/errfuns/enosr.S +++ b/libc/sysv/errfuns/enosr.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enostr.S b/libc/sysv/errfuns/enostr.S index 6705b7155..e9f64241e 100644 --- a/libc/sysv/errfuns/enostr.S +++ b/libc/sysv/errfuns/enostr.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enosys.S b/libc/sysv/errfuns/enosys.S index c0f6e7c36..4f2132726 100644 --- a/libc/sysv/errfuns/enosys.S +++ b/libc/sysv/errfuns/enosys.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotblk.S b/libc/sysv/errfuns/enotblk.S index c4812cb03..c04ba77b4 100644 --- a/libc/sysv/errfuns/enotblk.S +++ b/libc/sysv/errfuns/enotblk.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotconn.S b/libc/sysv/errfuns/enotconn.S index b6c26d55c..1ea6d6eca 100644 --- a/libc/sysv/errfuns/enotconn.S +++ b/libc/sysv/errfuns/enotconn.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotdir.S b/libc/sysv/errfuns/enotdir.S index 7afc1762f..14103122d 100644 --- a/libc/sysv/errfuns/enotdir.S +++ b/libc/sysv/errfuns/enotdir.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotempty.S b/libc/sysv/errfuns/enotempty.S index 67bbdc837..dd014acbc 100644 --- a/libc/sysv/errfuns/enotempty.S +++ b/libc/sysv/errfuns/enotempty.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotnam.S b/libc/sysv/errfuns/enotnam.S index 7a1094e5b..259a7bdae 100644 --- a/libc/sysv/errfuns/enotnam.S +++ b/libc/sysv/errfuns/enotnam.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotrecoverable.S b/libc/sysv/errfuns/enotrecoverable.S index e50430452..85ed3a663 100644 --- a/libc/sysv/errfuns/enotrecoverable.S +++ b/libc/sysv/errfuns/enotrecoverable.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotsock.S b/libc/sysv/errfuns/enotsock.S index 8f0753ce5..02e2b93ff 100644 --- a/libc/sysv/errfuns/enotsock.S +++ b/libc/sysv/errfuns/enotsock.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotsup.S b/libc/sysv/errfuns/enotsup.S index 59d130623..01888f280 100644 --- a/libc/sysv/errfuns/enotsup.S +++ b/libc/sysv/errfuns/enotsup.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotty.S b/libc/sysv/errfuns/enotty.S index beed92e95..e07629a98 100644 --- a/libc/sysv/errfuns/enotty.S +++ b/libc/sysv/errfuns/enotty.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enotuniq.S b/libc/sysv/errfuns/enotuniq.S index 57b04e9ba..a40cf8982 100644 --- a/libc/sysv/errfuns/enotuniq.S +++ b/libc/sysv/errfuns/enotuniq.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/enxio.S b/libc/sysv/errfuns/enxio.S index 637241908..6e827d4c6 100644 --- a/libc/sysv/errfuns/enxio.S +++ b/libc/sysv/errfuns/enxio.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eopnotsupp.S b/libc/sysv/errfuns/eopnotsupp.S index fa974a998..0c740d2ab 100644 --- a/libc/sysv/errfuns/eopnotsupp.S +++ b/libc/sysv/errfuns/eopnotsupp.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eoverflow.S b/libc/sysv/errfuns/eoverflow.S index 81aad5b64..98fae88a9 100644 --- a/libc/sysv/errfuns/eoverflow.S +++ b/libc/sysv/errfuns/eoverflow.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eownerdead.S b/libc/sysv/errfuns/eownerdead.S index 5968f3807..033cab8bf 100644 --- a/libc/sysv/errfuns/eownerdead.S +++ b/libc/sysv/errfuns/eownerdead.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eperm.S b/libc/sysv/errfuns/eperm.S index cc4fefa78..54df77607 100644 --- a/libc/sysv/errfuns/eperm.S +++ b/libc/sysv/errfuns/eperm.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/epfnosupport.S b/libc/sysv/errfuns/epfnosupport.S index 73da7dd25..9732440f5 100644 --- a/libc/sysv/errfuns/epfnosupport.S +++ b/libc/sysv/errfuns/epfnosupport.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/epipe.S b/libc/sysv/errfuns/epipe.S index 5c1f01948..fcf57e4c8 100644 --- a/libc/sysv/errfuns/epipe.S +++ b/libc/sysv/errfuns/epipe.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eproto.S b/libc/sysv/errfuns/eproto.S index 22ceb6bd7..f5c7e0c1f 100644 --- a/libc/sysv/errfuns/eproto.S +++ b/libc/sysv/errfuns/eproto.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eprotonosupport.S b/libc/sysv/errfuns/eprotonosupport.S index f8f9bcd6a..3934683f9 100644 --- a/libc/sysv/errfuns/eprotonosupport.S +++ b/libc/sysv/errfuns/eprotonosupport.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eprototype.S b/libc/sysv/errfuns/eprototype.S index ceb8efbb3..208d4989f 100644 --- a/libc/sysv/errfuns/eprototype.S +++ b/libc/sysv/errfuns/eprototype.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/erange.S b/libc/sysv/errfuns/erange.S index 1dc1b07e3..e9e8e727c 100644 --- a/libc/sysv/errfuns/erange.S +++ b/libc/sysv/errfuns/erange.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eremchg.S b/libc/sysv/errfuns/eremchg.S index 201ae2688..2bdcac692 100644 --- a/libc/sysv/errfuns/eremchg.S +++ b/libc/sysv/errfuns/eremchg.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eremote.S b/libc/sysv/errfuns/eremote.S index db3ddb627..515e7d5b6 100644 --- a/libc/sysv/errfuns/eremote.S +++ b/libc/sysv/errfuns/eremote.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eremoteio.S b/libc/sysv/errfuns/eremoteio.S index 12e2a74b5..d57d9e119 100644 --- a/libc/sysv/errfuns/eremoteio.S +++ b/libc/sysv/errfuns/eremoteio.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/erestart.S b/libc/sysv/errfuns/erestart.S index 30eaa1d0b..67bc02b9b 100644 --- a/libc/sysv/errfuns/erestart.S +++ b/libc/sysv/errfuns/erestart.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/erfkill.S b/libc/sysv/errfuns/erfkill.S index 141b8e85a..49be57d27 100644 --- a/libc/sysv/errfuns/erfkill.S +++ b/libc/sysv/errfuns/erfkill.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/erofs.S b/libc/sysv/errfuns/erofs.S index fdab8c9a8..6d926c890 100644 --- a/libc/sysv/errfuns/erofs.S +++ b/libc/sysv/errfuns/erofs.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eshutdown.S b/libc/sysv/errfuns/eshutdown.S index 1f6d8cfd1..dfbcce120 100644 --- a/libc/sysv/errfuns/eshutdown.S +++ b/libc/sysv/errfuns/eshutdown.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/esocktnosupport.S b/libc/sysv/errfuns/esocktnosupport.S index 6a29e9c81..6891eb9d9 100644 --- a/libc/sysv/errfuns/esocktnosupport.S +++ b/libc/sysv/errfuns/esocktnosupport.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/espipe.S b/libc/sysv/errfuns/espipe.S index 373a08844..4b8bbd3b9 100644 --- a/libc/sysv/errfuns/espipe.S +++ b/libc/sysv/errfuns/espipe.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/esrch.S b/libc/sysv/errfuns/esrch.S index 91dc831d6..d7220c067 100644 --- a/libc/sysv/errfuns/esrch.S +++ b/libc/sysv/errfuns/esrch.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/esrmnt.S b/libc/sysv/errfuns/esrmnt.S index 109dc659e..3cea68263 100644 --- a/libc/sysv/errfuns/esrmnt.S +++ b/libc/sysv/errfuns/esrmnt.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/estale.S b/libc/sysv/errfuns/estale.S index 88a27e0c8..8653aa5b4 100644 --- a/libc/sysv/errfuns/estale.S +++ b/libc/sysv/errfuns/estale.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/estrpipe.S b/libc/sysv/errfuns/estrpipe.S index 52a5c083e..037d0644d 100644 --- a/libc/sysv/errfuns/estrpipe.S +++ b/libc/sysv/errfuns/estrpipe.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/etime.S b/libc/sysv/errfuns/etime.S index a0071f600..b3f273c25 100644 --- a/libc/sysv/errfuns/etime.S +++ b/libc/sysv/errfuns/etime.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/etimedout.S b/libc/sysv/errfuns/etimedout.S index 7787c672a..878b9a7e9 100644 --- a/libc/sysv/errfuns/etimedout.S +++ b/libc/sysv/errfuns/etimedout.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/etoomanyrefs.S b/libc/sysv/errfuns/etoomanyrefs.S index 5e2fe7174..7f22e9ef6 100644 --- a/libc/sysv/errfuns/etoomanyrefs.S +++ b/libc/sysv/errfuns/etoomanyrefs.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/etxtbsy.S b/libc/sysv/errfuns/etxtbsy.S index 672146f58..8cf8c93fb 100644 --- a/libc/sysv/errfuns/etxtbsy.S +++ b/libc/sysv/errfuns/etxtbsy.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/euclean.S b/libc/sysv/errfuns/euclean.S index 891e5f866..80aeddd80 100644 --- a/libc/sysv/errfuns/euclean.S +++ b/libc/sysv/errfuns/euclean.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eunatch.S b/libc/sysv/errfuns/eunatch.S index 655cfc37d..fc675e49d 100644 --- a/libc/sysv/errfuns/eunatch.S +++ b/libc/sysv/errfuns/eunatch.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/eusers.S b/libc/sysv/errfuns/eusers.S index de75227d8..b6ffd4571 100644 --- a/libc/sysv/errfuns/eusers.S +++ b/libc/sysv/errfuns/eusers.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/exdev.S b/libc/sysv/errfuns/exdev.S index 679c3a67b..76fb8f71f 100644 --- a/libc/sysv/errfuns/exdev.S +++ b/libc/sysv/errfuns/exdev.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/errfuns/exfull.S b/libc/sysv/errfuns/exfull.S index fdc83132a..2d8f37848 100644 --- a/libc/sysv/errfuns/exfull.S +++ b/libc/sysv/errfuns/exfull.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" .text.unlikely .ftrace1 diff --git a/libc/sysv/gen.sh b/libc/sysv/gen.sh index da514a903..7abdf723d 100644 --- a/libc/sysv/gen.sh +++ b/libc/sysv/gen.sh @@ -66,7 +66,7 @@ errfun() { NAME="$1" ERRNO="$2" { - printf '#include "libc/macros.internal.h"\n.text.unlikely\n\n' + printf '#include "libc/macros.h"\n.text.unlikely\n\n' printf '\t.ftrace1\n' printf '%s:\n' "$NAME" printf '\t.ftrace2\n' diff --git a/libc/sysv/hostos.S b/libc/sysv/hostos.S index a378a5c70..e4550d488 100644 --- a/libc/sysv/hostos.S +++ b/libc/sysv/hostos.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .bss .balign 8 diff --git a/libc/sysv/macros.internal.h b/libc/sysv/macros.internal.h index da2ec43d6..4d348d5da 100644 --- a/libc/sysv/macros.internal.h +++ b/libc/sysv/macros.internal.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_MACROS_H_ #define COSMOPOLITAN_LIBC_SYSV_MACROS_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __ASSEMBLER__ /* clang-format off */ diff --git a/libc/sysv/restorert.S b/libc/sysv/restorert.S index 864e1d5d9..356fa575e 100644 --- a/libc/sysv/restorert.S +++ b/libc/sysv/restorert.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/sysv/consts/nrlinux.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" .privileged // Linux Signal Trampoline (HOLY CODE) diff --git a/libc/sysv/syscall2.S b/libc/sysv/syscall2.S index c420783ef..30cf685b1 100644 --- a/libc/sysv/syscall2.S +++ b/libc/sysv/syscall2.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Invokes system call w/ arity of two. // diff --git a/libc/sysv/syscall3.S b/libc/sysv/syscall3.S index 06058bb29..fc9ee1051 100644 --- a/libc/sysv/syscall3.S +++ b/libc/sysv/syscall3.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Invokes system call w/ arity of three. // diff --git a/libc/sysv/syscall4.S b/libc/sysv/syscall4.S index c5d37788a..30aa9f4e3 100644 --- a/libc/sysv/syscall4.S +++ b/libc/sysv/syscall4.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Invokes system call w/ arity of four. // diff --git a/libc/sysv/syscon.S b/libc/sysv/syscon.S index 9aeae721a..e3d6e812c 100644 --- a/libc/sysv/syscon.S +++ b/libc/sysv/syscon.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" // Sections for varint encoded magic numbers. // diff --git a/libc/sysv/syscount.S b/libc/sysv/syscount.S index 6ede1dc3e..4bf4ec6d0 100644 --- a/libc/sysv/syscount.S +++ b/libc/sysv/syscount.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // RII System Five system call counter. // diff --git a/libc/sysv/syslib.S b/libc/sysv/syslib.S index e9c165588..9c24943ad 100644 --- a/libc/sysv/syslib.S +++ b/libc/sysv/syslib.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .bss .balign 8 diff --git a/libc/sysv/systemfive.S b/libc/sysv/systemfive.S index 879edaf05..5fd782d62 100644 --- a/libc/sysv/systemfive.S +++ b/libc/sysv/systemfive.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/thread/pt.internal.h" #define SIG_IGN 1 diff --git a/libc/testlib/bench.S b/libc/testlib/bench.S index 730d0beb7..49e1e83db 100644 --- a/libc/testlib/bench.S +++ b/libc/testlib/bench.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .yoink testlib_runallbenchmarks // Decentralized section for benchmark registration. diff --git a/libc/testlib/binequals.c b/libc/testlib/binequals.c index f56000a38..79ab6c9f5 100644 --- a/libc/testlib/binequals.c +++ b/libc/testlib/binequals.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/testlib/testlib.h" /** diff --git a/libc/testlib/blake2b256_tests.S b/libc/testlib/blake2b256_tests.S index d5d600e19..50d02704f 100644 --- a/libc/testlib/blake2b256_tests.S +++ b/libc/testlib/blake2b256_tests.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata // Blake2B256 test vectors. diff --git a/libc/testlib/blocktronics.S b/libc/testlib/blocktronics.S index 055803694..dcbff573b 100644 --- a/libc/testlib/blocktronics.S +++ b/libc/testlib/blocktronics.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata // Nontrivial NUL-terminated string test vector. diff --git a/libc/testlib/ezbench.h b/libc/testlib/ezbench.h index 35fa23e33..70bb39dd3 100644 --- a/libc/testlib/ezbench.h +++ b/libc/testlib/ezbench.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_TESTLIB_EZBENCH_H_ #define COSMOPOLITAN_LIBC_TESTLIB_EZBENCH_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/nexgen32e/bench.h" #include "libc/nexgen32e/x86feature.h" diff --git a/libc/testlib/fixture.S b/libc/testlib/fixture.S index 03139e2ab..bea3297bd 100644 --- a/libc/testlib/fixture.S +++ b/libc/testlib/fixture.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Decentralized section for test fixture registration. // diff --git a/libc/testlib/hexequals.c b/libc/testlib/hexequals.c index a4f8b5cf9..1fadd63ed 100644 --- a/libc/testlib/hexequals.c +++ b/libc/testlib/hexequals.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/testlib/testlib.h" /** diff --git a/libc/testlib/hyperion.S b/libc/testlib/hyperion.S index 0e2925b5e..66bdf3cf8 100644 --- a/libc/testlib/hyperion.S +++ b/libc/testlib/hyperion.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata // Nontrivial NUL-terminated string test vector. diff --git a/libc/testlib/moby.S b/libc/testlib/moby.S index aa382f5e4..fff6bcaaa 100644 --- a/libc/testlib/moby.S +++ b/libc/testlib/moby.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata // Nontrivial NUL-terminated string test vector. diff --git a/libc/testlib/polluteregisters.S b/libc/testlib/polluteregisters.S index b26144eb4..50cf2d5e4 100644 --- a/libc/testlib/polluteregisters.S +++ b/libc/testlib/polluteregisters.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/nexgen32e/x86feature.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" __polluteregisters: #ifdef __x86_64__ diff --git a/libc/testlib/subprocess.h b/libc/testlib/subprocess.h index 0d396de75..c09ee56c0 100644 --- a/libc/testlib/subprocess.h +++ b/libc/testlib/subprocess.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_LIBC_TESTLIB_SUBPROCESS_H_ #define COSMOPOLITAN_LIBC_TESTLIB_SUBPROCESS_H_ #include "libc/calls/calls.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/testlib/testlib.h" COSMOPOLITAN_C_START_ diff --git a/libc/testlib/testcase.S b/libc/testlib/testcase.S index 272521378..46a76c374 100644 --- a/libc/testlib/testcase.S +++ b/libc/testlib/testcase.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Decentralized section for test testcase registration. // diff --git a/libc/testlib/testmain.c b/libc/testlib/testmain.c index e211f8564..083a2daa2 100644 --- a/libc/testlib/testmain.c +++ b/libc/testlib/testmain.c @@ -32,7 +32,7 @@ #include "libc/intrin/ubsan.h" #include "libc/intrin/weaken.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/leaks.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/nexgen32e.h" diff --git a/libc/testlib/testrunner.c b/libc/testlib/testrunner.c index efe4483e2..27ef2a639 100644 --- a/libc/testlib/testrunner.c +++ b/libc/testlib/testrunner.c @@ -26,7 +26,7 @@ #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/process.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" diff --git a/libc/testlib/viewables.S b/libc/testlib/viewables.S index aa5154a93..f367d3577 100644 --- a/libc/testlib/viewables.S +++ b/libc/testlib/viewables.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" .rodata // Nontrivial NUL-terminated string test vector. diff --git a/libc/thread/makecontext.c b/libc/thread/makecontext.c index 0108979f7..328ff6a4e 100644 --- a/libc/thread/makecontext.c +++ b/libc/thread/makecontext.c @@ -23,7 +23,7 @@ #include "libc/nexgen32e/nexgen32e.h" #include "libc/nexgen32e/stackframe.h" #include "libc/runtime/runtime.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/str/str.h" #include "libc/thread/thread.h" diff --git a/libc/thread/mktls.c b/libc/thread/mktls.c index 3e461fe17..b48ea3137 100644 --- a/libc/thread/mktls.c +++ b/libc/thread/mktls.c @@ -19,7 +19,7 @@ #include "ape/sections.internal.h" #include "libc/dce.h" #include "libc/intrin/atomic.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" diff --git a/libc/thread/pthread_create.c b/libc/thread/pthread_create.c index f44163c85..ec19ee9a7 100644 --- a/libc/thread/pthread_create.c +++ b/libc/thread/pthread_create.c @@ -32,7 +32,7 @@ #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" #include "libc/log/internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alloca.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/crc32.h" diff --git a/libc/thread/pthread_detach.c b/libc/thread/pthread_detach.c index 8c0bc0c6f..da41ee352 100644 --- a/libc/thread/pthread_detach.c +++ b/libc/thread/pthread_detach.c @@ -21,7 +21,7 @@ #include "libc/intrin/atomic.h" #include "libc/intrin/describeflags.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/thread/posixthread.internal.h" #include "libc/thread/thread.h" diff --git a/libc/thread/pthread_getattr_np.c b/libc/thread/pthread_getattr_np.c index 65f8c470a..7742b329f 100644 --- a/libc/thread/pthread_getattr_np.c +++ b/libc/thread/pthread_getattr_np.c @@ -22,7 +22,7 @@ #include "libc/intrin/atomic.h" #include "libc/intrin/maps.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" #include "libc/sysv/consts/auxv.h" diff --git a/libc/thread/pthread_getname_np.c b/libc/thread/pthread_getname_np.c index cca44d59d..5f31b8287 100644 --- a/libc/thread/pthread_getname_np.c +++ b/libc/thread/pthread_getname_np.c @@ -24,7 +24,7 @@ #include "libc/fmt/itoa.h" #include "libc/intrin/asmflag.h" #include "libc/intrin/atomic.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/consts/o.h" diff --git a/libc/vga/rlinit-init-vga.S b/libc/vga/rlinit-init-vga.S index 70ff1ccb6..6a759cb73 100644 --- a/libc/vga/rlinit-init-vga.S +++ b/libc/vga/rlinit-init-vga.S @@ -24,7 +24,7 @@ │ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR │ │ OTHER DEALINGS IN THE SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/mman.internal.h" #include "libc/vga/vga.internal.h" diff --git a/libc/vga/rlinit-vesa.S b/libc/vga/rlinit-vesa.S index f1a91b1a0..dfa1922f8 100644 --- a/libc/vga/rlinit-vesa.S +++ b/libc/vga/rlinit-vesa.S @@ -25,7 +25,7 @@ │ OTHER DEALINGS IN THE SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "ape/relocations.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/mman.internal.h" #include "libc/vga/vga.internal.h" diff --git a/libc/vga/tty-graph.c b/libc/vga/tty-graph.c index 55c4c409f..1c2ad77df 100644 --- a/libc/vga/tty-graph.c +++ b/libc/vga/tty-graph.c @@ -25,7 +25,7 @@ │ OTHER DEALINGS IN THE SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/newbie.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/vga/vga.internal.h" diff --git a/libc/vga/tty-graph.inc b/libc/vga/tty-graph.inc index 392e447f0..dc646ad2d 100644 --- a/libc/vga/tty-graph.inc +++ b/libc/vga/tty-graph.inc @@ -25,7 +25,7 @@ │ OTHER DEALINGS IN THE SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/newbie.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdckdint.h" #include "libc/str/str.h" #include "libc/vga/vga.internal.h" diff --git a/libc/vga/tty-klog.greg.c b/libc/vga/tty-klog.greg.c index e841034b2..35afe5380 100644 --- a/libc/vga/tty-klog.greg.c +++ b/libc/vga/tty-klog.greg.c @@ -25,7 +25,7 @@ │ OTHER DEALINGS IN THE SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/newbie.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/mman.internal.h" #include "libc/str/str.h" #include "libc/vga/vga.internal.h" diff --git a/libc/x/syslog.c b/libc/x/syslog.c index 8c5840016..9d278ed84 100644 --- a/libc/x/syslog.c +++ b/libc/x/syslog.c @@ -25,7 +25,7 @@ #include "libc/errno.h" #include "libc/intrin/safemacros.h" #include "libc/log/internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/events.h" #include "libc/nt/runtime.h" #include "libc/sock/sock.h" diff --git a/libc/zip.internal.h b/libc/zip.h similarity index 100% rename from libc/zip.internal.h rename to libc/zip.h diff --git a/net/finger/fingersyn.c b/net/finger/fingersyn.c index eb3d24fab..e46a091e2 100644 --- a/net/finger/fingersyn.c +++ b/net/finger/fingersyn.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" /** * Fingers IP+TCP SYN packet. diff --git a/net/http/base32.c b/net/http/base32.c index c9a3af12f..3d8ed1160 100644 --- a/net/http/base32.c +++ b/net/http/base32.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" diff --git a/net/http/decodebase64.c b/net/http/decodebase64.c index a9b19288a..a3aeaa38d 100644 --- a/net/http/decodebase64.c +++ b/net/http/decodebase64.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "net/http/escape.h" diff --git a/net/http/encodeurl.c b/net/http/encodeurl.c index acb7e09d3..455a2bdc3 100644 --- a/net/http/encodeurl.c +++ b/net/http/encodeurl.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/mem/mem.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "net/http/escape.h" #include "net/http/url.h" diff --git a/net/http/findcontenttype.c b/net/http/findcontenttype.c index 5ad6a3a81..587a05cad 100644 --- a/net/http/findcontenttype.c +++ b/net/http/findcontenttype.c @@ -18,10 +18,10 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/intrin/bswap.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/serialize.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "net/http/http.h" static const struct ContentTypeExtension { diff --git a/net/http/formathttpdatetime.c b/net/http/formathttpdatetime.c index 80089e3d0..e0b6d5c1b 100644 --- a/net/http/formathttpdatetime.c +++ b/net/http/formathttpdatetime.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/time.h" #include "net/http/http.h" diff --git a/net/http/gethttpheader.inc b/net/http/gethttpheader.inc index 72f3b7afe..8e58c9279 100644 --- a/net/http/gethttpheader.inc +++ b/net/http/gethttpheader.inc @@ -33,7 +33,7 @@ #line 1 "gethttpheader.gperf" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "net/http/http.h" #define GPERF_DOWNCASE #line 12 "gethttpheader.gperf" diff --git a/net/http/gethttpreason.c b/net/http/gethttpreason.c index 276a75baa..e4492f914 100644 --- a/net/http/gethttpreason.c +++ b/net/http/gethttpreason.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/itoa.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "net/http/http.h" static const struct thatispacked HttpReason { diff --git a/net/http/ismimetype.c b/net/http/ismimetype.c index a810a0585..17a0956d6 100644 --- a/net/http/ismimetype.c +++ b/net/http/ismimetype.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "net/http/http.h" /** diff --git a/net/http/isnocompressext.c b/net/http/isnocompressext.c index 10b6b7e72..49b21be28 100644 --- a/net/http/isnocompressext.c +++ b/net/http/isnocompressext.c @@ -17,10 +17,10 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/bswap.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/serialize.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "net/http/http.h" static const char kNoCompressExts[][8] = { diff --git a/net/http/parsehttpmessage.c b/net/http/parsehttpmessage.c index 1a52fce57..8a0429a41 100644 --- a/net/http/parsehttpmessage.c +++ b/net/http/parsehttpmessage.c @@ -25,7 +25,7 @@ #include "libc/serialize.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/errfuns.h" #include "libc/x/x.h" #include "net/http/http.h" @@ -47,6 +47,7 @@ void DestroyHttpMessage(struct HttpMessage *r) { free(r->xheaders.p); r->xheaders.p = NULL; r->xheaders.n = 0; + r->xheaders.c = 0; } } diff --git a/net/http/parsehttpmethod.c b/net/http/parsehttpmethod.c index bb71041d4..152dadc2e 100644 --- a/net/http/parsehttpmethod.c +++ b/net/http/parsehttpmethod.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "net/http/http.h" /** diff --git a/net/http/parsehttprange.c b/net/http/parsehttprange.c index 80aa738b7..4974482dc 100644 --- a/net/http/parsehttprange.c +++ b/net/http/parsehttprange.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdckdint.h" #include "libc/str/str.h" #include "net/http/http.h" diff --git a/net/http/parseurl.c b/net/http/parseurl.c index c967f4543..16ffd4b58 100644 --- a/net/http/parseurl.c +++ b/net/http/parseurl.c @@ -20,7 +20,7 @@ #include "libc/limits.h" #include "libc/mem/mem.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/x/x.h" #include "net/http/escape.h" #include "net/http/url.h" diff --git a/net/http/unchunk.c b/net/http/unchunk.c index d3fe94bfe..cbacd179e 100644 --- a/net/http/unchunk.c +++ b/net/http/unchunk.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/errfuns.h" #include "net/http/escape.h" #include "net/http/http.h" diff --git a/net/https/describesslverifyfailure.c b/net/https/describesslverifyfailure.c index 46e0056ab..44b22a809 100644 --- a/net/https/describesslverifyfailure.c +++ b/net/https/describesslverifyfailure.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "net/https/https.h" diff --git a/net/turfwar/turfwar.c b/net/turfwar/turfwar.c index 6a0b956cc..3a717fc50 100644 --- a/net/turfwar/turfwar.c +++ b/net/turfwar/turfwar.c @@ -39,7 +39,7 @@ #include "libc/intrin/strace.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/mem/sortedints.internal.h" @@ -74,7 +74,7 @@ #include "libc/time.h" #include "libc/x/x.h" #include "libc/x/xasprintf.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "net/http/escape.h" #include "net/http/http.h" #include "net/http/ip.h" diff --git a/test/dsp/core/alaw_test.c b/test/dsp/core/alaw_test.c index ec434c8da..5f91bf176 100644 --- a/test/dsp/core/alaw_test.c +++ b/test/dsp/core/alaw_test.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/core/core.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/testlib/ezbench.h" diff --git a/test/dsp/core/getintegercoefficients_test.c b/test/dsp/core/getintegercoefficients_test.c index 4fa0e3009..ec7cd03e3 100644 --- a/test/dsp/core/getintegercoefficients_test.c +++ b/test/dsp/core/getintegercoefficients_test.c @@ -19,7 +19,7 @@ #include "dsp/core/core.h" #include "dsp/core/q.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" diff --git a/test/dsp/core/mulaw_test.c b/test/dsp/core/mulaw_test.c index f19eda5c9..d2c0f2863 100644 --- a/test/dsp/core/mulaw_test.c +++ b/test/dsp/core/mulaw_test.c @@ -19,7 +19,7 @@ #include "dsp/core/core.h" #include "dsp/core/ituround.h" #include "libc/assert.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" diff --git a/test/dsp/core/scalevolume_test.c b/test/dsp/core/scalevolume_test.c index 3940a7055..a69d2fbf4 100644 --- a/test/dsp/core/scalevolume_test.c +++ b/test/dsp/core/scalevolume_test.c @@ -20,7 +20,7 @@ #include "dsp/mpeg/mpeg.h" #include "libc/limits.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/x86feature.h" #include "libc/stdio/rand.h" #include "libc/testlib/ezbench.h" diff --git a/test/dsp/scale/scale_test.c b/test/dsp/scale/scale_test.c index be2ae9d6e..b43368f43 100644 --- a/test/dsp/scale/scale_test.c +++ b/test/dsp/scale/scale_test.c @@ -22,7 +22,7 @@ #include "dsp/core/core.h" #include "dsp/core/half.h" #include "libc/fmt/bing.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" diff --git a/test/libc/calls/cachestat_test.c b/test/libc/calls/cachestat_test.c index 63c3e8088..b756d852d 100644 --- a/test/libc/calls/cachestat_test.c +++ b/test/libc/calls/cachestat_test.c @@ -24,7 +24,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/runtime/runtime.h" #include "libc/runtime/sysconf.h" diff --git a/test/libc/calls/fchmodat_test.c b/test/libc/calls/fchmodat_test.c index cb6d99d40..e103e3569 100644 --- a/test/libc/calls/fchmodat_test.c +++ b/test/libc/calls/fchmodat_test.c @@ -20,7 +20,7 @@ #include "libc/calls/struct/stat.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/consts/o.h" diff --git a/test/libc/calls/fcntl_test.c b/test/libc/calls/fcntl_test.c index 84675e66a..d816d27fe 100644 --- a/test/libc/calls/fcntl_test.c +++ b/test/libc/calls/fcntl_test.c @@ -22,7 +22,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/f.h" #include "libc/sysv/consts/fd.h" diff --git a/test/libc/calls/getcwd_test.c b/test/libc/calls/getcwd_test.c index 0cd9919a6..f76653466 100644 --- a/test/libc/calls/getcwd_test.c +++ b/test/libc/calls/getcwd_test.c @@ -22,7 +22,7 @@ #include "libc/errno.h" #include "libc/fmt/libgen.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/serialize.h" #include "libc/str/str.h" diff --git a/test/libc/calls/getgroups_test.c b/test/libc/calls/getgroups_test.c index 7c221e899..e19372297 100644 --- a/test/libc/calls/getgroups_test.c +++ b/test/libc/calls/getgroups_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/testlib/testlib.h" TEST(getgroups, test) { diff --git a/test/libc/calls/getrandom_test.c b/test/libc/calls/getrandom_test.c index 3e2386a7a..245fc967c 100644 --- a/test/libc/calls/getrandom_test.c +++ b/test/libc/calls/getrandom_test.c @@ -23,7 +23,7 @@ #include "libc/calls/struct/sigset.h" #include "libc/errno.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" @@ -34,7 +34,7 @@ #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/grnd.h" #include "libc/sysv/consts/sig.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/calls/lock_ofd_test.c b/test/libc/calls/lock_ofd_test.c index 4b7081299..09c279cf2 100644 --- a/test/libc/calls/lock_ofd_test.c +++ b/test/libc/calls/lock_ofd_test.c @@ -23,7 +23,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/f.h" #include "libc/sysv/consts/o.h" diff --git a/test/libc/calls/lock_test.c b/test/libc/calls/lock_test.c index 5307228be..d05495400 100644 --- a/test/libc/calls/lock_test.c +++ b/test/libc/calls/lock_test.c @@ -20,7 +20,7 @@ #include "libc/calls/struct/flock.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sysv/consts/f.h" #include "libc/sysv/consts/o.h" diff --git a/test/libc/calls/open_test.c b/test/libc/calls/open_test.c index 230ef10b2..1962e6c07 100644 --- a/test/libc/calls/open_test.c +++ b/test/libc/calls/open_test.c @@ -23,7 +23,7 @@ #include "libc/calls/syscall-sysv.internal.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" diff --git a/test/libc/calls/pledge_test.c b/test/libc/calls/pledge_test.c index c710147f1..d53886841 100644 --- a/test/libc/calls/pledge_test.c +++ b/test/libc/calls/pledge_test.c @@ -30,7 +30,7 @@ #include "libc/calls/syscall_support-sysv.internal.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/calls/reservefd_test.c b/test/libc/calls/reservefd_test.c index b1013e019..bd8c608d3 100644 --- a/test/libc/calls/reservefd_test.c +++ b/test/libc/calls/reservefd_test.c @@ -23,7 +23,7 @@ #include "libc/calls/struct/rlimit.h" #include "libc/calls/struct/sigaction.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" diff --git a/test/libc/calls/writev_test.c b/test/libc/calls/writev_test.c index c6a9a9540..834ae1a90 100644 --- a/test/libc/calls/writev_test.c +++ b/test/libc/calls/writev_test.c @@ -21,7 +21,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/fmt/formatint64thousands_test.c b/test/libc/fmt/formatint64thousands_test.c index c52389ebc..b0b1398b6 100644 --- a/test/libc/fmt/formatint64thousands_test.c +++ b/test/libc/fmt/formatint64thousands_test.c @@ -19,7 +19,7 @@ #include "libc/fmt/conv.h" #include "libc/fmt/itoa.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/stdio/stdio.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/intrin/demangle_test.c b/test/libc/intrin/demangle_test.c index 3ec28860c..27fce05ae 100644 --- a/test/libc/intrin/demangle_test.c +++ b/test/libc/intrin/demangle_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "demangle_cases.inc" #include "libc/cosmo.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/internal.h" #include "libc/str/str.h" diff --git a/test/libc/intrin/describeflags_test.c b/test/libc/intrin/describeflags_test.c index 14f2892a0..65be2c1e7 100644 --- a/test/libc/intrin/describeflags_test.c +++ b/test/libc/intrin/describeflags_test.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/testlib/testlib.h" static const struct DescribeFlags kFlags[] = { diff --git a/test/libc/intrin/kprintf_test.c b/test/libc/intrin/kprintf_test.c index e6d17b336..eeabf193a 100644 --- a/test/libc/intrin/kprintf_test.c +++ b/test/libc/intrin/kprintf_test.c @@ -23,7 +23,7 @@ #include "libc/intrin/kprintf.h" #include "libc/limits.h" #include "libc/log/libfatal.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/memtrack.internal.h" #include "libc/runtime/runtime.h" #include "libc/runtime/symbols.internal.h" diff --git a/test/libc/intrin/lockipc_test.c b/test/libc/intrin/lockipc_test.c index 6e9b84d52..0f3467bc2 100644 --- a/test/libc/intrin/lockipc_test.c +++ b/test/libc/intrin/lockipc_test.c @@ -19,7 +19,7 @@ #include "libc/calls/calls.h" #include "libc/errno.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/testlib/testlib.h" #include "libc/thread/thread.h" diff --git a/test/libc/intrin/magicu_test.c b/test/libc/intrin/magicu_test.c index 4a5753e2a..351a861bb 100644 --- a/test/libc/intrin/magicu_test.c +++ b/test/libc/intrin/magicu_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/magicu.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/intrin/memmove_test.c b/test/libc/intrin/memmove_test.c index 701ef044a..7a4dbeb03 100644 --- a/test/libc/intrin/memmove_test.c +++ b/test/libc/intrin/memmove_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/intrin/pthread_mutex_lock_test.c b/test/libc/intrin/pthread_mutex_lock_test.c index e2e97cda1..0ee1dea05 100644 --- a/test/libc/intrin/pthread_mutex_lock_test.c +++ b/test/libc/intrin/pthread_mutex_lock_test.c @@ -23,7 +23,7 @@ #include "libc/errno.h" #include "libc/intrin/strace.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/test/libc/intrin/rand64_test.c b/test/libc/intrin/rand64_test.c index dc0c19a4b..0e0062656 100644 --- a/test/libc/intrin/rand64_test.c +++ b/test/libc/intrin/rand64_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/calls/struct/sigaction.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/internal.h" #include "libc/stdio/rand.h" #include "libc/str/str.h" diff --git a/test/libc/intrin/strcmp_test.c b/test/libc/intrin/strcmp_test.c index 742dac914..c2be5af6c 100644 --- a/test/libc/intrin/strcmp_test.c +++ b/test/libc/intrin/strcmp_test.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/ctype.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/cachesize.h" diff --git a/test/libc/intrin/strlen_test.c b/test/libc/intrin/strlen_test.c index 87c316fa0..3d0619ee4 100644 --- a/test/libc/intrin/strlen_test.c +++ b/test/libc/intrin/strlen_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" diff --git a/test/libc/intrin/tree_test.c b/test/libc/intrin/tree_test.c index 0f9d3f04d..7bafb37dd 100644 --- a/test/libc/intrin/tree_test.c +++ b/test/libc/intrin/tree_test.c @@ -17,7 +17,7 @@ #include "libc/intrin/kprintf.h" #include "libc/intrin/maps.h" #include "libc/intrin/tree.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" diff --git a/test/libc/log/backtrace.c b/test/libc/log/backtrace.c index 4eb39eda3..09b858a8f 100644 --- a/test/libc/log/backtrace.c +++ b/test/libc/log/backtrace.c @@ -20,7 +20,7 @@ #include "libc/intrin/weaken.h" #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/leaks.h" #include "libc/mem/mem.h" #include "libc/runtime/internal.h" diff --git a/test/libc/mem/djbsort_test.c b/test/libc/mem/djbsort_test.c index 3f1f9db9b..e4c53ff94 100644 --- a/test/libc/mem/djbsort_test.c +++ b/test/libc/mem/djbsort_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/test/libc/mem/malloc_test.c b/test/libc/mem/malloc_test.c index dd1908e68..5e69b98ca 100644 --- a/test/libc/mem/malloc_test.c +++ b/test/libc/mem/malloc_test.c @@ -24,7 +24,7 @@ #include "libc/intrin/cxaatexit.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/safemacros.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/internal.h" diff --git a/test/libc/mem/qsort_test.c b/test/libc/mem/qsort_test.c index e693da6b6..de279d59e 100644 --- a/test/libc/mem/qsort_test.c +++ b/test/libc/mem/qsort_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/test/libc/nexgen32e/kbase36_test.c b/test/libc/nexgen32e/kbase36_test.c index aea4b9959..cd23d5fd0 100644 --- a/test/libc/nexgen32e/kbase36_test.c +++ b/test/libc/nexgen32e/kbase36_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/testlib/testlib.h" TEST(kBase36, test) { diff --git a/test/libc/nexgen32e/kcp437_test.c b/test/libc/nexgen32e/kcp437_test.c index 46ce97b07..018453744 100644 --- a/test/libc/nexgen32e/kcp437_test.c +++ b/test/libc/nexgen32e/kcp437_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/unicode.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/nexgen32e/memmove_test.c b/test/libc/nexgen32e/memmove_test.c index 8c54d5d08..92625b768 100644 --- a/test/libc/nexgen32e/memmove_test.c +++ b/test/libc/nexgen32e/memmove_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/rand.h" #include "libc/str/str.h" diff --git a/test/libc/proc/fork_test.c b/test/libc/proc/fork_test.c index 641909045..958fbbb2b 100644 --- a/test/libc/proc/fork_test.c +++ b/test/libc/proc/fork_test.c @@ -24,7 +24,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" diff --git a/test/libc/stdio/dtoa_test.c b/test/libc/stdio/dtoa_test.c index 738dbc841..7929d3daf 100644 --- a/test/libc/stdio/dtoa_test.c +++ b/test/libc/stdio/dtoa_test.c @@ -19,7 +19,7 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/sched_param.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/test/libc/stdio/getentropy_test.c b/test/libc/stdio/getentropy_test.c index 532e6b098..f23ff2d4d 100644 --- a/test/libc/stdio/getentropy_test.c +++ b/test/libc/stdio/getentropy_test.c @@ -22,13 +22,13 @@ #include "libc/calls/struct/sigset.h" #include "libc/dce.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/sig.h" #include "libc/testlib/testlib.h" #include "libc/thread/thread.h" diff --git a/test/libc/stdio/mt19937_test.c b/test/libc/stdio/mt19937_test.c index 1da2588a9..17de8f5ec 100644 --- a/test/libc/stdio/mt19937_test.c +++ b/test/libc/stdio/mt19937_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/stdio/zipdir_test.c b/test/libc/stdio/zipdir_test.c index 83dda5aff..141bb9ad3 100644 --- a/test/libc/stdio/zipdir_test.c +++ b/test/libc/stdio/zipdir_test.c @@ -20,7 +20,7 @@ #include "libc/calls/struct/dirent.h" #include "libc/calls/struct/stat.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/str/blake2_test.c b/test/libc/str/blake2_test.c index 568a5d7ef..4fe6d1427 100644 --- a/test/libc/str/blake2_test.c +++ b/test/libc/str/blake2_test.c @@ -23,7 +23,7 @@ #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/testlib/benchmark.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/str/hexpcpy_test.c b/test/libc/str/hexpcpy_test.c index 0a1c1c93d..532342d64 100644 --- a/test/libc/str/hexpcpy_test.c +++ b/test/libc/str/hexpcpy_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/rand.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/str/strcasestr_test.c b/test/libc/str/strcasestr_test.c index a4b29daff..578e2e70e 100644 --- a/test/libc/str/strcasestr_test.c +++ b/test/libc/str/strcasestr_test.c @@ -22,7 +22,7 @@ #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/x86feature.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/thread/pthread_create_test.c b/test/libc/thread/pthread_create_test.c index d977dd0dc..03465ff93 100644 --- a/test/libc/thread/pthread_create_test.c +++ b/test/libc/thread/pthread_create_test.c @@ -26,7 +26,7 @@ #include "libc/errno.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/nexgen32e.h" diff --git a/test/libc/tinymath/fdot_test.cc b/test/libc/tinymath/fdot_test.cc index b5b6ab6ca..9cd724926 100644 --- a/test/libc/tinymath/fdot_test.cc +++ b/test/libc/tinymath/fdot_test.cc @@ -1,7 +1,7 @@ #include "libc/assert.h" #include "libc/calls/struct/timespec.h" #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/leaks.h" diff --git a/test/libc/tinymath/fsum_test.cc b/test/libc/tinymath/fsum_test.cc index 65f58b8e9..5e51c4cc2 100644 --- a/test/libc/tinymath/fsum_test.cc +++ b/test/libc/tinymath/fsum_test.cc @@ -1,7 +1,7 @@ #include "libc/assert.h" #include "libc/calls/struct/timespec.h" #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/leaks.h" diff --git a/test/libc/tinymath/powl_test.c b/test/libc/tinymath/powl_test.c index 0c2f3bada..8d25a7186 100644 --- a/test/libc/tinymath/powl_test.c +++ b/test/libc/tinymath/powl_test.c @@ -20,7 +20,7 @@ #include "libc/calls/struct/siginfo.h" #include "libc/calls/ucontext.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/runtime/pc.internal.h" diff --git a/test/libc/tinymath/strtod_test.c b/test/libc/tinymath/strtod_test.c index 05e46173e..e6a64531c 100644 --- a/test/libc/tinymath/strtod_test.c +++ b/test/libc/tinymath/strtod_test.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/fenv.h" diff --git a/test/libc/tinymath/tanh_test.c b/test/libc/tinymath/tanh_test.c index c59e5511c..bf3062602 100644 --- a/test/libc/tinymath/tanh_test.c +++ b/test/libc/tinymath/tanh_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/xed/x86ild_lib.c b/test/libc/xed/x86ild_lib.c index e7cc1b0e7..af8d699ae 100644 --- a/test/libc/xed/x86ild_lib.c +++ b/test/libc/xed/x86ild_lib.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/bing.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" diff --git a/test/net/https/mbedtls_test.c b/test/net/https/mbedtls_test.c index 34eea7401..992ffdf02 100644 --- a/test/net/https/mbedtls_test.c +++ b/test/net/https/mbedtls_test.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/bswap.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/nexgen32e/crc32.h" #include "libc/nexgen32e/nexgen32e.h" diff --git a/test/tool/net/sqlite_test.c b/test/tool/net/sqlite_test.c index 96c5bacc3..5df4ff716 100644 --- a/test/tool/net/sqlite_test.c +++ b/test/tool/net/sqlite_test.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/test/tool/plinko/plinko_test.c b/test/tool/plinko/plinko_test.c index 087663223..aa260d554 100644 --- a/test/tool/plinko/plinko_test.c +++ b/test/tool/plinko/plinko_test.c @@ -20,7 +20,7 @@ #include "libc/calls/struct/sigaction.h" #include "libc/errno.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" diff --git a/test/tool/viz/lib/fun_test.c b/test/tool/viz/lib/fun_test.c index 11315a9dc..a158d8e82 100644 --- a/test/tool/viz/lib/fun_test.c +++ b/test/tool/viz/lib/fun_test.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/stdio/rand.h" #include "libc/str/str.h" diff --git a/test/tool/viz/lib/ycbcr2rgb2_test.c b/test/tool/viz/lib/ycbcr2rgb2_test.c index 1e0f9e0e6..4136cf4d3 100644 --- a/test/tool/viz/lib/ycbcr2rgb2_test.c +++ b/test/tool/viz/lib/ycbcr2rgb2_test.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/mpeg/mpeg.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/third_party/chibicc/as.c b/third_party/chibicc/as.c index e17c68d27..2859df2b7 100644 --- a/third_party/chibicc/as.c +++ b/third_party/chibicc/as.c @@ -24,13 +24,13 @@ #include "libc/intrin/popcnt.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/crc32.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/s.h" #include "libc/x/x.h" diff --git a/third_party/chibicc/chibicc.h b/third_party/chibicc/chibicc.h index 25beb3469..aefe6592e 100644 --- a/third_party/chibicc/chibicc.h +++ b/third_party/chibicc/chibicc.h @@ -11,7 +11,7 @@ #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/crc32.h" #include "libc/runtime/runtime.h" diff --git a/third_party/chibicc/test/vla_test.c b/third_party/chibicc/test/vla_test.c index b5010645d..870e04775 100644 --- a/third_party/chibicc/test/vla_test.c +++ b/third_party/chibicc/test/vla_test.c @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "third_party/chibicc/test/test.h" int index1d(int xn, int p[xn], int x) { diff --git a/third_party/chibicc/tokenize.c b/third_party/chibicc/tokenize.c index cc297966a..ea12c8765 100644 --- a/third_party/chibicc/tokenize.c +++ b/third_party/chibicc/tokenize.c @@ -2,7 +2,7 @@ #include "libc/log/log.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "third_party/chibicc/chibicc.h" #include "third_party/chibicc/file.h" #include "libc/ctype.h" diff --git a/third_party/compiler_rt/comprt.S b/third_party/compiler_rt/comprt.S index 95060b658..d31861204 100644 --- a/third_party/compiler_rt/comprt.S +++ b/third_party/compiler_rt/comprt.S @@ -1,4 +1,4 @@ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Nop ref this to force pull the license into linkage. .section .yoink diff --git a/third_party/dlmalloc/dlmalloc.c b/third_party/dlmalloc/dlmalloc.c index b79113311..28f516f0e 100644 --- a/third_party/dlmalloc/dlmalloc.c +++ b/third_party/dlmalloc/dlmalloc.c @@ -8,7 +8,7 @@ #include "libc/intrin/bsr.h" #include "libc/intrin/likely.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/runtime/internal.h" diff --git a/third_party/dlmalloc/threaded.inc b/third_party/dlmalloc/threaded.inc index 83d608b9b..2454742cd 100644 --- a/third_party/dlmalloc/threaded.inc +++ b/third_party/dlmalloc/threaded.inc @@ -20,7 +20,7 @@ #include "libc/intrin/magicu.h" #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/rdtscp.h" #include "libc/nexgen32e/x86feature.h" #include "libc/runtime/runtime.h" diff --git a/third_party/gdtoa/misc.c b/third_party/gdtoa/misc.c index 75d3883d8..845f73223 100644 --- a/third_party/gdtoa/misc.c +++ b/third_party/gdtoa/misc.c @@ -30,7 +30,7 @@ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/thread/thread.h" #include "libc/thread/tls.h" diff --git a/third_party/linenoise/linenoise.c b/third_party/linenoise/linenoise.c index 94ecebb90..972044bb1 100644 --- a/third_party/linenoise/linenoise.c +++ b/third_party/linenoise/linenoise.c @@ -144,7 +144,7 @@ #include "libc/intrin/strace.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/rdtsc.h" @@ -155,7 +155,7 @@ #include "libc/stdio/append.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/unicode.h" #include "libc/sysv/consts/fileno.h" #include "libc/sysv/consts/map.h" diff --git a/third_party/lua/lrepl.c b/third_party/lua/lrepl.c index c2253c129..5201f1e7b 100644 --- a/third_party/lua/lrepl.c +++ b/third_party/lua/lrepl.c @@ -32,7 +32,7 @@ #include "libc/errno.h" #include "libc/intrin/nomultics.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/third_party/lua/luacallwithtrace.c b/third_party/lua/luacallwithtrace.c index 7dee8c79f..5c0ac4d93 100644 --- a/third_party/lua/luacallwithtrace.c +++ b/third_party/lua/luacallwithtrace.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "third_party/lua/cosmo.h" #include "third_party/lua/lauxlib.h" diff --git a/third_party/lua/lunix.c b/third_party/lua/lunix.c index 8f9e8a966..8105cc313 100644 --- a/third_party/lua/lunix.c +++ b/third_party/lua/lunix.c @@ -49,7 +49,7 @@ #include "libc/intrin/strace.h" #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/process.h" #include "libc/nt/runtime.h" diff --git a/third_party/maxmind/getmetroname.c b/third_party/maxmind/getmetroname.c index 2326f2ddb..79a6e1ca7 100644 --- a/third_party/maxmind/getmetroname.c +++ b/third_party/maxmind/getmetroname.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "third_party/maxmind/maxminddb.h" const struct thatispacked MetroName { diff --git a/third_party/mbedtls/bigmul.c b/third_party/mbedtls/bigmul.c index 8d84456ae..2233ea644 100644 --- a/third_party/mbedtls/bigmul.c +++ b/third_party/mbedtls/bigmul.c @@ -17,7 +17,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/log/backtrace.internal.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/x86feature.h" #include "third_party/mbedtls/bignum.h" diff --git a/third_party/mbedtls/bignum.c b/third_party/mbedtls/bignum.c index 96f0eb1a1..6bcf0f029 100644 --- a/third_party/mbedtls/bignum.c +++ b/third_party/mbedtls/bignum.c @@ -19,7 +19,7 @@ #include "libc/serialize.h" #include "libc/intrin/bsf.h" #include "libc/intrin/bswap.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/nexgen32e.h" #include "libc/nexgen32e/x86feature.h" #include "libc/runtime/runtime.h" diff --git a/third_party/mbedtls/bigshift.c b/third_party/mbedtls/bigshift.c index d6be87e91..0c056a145 100644 --- a/third_party/mbedtls/bigshift.c +++ b/third_party/mbedtls/bigshift.c @@ -15,7 +15,7 @@ │ See the License for the specific language governing permissions and │ │ limitations under the License. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "third_party/mbedtls/bignum.h" #include "third_party/mbedtls/bignum_internal.h" diff --git a/third_party/mbedtls/fastdiv.h b/third_party/mbedtls/fastdiv.h index 16d866a5c..df177adfd 100644 --- a/third_party/mbedtls/fastdiv.h +++ b/third_party/mbedtls/fastdiv.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_THIRD_PARTY_MBEDTLS_FASTDIV_H_ #define COSMOPOLITAN_THIRD_PARTY_MBEDTLS_FASTDIV_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" COSMOPOLITAN_C_START_ struct Divisor { diff --git a/third_party/mbedtls/formatclientciphers.c b/third_party/mbedtls/formatclientciphers.c index 3b2b04c3b..392373a0c 100644 --- a/third_party/mbedtls/formatclientciphers.c +++ b/third_party/mbedtls/formatclientciphers.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/serialize.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/stdio/append.h" #include "third_party/mbedtls/iana.h" diff --git a/third_party/mbedtls/sha1.c b/third_party/mbedtls/sha1.c index 7507a7445..193a4c3a5 100644 --- a/third_party/mbedtls/sha1.c +++ b/third_party/mbedtls/sha1.c @@ -17,7 +17,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/mbedtls/sha1.h" #include "libc/serialize.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/sha.h" #include "libc/nexgen32e/x86feature.h" #include "libc/str/str.h" diff --git a/third_party/mbedtls/sha256.c b/third_party/mbedtls/sha256.c index 03e979011..6112e6c77 100644 --- a/third_party/mbedtls/sha256.c +++ b/third_party/mbedtls/sha256.c @@ -17,7 +17,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/mbedtls/sha256.h" #include "libc/dce.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/nexgen32e.h" #include "libc/nexgen32e/sha.h" #include "libc/nexgen32e/x86feature.h" diff --git a/third_party/mbedtls/sha512.c b/third_party/mbedtls/sha512.c index 82469e893..e4c551962 100644 --- a/third_party/mbedtls/sha512.c +++ b/third_party/mbedtls/sha512.c @@ -17,7 +17,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/mbedtls/sha512.h" #include "libc/literal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/nexgen32e.h" #include "libc/nexgen32e/x86feature.h" #include "libc/str/str.h" diff --git a/third_party/mbedtls/sha512t.c b/third_party/mbedtls/sha512t.c index 5e4730831..33180e110 100644 --- a/third_party/mbedtls/sha512t.c +++ b/third_party/mbedtls/sha512t.c @@ -15,7 +15,7 @@ │ See the License for the specific language governing permissions and │ │ limitations under the License. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "third_party/mbedtls/platform.h" #include "third_party/mbedtls/sha512.h" diff --git a/third_party/mbedtls/ssl_srv.c b/third_party/mbedtls/ssl_srv.c index 5b2cbe2e8..b58d403fe 100644 --- a/third_party/mbedtls/ssl_srv.c +++ b/third_party/mbedtls/ssl_srv.c @@ -16,7 +16,7 @@ │ limitations under the License. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/time.h" #include "third_party/mbedtls/common.h" diff --git a/third_party/mbedtls/test/test.inc b/third_party/mbedtls/test/test.inc index f4a992d4e..8c10d98da 100644 --- a/third_party/mbedtls/test/test.inc +++ b/third_party/mbedtls/test/test.inc @@ -2,7 +2,7 @@ #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/exit.h" #include "third_party/mbedtls/config.h" #include "third_party/mbedtls/test/lib.h" diff --git a/third_party/musl/strptime.c b/third_party/musl/strptime.c index afbad2570..321a14cd9 100644 --- a/third_party/musl/strptime.c +++ b/third_party/musl/strptime.c @@ -26,7 +26,7 @@ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/conv.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/ctype.h" #include "libc/str/langinfo.h" diff --git a/third_party/nsync/common.c b/third_party/nsync/common.c index 79daaf9b1..d5427a3be 100644 --- a/third_party/nsync/common.c +++ b/third_party/nsync/common.c @@ -27,8 +27,8 @@ #include "libc/nt/runtime.h" #include "libc/runtime/memtrack.internal.h" #include "libc/runtime/runtime.h" -#include "libc/stdalign.internal.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" +#include "libc/stdalign.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/prot.h" #include "libc/thread/thread.h" diff --git a/third_party/nsync/compat.S b/third_party/nsync/compat.S index bcd4d8cd3..4d8f39d4d 100644 --- a/third_party/nsync/compat.S +++ b/third_party/nsync/compat.S @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/timespec.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" nsync_time_now: jmp timespec_real diff --git a/third_party/python/Include/pyctype.h b/third_party/python/Include/pyctype.h index 58ad51ca4..dabcae58a 100644 --- a/third_party/python/Include/pyctype.h +++ b/third_party/python/Include/pyctype.h @@ -1,7 +1,7 @@ #ifndef Py_LIMITED_API #ifndef PYCTYPE_H #define PYCTYPE_H -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #define Py_TOLOWER(c) kToLower[255 & (c)] #define Py_TOUPPER(c) kToUpper[255 & (c)] diff --git a/third_party/python/Modules/_hashmbedtls.c b/third_party/python/Modules/_hashmbedtls.c index 26202c7b5..75db2c482 100644 --- a/third_party/python/Modules/_hashmbedtls.c +++ b/third_party/python/Modules/_hashmbedtls.c @@ -18,7 +18,7 @@ #define PY_SSIZE_T_CLEAN #include "libc/calls/calls.h" #include "libc/log/backtrace.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/third_party/python/Modules/tlsmodule.c b/third_party/python/Modules/tlsmodule.c index 1fca255fa..6ef1d7762 100644 --- a/third_party/python/Modules/tlsmodule.c +++ b/third_party/python/Modules/tlsmodule.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/str/str.h" #include "net/https/https.h" diff --git a/third_party/python/Modules/tokenbucket.c b/third_party/python/Modules/tokenbucket.c index 22cd4f05a..4f9bb7ced 100644 --- a/third_party/python/Modules/tokenbucket.c +++ b/third_party/python/Modules/tokenbucket.c @@ -24,7 +24,7 @@ #include "libc/calls/struct/timespec.h" #include "libc/errno.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h" diff --git a/third_party/python/Python/cosmomodule.c b/third_party/python/Python/cosmomodule.c index fa82214ed..1ce9343bd 100644 --- a/third_party/python/Python/cosmomodule.c +++ b/third_party/python/Python/cosmomodule.c @@ -23,7 +23,7 @@ #include "libc/dce.h" #include "libc/errno.h" #include "libc/intrin/popcnt.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/crc32.h" diff --git a/third_party/python/Python/import.c b/third_party/python/Python/import.c index 1ed177be9..9b8c1d723 100644 --- a/third_party/python/Python/import.c +++ b/third_party/python/Python/import.c @@ -10,7 +10,7 @@ #include "libc/calls/struct/stat.macros.h" #include "libc/fmt/conv.h" #include "libc/fmt/libgen.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/third_party/python/Python/random.c b/third_party/python/Python/random.c index 673907859..8f3fc9b75 100644 --- a/third_party/python/Python/random.c +++ b/third_party/python/Python/random.c @@ -9,7 +9,7 @@ #include "libc/calls/weirdtypes.h" #include "libc/errno.h" #include "libc/fmt/conv.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" diff --git a/third_party/python/pyobj.c b/third_party/python/pyobj.c index 4f9def529..927155d3f 100644 --- a/third_party/python/pyobj.c +++ b/third_party/python/pyobj.c @@ -24,7 +24,7 @@ #include "libc/fmt/conv.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" @@ -35,7 +35,7 @@ #include "libc/sysv/consts/o.h" #include "libc/time.h" #include "libc/x/x.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/getopt/getopt.internal.h" #include "third_party/python/Include/abstract.h" #include "third_party/python/Include/bytesobject.h" diff --git a/third_party/python/runpythonmodule.c b/third_party/python/runpythonmodule.c index ba23daa13..f4c41e38e 100644 --- a/third_party/python/runpythonmodule.c +++ b/third_party/python/runpythonmodule.c @@ -16,7 +16,7 @@ #include "libc/intrin/weaken.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/third_party/stb/stb_image.c b/third_party/stb/stb_image.c index 60b55072d..74eca2447 100644 --- a/third_party/stb/stb_image.c +++ b/third_party/stb/stb_image.c @@ -25,7 +25,7 @@ #include "libc/limits.h" #include "libc/log/gdb.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/x86feature.h" diff --git a/third_party/stb/stb_image_resize.c b/third_party/stb/stb_image_resize.c index 7fc71a33e..43fcb1710 100644 --- a/third_party/stb/stb_image_resize.c +++ b/third_party/stb/stb_image_resize.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/stb/stb_image_resize.h" #include "libc/assert.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/str/str.h" diff --git a/third_party/stb/stb_image_write.c b/third_party/stb/stb_image_write.c index 9af55ae36..573cb893b 100644 --- a/third_party/stb/stb_image_write.c +++ b/third_party/stb/stb_image_write.c @@ -21,7 +21,7 @@ #include "libc/assert.h" #include "libc/fmt/conv.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/nexgen32e.h" diff --git a/third_party/stb/stb_truetype.c b/third_party/stb/stb_truetype.c index e1449c11b..ef59f4b6a 100644 --- a/third_party/stb/stb_truetype.c +++ b/third_party/stb/stb_truetype.c @@ -29,7 +29,7 @@ #include "libc/assert.h" #include "libc/serialize.h" #include "libc/intrin/likely.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/third_party/tree/tree.h b/third_party/tree/tree.h index f44295315..473d487ee 100644 --- a/third_party/tree/tree.h +++ b/third_party/tree/tree.h @@ -20,7 +20,7 @@ #include "libc/calls/struct/stat.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #ifdef __ANDROID #define mbstowcs(w,m,x) mbsrtowcs(w,(const char**)(& #m),x,NULL) diff --git a/third_party/tz/difftime.c b/third_party/tz/difftime.c index 929dd5b14..33622f2ff 100644 --- a/third_party/tz/difftime.c +++ b/third_party/tz/difftime.c @@ -2,7 +2,7 @@ │ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/weirdtypes.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/time.h" /* Return the difference between two timestamps. */ diff --git a/third_party/xed/x86ild.greg.c b/third_party/xed/x86ild.greg.c index fe70349e2..cf7749fda 100644 --- a/third_party/xed/x86ild.greg.c +++ b/third_party/xed/x86ild.greg.c @@ -21,7 +21,7 @@ #include "libc/serialize.h" #include "libc/intrin/bsr.h" #include "libc/log/libfatal.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/str/str.h" #include "third_party/xed/avx512.h" diff --git a/third_party/xxhash/xxhash.h b/third_party/xxhash/xxhash.h index b69ea3bad..a5e4fd471 100644 --- a/third_party/xxhash/xxhash.h +++ b/third_party/xxhash/xxhash.h @@ -1203,7 +1203,7 @@ struct XXH64_state_s { #ifndef XXH_NO_XXH3 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" # define XXH_ALIGN(n) alignas(n) #elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */ /* In C++ alignas() is a keyword */ diff --git a/third_party/zstd/lib/common/compiler.h b/third_party/zstd/lib/common/compiler.h index f4b6aec75..e0aee016d 100644 --- a/third_party/zstd/lib/common/compiler.h +++ b/third_party/zstd/lib/common/compiler.h @@ -288,7 +288,7 @@ # elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 support */ -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" # define ZSTD_ALIGNOF(T) alignof(T) # else diff --git a/third_party/zstd/lib/common/xxhash.h b/third_party/zstd/lib/common/xxhash.h index 6a4ea347b..fa8d21d69 100644 --- a/third_party/zstd/lib/common/xxhash.h +++ b/third_party/zstd/lib/common/xxhash.h @@ -1019,7 +1019,7 @@ struct XXH64_state_s { #ifndef XXH_NO_XXH3 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" # define XXH_ALIGN(n) alignas(n) #elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */ /* In C++ alignas() is a keyword */ diff --git a/tool/build/apelink.c b/tool/build/apelink.c index 2c707ab61..c27a3dda2 100644 --- a/tool/build/apelink.c +++ b/tool/build/apelink.c @@ -21,7 +21,7 @@ #include "libc/calls/calls.h" #include "libc/ctype.h" #include "libc/dce.h" -#include "libc/dos.internal.h" +#include "libc/dos.h" #include "libc/elf/def.h" #include "libc/elf/elf.h" #include "libc/elf/scalar.h" @@ -30,8 +30,8 @@ #include "libc/fmt/conv.h" #include "libc/fmt/itoa.h" #include "libc/limits.h" -#include "libc/macho.internal.h" -#include "libc/macros.internal.h" +#include "libc/macho.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/pedef.internal.h" #include "libc/nt/struct/imageimportbyname.internal.h" @@ -41,7 +41,7 @@ #include "libc/runtime/runtime.h" #include "libc/runtime/symbols.internal.h" #include "libc/serialize.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/stdckdint.h" #include "libc/stdio/stdio.h" #include "libc/str/blake2.h" @@ -49,7 +49,7 @@ #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/getopt/getopt.internal.h" #include "third_party/zlib/zlib.h" #include "tool/build/lib/lib.h" diff --git a/tool/build/ar.c b/tool/build/ar.c index 616ee56dd..640b342e3 100644 --- a/tool/build/ar.c +++ b/tool/build/ar.c @@ -31,7 +31,7 @@ #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/bsr.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/serialize.h" #include "libc/stdckdint.h" diff --git a/tool/build/assimilate.c b/tool/build/assimilate.c index 8c6d4c1cf..02babe0b5 100644 --- a/tool/build/assimilate.c +++ b/tool/build/assimilate.c @@ -25,8 +25,8 @@ #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/limits.h" -#include "libc/macho.internal.h" -#include "libc/macros.internal.h" +#include "libc/macho.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/serialize.h" #include "libc/stdckdint.h" diff --git a/tool/build/bigmul.c b/tool/build/bigmul.c index 332955527..181f32df4 100644 --- a/tool/build/bigmul.c +++ b/tool/build/bigmul.c @@ -19,7 +19,7 @@ #include "libc/assert.h" #include "libc/fmt/conv.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" diff --git a/tool/build/compile.c b/tool/build/compile.c index 62c44d41c..37406b791 100644 --- a/tool/build/compile.c +++ b/tool/build/compile.c @@ -38,7 +38,7 @@ #include "libc/log/appendresourcereport.internal.h" #include "libc/log/color.internal.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/alg.h" #include "libc/mem/gc.h" diff --git a/tool/build/elf2pe.c b/tool/build/elf2pe.c index b1508a926..485ada109 100644 --- a/tool/build/elf2pe.c +++ b/tool/build/elf2pe.c @@ -29,7 +29,7 @@ #include "libc/intrin/dll.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/pedef.internal.h" #include "libc/nt/struct/imagedatadirectory.internal.h" diff --git a/tool/build/fixupobj.c b/tool/build/fixupobj.c index 570cd3e4c..09d1625b6 100644 --- a/tool/build/fixupobj.c +++ b/tool/build/fixupobj.c @@ -31,12 +31,12 @@ #include "libc/fmt/magnumstrs.internal.h" #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/serialize.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/stdckdint.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" @@ -44,7 +44,7 @@ #include "libc/sysv/consts/msync.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/getopt/getopt.internal.h" /** diff --git a/tool/build/helpop.c b/tool/build/helpop.c index 9da096ca6..e5e0297c3 100644 --- a/tool/build/helpop.c +++ b/tool/build/helpop.c @@ -19,7 +19,7 @@ #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/intrin/safemacros.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/tool/build/killall.c b/tool/build/killall.c index 75a41e5c7..5ebb61397 100644 --- a/tool/build/killall.c +++ b/tool/build/killall.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/enum/formatmessageflags.h" #include "libc/nt/enum/lang.h" diff --git a/tool/build/lib/buffer.c b/tool/build/lib/buffer.c index 037047f66..5fe539a56 100644 --- a/tool/build/lib/buffer.c +++ b/tool/build/lib/buffer.c @@ -19,7 +19,7 @@ #include "tool/build/lib/buffer.h" #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/arraylist2.internal.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" diff --git a/tool/build/lib/elfwriter.c b/tool/build/lib/elfwriter.c index 46cdd0341..32572c773 100644 --- a/tool/build/lib/elfwriter.c +++ b/tool/build/lib/elfwriter.c @@ -26,7 +26,7 @@ #include "libc/mem/mem.h" #include "libc/runtime/memtrack.internal.h" #include "libc/runtime/runtime.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/str/str.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/msync.h" diff --git a/tool/build/lib/elfwriter_zip.c b/tool/build/lib/elfwriter_zip.c index 991d7a880..886778038 100644 --- a/tool/build/lib/elfwriter_zip.c +++ b/tool/build/lib/elfwriter_zip.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/dos.internal.h" +#include "libc/dos.h" #include "libc/elf/def.h" #include "libc/fmt/wintime.internal.h" #include "libc/limits.h" @@ -33,7 +33,7 @@ #include "libc/time.h" #include "libc/x/x.h" #include "libc/x/xasprintf.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "net/http/http.h" #include "third_party/zlib/zlib.h" #include "tool/build/lib/elfwriter.h" diff --git a/tool/build/lib/eztls.c b/tool/build/lib/eztls.c index 754d1a533..0e5de53ef 100644 --- a/tool/build/lib/eztls.c +++ b/tool/build/lib/eztls.c @@ -24,7 +24,7 @@ #include "libc/fmt/itoa.h" #include "libc/intrin/kprintf.h" #include "libc/intrin/strace.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/sysv/consts/sig.h" #include "libc/thread/thread.h" #include "libc/x/x.h" diff --git a/tool/build/lib/getargs.c b/tool/build/lib/getargs.c index 3e31da96b..faf5fe68d 100644 --- a/tool/build/lib/getargs.c +++ b/tool/build/lib/getargs.c @@ -21,7 +21,7 @@ #include "libc/calls/calls.h" #include "libc/errno.h" #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/runtime/sysconf.h" #include "libc/stdio/stdio.h" diff --git a/tool/build/lz4toasm.c b/tool/build/lz4toasm.c index b13a16926..b7a8943aa 100644 --- a/tool/build/lz4toasm.c +++ b/tool/build/lz4toasm.c @@ -21,7 +21,7 @@ #include "libc/fmt/conv.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/kompressor.h" @@ -29,7 +29,7 @@ #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/x/x.h" #include "third_party/getopt/getopt.internal.h" @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) { fprintf(fout, "/\t%s -o %s -s %s %s\n" - "#include \"libc/macros.internal.h\"\n" + "#include \"libc/macros.h\"\n" "\n", argv[0], outpath, symbol, lz4path); diff --git a/tool/build/mkdeps.c b/tool/build/mkdeps.c index baa6ba843..1a17eb9df 100644 --- a/tool/build/mkdeps.c +++ b/tool/build/mkdeps.c @@ -24,7 +24,7 @@ #include "libc/fmt/magnumstrs.internal.h" #include "libc/intrin/kprintf.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/crc32.h" @@ -33,7 +33,7 @@ #include "libc/stdio/append.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" diff --git a/tool/build/objbincopy.c b/tool/build/objbincopy.c index ce08d0aed..42427c226 100644 --- a/tool/build/objbincopy.c +++ b/tool/build/objbincopy.c @@ -21,8 +21,8 @@ #include "libc/elf/elf.h" #include "libc/elf/struct/ehdr.h" #include "libc/intrin/kprintf.h" -#include "libc/macho.internal.h" -#include "libc/macros.internal.h" +#include "libc/macho.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" diff --git a/tool/build/package.c b/tool/build/package.c index 57b5de82a..0c88b4c2d 100644 --- a/tool/build/package.c +++ b/tool/build/package.c @@ -30,7 +30,7 @@ #include "libc/intrin/bswap.h" #include "libc/intrin/kprintf.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/alg.h" #include "libc/mem/arraylist.internal.h" #include "libc/mem/mem.h" diff --git a/tool/build/pledge.c b/tool/build/pledge.c index f77306629..78f5527d5 100644 --- a/tool/build/pledge.c +++ b/tool/build/pledge.c @@ -42,7 +42,7 @@ #include "libc/intrin/promises.h" #include "libc/intrin/safemacros.h" #include "libc/limits.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/alloca.h" #include "libc/nexgen32e/kcpuids.h" diff --git a/tool/build/runitd.c b/tool/build/runitd.c index 577876772..4f512b69a 100644 --- a/tool/build/runitd.c +++ b/tool/build/runitd.c @@ -33,7 +33,7 @@ #include "libc/intrin/kprintf.h" #include "libc/log/appendresourcereport.internal.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/leaks.h" #include "libc/mem/mem.h" diff --git a/tool/build/sha256sum.c b/tool/build/sha256sum.c index 369676127..50f461791 100644 --- a/tool/build/sha256sum.c +++ b/tool/build/sha256sum.c @@ -25,7 +25,7 @@ #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "third_party/getopt/getopt.internal.h" #include "third_party/mbedtls/sha256.h" diff --git a/tool/build/zipcopy.c b/tool/build/zipcopy.c index 125ab57ae..9f3aa8fd0 100644 --- a/tool/build/zipcopy.c +++ b/tool/build/zipcopy.c @@ -32,7 +32,7 @@ #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/getopt/getopt.internal.h" static int infd; diff --git a/tool/build/zipobj.c b/tool/build/zipobj.c index 37cb3ef89..007bbfa7a 100644 --- a/tool/build/zipobj.c +++ b/tool/build/zipobj.c @@ -39,7 +39,7 @@ #include "libc/sysv/consts/s.h" #include "libc/time.h" #include "libc/x/x.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "third_party/getopt/getopt.internal.h" #include "tool/build/lib/elfwriter.h" #include "tool/build/lib/stripcomponents.h" diff --git a/tool/curl/curl.c b/tool/curl/curl.c index c35812955..c108f0928 100644 --- a/tool/curl/curl.c +++ b/tool/curl/curl.c @@ -14,7 +14,7 @@ #include "libc/errno.h" #include "libc/fmt/itoa.h" #include "libc/fmt/magnumstrs.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/tool/decode/elf.c b/tool/decode/elf.c index 4db9e45ab..2d62bab2e 100644 --- a/tool/decode/elf.c +++ b/tool/decode/elf.c @@ -29,7 +29,7 @@ #include "libc/intrin/safemacros.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/tool/decode/lib/bitabuilder.c b/tool/decode/lib/bitabuilder.c index 9fa598a81..f57a2d7cd 100644 --- a/tool/decode/lib/bitabuilder.c +++ b/tool/decode/lib/bitabuilder.c @@ -20,7 +20,7 @@ #include "libc/assert.h" #include "libc/limits.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" diff --git a/tool/decode/lib/disassemblehex.c b/tool/decode/lib/disassemblehex.c index afa901259..d9859d890 100644 --- a/tool/decode/lib/disassemblehex.c +++ b/tool/decode/lib/disassemblehex.c @@ -19,7 +19,7 @@ #include "tool/decode/lib/disassemblehex.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" static size_t countzeroes(const uint8_t *data, size_t size) { size_t i; diff --git a/tool/decode/lib/machoidnames.c b/tool/decode/lib/machoidnames.c index b2b1c5ecc..0755f31e3 100644 --- a/tool/decode/lib/machoidnames.c +++ b/tool/decode/lib/machoidnames.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "tool/decode/lib/machoidnames.h" -#include "libc/macho.internal.h" +#include "libc/macho.h" const struct IdName kMachoArchitectures[] = { {MAC_CPU_MC680x0, "MAC_CPU_MC680x0"}, // diff --git a/tool/decode/lib/zipnames.c b/tool/decode/lib/zipnames.c index a5d834ff4..ae5ec5bcc 100644 --- a/tool/decode/lib/zipnames.c +++ b/tool/decode/lib/zipnames.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "tool/decode/lib/zipnames.h" #include "libc/nt/enum/fileflagandattributes.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" const struct IdName kZipCompressionNames[] = { {kZipCompressionNone, "kZipCompressionNone"}, diff --git a/tool/decode/macho.c b/tool/decode/macho.c index 9f358aaef..b177d13aa 100644 --- a/tool/decode/macho.c +++ b/tool/decode/macho.c @@ -22,13 +22,13 @@ #include "libc/fmt/conv.h" #include "libc/fmt/libgen.h" #include "libc/intrin/safemacros.h" -#include "libc/macho.internal.h" +#include "libc/macho.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" @@ -48,7 +48,7 @@ static size_t machosize; static void startfile(void) { showtitle("αcτµαlly pδrταblε εxεcµταblε", "tool/decode/macho", NULL, NULL, &kModelineAsm); - printf("#include \"libc/macho.internal.h\"\n\n", path); + printf("#include \"libc/macho.h\"\n\n", path); } static void showmachoheader(void) { diff --git a/tool/decode/unhex.c b/tool/decode/unhex.c index c29e094aa..9440d5627 100644 --- a/tool/decode/unhex.c +++ b/tool/decode/unhex.c @@ -8,7 +8,7 @@ #include "libc/calls/calls.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * @fileoverview Hex to binary converter program. diff --git a/tool/decode/x86opinfo.c b/tool/decode/x86opinfo.c index 6b741c304..ee2d0bb11 100644 --- a/tool/decode/x86opinfo.c +++ b/tool/decode/x86opinfo.c @@ -18,11 +18,11 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/ctype.h" #include "libc/errno.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/exit.h" #include "third_party/getopt/getopt.internal.h" diff --git a/tool/decode/zip.c b/tool/decode/zip.c index 96a88ab2e..1d5d30ede 100644 --- a/tool/decode/zip.c +++ b/tool/decode/zip.c @@ -39,7 +39,7 @@ #include "libc/sysv/consts/prot.h" #include "libc/time.h" #include "libc/x/xasprintf.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "tool/decode/lib/asmcodegen.h" #include "tool/decode/lib/disassemblehex.h" #include "tool/decode/lib/flagger.h" diff --git a/tool/net/getadaptersaddresses.c b/tool/net/getadaptersaddresses.c index 91ddbfa94..8dea1ab97 100644 --- a/tool/net/getadaptersaddresses.c +++ b/tool/net/getadaptersaddresses.c @@ -35,7 +35,7 @@ #include "libc/serialize.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr6.h" -#include "libc/stdalign.internal.h" +#include "libc/stdalign.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/sysv/consts/af.h" diff --git a/tool/net/lfuncs.c b/tool/net/lfuncs.c index 798099c7d..01b3ce19a 100644 --- a/tool/net/lfuncs.c +++ b/tool/net/lfuncs.c @@ -30,7 +30,7 @@ #include "libc/intrin/popcnt.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" @@ -45,7 +45,7 @@ #include "libc/str/highwayhash64.h" #include "libc/str/str.h" #include "libc/str/strwidth.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/af.h" #include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/o.h" diff --git a/tool/net/ljson.c b/tool/net/ljson.c index a3c73616c..037cd097b 100644 --- a/tool/net/ljson.c +++ b/tool/net/ljson.c @@ -27,7 +27,7 @@ #include "libc/serialize.h" #include "libc/stdckdint.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/utf16.h" #include "libc/sysv/consts/auxv.h" #include "libc/thread/thread.h" diff --git a/tool/net/lre.c b/tool/net/lre.c index e24648e29..598b5b4b6 100644 --- a/tool/net/lre.c +++ b/tool/net/lre.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "third_party/lua/lauxlib.h" #include "third_party/regex/regex.h" diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 0eec73175..fe2080c32 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -33,7 +33,7 @@ #include "libc/calls/termios.h" #include "libc/ctype.h" #include "libc/dce.h" -#include "libc/dos.internal.h" +#include "libc/dos.h" #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/fmt/itoa.h" @@ -46,7 +46,7 @@ #include "libc/log/appendresourcereport.internal.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/alloca.h" #include "libc/mem/gc.h" @@ -104,7 +104,7 @@ #include "libc/thread/tls.h" #include "libc/x/x.h" #include "libc/x/xasprintf.h" -#include "libc/zip.internal.h" +#include "libc/zip.h" #include "net/http/escape.h" #include "net/http/http.h" #include "net/http/ip.h" diff --git a/tool/net/winbench.c b/tool/net/winbench.c index ea8063709..f54547d97 100644 --- a/tool/net/winbench.c +++ b/tool/net/winbench.c @@ -16,7 +16,7 @@ #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/intrin/kprintf.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/accounting.h" #include "libc/nt/enum/wsaid.h" diff --git a/tool/plinko/lib/gc.c b/tool/plinko/lib/gc.c index 08ef948a8..33e320eb4 100644 --- a/tool/plinko/lib/gc.c +++ b/tool/plinko/lib/gc.c @@ -24,7 +24,7 @@ #include "libc/log/check.h" #include "libc/log/countbranch.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "tool/plinko/lib/cons.h" diff --git a/tool/plinko/lib/histo.h b/tool/plinko/lib/histo.h index 4cdc63904..10025713e 100644 --- a/tool/plinko/lib/histo.h +++ b/tool/plinko/lib/histo.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_TOOL_PLINKO_LIB_HISTO_H_ #define COSMOPOLITAN_TOOL_PLINKO_LIB_HISTO_H_ #include "libc/intrin/bsr.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" COSMOPOLITAN_C_START_ #define HISTO(H, X) \ diff --git a/tool/plinko/lib/iswide.c b/tool/plinko/lib/iswide.c index f458bfad5..dcad18abf 100644 --- a/tool/plinko/lib/iswide.c +++ b/tool/plinko/lib/iswide.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "tool/plinko/lib/char.h" static const unsigned short kWides[][2] = { diff --git a/tool/plinko/lib/plinko.c b/tool/plinko/lib/plinko.c index 181c3b838..00bb69622 100644 --- a/tool/plinko/lib/plinko.c +++ b/tool/plinko/lib/plinko.c @@ -26,7 +26,7 @@ #include "libc/log/countbranch.h" #include "libc/log/countexpr.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nexgen32e/rdtsc.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" diff --git a/tool/viz/bin2asm.c b/tool/viz/bin2asm.c index 37496fd93..99c785e5e 100644 --- a/tool/viz/bin2asm.c +++ b/tool/viz/bin2asm.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #define COLS 8 diff --git a/tool/viz/bing.c b/tool/viz/bing.c index 1ded5fa49..750d0f032 100644 --- a/tool/viz/bing.c +++ b/tool/viz/bing.c @@ -22,7 +22,7 @@ #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/exit.h" #include "libc/sysv/consts/fileno.h" diff --git a/tool/viz/derasterize.c b/tool/viz/derasterize.c index 478ec1dc8..abd982197 100644 --- a/tool/viz/derasterize.c +++ b/tool/viz/derasterize.c @@ -25,7 +25,7 @@ #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/tool/viz/dumphexc.c b/tool/viz/dumphexc.c index d7f40a953..095b7804d 100644 --- a/tool/viz/dumphexc.c +++ b/tool/viz/dumphexc.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" #include "libc/stdio/hex.internal.h" diff --git a/tool/viz/fontspace.c b/tool/viz/fontspace.c index 875a73648..7e81629c8 100644 --- a/tool/viz/fontspace.c +++ b/tool/viz/fontspace.c @@ -24,7 +24,7 @@ #include "libc/intrin/bsr.h" #include "libc/log/libfatal.internal.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" diff --git a/tool/viz/getglyph.c b/tool/viz/getglyph.c index 4a7d30f68..4c2a3b5f3 100644 --- a/tool/viz/getglyph.c +++ b/tool/viz/getglyph.c @@ -20,7 +20,7 @@ #include "libc/fmt/conv.h" #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/stdio/append.h" diff --git a/tool/viz/lib/bilinearscale.c b/tool/viz/lib/bilinearscale.c index fd58723a9..586e848bd 100644 --- a/tool/viz/lib/bilinearscale.c +++ b/tool/viz/lib/bilinearscale.c @@ -21,7 +21,7 @@ #include "libc/intrin/bsr.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/tool/viz/lib/dither.c b/tool/viz/lib/dither.c index d61a39049..dcb43ea7d 100644 --- a/tool/viz/lib/dither.c +++ b/tool/viz/lib/dither.c @@ -20,7 +20,7 @@ #include "libc/intrin/hilbert.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/tool/viz/lib/doublechrominance.S b/tool/viz/lib/doublechrominance.S index b316fb9b1..0db0eb343 100644 --- a/tool/viz/lib/doublechrominance.S +++ b/tool/viz/lib/doublechrominance.S @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" // Duplicates chrominance samples horizontally, e.g. // diff --git a/tool/viz/lib/formatstringtable-testlib.h b/tool/viz/lib/formatstringtable-testlib.h index b4eb037c6..1b884965e 100644 --- a/tool/viz/lib/formatstringtable-testlib.h +++ b/tool/viz/lib/formatstringtable-testlib.h @@ -1,6 +1,6 @@ #ifndef COSMOPOLITAN_TOOL_VIZ_LIB_FORMATSTRINGTABLE_TESTLIB_H_ #define COSMOPOLITAN_TOOL_VIZ_LIB_FORMATSTRINGTABLE_TESTLIB_H_ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" #include "tool/viz/lib/formatstringtable.h" diff --git a/tool/viz/lib/gaussian.c b/tool/viz/lib/gaussian.c index fb1cd87a8..c737b2240 100644 --- a/tool/viz/lib/gaussian.c +++ b/tool/viz/lib/gaussian.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" diff --git a/tool/viz/lib/getxtermcodes.c b/tool/viz/lib/getxtermcodes.c index 52908f3ab..0f00469e8 100644 --- a/tool/viz/lib/getxtermcodes.c +++ b/tool/viz/lib/getxtermcodes.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/tty/quant.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "tool/viz/lib/graphic.h" void getxtermcodes(struct TtyRgb *p, const struct Graphic *g) { diff --git a/tool/viz/lib/perlin3.c b/tool/viz/lib/perlin3.c index 138296e11..f9f81e9c9 100644 --- a/tool/viz/lib/perlin3.c +++ b/tool/viz/lib/perlin3.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "tool/viz/lib/graphic.h" diff --git a/tool/viz/lib/sharpen.c b/tool/viz/lib/sharpen.c index eec139e4d..c79586537 100644 --- a/tool/viz/lib/sharpen.c +++ b/tool/viz/lib/sharpen.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "dsp/core/ks8.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" diff --git a/tool/viz/lib/sobel.c b/tool/viz/lib/sobel.c index a6acf15b0..1f83878ee 100644 --- a/tool/viz/lib/sobel.c +++ b/tool/viz/lib/sobel.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/nexgen32e.h" diff --git a/tool/viz/lib/stringbuilder.c b/tool/viz/lib/stringbuilder.c index f9419a41e..85906bf8b 100644 --- a/tool/viz/lib/stringbuilder.c +++ b/tool/viz/lib/stringbuilder.c @@ -18,7 +18,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "tool/viz/lib/stringbuilder.h" #include "libc/log/check.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/x/x.h" diff --git a/tool/viz/lib/unsharp.c b/tool/viz/lib/unsharp.c index 8bd6f272c..4514f8265 100644 --- a/tool/viz/lib/unsharp.c +++ b/tool/viz/lib/unsharp.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/sysv/errfuns.h" diff --git a/tool/viz/lib/writetoframebuffer.c b/tool/viz/lib/writetoframebuffer.c index f46d95387..9a2b7a116 100644 --- a/tool/viz/lib/writetoframebuffer.c +++ b/tool/viz/lib/writetoframebuffer.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "tool/viz/lib/graphic.h" void WriteToFrameBuffer(size_t dyn, size_t dxn, unsigned char dst[dyn][dxn][4], diff --git a/tool/viz/lib/ycbcr2rgb3.c b/tool/viz/lib/ycbcr2rgb3.c index 96d7d52ff..958c5ef1e 100644 --- a/tool/viz/lib/ycbcr2rgb3.c +++ b/tool/viz/lib/ycbcr2rgb3.c @@ -33,7 +33,7 @@ #include "libc/intrin/pmulhrsw.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/tool/viz/life.c b/tool/viz/life.c index 8ca83fb8b..389132dff 100644 --- a/tool/viz/life.c +++ b/tool/viz/life.c @@ -32,7 +32,7 @@ #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nexgen32e/nt2sysv.h" #include "libc/nt/comdlg.h" diff --git a/tool/viz/memzoom.c b/tool/viz/memzoom.c index e3f16a046..67afb55e2 100644 --- a/tool/viz/memzoom.c +++ b/tool/viz/memzoom.c @@ -36,13 +36,13 @@ #include "libc/intrin/safemacros.h" #include "libc/limits.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/sock/sock.h" #include "libc/sock/struct/pollfd.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" #include "libc/str/unicode.h" #include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/exit.h" diff --git a/tool/viz/printansi.c b/tool/viz/printansi.c index 849242540..900dd8b3a 100644 --- a/tool/viz/printansi.c +++ b/tool/viz/printansi.c @@ -33,7 +33,7 @@ #include "libc/limits.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" diff --git a/tool/viz/printvideo.c b/tool/viz/printvideo.c index 04c7da6b6..c63368f41 100644 --- a/tool/viz/printvideo.c +++ b/tool/viz/printvideo.c @@ -47,7 +47,7 @@ #include "libc/intrin/xchg.h" #include "libc/log/check.h" #include "libc/log/log.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/math.h" #include "libc/mem/alg.h" #include "libc/mem/arraylist.internal.h" diff --git a/tool/viz/rlimit.c b/tool/viz/rlimit.c index cc7821c3c..1e4296b26 100644 --- a/tool/viz/rlimit.c +++ b/tool/viz/rlimit.c @@ -13,7 +13,7 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/strace.h" #include "libc/log/color.internal.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/tool/viz/tailf.c b/tool/viz/tailf.c index ed420d23e..b2f7bb5d3 100644 --- a/tool/viz/tailf.c +++ b/tool/viz/tailf.c @@ -19,7 +19,7 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/stat.h" #include "libc/intrin/safemacros.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/tool/viz/unbing.c b/tool/viz/unbing.c index fc5074eb4..cbf6de954 100644 --- a/tool/viz/unbing.c +++ b/tool/viz/unbing.c @@ -19,7 +19,7 @@ #include "libc/calls/calls.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/str/tab.internal.h" +#include "libc/str/tab.h" /** * @fileoverview UnBing: Glyphs → Binary. diff --git a/tool/viz/virtualquery.c b/tool/viz/virtualquery.c index e1ce16cc1..27e0fc9e0 100644 --- a/tool/viz/virtualquery.c +++ b/tool/viz/virtualquery.c @@ -20,7 +20,7 @@ #include "libc/errno.h" #include "libc/fmt/conv.h" #include "libc/intrin/describeflags.h" -#include "libc/macros.internal.h" +#include "libc/macros.h" #include "libc/nt/enum/memflags.h" #include "libc/nt/memory.h" #include "libc/nt/struct/memorybasicinformation.h" From 7f0db3e3b9fcbb64302ce13cd637ec17b1de7179 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 4 Aug 2024 12:54:30 -0700 Subject: [PATCH 08/39] Add last commit to .git-blame-ignore-revs --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 6436e229a..c045e06bb 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -27,3 +27,5 @@ da8baf2aa5ce93b958aca90a0ae69f537806324b 369f9740de4534c28d0e81ab2afc99decbb9a3e6 # Get rid of .internal.h convention in LIBC_INTRIN 86d884cce24d773e298a2714c1e3d91ecab9be45 +# Remove .internal from more header filenames +31194165d2afca36c2315a6e7ca2f0797dde09e3 From ff1a0d1c40c4039eef20edc97d67d3f5368c68a9 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 4 Aug 2024 14:59:53 -0700 Subject: [PATCH 09/39] Upgrade to superconfigure z0.0.51 --- tool/cosmocc/README.md | 2 +- tool/cosmocc/package.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tool/cosmocc/README.md b/tool/cosmocc/README.md index 0db871acd..da18a2aa6 100644 --- a/tool/cosmocc/README.md +++ b/tool/cosmocc/README.md @@ -417,7 +417,7 @@ statements instead, so that Cosmopolitan Libc's system constants will work as expected. Our modifications to GNU GCC are published under the ISC license at . The binaries you see here were first published at - which + which is regularly updated. ## Legal diff --git a/tool/cosmocc/package.sh b/tool/cosmocc/package.sh index 988b6dc79..c3271eceb 100755 --- a/tool/cosmocc/package.sh +++ b/tool/cosmocc/package.sh @@ -182,10 +182,10 @@ fetch() { OLD=$PWD cd "$OUTDIR/" if [ ! -x bin/x86_64-linux-cosmo-gcc ]; then - fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.48/aarch64-gcc.zip + fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.51/aarch64-gcc.zip unzip aarch64-gcc.zip rm -f aarch64-gcc.zip - fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.48/x86_64-gcc.zip + fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.51/x86_64-gcc.zip unzip x86_64-gcc.zip rm -f x86_64-gcc.zip fi From 24666e121d0e494a5c906fe4e369d18e684d3daf Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Wed, 14 Aug 2024 23:47:40 -0500 Subject: [PATCH 10/39] add nightly cosmocc (artifact) builds (#1254) Using https://nightly.link/ with GitHub actions artifacts you can have a nightly build (but not a _release_ -- there's no releasing or pre-releasing happening) of cosmocc. Example URL if this PR were merged: https://nightly.link/jart/cosmopolitan/workflows/nightly-cosmocc/master/cosmocc.zip Or you can just download it directly from the GitHub "Actions" https://github.com/jart/cosmopolitan/actions workflow summary page of a particular run example from my own fork: ![image](https://github.com/user-attachments/assets/8ba708dd-8289-4f8b-932c-cf535ee86f62) could download by clicking on the artifact or by using third-party service to provide a link for unauthenticated requests (like wget or curl) https://nightly.link/jcbhmr/cosmopolitan/workflows/tool-cosmocc-package-sh/master/cosmocc.zip this would be useful for users who don't want to or can't figure out how to build cosmocc themselves (like Windows) but still want to use a nightly build since a fix hasn't been released as a release version yet. this would also be a good way to test the release process but instead of pushing the `cosmocc.zip` to _wherever it goes now_ you publish it as a github actions artifact for the very few nightly bleeding edge users to use & test. you don't have to use https://nightly.link or recommend it or anything; i just know its a cool way to wget or curl the URLs instead of downloading it via your browser web UI. particularly useful for remote/ssh/web-ide development. --- .github/workflows/nightly-cosmocc.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/nightly-cosmocc.yml diff --git a/.github/workflows/nightly-cosmocc.yml b/.github/workflows/nightly-cosmocc.yml new file mode 100644 index 000000000..69ccb16d2 --- /dev/null +++ b/.github/workflows/nightly-cosmocc.yml @@ -0,0 +1,24 @@ +name: Nightly cosmocc +on: + schedule: + # https://crontab.guru/#37_4_*_*_* + - cron: "37 4 * * *" + workflow_dispatch: +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true +jobs: + build-cosmocc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + sudo cp build/bootstrap/ape.elf /usr/bin/ape + sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" + - run: tool/cosmocc/package.sh + # https://github.com/actions/upload-artifact/issues/590 + - uses: actions/upload-artifact@v4.3.5 + with: + name: cosmocc + path: cosmocc + compression-level: 9 From 2045e87b7cefc688ceedea1c61ecc1f4795cc584 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 15 Aug 2024 18:33:35 -0700 Subject: [PATCH 11/39] Fix build issues --- ape/BUILD.mk | 20 ++++++++++---------- libc/intrin/strace.h | 2 +- test/tool/build/lib/asmdown_test.c | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ape/BUILD.mk b/ape/BUILD.mk index 7265b222a..3e8ea3137 100644 --- a/ape/BUILD.mk +++ b/ape/BUILD.mk @@ -45,10 +45,10 @@ o/$(MODE)/ape: $(APE) o/$(MODE)/ape/aarch64.lds: \ ape/aarch64.lds \ - libc/zip.internal.h \ + libc/zip.h \ libc/thread/tls.h \ libc/calls/struct/timespec.h \ - libc/macros.internal.h \ + libc/macros.h \ libc/str/str.h APE_LOADER_LDFLAGS = \ @@ -162,8 +162,8 @@ o/$(MODE)/ape/ape-no-modify-self.o: \ libc/dce.h \ libc/elf/def.h \ libc/thread/tls.h \ - libc/macho.internal.h \ - libc/macros.internal.h \ + libc/macho.h \ + libc/macros.h \ libc/nexgen32e/uart.internal.h \ libc/calls/metalfile.internal.h \ libc/nt/pedef.internal.h \ @@ -188,8 +188,8 @@ o/$(MODE)/ape/ape-copy-self.o: \ libc/dce.h \ libc/elf/def.h \ libc/thread/tls.h \ - libc/macho.internal.h \ - libc/macros.internal.h \ + libc/macho.h \ + libc/macros.h \ libc/nexgen32e/uart.internal.h \ libc/calls/metalfile.internal.h \ libc/nt/pedef.internal.h \ @@ -259,8 +259,8 @@ o/$(MODE)/ape/ape.o: \ libc/thread/tls.h \ ape/ape.internal.h \ ape/macros.internal.h \ - libc/macho.internal.h \ - libc/macros.internal.h \ + libc/macho.h \ + libc/macros.h \ libc/sysv/consts/prot.h \ libc/nt/pedef.internal.h \ libc/runtime/pc.internal.h \ @@ -281,7 +281,7 @@ o/$(MODE)/ape/ape.lds: \ libc/dce.h \ libc/elf/def.h \ libc/elf/pf2prot.internal.h \ - libc/macros.internal.h \ + libc/macros.h \ libc/nt/pedef.internal.h \ libc/str/str.h \ - libc/zip.internal.h + libc/zip.h diff --git a/libc/intrin/strace.h b/libc/intrin/strace.h index adda49caa..3c521857f 100644 --- a/libc/intrin/strace.h +++ b/libc/intrin/strace.h @@ -5,7 +5,7 @@ #define SYSDEBUG 0 #endif -#define _NTTRACE 1 /* not configurable w/ flag yet */ +#define _NTTRACE 0 /* not configurable w/ flag yet */ #define _POLLTRACE 0 /* not configurable w/ flag yet */ #define _DATATRACE 1 /* not configurable w/ flag yet */ #define _LOCKTRACE 0 /* not configurable w/ flag yet */ diff --git a/test/tool/build/lib/asmdown_test.c b/test/tool/build/lib/asmdown_test.c index 0d3b2259f..3524c2599 100644 --- a/test/tool/build/lib/asmdown_test.c +++ b/test/tool/build/lib/asmdown_test.c @@ -23,7 +23,7 @@ TEST(ParseAsmdown, test) { struct Asmdown *ad; const char *s = "\ -#include \"libc/macros.internal.h\"\n\ +#include \"libc/macros.h\"\n\ .source __FILE__\n\ \n\ / Returns absolute value of double.\n\ @@ -87,7 +87,7 @@ tinymath_acos:\n\ TEST(ParseAsmdown, testAlias) { struct Asmdown *ad; const char *s = "\ -#include \"libc/macros.internal.h\"\n\ +#include \"libc/macros.h\"\n\ .source __FILE__\n\ \n\ / Returns arc cosine of 𝑥.\n\ @@ -137,7 +137,7 @@ tinymath_acos:\n\ TEST(ParseAsmdown, testClangIsEvil) { struct Asmdown *ad; const char *s = "\ -#include \"libc/macros.internal.h\"\n\ +#include \"libc/macros.h\"\n\ .source __FILE__\n\ \n\ // Returns arc cosine of 𝑥.\n\ From 3fd275f59facc3f9ea14536f268becf90f7aec81 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 15 Aug 2024 18:33:40 -0700 Subject: [PATCH 12/39] Import optimized routines changes to exp10 --- libc/tinymath/exp10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/tinymath/exp10.c b/libc/tinymath/exp10.c index 443800a66..f58f0f3f0 100644 --- a/libc/tinymath/exp10.c +++ b/libc/tinymath/exp10.c @@ -43,7 +43,7 @@ special_case (uint64_t sbits, double_t tmp, uint64_t ki) { double_t scale, y; - if (ki - (1ull << 16) < 0x80000000) + if ((ki & 0x80000000) == 0) { /* The exponent of scale might have overflowed by 1. */ sbits -= 1ull << 52; @@ -109,14 +109,14 @@ exp10 (double x) /* Reduce x: z = x * N / log10(2), k = round(z). */ double_t z = __exp_data.invlog10_2N * x; double_t kd; - int64_t ki; + uint64_t ki; #if TOINT_INTRINSICS kd = roundtoint (z); ki = converttoint (z); #else kd = eval_as_double (z + Shift); + ki = asuint64 (kd); kd -= Shift; - ki = kd; #endif /* r = x - k * log10(2), r in [-0.5, 0.5]. */ From 0a79c6961ffdcf123bf1a4783dc893343f039674 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 15 Aug 2024 21:32:30 -0700 Subject: [PATCH 13/39] Make malloc scalable on all platforms It turns out sched_getcpu() didn't work on many platforms. So the system call now has tests and is well documented. We now employ new workarounds on platforms where it isn't supported in our malloc() implementation. It was previously the case that malloc() was only scalable on Linux/Windows for x86-64. Now the other platforms are scalable too. --- examples/nproc.c | 15 ++++ libc/calls/getcpu.c | 78 ++++++++++++------ libc/calls/sched_getcpu.c | 80 ++++++++++++++---- libc/intrin/atomic.h | 122 ++++++++++++++++++++-------- libc/runtime/syslib.internal.h | 1 + test/libc/calls/sched_getcpu_test.c | 113 ++++++++++++++++++++++++++ third_party/dlmalloc/threaded.inc | 54 ++++++------ tool/viz/malloc_scalability.c | 55 +++++++++++++ tool/viz/vdsodump.c | 40 +++++++++ 9 files changed, 459 insertions(+), 99 deletions(-) create mode 100644 examples/nproc.c create mode 100644 test/libc/calls/sched_getcpu_test.c create mode 100644 tool/viz/malloc_scalability.c create mode 100644 tool/viz/vdsodump.c diff --git a/examples/nproc.c b/examples/nproc.c new file mode 100644 index 000000000..73ad91934 --- /dev/null +++ b/examples/nproc.c @@ -0,0 +1,15 @@ +#if 0 +/*─────────────────────────────────────────────────────────────────╗ +│ To the extent possible under law, Justine Tunney has waived │ +│ all copyright and related or neighboring rights to this file, │ +│ as it is written in the following disclaimers: │ +│ • http://unlicense.org/ │ +│ • http://creativecommons.org/publicdomain/zero/1.0/ │ +╚─────────────────────────────────────────────────────────────────*/ +#endif +#include +#include + +int main(int argc, char *argv[]) { + printf("%d\n", __get_cpu_count()); +} diff --git a/libc/calls/getcpu.c b/libc/calls/getcpu.c index bdc97089e..b689f43fc 100644 --- a/libc/calls/getcpu.c +++ b/libc/calls/getcpu.c @@ -30,39 +30,63 @@ int sys_getcpu(unsigned *opt_cpu, unsigned *opt_node, void *tcache); +/** + * Determines ID of CPU on which thread is currently scheduled. + * + * This is the same as sched_getcpu(), except it also supports returning + * the ID of the current NUMA node. On some platforms this functionality + * isn't available, in which case `out_opt_node` is always be set to 0. + */ int getcpu(unsigned *out_opt_cpu, unsigned *out_opt_node) { - unsigned cpu; - unsigned node; - if (X86_HAVE(RDTSCP)) { + + if (IsWindows()) { + struct NtProcessorNumber pn; + if (out_opt_cpu) { + GetCurrentProcessorNumberEx(&pn); + *out_opt_cpu = 64 * pn.Group + pn.Number; + } + if (out_opt_node) { + unsigned short node16; + if (GetNumaProcessorNodeEx(&pn, &node16)) { + *out_opt_node = node16; + } else { + return __winerr(); + } + } + return 0; + } + +#ifdef __x86_64__ + if (X86_HAVE(RDTSCP) && (IsLinux() || IsFreebsd())) { unsigned tsc_aux; rdtscp(&tsc_aux); - cpu = TSC_AUX_CORE(tsc_aux); - node = TSC_AUX_NODE(tsc_aux); - } else if (IsWindows()) { - struct NtProcessorNumber pn; - GetCurrentProcessorNumberEx(&pn); - cpu = 64 * pn.Group + pn.Number; - unsigned short node16; - if (GetNumaProcessorNodeEx(&pn, &node16)) { - node = node16; - } else { - return __winerr(); + if (out_opt_cpu) + *out_opt_cpu = TSC_AUX_CORE(tsc_aux); + if (out_opt_node) + *out_opt_node = TSC_AUX_NODE(tsc_aux); + return 0; + } +#endif + + if (IsXnu() || IsOpenbsd() || IsNetbsd() || IsFreebsd()) { + if (out_opt_cpu) { + int rc = sched_getcpu(); + if (rc == -1) + return -1; + *out_opt_cpu = rc; } - } else if (IsAarch64()) { - long tpidr_el0; - asm("mrs\t%0,tpidr_el0" : "=r"(tpidr_el0)); - cpu = tpidr_el0 & 255; - node = 0; - } else { - int rc = sys_getcpu(&cpu, &node, 0); - if (rc == -1) - return -1; + if (out_opt_node) + *out_opt_node = 0; + return 0; } - if (out_opt_cpu) { + + unsigned cpu, node; + int rc = sys_getcpu(&cpu, &node, 0); + if (rc == -1) + return -1; + if (out_opt_cpu) *out_opt_cpu = cpu; - } - if (out_opt_node) { + if (out_opt_node) *out_opt_node = node; - } return 0; } diff --git a/libc/calls/sched_getcpu.c b/libc/calls/sched_getcpu.c index 12a0a832b..e671e80ca 100644 --- a/libc/calls/sched_getcpu.c +++ b/libc/calls/sched_getcpu.c @@ -23,32 +23,82 @@ #include "libc/nexgen32e/x86feature.h" #include "libc/nt/struct/processornumber.h" #include "libc/nt/synchronization.h" +#include "libc/runtime/syslib.internal.h" #include "libc/sysv/errfuns.h" int sys_getcpu(unsigned *opt_cpu, unsigned *opt_node, void *tcache); /** * Returns ID of CPU on which thread is currently scheduled. + * + * This function is supported on the following platforms: + * + * - x86-64 + * + * - Linux: rdtsc + * - FreeBSD: rdtsc + * - Windows: win32 + * - OpenBSD: unsupported + * - NetBSD: unsupported + * - MacOS: unsupported + * + * - aarch64 + * + * - Linux: syscall + * - FreeBSD: syscall + * - MacOS: supported + * * @return cpu number on success, or -1 w/ errno */ int sched_getcpu(void) { - if (X86_HAVE(RDTSCP)) { - unsigned tsc_aux; - rdtscp(&tsc_aux); - return TSC_AUX_CORE(tsc_aux); - } else if (IsAarch64()) { - long tpidr_el0; - asm("mrs\t%0,tpidr_el0" : "=r"(tpidr_el0)); - return tpidr_el0 & 255; - } else if (IsWindows()) { + + if (IsWindows()) { struct NtProcessorNumber pn; GetCurrentProcessorNumberEx(&pn); return 64 * pn.Group + pn.Number; - } else { - unsigned cpu = 0; - int rc = sys_getcpu(&cpu, 0, 0); - if (rc == -1) - return -1; - return cpu; } + +#ifdef __x86_64__ + if (X86_HAVE(RDTSCP) && (IsLinux() || IsFreebsd())) { + // Only the Linux, FreeBSD, and Windows kernels can be counted upon + // to populate the TSC_AUX register with the current thread number. + unsigned tsc_aux; + rdtscp(&tsc_aux); + return TSC_AUX_CORE(tsc_aux); + } +#endif + +#ifdef __aarch64__ + if (IsXnu()) { + // pthread_cpu_number_np() is defined by MacOS 11.0+ (Big Sur) in + // the SDK pthread.h header file, even though there's no man page + if (__syslib && __syslib->__version >= 9) { + errno_t err; + size_t out = 0; + if ((err = __syslib->__pthread_cpu_number_np(&out))) { + errno = err; + return -1; + } + return out; + } else { + errno = ENOSYS; // upgrade your ape loader + return -1; // cc -o /usr/local/bin/ape ape/ape-m1.c + } + } +#endif + +#ifdef __aarch64__ + if (IsFreebsd()) { + register int x0 asm("x0"); + register int x8 asm("x8") = 581; // sched_getcpu + asm volatile("svc\t0" : "=r"(x0) : "r"(x8) : "memory"); + return x0; + } +#endif + + unsigned cpu = 0; + int rc = sys_getcpu(&cpu, 0, 0); + if (rc == -1) + return -1; + return cpu; } diff --git a/libc/intrin/atomic.h b/libc/intrin/atomic.h index 3d503d37f..a2d93df8a 100644 --- a/libc/intrin/atomic.h +++ b/libc/intrin/atomic.h @@ -13,48 +13,26 @@ */ typedef enum { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, + memory_order_relaxed = __ATOMIC_RELAXED, + memory_order_consume = __ATOMIC_CONSUME, + memory_order_acquire = __ATOMIC_ACQUIRE, + memory_order_release = __ATOMIC_RELEASE, + memory_order_acq_rel = __ATOMIC_ACQ_REL, + memory_order_seq_cst = __ATOMIC_SEQ_CST } memory_order; -#define ATOMIC_VAR_INIT(...) __VA_ARGS__ +#if !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L) +#define ATOMIC_VAR_INIT(...) __VA_ARGS__ +#endif + #define atomic_is_lock_free(obj) ((void)(obj), sizeof(obj) <= sizeof(void *)) #define atomic_flag atomic_bool -#define ATOMIC_FLAG_INIT ATOMIC_VAR_INIT(0) +#define ATOMIC_FLAG_INIT false #define atomic_flag_test_and_set_explicit(x, order) \ atomic_exchange_explicit(x, 1, order) #define atomic_flag_clear_explicit(x, order) atomic_store_explicit(x, 0, order) -#define atomic_compare_exchange_strong(pObject, pExpected, desired) \ - atomic_compare_exchange_strong_explicit( \ - pObject, pExpected, desired, memory_order_seq_cst, memory_order_seq_cst) -#define atomic_compare_exchange_weak(pObject, pExpected, desired) \ - atomic_compare_exchange_weak_explicit( \ - pObject, pExpected, desired, memory_order_seq_cst, memory_order_seq_cst) -#define atomic_exchange(pObject, desired) \ - atomic_exchange_explicit(pObject, desired, memory_order_seq_cst) -#define atomic_fetch_add(pObject, operand) \ - atomic_fetch_add_explicit(pObject, operand, memory_order_seq_cst) -#define atomic_fetch_and(pObject, operand) \ - atomic_fetch_and_explicit(pObject, operand, memory_order_seq_cst) -#define atomic_fetch_or(pObject, operand) \ - atomic_fetch_or_explicit(pObject, operand, memory_order_seq_cst) -#define atomic_fetch_sub(pObject, operand) \ - atomic_fetch_sub_explicit(pObject, operand, memory_order_seq_cst) -#define atomic_fetch_xor(pObject, operand) \ - atomic_fetch_xor_explicit(pObject, operand, memory_order_seq_cst) -#define atomic_load(pObject) atomic_load_explicit(pObject, memory_order_seq_cst) -#define atomic_store(pObject, desired) \ - atomic_store_explicit(pObject, desired, memory_order_seq_cst) -#define atomic_flag_test_and_set(x) \ - atomic_flag_test_and_set_explicit(x, memory_order_seq_cst) -#define atomic_flag_clear(x) atomic_flag_clear_explicit(x, memory_order_seq_cst) - #if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) #define atomic_init(obj, value) __c11_atomic_init(obj, value) @@ -84,9 +62,35 @@ typedef enum { #define atomic_store_explicit(object, desired, order) \ __c11_atomic_store(object, desired, order) +#define atomic_compare_exchange_strong(pObject, pExpected, desired) \ + atomic_compare_exchange_strong_explicit( \ + pObject, pExpected, desired, memory_order_seq_cst, memory_order_seq_cst) +#define atomic_compare_exchange_weak(pObject, pExpected, desired) \ + atomic_compare_exchange_weak_explicit( \ + pObject, pExpected, desired, memory_order_seq_cst, memory_order_seq_cst) +#define atomic_exchange(pObject, desired) \ + atomic_exchange_explicit(pObject, desired, memory_order_seq_cst) +#define atomic_fetch_add(pObject, operand) \ + atomic_fetch_add_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_and(pObject, operand) \ + atomic_fetch_and_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_or(pObject, operand) \ + atomic_fetch_or_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_sub(pObject, operand) \ + atomic_fetch_sub_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_xor(pObject, operand) \ + atomic_fetch_xor_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_load(pObject) atomic_load_explicit(pObject, memory_order_seq_cst) +#define atomic_store(pObject, desired) \ + atomic_store_explicit(pObject, desired, memory_order_seq_cst) +#define atomic_flag_test_and_set(x) \ + atomic_flag_test_and_set_explicit(x, memory_order_seq_cst) +#define atomic_flag_clear(x) atomic_flag_clear_explicit(x, memory_order_seq_cst) + #elif (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407 -#define atomic_init(obj, value) ((void)(*(obj) = (value))) +#define atomic_init(obj, value) \ + atomic_store_explicit(obj, value, __ATOMIC_RELAXED) #define atomic_thread_fence(order) __atomic_thread_fence(order) #define atomic_signal_fence(order) __atomic_signal_fence(order) #define atomic_compare_exchange_strong_explicit(pObject, pExpected, desired, \ @@ -111,6 +115,31 @@ typedef enum { #define atomic_store_explicit(pObject, desired, order) \ __atomic_store_n(pObject, desired, order) +#define atomic_compare_exchange_strong(pObject, pExpected, desired) \ + atomic_compare_exchange_strong_explicit(pObject, pExpected, desired, \ + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) +#define atomic_compare_exchange_weak(pObject, pExpected, desired) \ + atomic_compare_exchange_weak_explicit(pObject, pExpected, desired, \ + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) +#define atomic_exchange(pObject, desired) \ + atomic_exchange_explicit(pObject, desired, __ATOMIC_SEQ_CST) +#define atomic_fetch_add(pObject, operand) \ + atomic_fetch_add_explicit(pObject, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_and(pObject, operand) \ + atomic_fetch_and_explicit(pObject, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_or(pObject, operand) \ + atomic_fetch_or_explicit(pObject, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_sub(pObject, operand) \ + atomic_fetch_sub_explicit(pObject, operand, __ATOMIC_SEQ_CST) +#define atomic_fetch_xor(pObject, operand) \ + atomic_fetch_xor_explicit(pObject, operand, __ATOMIC_SEQ_CST) +#define atomic_load(pObject) atomic_load_explicit(pObject, __ATOMIC_SEQ_CST) +#define atomic_store(pObject, desired) \ + atomic_store_explicit(pObject, desired, __ATOMIC_SEQ_CST) +#define atomic_flag_test_and_set(x) \ + atomic_flag_test_and_set_explicit(x, __ATOMIC_SEQ_CST) +#define atomic_flag_clear(x) atomic_flag_clear_explicit(x, __ATOMIC_SEQ_CST) + #elif (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 401 #define atomic_init(obj, value) ((void)(*(obj) = (value))) @@ -210,6 +239,31 @@ typedef enum { #define atomic_store_explicit(object, desired, order) \ ((void)atomic_exchange_explicit(object, desired, order)) +#define atomic_compare_exchange_strong(pObject, pExpected, desired) \ + atomic_compare_exchange_strong_explicit( \ + pObject, pExpected, desired, memory_order_seq_cst, memory_order_seq_cst) +#define atomic_compare_exchange_weak(pObject, pExpected, desired) \ + atomic_compare_exchange_weak_explicit( \ + pObject, pExpected, desired, memory_order_seq_cst, memory_order_seq_cst) +#define atomic_exchange(pObject, desired) \ + atomic_exchange_explicit(pObject, desired, memory_order_seq_cst) +#define atomic_fetch_add(pObject, operand) \ + atomic_fetch_add_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_and(pObject, operand) \ + atomic_fetch_and_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_or(pObject, operand) \ + atomic_fetch_or_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_sub(pObject, operand) \ + atomic_fetch_sub_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_fetch_xor(pObject, operand) \ + atomic_fetch_xor_explicit(pObject, operand, memory_order_seq_cst) +#define atomic_load(pObject) atomic_load_explicit(pObject, memory_order_seq_cst) +#define atomic_store(pObject, desired) \ + atomic_store_explicit(pObject, desired, memory_order_seq_cst) +#define atomic_flag_test_and_set(x) \ + atomic_flag_test_and_set_explicit(x, memory_order_seq_cst) +#define atomic_flag_clear(x) atomic_flag_clear_explicit(x, memory_order_seq_cst) + #else /* non-gcc or old gcc w/o x86 */ #error "atomic operations not supported with this compiler and/or architecture" #endif diff --git a/libc/runtime/syslib.internal.h b/libc/runtime/syslib.internal.h index 90ed2994f..424034537 100644 --- a/libc/runtime/syslib.internal.h +++ b/libc/runtime/syslib.internal.h @@ -82,6 +82,7 @@ struct Syslib { char *(*__dlerror)(void); /* v9 (2024-01-31) */ int (*__pthread_cpu_number_np)(size_t *); + /* v10 (2024-05-02) */ long (*__sysctl)(int *, unsigned, void *, size_t *, void *, size_t); long (*__sysctlbyname)(const char *, void *, size_t *, void *, size_t); long (*__sysctlnametomib)(const char *, int *, size_t *); diff --git a/test/libc/calls/sched_getcpu_test.c b/test/libc/calls/sched_getcpu_test.c new file mode 100644 index 000000000..72c85ee05 --- /dev/null +++ b/test/libc/calls/sched_getcpu_test.c @@ -0,0 +1,113 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/atomic.h" +#include "libc/calls/calls.h" +#include "libc/dce.h" +#include "libc/intrin/atomic.h" +#include "libc/macros.h" +#include "libc/runtime/runtime.h" +#include "libc/testlib/subprocess.h" +#include "libc/testlib/testlib.h" +#include "libc/thread/thread.h" +#include "libc/thread/thread2.h" + +int cpu_count; + +void SetUpOnce(void) { + cpu_count = __get_cpu_count(); +} + +//////////////////////////////////////////////////////////////////////////////// +// AFFINITY TEST + +TEST(sched_getcpu, affinity_test) { + + if (IsXnu()) + return; + if (IsNetbsd()) + return; + if (IsOpenbsd()) + return; + + SPAWN(fork); + int n = cpu_count; + for (int i = 0; i < n; ++i) { + cpu_set_t affinity; + CPU_ZERO(&affinity); + CPU_SET(i, &affinity); + ASSERT_EQ( + 0, pthread_setaffinity_np(pthread_self(), sizeof(affinity), &affinity)); + EXPECT_EQ(i, sched_getcpu()); + } + EXITS(0); +} + +//////////////////////////////////////////////////////////////////////////////// +// KLUDGE TEST + +#define THREADS 2 +#define ITERATIONS 10000 + +int g_hits[256]; +atomic_int g_sync; + +int call_sched_getcpu(void) { + int res = sched_getcpu(); + ASSERT_NE(-1, res); + ASSERT_GE(res, 0); + ASSERT_LT(res, cpu_count); + return res; +} + +void *worker(void *arg) { + int ith = (long)arg; + int nth = THREADS; + for (int i = 0; i < ITERATIONS; ++i) { + // help execution of threads be interleaved + int sync = atomic_fetch_add(&g_sync, 1); + if (sync % nth == ith) { + g_hits[call_sched_getcpu() % ARRAYLEN(g_hits)]++; + } + } + return 0; +} + +TEST(sched_getcpu, kludge_test) { + +#ifdef __x86_64__ + if (IsXnu()) + return; +#endif + if (IsNetbsd()) + return; + if (IsOpenbsd()) + return; + + if (cpu_count < THREADS) + return; + pthread_t th[THREADS]; + for (int i = 0; i < THREADS; ++i) + ASSERT_EQ(0, pthread_create(th + i, 0, worker, (void *)(long)i)); + for (int i = 0; i < THREADS; ++i) + ASSERT_EQ(0, pthread_join(th[i], 0)); + int hit = 0; + for (int i = 0; i < ARRAYLEN(g_hits); ++i) + hit += !!g_hits[i]; + ASSERT_GE(hit, THREADS); +} diff --git a/third_party/dlmalloc/threaded.inc b/third_party/dlmalloc/threaded.inc index 2454742cd..7c7253461 100644 --- a/third_party/dlmalloc/threaded.inc +++ b/third_party/dlmalloc/threaded.inc @@ -21,12 +21,9 @@ #include "libc/intrin/strace.h" #include "libc/intrin/weaken.h" #include "libc/macros.h" -#include "libc/nexgen32e/rdtscp.h" -#include "libc/nexgen32e/x86feature.h" #include "libc/runtime/runtime.h" #include "libc/thread/thread.h" -#include "libc/runtime/runtime.h" -#include "libc/intrin/weaken.h" +#include "libc/thread/threads.h" #include "third_party/dlmalloc/dlmalloc.h" #if !FOOTERS || !MSPACES @@ -34,6 +31,7 @@ #endif static struct magicu magiu; +static unsigned g_cpucount; static unsigned g_heapslen; static mstate g_heaps[128]; @@ -90,18 +88,29 @@ void dlmalloc_inspect_all(void handler(void *start, void *end, } } -forceinline mstate get_arena(void) { - unsigned cpu; -#ifdef __x86_64__ - unsigned tsc_aux; - rdtscp(&tsc_aux); - cpu = TSC_AUX_CORE(tsc_aux); -#else - long tpidr_el0; - asm("mrs\t%0,tpidr_el0" : "=r"(tpidr_el0)); - cpu = tpidr_el0 & 255; -#endif - return g_heaps[__magicu_div(cpu, magiu) % g_heapslen]; +// we make malloc() scalable basically by +// +// return g_heaps[sched_getcpu() / 2]; +// +// except we cache the syscall result using thread-local storage. on +// some platforms, it's not possible to use sched_getcpu() so we use +// arbitrary assignments to help scalability, but may not be optimal +static mstate get_arena(void) { + static atomic_uint assign; + static thread_local unsigned i; + static thread_local unsigned n; + if (n == 50) + n = 0; + if (!n) { + i = sched_getcpu(); + if (i == -1) { + i = atomic_fetch_add_explicit(&assign, 1, memory_order_relaxed); + i %= g_cpucount; + } + i = __magicu_div(i, magiu) % g_heapslen; + } + ++n; + return g_heaps[i]; } static void *dlmalloc_single(size_t n) { @@ -174,19 +183,18 @@ static void threaded_dlmalloc(void) { if (!_weaken(pthread_create)) return use_single_heap(false); - if (!IsAarch64() && !X86_HAVE(RDTSCP)) - return use_single_heap(true); - // determine how many independent heaps we should install // by default we do an approximation of one heap per core // this code makes the c++ stl go 164x faster on my ryzen - cpus = __get_cpu_count(); - if (cpus == -1) + g_cpucount = cpus = __get_cpu_count(); + if (cpus == -1) { heaps = 1; - else if ((var = getenv("COSMOPOLITAN_HEAP_COUNT"))) + g_cpucount = 1; + } else if ((var = getenv("COSMOPOLITAN_HEAP_COUNT"))) { heaps = dlmalloc_atoi(var); - else + } else { heaps = cpus >> 1; + } if (heaps <= 1) return use_single_heap(true); if (heaps > ARRAYLEN(g_heaps)) diff --git a/tool/viz/malloc_scalability.c b/tool/viz/malloc_scalability.c new file mode 100644 index 000000000..434be2123 --- /dev/null +++ b/tool/viz/malloc_scalability.c @@ -0,0 +1,55 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/calls/struct/timespec.h" +#include "libc/mem/mem.h" +#include "libc/runtime/runtime.h" +#include "libc/thread/thread.h" + +#define ALLOCATIONS 1000 + +void *worker(void *arg) { + void **ptrs = malloc(ALLOCATIONS * sizeof(void *)); + for (int i = 0; i < ALLOCATIONS; ++i) + ptrs[i] = malloc(1); + for (int i = 0; i < ALLOCATIONS; ++i) + free(ptrs[i]); + free(ptrs); + return 0; +} + +void test(int n) { + struct timespec start = timespec_real(); + pthread_t *th = malloc(sizeof(pthread_t) * n); + for (int i = 0; i < n; ++i) + pthread_create(th + i, 0, worker, 0); + for (int i = 0; i < n; ++i) + pthread_join(th[i], 0); + free(th); + struct timespec end = timespec_real(); + printf("%2d threads * %d allocs = %ld us\n", n, ALLOCATIONS, + timespec_tomicros(timespec_sub(end, start))); +} + +int main(int argc, char *argv[]) { + int n = __get_cpu_count(); + if (n < 8) + n = 8; + for (int i = 1; i <= n; ++i) + test(i); +} diff --git a/tool/viz/vdsodump.c b/tool/viz/vdsodump.c new file mode 100644 index 000000000..22174a323 --- /dev/null +++ b/tool/viz/vdsodump.c @@ -0,0 +1,40 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/calls/calls.h" +#include "libc/intrin/getauxval.h" +#include "libc/runtime/runtime.h" +#include "libc/sysv/consts/auxv.h" + +int main(int argc, char *argv[]) { + struct AuxiliaryValue av; + av = __getauxval(AT_SYSINFO_EHDR); + if (!av.isfound) + return 2; + int fd = creat("vdso.so", 0644); + if (fd == -1) + return 3; + int i; + for (i = 0;; i += getpagesize()) + if (write(fd, (char *)av.value + i, getpagesize()) == -1) + break; + if (!i) + return 4; + if (close(fd)) + return 5; +} From 1671283f1a2f6a5911904aa66f16ad216b05d99d Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 15 Aug 2024 23:54:14 -0700 Subject: [PATCH 14/39] Avoid clobbering errno --- third_party/dlmalloc/threaded.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/third_party/dlmalloc/threaded.inc b/third_party/dlmalloc/threaded.inc index 7c7253461..f6664b653 100644 --- a/third_party/dlmalloc/threaded.inc +++ b/third_party/dlmalloc/threaded.inc @@ -24,6 +24,7 @@ #include "libc/runtime/runtime.h" #include "libc/thread/thread.h" #include "libc/thread/threads.h" +#include "libc/errno.h" #include "third_party/dlmalloc/dlmalloc.h" #if !FOOTERS || !MSPACES @@ -102,8 +103,10 @@ static mstate get_arena(void) { if (n == 50) n = 0; if (!n) { + int e = errno; i = sched_getcpu(); if (i == -1) { + errno = e; i = atomic_fetch_add_explicit(&assign, 1, memory_order_relaxed); i %= g_cpucount; } From 5bd22aef12b89fada75eb50bdfb31153690f2352 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 06:43:59 -0700 Subject: [PATCH 15/39] Experiment with supporting Windows Arm64 natively So far I haven't found any way to run native Arm64 code on Windows Arm64 without using MSVC. When I build a PE binary from scratch that should be a valid Windows Arm64 program, the OS refuses to run it. Possibly due to requiring additional content like XML manifests or relocation or control flow integrity data that isn't normally required on x64. I've also tried using VirtualAlloc2() to JIT an Arm64 native function, but VirtualAlloc2 always fails with invalid parameter. I tried using MSVC to create an ARM DLL that my x64 emulated program can link at runtime, to pass a function pointer with ARM code, but LoadLibrary() rejects ARM DLLs as invalid exe The only option left, is likely to write a new program like ape/ape-m1.c which can be compiled by MSVC to load and run an AARCH64 ELF executable. The emulated x64 binary would detect emulation using IsWow64Process2 and then drop the loader executable in a temporary folder, and re-launch the original executable, using the Arm64 segments of the cosmocc fat binary. --- examples/BUILD.mk | 1 + libc/nt/enum/pageflags.h | 3 +++ libc/nt/kernel32/IsWow64Process2.S | 18 +++++++++++++++++ libc/nt/master.sh | 5 +++-- libc/nt/runtime.h | 2 ++ libc/nt/struct/arm64.h | 20 ++++++++++++++++++ libc/nt/struct/memextendedparameter.h | 14 +++++++------ tool/build/elf2pe.c | 29 ++++++++++++++++++++++++--- tool/build/elf2pe.h | 4 ++-- tool/hello/BUILD.mk | 2 +- tool/hello/hello-pe.c | 3 ++- tool/hello/life-pe.c | 3 ++- 12 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 libc/nt/kernel32/IsWow64Process2.S create mode 100644 libc/nt/struct/arm64.h diff --git a/examples/BUILD.mk b/examples/BUILD.mk index ff8e97a79..e0318d0a7 100644 --- a/examples/BUILD.mk +++ b/examples/BUILD.mk @@ -53,6 +53,7 @@ EXAMPLES_DIRECTDEPS = \ LIBC_NEXGEN32E \ LIBC_NT_ADVAPI32 \ LIBC_NT_IPHLPAPI \ + LIBC_NT_MEMORY \ LIBC_NT_KERNEL32 \ LIBC_NT_NTDLL \ LIBC_NT_USER32 \ diff --git a/libc/nt/enum/pageflags.h b/libc/nt/enum/pageflags.h index 5cef3a2fa..40569decb 100644 --- a/libc/nt/enum/pageflags.h +++ b/libc/nt/enum/pageflags.h @@ -23,4 +23,7 @@ #define kNtSecLargePages 0x80000000 #define kNtSecWritecombine 0x40000000 +#define kNtPageTargetsInvalid 0x40000000 +#define kNtPageTargetsNoUpdate 0x40000000 + #endif /* COSMOPOLITAN_LIBC_NT_ENUM_PAGEFLAGS_H_ */ diff --git a/libc/nt/kernel32/IsWow64Process2.S b/libc/nt/kernel32/IsWow64Process2.S new file mode 100644 index 000000000..4cb92ff17 --- /dev/null +++ b/libc/nt/kernel32/IsWow64Process2.S @@ -0,0 +1,18 @@ +#include "libc/nt/codegen.h" +.imp kernel32,__imp_IsWow64Process2,IsWow64Process2 + + .text.windows + .ftrace1 +IsWow64Process2: + .ftrace2 +#ifdef __x86_64__ + push %rbp + mov %rsp,%rbp + mov __imp_IsWow64Process2(%rip),%rax + jmp __sysv2nt +#elif defined(__aarch64__) + mov x0,#0 + ret +#endif + .endfn IsWow64Process2,globl + .previous diff --git a/libc/nt/master.sh b/libc/nt/master.sh index 4f44cc057..0e8e63654 100755 --- a/libc/nt/master.sh +++ b/libc/nt/master.sh @@ -113,6 +113,7 @@ imp 'GetCurrentProcessId' GetCurrentProcessId kernel32 0 imp 'GetCurrentProcessorNumberEx' GetCurrentProcessorNumberEx kernel32 1 imp 'GetCurrentThread' GetCurrentThread kernel32 0 imp 'GetCurrentThreadId' GetCurrentThreadId kernel32 0 +imp 'GetDynamicTimeZoneInformation' GetDynamicTimeZoneInformation kernel32 1 imp 'GetEnvironmentStrings' GetEnvironmentStringsW kernel32 1 imp 'GetEnvironmentVariable' GetEnvironmentVariableW kernel32 3 imp 'GetExitCodeThread' GetExitCodeThread kernel32 2 @@ -168,8 +169,6 @@ imp 'GetSystemTimePreciseAsFileTime' GetSystemTimePreciseAsFileTime kernel3 imp 'GetSystemTimes' GetSystemTimes kernel32 3 imp 'GetTempPath' GetTempPathW kernel32 2 imp 'GetTempPathA' GetTempPathA kernel32 2 -imp 'GetDynamicTimeZoneInformation' GetDynamicTimeZoneInformation kernel32 1 -imp 'GetTimeZoneInformation' GetTimeZoneInformation kernel32 1 imp 'GetThreadContext' GetThreadContext kernel32 2 imp 'GetThreadDescription' GetThreadDescription kernel32 2 imp 'GetThreadIOPendingFlag' GetThreadIOPendingFlag kernel32 2 @@ -178,6 +177,7 @@ imp 'GetThreadPriority' GetThreadPriority kernel32 1 imp 'GetThreadPriorityBoost' GetThreadPriorityBoost kernel32 2 imp 'GetThreadTimes' GetThreadTimes kernel32 5 imp 'GetTickCount64' GetTickCount64 kernel32 0 +imp 'GetTimeZoneInformation' GetTimeZoneInformation kernel32 1 imp 'GetVersionEx' GetVersionExW kernel32 1 imp 'GetVolumeInformationByHandle' GetVolumeInformationByHandleW kernel32 8 imp 'GetVolumePathName' GetVolumePathNameW kernel32 3 @@ -197,6 +197,7 @@ imp 'InitializeCriticalSection' InitializeCriticalSection kernel32 1 imp 'InitializeCriticalSectionAndSpinCount' InitializeCriticalSectionAndSpinCount kernel32 2 imp 'InitializeProcThreadAttributeList' InitializeProcThreadAttributeList kernel32 4 imp 'InitializeSRWLock' InitializeSRWLock kernel32 1 +imp 'IsWow64Process2' IsWow64Process2 kernel32 3 imp 'LeaveCriticalSection' LeaveCriticalSection kernel32 1 imp 'LoadLibrary' LoadLibraryW kernel32 1 imp 'LoadLibraryA' LoadLibraryA kernel32 1 diff --git a/libc/nt/runtime.h b/libc/nt/runtime.h index 953e77692..5aa2df862 100644 --- a/libc/nt/runtime.h +++ b/libc/nt/runtime.h @@ -43,6 +43,8 @@ bool32 SetDefaultDllDirectories(unsigned dirflags); bool32 ProcessPrng(void *RandomBuffer, uint32_t RandomBufferLength); uint32_t GetModuleFileName(int64_t hModule, char16_t *lpFilename, uint32_t nSize); +bool32 IsWow64Process2(intptr_t hProcess, uint16_t *out_pProcessMachine, + uint16_t *out_opt_pNativeMachine); #if ShouldUseMsabiAttribute() #include "libc/nt/thunk/runtime.inc" diff --git a/libc/nt/struct/arm64.h b/libc/nt/struct/arm64.h new file mode 100644 index 000000000..295da0fcd --- /dev/null +++ b/libc/nt/struct/arm64.h @@ -0,0 +1,20 @@ +#ifndef COSMOPOLITAN_LIBC_NT_STRUCT_ARM64_H_ +#define COSMOPOLITAN_LIBC_NT_STRUCT_ARM64_H_ + +struct NtArm64RuntimeFunction { + uint32_t BeginAddress; + union { + uint32_t UnwindData; + struct { + uint32_t Flag : 2; + uint32_t FunctionLength : 11; + uint32_t RegF : 3; + uint32_t RegI : 4; + uint32_t H : 1; + uint32_t CR : 2; + uint32_t FrameSize : 9; + }; + }; +}; + +#endif /* COSMOPOLITAN_LIBC_NT_STRUCT_ARM64_H_ */ diff --git a/libc/nt/struct/memextendedparameter.h b/libc/nt/struct/memextendedparameter.h index 6cd4d0f5d..5fdd3985c 100644 --- a/libc/nt/struct/memextendedparameter.h +++ b/libc/nt/struct/memextendedparameter.h @@ -9,26 +9,28 @@ #define kNtMemExtendedParameterPartitionHandle 3 #define kNtMemExtendedParameterUserPhysicalHandle 4 #define kNtMemExtendedParameterAttributeFlags 5 -#define kNtMemExtendedParameterMax 6 +#define kNtMemExtendedParameterImageMachine 6 +#define kNtMemExtendedParameterMax 7 #define kNtMemExtendedParameterGraphics 0x00000001 #define kNtMemExtendedParameterNonpaged 0x00000002 #define kNtMemExtendedParameterZeroPagesOptional 0x00000004 #define kNtMemExtendedParameterNonpagedLarge 0x00000008 #define kNtMemExtendedParameterNonpagedHuge 0x00000010 +#define kNtMemExtendedParameterSoftFaultPages 0x00000020 +#define kNtMemExtendedParameterEcCode 0x00000040 +#define kNtMemExtendedParameterImageNoHpat 0x00000080 struct NtMemExtendedParameter { - struct { - uint64_t Type : kNtMemExtendedParameterTypeBits; - uint64_t Reserved : 64 - kNtMemExtendedParameterTypeBits; - } DUMMYSTRUCTNAME; + uint8_t Type; + uint8_t Reserved[7]; union { uint64_t ULong64; void *Pointer; size_t Size; intptr_t Handle; unsigned ULong; - } DUMMYUNIONNAME; + }; }; #endif /* COSMOPOLITAN_LIBC_NT_STRUCT_MEMEXTENDEDPARAMETER_H_ */ diff --git a/tool/build/elf2pe.c b/tool/build/elf2pe.c index 485ada109..784525584 100644 --- a/tool/build/elf2pe.c +++ b/tool/build/elf2pe.c @@ -229,6 +229,17 @@ static struct Segment *NewSegment(void) { return s; } +static int ConvertElfMachineToPe(struct Elf *elf) { + switch (elf->ehdr->e_machine) { + case EM_NEXGEN32E: + return kNtImageFileMachineNexgen32e; + case EM_AARCH64: + return kNtImageFileMachineArm64; + default: + Die(elf->path, "unsupported e_machine"); + } +} + static Elf64_Addr RelocateVaddrWithinSegment(struct Elf *elf, Elf64_Addr vaddr_old, struct Segment *segment) { @@ -811,7 +822,17 @@ static uint32_t GetPeSectionCharacteristics(struct Segment *s) { // originally in the elf image that ld linked. in order for this to work // the executable needs to be linked in `ld -q` mode, since it'll retain // the .rela sections we'll need later to fixup the binary. -static struct ImagePointer GeneratePe(struct Elf *elf, char *fp, int64_t vp) { +static struct ImagePointer GeneratePe(struct Elf *elf, char *fp) { + + int64_t vp = 0; + Elf64_Phdr *phdr; + for (int i = 0; i < elf->ehdr->e_phnum; ++i) { + if ((phdr = GetElfProgramHeaderAddress(elf->ehdr, elf->size, i)) && + phdr->p_type == PT_LOAD) { + vp = phdr->p_vaddr; + break; + } + } Elf64_Sym *entry; if (!(entry = FindGlobal(elf, "__win32_start")) && @@ -855,7 +876,7 @@ static struct ImagePointer GeneratePe(struct Elf *elf, char *fp, int64_t vp) { struct NtImageFileHeader *filehdr; filehdr = (struct NtImageFileHeader *)fp; fp += sizeof(struct NtImageFileHeader); - filehdr->Machine = kNtImageFileMachineNexgen32e; + filehdr->Machine = ConvertElfMachineToPe(elf); filehdr->TimeDateStamp = 1690072024; filehdr->Characteristics = kNtPeFileExecutableImage | kNtImageFileLargeAddressAware | @@ -873,7 +894,9 @@ static struct ImagePointer GeneratePe(struct Elf *elf, char *fp, int64_t vp) { opthdr->FileAlignment = 512; opthdr->SectionAlignment = MAX(4096, elf->align); opthdr->MajorOperatingSystemVersion = 6; + opthdr->MinorOperatingSystemVersion = 2; opthdr->MajorSubsystemVersion = 6; + opthdr->MinorSubsystemVersion = 2; opthdr->Subsystem = kNtImageSubsystemWindowsCui; opthdr->DllCharacteristics = kNtImageDllcharacteristicsNxCompat | kNtImageDllcharacteristicsHighEntropyVa; @@ -1116,7 +1139,7 @@ int main(int argc, char *argv[]) { // translate executable struct Elf *elf = OpenElf(argv[optind]); char *buf = Memalign(MAX_ALIGN, 134217728); - struct ImagePointer ip = GeneratePe(elf, buf, 0x00400000); + struct ImagePointer ip = GeneratePe(elf, buf); if (creat(outpath, 0755) == -1) DieSys(elf->path); Pwrite(3, buf, ip.fp - buf, 0); diff --git a/tool/build/elf2pe.h b/tool/build/elf2pe.h index 53312b1a2..49cb8e71e 100644 --- a/tool/build/elf2pe.h +++ b/tool/build/elf2pe.h @@ -1,8 +1,8 @@ #ifndef COSMOPOLITAN_TOOL_BUILD_ELF2PE_H_ #define COSMOPOLITAN_TOOL_BUILD_ELF2PE_H_ -#define __dll_import(DLL, RET, FUNC, ARGS) \ - extern RET(*const __attribute__((__ms_abi__, __weak__)) FUNC) \ +#define __dll_import(DLL, RET, FUNC, ARGS) \ + extern RET(*const __msabi __attribute__((__weak__)) FUNC) \ ARGS __asm__("\"dll$" DLL "$" #FUNC "\"") #endif /* COSMOPOLITAN_TOOL_BUILD_ELF2PE_H_ */ diff --git a/tool/hello/BUILD.mk b/tool/hello/BUILD.mk index 80648401c..bb2cbb1cd 100644 --- a/tool/hello/BUILD.mk +++ b/tool/hello/BUILD.mk @@ -79,7 +79,7 @@ o/$(MODE)/tool/hello/hello-pe.ape: \ # elf2pe can generate binaries that don't have dll imports o/$(MODE)/tool/hello/life-pe.dbg: \ o/$(MODE)/tool/hello/life-pe.o - @$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain + @$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain #-Ttext-segment=0x140000000 o/$(MODE)/tool/hello/life-pe.ape: \ o/$(MODE)/tool/hello/life-pe.dbg \ o/$(MODE)/tool/build/elf2pe diff --git a/tool/hello/hello-pe.c b/tool/hello/hello-pe.c index c54ce5e08..47198ee76 100644 --- a/tool/hello/hello-pe.c +++ b/tool/hello/hello-pe.c @@ -7,6 +7,7 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif +#include "libc/nt/thunk/msabi.h" #include "tool/build/elf2pe.h" #define STD_OUTPUT_HANDLE -11u @@ -15,7 +16,7 @@ __dll_import("kernel32.dll", long, GetStdHandle, (unsigned)); __dll_import("kernel32.dll", int, WriteFile, (long, const void *, unsigned, unsigned *, void *)); -__attribute__((__ms_abi__)) long WinMain(void) { +__msabi long WinMain(void) { WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "hello world\n", 12, 0, 0); return 0; } diff --git a/tool/hello/life-pe.c b/tool/hello/life-pe.c index 6f6098d1d..5786749af 100644 --- a/tool/hello/life-pe.c +++ b/tool/hello/life-pe.c @@ -7,7 +7,8 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif +#include "libc/nt/thunk/msabi.h" -__attribute__((__ms_abi__)) long WinMain(void) { +__msabi long WinMain(void) { return 42 << 8; } From de0cde8def86160673665a71529ce6cb60f629a0 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 07:43:10 -0700 Subject: [PATCH 16/39] Release Cosmopolitan v3.7.0 --- libc/integral/normalize.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/integral/normalize.inc b/libc/integral/normalize.inc index 39ac2a177..d92853152 100644 --- a/libc/integral/normalize.inc +++ b/libc/integral/normalize.inc @@ -3,8 +3,8 @@ #endif #define __COSMOPOLITAN_MAJOR__ 3 -#define __COSMOPOLITAN_MINOR__ 6 -#define __COSMOPOLITAN_PATCH__ 2 +#define __COSMOPOLITAN_MINOR__ 7 +#define __COSMOPOLITAN_PATCH__ 0 #define __COSMOPOLITAN__ \ (100000000 * __COSMOPOLITAN_MAJOR__ + 1000000 * __COSMOPOLITAN_MINOR__ + \ __COSMOPOLITAN_PATCH__) From 11d9fb521d81b171ba50d636c469050b206b5280 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 11:05:37 -0700 Subject: [PATCH 17/39] Make atomics faster on aarch64 This change implements the compiler runtime for ARM v8.1 ISE atomics and gets rid of the mandatory -mno-outline-atomics flag. It can dramatically speed things up, on newer ARM CPUs, as indicated by the changed lines in test/libc/thread/footek_test.c. In llamafile dispatching on hwcap atomic also shaved microseconds off synchronization barriers. --- Makefile | 2 +- ape/ape.lds | 2 +- build/definitions.mk | 6 +- libc/intrin/aarch64/atomics.S | 1919 ++++++++++++++++++++++++++++++++ libc/intrin/armlse.c | 32 + libc/intrin/atomic.c | 24 + libc/thread/pthread_cancel.c | 1 - test/libc/thread/footek_test.c | 130 ++- tool/build/fixupobj.c | 2 +- tool/cosmocc/bin/cosmocc | 2 +- tool/cosmocc/bin/cosmocross | 2 +- tool/hello/BUILD.mk | 2 +- 12 files changed, 2053 insertions(+), 71 deletions(-) create mode 100644 libc/intrin/aarch64/atomics.S create mode 100644 libc/intrin/armlse.c create mode 100644 libc/intrin/atomic.c diff --git a/Makefile b/Makefile index dcc3278ff..c0c55c837 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ endif ifneq ($(findstring aarch64,$(MODE)),) ARCH = aarch64 -HOSTS ?= pi studio freebsdarm +HOSTS ?= pi pi5 studio freebsdarm else ARCH = x86_64 HOSTS ?= freebsd rhel7 xnu openbsd netbsd win10 diff --git a/ape/ape.lds b/ape/ape.lds index 4e6db724a..4bf0f0fd8 100644 --- a/ape/ape.lds +++ b/ape/ape.lds @@ -310,7 +310,7 @@ SECTIONS { . = ALIGN(__privileged_end > __privileged_start ? CONSTANT(COMMONPAGESIZE) : 0); /*END: morphable code */ __privileged_start = .; - *(.privileged) + *(.privileged .privileged.*) __privileged_end = .; KEEP(*(.ape.pad.text)) diff --git a/build/definitions.mk b/build/definitions.mk index 774983244..703a5c381 100644 --- a/build/definitions.mk +++ b/build/definitions.mk @@ -115,14 +115,10 @@ ifeq ($(ARCH), aarch64) # - Cosmopolitan Libc uses x28 for thread-local storage because Apple # forbids us from using tpidr_el0 too. # -# - Cosmopolitan currently lacks an implementation of the runtime -# libraries needed by the -moutline-atomics flag -# DEFAULT_COPTS += \ -ffixed-x18 \ -ffixed-x28 \ - -fsigned-char \ - -mno-outline-atomics + -fsigned-char endif MATHEMATICAL = \ diff --git a/libc/intrin/aarch64/atomics.S b/libc/intrin/aarch64/atomics.S new file mode 100644 index 000000000..17bc04fc3 --- /dev/null +++ b/libc/intrin/aarch64/atomics.S @@ -0,0 +1,1919 @@ +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include "libc/macros.h" + +// aarch64 atomics compiler runtime +// +// armv8.1 introduced atomic instructions that go considerably faster. +// you can pass the -mno-outline-atomics flag to the compiler to avoid +// this runtime, however that'll go slower. + +.arch armv8-a+lse + +.macro .prvfn name + .privileged + .balign 16 +\name: +.endm + +.macro .begfn name + .section .text.\name,"ax",%progbits + .balign 16 + .ftrace1 +\name: + .ftrace2 +.endm + +.macro jnatom label + adrp x16,__aarch64_have_lse_atomics + ldrb w16,[x16,:lo12:__aarch64_have_lse_atomics] + cbz w16,\label +.endm + + +.begfn __aarch64_swp1_relax + jnatom 1f + swpb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + stxrb w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp1_relax,globl + +.begfn __aarch64_swp1_acq + jnatom 1f + swpab w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + stxrb w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp1_acq,globl + +.begfn __aarch64_swp1_rel + jnatom 1f + swplb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + stlxrb w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp1_rel,globl + +.begfn __aarch64_swp1_acq_rel + jnatom 1f + swpalb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + stlxrb w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp1_acq_rel,globl + +.begfn __aarch64_swp1_sync + jnatom 1f + swpab w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + stxrb w17,w16,[x1] + cbnz w17,0b + dmb ish + ret +.endfn __aarch64_swp1_sync,globl + + +.begfn __aarch64_cas1_relax + jnatom 1f + casb w0,w1,[x2] + ret +1: uxtb w16,w0 +0: ldxrb w0,[x2] + cmp w0,w16 + bne 1f + stxrb w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas1_relax,globl + +.begfn __aarch64_cas1_acq + jnatom 1f + casab w0,w1,[x2] + ret +1: uxtb w16,w0 +0: ldaxrb w0,[x2] + cmp w0,w16 + bne 1f + stxrb w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas1_acq,globl + +.begfn __aarch64_cas1_rel + jnatom 1f + caslb w0,w1,[x2] + ret +1: uxtb w16,w0 +0: ldxrb w0,[x2] + cmp w0,w16 + bne 1f + stlxrb w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas1_rel,globl + +.begfn __aarch64_cas1_acq_rel + jnatom 1f + casalb w0,w1,[x2] + ret +1: uxtb w16,w0 +0: ldaxrb w0,[x2] + cmp w0,w16 + bne 1f + stlxrb w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas1_acq_rel,globl + +.begfn __aarch64_cas1_sync + jnatom 1f + casalb w0,w1,[x2] + ret +1: uxtb w16,w0 +0: ldxrb w0,[x2] + cmp w0,w16 + bne 1f + stlxrb w17,w1,[x2] + cbnz w17,0b +1: dmb ish + ret +.endfn __aarch64_cas1_sync,globl + + +.begfn __aarch64_ldadd1_relax + jnatom 1f + ldaddb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + add w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd1_relax,globl + +.begfn __aarch64_ldadd1_acq + jnatom 1f + ldaddab w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + add w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd1_acq,globl + +.begfn __aarch64_ldadd1_rel + jnatom 1f + ldaddlb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + add w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd1_rel,globl + +.begfn __aarch64_ldadd1_acq_rel + jnatom 1f + ldaddalb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + add w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd1_acq_rel,globl + +.begfn __aarch64_ldadd1_sync + jnatom 1f + ldaddalb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + add w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldadd1_sync,globl + + +.begfn __aarch64_ldset1_relax + jnatom 1f + ldsetb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + orr w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset1_relax,globl + +.begfn __aarch64_ldset1_acq + jnatom 1f + ldsetab w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + orr w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset1_acq,globl + +.begfn __aarch64_ldset1_rel + jnatom 1f + ldsetlb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + orr w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset1_rel,globl + +.begfn __aarch64_ldset1_acq_rel + jnatom 1f + ldsetalb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + orr w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset1_acq_rel,globl + +.begfn __aarch64_ldset1_sync + jnatom 1f + ldsetalb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + orr w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldset1_sync,globl + + +.begfn __aarch64_ldclr1_relax + jnatom 1f + ldclrb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + bic w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr1_relax,globl + +.begfn __aarch64_ldclr1_acq + jnatom 1f + ldclrab w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + bic w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr1_acq,globl + +.begfn __aarch64_ldclr1_rel + jnatom 1f + ldclrlb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + bic w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr1_rel,globl + +.begfn __aarch64_ldclr1_acq_rel + jnatom 1f + ldclralb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + bic w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr1_acq_rel,globl + +.begfn __aarch64_ldclr1_sync + jnatom 1f + ldclralb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + bic w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldclr1_sync,globl + + +.begfn __aarch64_ldeor1_relax + jnatom 1f + ldeorb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + eor w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor1_relax,globl + +.begfn __aarch64_ldeor1_acq + jnatom 1f + ldeorab w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + eor w17,w0,w16 + stxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor1_acq,globl + +.begfn __aarch64_ldeor1_rel + jnatom 1f + ldeorlb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + eor w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor1_rel,globl + +.begfn __aarch64_ldeor1_acq_rel + jnatom 1f + ldeoralb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrb w0,[x1] + eor w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor1_acq_rel,globl + +.begfn __aarch64_ldeor1_sync + jnatom 1f + ldeoralb w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrb w0,[x1] + eor w17,w0,w16 + stlxrb w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldeor1_sync,globl + + +.begfn __aarch64_swp2_relax + jnatom 1f + swph w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + stxrh w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp2_relax,globl + +.begfn __aarch64_swp2_acq + jnatom 1f + swpah w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + stxrh w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp2_acq,globl + +.begfn __aarch64_swp2_rel + jnatom 1f + swplh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + stlxrh w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp2_rel,globl + +.begfn __aarch64_swp2_acq_rel + jnatom 1f + swpalh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + stlxrh w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp2_acq_rel,globl + +.begfn __aarch64_swp2_sync + jnatom 1f + swpah w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + stxrh w17,w16,[x1] + cbnz w17,0b + dmb ish + ret +.endfn __aarch64_swp2_sync,globl + + +.begfn __aarch64_cas2_relax + jnatom 1f + cash w0,w1,[x2] + ret +1: uxth w16,w0 +0: ldxrh w0,[x2] + cmp w0,w16 + bne 1f + stxrh w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas2_relax,globl + +.begfn __aarch64_cas2_acq + jnatom 1f + casah w0,w1,[x2] + ret +1: uxth w16,w0 +0: ldaxrh w0,[x2] + cmp w0,w16 + bne 1f + stxrh w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas2_acq,globl + +.begfn __aarch64_cas2_rel + jnatom 1f + caslh w0,w1,[x2] + ret +1: uxth w16,w0 +0: ldxrh w0,[x2] + cmp w0,w16 + bne 1f + stlxrh w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas2_rel,globl + +.begfn __aarch64_cas2_acq_rel + jnatom 1f + casalh w0,w1,[x2] + ret +1: uxth w16,w0 +0: ldaxrh w0,[x2] + cmp w0,w16 + bne 1f + stlxrh w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas2_acq_rel,globl + +.begfn __aarch64_cas2_sync + jnatom 1f + casalh w0,w1,[x2] + ret +1: uxth w16,w0 +0: ldxrh w0,[x2] + cmp w0,w16 + bne 1f + stlxrh w17,w1,[x2] + cbnz w17,0b +1: dmb ish + ret +.endfn __aarch64_cas2_sync,globl + + +.begfn __aarch64_ldadd2_relax + jnatom 1f + ldaddh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + add w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd2_relax,globl + +.begfn __aarch64_ldadd2_acq + jnatom 1f + ldaddah w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + add w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd2_acq,globl + +.begfn __aarch64_ldadd2_rel + jnatom 1f + ldaddlh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + add w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd2_rel,globl + +.begfn __aarch64_ldadd2_acq_rel + jnatom 1f + ldaddalh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + add w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd2_acq_rel,globl + +.begfn __aarch64_ldadd2_sync + jnatom 1f + ldaddalh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + add w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldadd2_sync,globl + + +.begfn __aarch64_ldset2_relax + jnatom 1f + ldseth w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + orr w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset2_relax,globl + +.begfn __aarch64_ldset2_acq + jnatom 1f + ldsetah w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + orr w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset2_acq,globl + +.begfn __aarch64_ldset2_rel + jnatom 1f + ldsetlh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + orr w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset2_rel,globl + +.begfn __aarch64_ldset2_acq_rel + jnatom 1f + ldsetalh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + orr w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset2_acq_rel,globl + +.begfn __aarch64_ldset2_sync + jnatom 1f + ldsetalh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + orr w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldset2_sync,globl + + +.begfn __aarch64_ldclr2_relax + jnatom 1f + ldclrh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + bic w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr2_relax,globl + +.begfn __aarch64_ldclr2_acq + jnatom 1f + ldclrah w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + bic w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr2_acq,globl + +.begfn __aarch64_ldclr2_rel + jnatom 1f + ldclrlh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + bic w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr2_rel,globl + +.begfn __aarch64_ldclr2_acq_rel + jnatom 1f + ldclralh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + bic w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr2_acq_rel,globl + +.begfn __aarch64_ldclr2_sync + jnatom 1f + ldclralh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + bic w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldclr2_sync,globl + + +.begfn __aarch64_ldeor2_relax + jnatom 1f + ldeorh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + eor w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor2_relax,globl + +.begfn __aarch64_ldeor2_acq + jnatom 1f + ldeorah w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + eor w17,w0,w16 + stxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor2_acq,globl + +.begfn __aarch64_ldeor2_rel + jnatom 1f + ldeorlh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + eor w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor2_rel,globl + +.begfn __aarch64_ldeor2_acq_rel + jnatom 1f + ldeoralh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxrh w0,[x1] + eor w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor2_acq_rel,globl + +.begfn __aarch64_ldeor2_sync + jnatom 1f + ldeoralh w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxrh w0,[x1] + eor w17,w0,w16 + stlxrh w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldeor2_sync,globl + + +.begfn __aarch64_swp4_relax + jnatom 1f + swp w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + stxr w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp4_relax,globl + +.begfn __aarch64_swp4_acq + jnatom 1f + swpa w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + stxr w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp4_acq,globl + +.begfn __aarch64_swp4_rel + jnatom 1f + swpl w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + stlxr w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp4_rel,globl + +.begfn __aarch64_swp4_acq_rel + jnatom 1f + swpal w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + stlxr w17,w16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp4_acq_rel,globl + +.begfn __aarch64_swp4_sync + jnatom 1f + swpa w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + stxr w17,w16,[x1] + cbnz w17,0b + dmb ish + ret +.endfn __aarch64_swp4_sync,globl + + +.begfn __aarch64_cas4_relax + jnatom 1f + cas w0,w1,[x2] + ret +1: mov w16,w0 +0: ldxr w0,[x2] + cmp w0,w16 + bne 1f + stxr w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas4_relax,globl + +.begfn __aarch64_cas4_acq + jnatom 1f + casa w0,w1,[x2] + ret +1: mov w16,w0 +0: ldaxr w0,[x2] + cmp w0,w16 + bne 1f + stxr w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas4_acq,globl + +.begfn __aarch64_cas4_rel + jnatom 1f + casl w0,w1,[x2] + ret +1: mov w16,w0 +0: ldxr w0,[x2] + cmp w0,w16 + bne 1f + stlxr w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas4_rel,globl + +.begfn __aarch64_cas4_acq_rel + jnatom 1f + casal w0,w1,[x2] + ret +1: mov w16,w0 +0: ldaxr w0,[x2] + cmp w0,w16 + bne 1f + stlxr w17,w1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas4_acq_rel,globl + +.begfn __aarch64_cas4_sync + jnatom 1f + casal w0,w1,[x2] + ret +1: mov w16,w0 +0: ldxr w0,[x2] + cmp w0,w16 + bne 1f + stlxr w17,w1,[x2] + cbnz w17,0b +1: dmb ish + ret +.endfn __aarch64_cas4_sync,globl + + +.begfn __aarch64_ldadd4_relax + jnatom 1f + ldadd w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + add w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd4_relax,globl + +.begfn __aarch64_ldadd4_acq + jnatom 1f + ldadda w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + add w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd4_acq,globl + +.begfn __aarch64_ldadd4_rel + jnatom 1f + ldaddl w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + add w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd4_rel,globl + +.begfn __aarch64_ldadd4_acq_rel + jnatom 1f + ldaddal w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + add w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd4_acq_rel,globl + +.begfn __aarch64_ldadd4_sync + jnatom 1f + ldaddal w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + add w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldadd4_sync,globl + + +.begfn __aarch64_ldset4_relax + jnatom 1f + ldset w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + orr w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset4_relax,globl + +.begfn __aarch64_ldset4_acq + jnatom 1f + ldseta w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + orr w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset4_acq,globl + +.begfn __aarch64_ldset4_rel + jnatom 1f + ldsetl w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + orr w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset4_rel,globl + +.begfn __aarch64_ldset4_acq_rel + jnatom 1f + ldsetal w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + orr w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset4_acq_rel,globl + +.begfn __aarch64_ldset4_sync + jnatom 1f + ldsetal w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + orr w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldset4_sync,globl + + +.begfn __aarch64_ldclr4_relax + jnatom 1f + ldclr w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + bic w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr4_relax,globl + +.begfn __aarch64_ldclr4_acq + jnatom 1f + ldclra w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + bic w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr4_acq,globl + +.begfn __aarch64_ldclr4_rel + jnatom 1f + ldclrl w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + bic w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr4_rel,globl + +.begfn __aarch64_ldclr4_acq_rel + jnatom 1f + ldclral w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + bic w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr4_acq_rel,globl + +.begfn __aarch64_ldclr4_sync + jnatom 1f + ldclral w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + bic w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldclr4_sync,globl + + +.begfn __aarch64_ldeor4_relax + jnatom 1f + ldeor w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + eor w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor4_relax,globl + +.begfn __aarch64_ldeor4_acq + jnatom 1f + ldeora w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + eor w17,w0,w16 + stxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor4_acq,globl + +.begfn __aarch64_ldeor4_rel + jnatom 1f + ldeorl w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + eor w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor4_rel,globl + +.begfn __aarch64_ldeor4_acq_rel + jnatom 1f + ldeoral w0,w0,[x1] + ret +1: mov w16,w0 +0: ldaxr w0,[x1] + eor w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor4_acq_rel,globl + +.begfn __aarch64_ldeor4_sync + jnatom 1f + ldeoral w0,w0,[x1] + ret +1: mov w16,w0 +0: ldxr w0,[x1] + eor w17,w0,w16 + stlxr w15,w17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldeor4_sync,globl + + +.begfn __aarch64_swp8_relax + jnatom 1f + swp x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + stxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp8_relax,globl + +.begfn __aarch64_swp8_acq + jnatom 1f + swpa x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + stxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp8_acq,globl + +.begfn __aarch64_swp8_rel + jnatom 1f + swpl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + stlxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp8_rel,globl + +.begfn __aarch64_swp8_acq_rel + jnatom 1f + swpal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + stlxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp8_acq_rel,globl + +.begfn __aarch64_swp8_sync + jnatom 1f + swpa x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + stxr w17,x16,[x1] + cbnz w17,0b + dmb ish + ret +.endfn __aarch64_swp8_sync,globl + + +.prvfn __aarch64_cas8_relax + jnatom 1f + cas x0,x1,[x2] + ret +1: mov x16,x0 +0: ldxr x0,[x2] + cmp x0,x16 + bne 1f + stxr w17,x1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas8_relax,globl + +.prvfn __aarch64_cas8_acq + jnatom 1f + casa x0,x1,[x2] + ret +1: mov x16,x0 +0: ldaxr x0,[x2] + cmp x0,x16 + bne 1f + stxr w17,x1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas8_acq,globl + +.prvfn __aarch64_cas8_rel + jnatom 1f + casl x0,x1,[x2] + ret +1: mov x16,x0 +0: ldxr x0,[x2] + cmp x0,x16 + bne 1f + stlxr w17,x1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas8_rel,globl + +.begfn __aarch64_cas8_acq_rel + jnatom 1f + casal x0,x1,[x2] + ret +1: mov x16,x0 +0: ldaxr x0,[x2] + cmp x0,x16 + bne 1f + stlxr w17,x1,[x2] + cbnz w17,0b +1: ret +.endfn __aarch64_cas8_acq_rel,globl + +.begfn __aarch64_cas8_sync + jnatom 1f + casal x0,x1,[x2] + ret +1: mov x16,x0 +0: ldxr x0,[x2] + cmp x0,x16 + bne 1f + stlxr w17,x1,[x2] + cbnz w17,0b +1: dmb ish + ret +.endfn __aarch64_cas8_sync,globl + + +.begfn __aarch64_ldadd8_relax + jnatom 1f + ldadd x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + add x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd8_relax,globl + +.begfn __aarch64_ldadd8_acq + jnatom 1f + ldadda x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + add x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd8_acq,globl + +.begfn __aarch64_ldadd8_rel + jnatom 1f + ldaddl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + add x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd8_rel,globl + +.begfn __aarch64_ldadd8_acq_rel + jnatom 1f + ldaddal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + add x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd8_acq_rel,globl + +.begfn __aarch64_ldadd8_sync + jnatom 1f + ldaddal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + add x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldadd8_sync,globl + + +.begfn __aarch64_ldset8_relax + jnatom 1f + ldset x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + orr x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset8_relax,globl + +.begfn __aarch64_ldset8_acq + jnatom 1f + ldseta x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + orr x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset8_acq,globl + +.begfn __aarch64_ldset8_rel + jnatom 1f + ldsetl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + orr x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset8_rel,globl + +.begfn __aarch64_ldset8_acq_rel + jnatom 1f + ldsetal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + orr x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset8_acq_rel,globl + +.begfn __aarch64_ldset8_sync + jnatom 1f + ldsetal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + orr x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldset8_sync,globl + + +.begfn __aarch64_ldclr8_relax + jnatom 1f + ldclr x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + bic x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr8_relax,globl + +.begfn __aarch64_ldclr8_acq + jnatom 1f + ldclra x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + bic x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr8_acq,globl + +.begfn __aarch64_ldclr8_rel + jnatom 1f + ldclrl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + bic x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr8_rel,globl + +.begfn __aarch64_ldclr8_acq_rel + jnatom 1f + ldclral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + bic x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr8_acq_rel,globl + +.begfn __aarch64_ldclr8_sync + jnatom 1f + ldclral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + bic x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldclr8_sync,globl + + +.begfn __aarch64_ldeor8_relax + jnatom 1f + ldeor x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + eor x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor8_relax,globl + +.begfn __aarch64_ldeor8_acq + jnatom 1f + ldeora x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + eor x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor8_acq,globl + +.begfn __aarch64_ldeor8_rel + jnatom 1f + ldeorl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + eor x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor8_rel,globl + +.begfn __aarch64_ldeor8_acq_rel + jnatom 1f + ldeoral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + eor x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor8_acq_rel,globl + +.begfn __aarch64_ldeor8_sync + jnatom 1f + ldeoral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + eor x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldeor8_sync,globl + + +.begfn __aarch64_swp16_relax + jnatom 1f + swp x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + stxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp16_relax,globl + +.begfn __aarch64_swp16_acq + jnatom 1f + swpa x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + stxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp16_acq,globl + +.begfn __aarch64_swp16_rel + jnatom 1f + swpl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + stlxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp16_rel,globl + +.begfn __aarch64_swp16_acq_rel + jnatom 1f + swpal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + stlxr w17,x16,[x1] + cbnz w17,0b + ret +.endfn __aarch64_swp16_acq_rel,globl + +.begfn __aarch64_swp16_sync + jnatom 1f + swpa x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + stxr w17,x16,[x1] + cbnz w17,0b + dmb ish + ret +.endfn __aarch64_swp16_sync,globl + + +.begfn __aarch64_cas16_relax + jnatom 1f + casp x0,x1,x2,x3,[x4] + ret +1: mov x16,x0 + mov x17,x1 +0: ldxp x0,x1,[x4] + cmp x0,x16 + ccmp x1,x17,#0,eq + csel x15,x2,x0,eq + csel x14,x3,x1,eq + stxp w13,x15,x14,[x4] + cbnz w13,0b + ret +.endfn __aarch64_cas16_relax,globl + +.begfn __aarch64_cas16_acq + jnatom 1f + caspa x0,x1,x2,x3,[x4] + ret +1: mov x16,x0 + mov x17,x1 +0: ldaxp x0,x1,[x4] + cmp x0,x16 + ccmp x1,x17,#0,eq + csel x15,x2,x0,eq + csel x14,x3,x1,eq + stxp w13,x15,x14,[x4] + cbnz w13,0b + ret +.endfn __aarch64_cas16_acq,globl + +.begfn __aarch64_cas16_rel + jnatom 1f + caspl x0,x1,x2,x3,[x4] + ret +1: mov x16,x0 + mov x17,x1 +0: ldxp x0,x1,[x4] + cmp x0,x16 + ccmp x1,x17,#0,eq + csel x15,x2,x0,eq + csel x14,x3,x1,eq + stlxp w13,x15,x14,[x4] + cbnz w13,0b + ret +.endfn __aarch64_cas16_rel,globl + +.begfn __aarch64_cas16_acq_rel + jnatom 1f + caspal x0,x1,x2,x3,[x4] + ret +1: mov x16,x0 + mov x17,x1 +0: ldaxp x0,x1,[x4] + cmp x0,x16 + ccmp x1,x17,#0,eq + csel x15,x2,x0,eq + csel x14,x3,x1,eq + stlxp w13,x15,x14,[x4] + cbnz w13,0b + ret +.endfn __aarch64_cas16_acq_rel,globl + +.begfn __aarch64_cas16_sync + jnatom 1f + caspal x0,x1,x2,x3,[x4] + ret +1: mov x16,x0 + mov x17,x1 +0: ldxp x0,x1,[x4] + cmp x0,x16 + ccmp x1,x17,#0,eq + csel x15,x2,x0,eq + csel x14,x3,x1,eq + stlxp w13,x15,x14,[x4] + cbnz w13,0b + dmb ish + ret +.endfn __aarch64_cas16_sync,globl + + +.begfn __aarch64_ldadd16_relax + jnatom 1f + ldadd x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + add x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd16_relax,globl + +.begfn __aarch64_ldadd16_acq + jnatom 1f + ldadda x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + add x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd16_acq,globl + +.begfn __aarch64_ldadd16_rel + jnatom 1f + ldaddl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + add x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd16_rel,globl + +.begfn __aarch64_ldadd16_acq_rel + jnatom 1f + ldaddal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + add x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldadd16_acq_rel,globl + +.begfn __aarch64_ldadd16_sync + jnatom 1f + ldaddal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + add x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldadd16_sync,globl + + +.begfn __aarch64_ldset16_relax + jnatom 1f + ldset x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + orr x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset16_relax,globl + +.begfn __aarch64_ldset16_acq + jnatom 1f + ldseta x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + orr x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset16_acq,globl + +.begfn __aarch64_ldset16_rel + jnatom 1f + ldsetl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + orr x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset16_rel,globl + +.begfn __aarch64_ldset16_acq_rel + jnatom 1f + ldsetal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + orr x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldset16_acq_rel,globl + +.begfn __aarch64_ldset16_sync + jnatom 1f + ldsetal x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + orr x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldset16_sync,globl + + +.begfn __aarch64_ldclr16_relax + jnatom 1f + ldclr x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + bic x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr16_relax,globl + +.begfn __aarch64_ldclr16_acq + jnatom 1f + ldclra x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + bic x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr16_acq,globl + +.begfn __aarch64_ldclr16_rel + jnatom 1f + ldclrl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + bic x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr16_rel,globl + +.begfn __aarch64_ldclr16_acq_rel + jnatom 1f + ldclral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + bic x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldclr16_acq_rel,globl + +.begfn __aarch64_ldclr16_sync + jnatom 1f + ldclral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + bic x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldclr16_sync,globl + + +.begfn __aarch64_ldeor16_relax + jnatom 1f + ldeor x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + eor x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor16_relax,globl + +.begfn __aarch64_ldeor16_acq + jnatom 1f + ldeora x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + eor x17,x0,x16 + stxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor16_acq,globl + +.begfn __aarch64_ldeor16_rel + jnatom 1f + ldeorl x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + eor x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor16_rel,globl + +.begfn __aarch64_ldeor16_acq_rel + jnatom 1f + ldeoral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldaxr x0,[x1] + eor x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + ret +.endfn __aarch64_ldeor16_acq_rel,globl + +.begfn __aarch64_ldeor16_sync + jnatom 1f + ldeoral x0,x0,[x1] + ret +1: mov x16,x0 +0: ldxr x0,[x1] + eor x17,x0,x16 + stlxr w15,x17,[x1] + cbnz w15,0b + dmb ish + ret +.endfn __aarch64_ldeor16_sync,globl diff --git a/libc/intrin/armlse.c b/libc/intrin/armlse.c new file mode 100644 index 000000000..b05bf0709 --- /dev/null +++ b/libc/intrin/armlse.c @@ -0,0 +1,32 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/intrin/getauxval.h" +#include "libc/runtime/runtime.h" +#include "libc/sysv/consts/auxv.h" +#include "libc/sysv/consts/hwcap.h" +#ifdef __aarch64__ + +bool __aarch64_have_lse_atomics; + +static __attribute__((__constructor__(1))) void __aarch64_atomics_init(void) { + struct AuxiliaryValue x = __getauxval(AT_HWCAP); + __aarch64_have_lse_atomics = !!(x.value & HWCAP_ATOMICS); +} + +#endif /* __aarch64__ */ diff --git a/libc/intrin/atomic.c b/libc/intrin/atomic.c new file mode 100644 index 000000000..f46f74f49 --- /dev/null +++ b/libc/intrin/atomic.c @@ -0,0 +1,24 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/intrin/atomic.h" + +bool dog(_Atomic(long) *p, long *e, long w) { + return atomic_compare_exchange_weak_explicit(p, e, w, memory_order_acq_rel, + memory_order_relaxed); +} diff --git a/libc/thread/pthread_cancel.c b/libc/thread/pthread_cancel.c index bd6a1c6ea..5ddbea0db 100644 --- a/libc/thread/pthread_cancel.c +++ b/libc/thread/pthread_cancel.c @@ -354,7 +354,6 @@ static errno_t _pthread_cancel_everyone(void) { */ errno_t pthread_cancel(pthread_t thread) { struct PosixThread *arg; - unassert(thread); if ((arg = (struct PosixThread *)thread)) { return _pthread_cancel_single(arg); } else { diff --git a/test/libc/thread/footek_test.c b/test/libc/thread/footek_test.c index 98e07e5e9..acaae0727 100644 --- a/test/libc/thread/footek_test.c +++ b/test/libc/thread/footek_test.c @@ -10,26 +10,26 @@ #include #include "third_party/nsync/futex.internal.h" -// THIS IS AN EXAMPLE OF HOW TO USE COSMOPOLITAN FUTEXES TO IMPLEMENT -// YOUR OWN MUTEXES FROM SCRATCH. LOOK AT HOW MUCH BETTER THIS IT CAN -// MAKE THINGS COMPARED TO SPIN LOCKS. ALGORITHM FROM ULRICH DREPPER. - // arm fleet // with futexes // 30 threads / 100000 iterations // -// 242,604 us real -// 4,222,946 us user -// 1,079,229 us sys -// footek_test on studio.test. 630 µs 17'415 µs 256'782 µs -// 1,362,557 us real -// 3,232,978 us user -// 2,104,824 us sys -// footek_test on pi.test. 611 µs 21'708 µs 1'385'129 µs -// 1,346,482 us real -// 3,370,513 us user -// 1,992,383 us sys -// footek_test on freebsdarm.test. 427 µs 19'967 µs 1'393'476 µs +// 54,183 us real +// 84,723 us user +// 741,667 us sys +// footek_test on studio.test. 609 µs 14'106 µs 65'607 µs +// 406,588 us real +// 884,696 us user +// 720,567 us sys +// footek_test on pi5.test. 334 µs 13'398 µs 408'450 µs +// 1,253,808 us real +// 3,608,426 us user +// 1,378,765 us sys +// footek_test on freebsdarm.test. 367 µs 16'466 µs 1'287'915 µs +// 1,316,058 us real +// 3,286,528 us user +// 1,738,756 us sys +// footek_test on pi.test. 450 µs 16'787 µs 1'338'420 µs // arm fleet // without futexes @@ -106,9 +106,14 @@ // 16,265 us sys // footek_test on xnu.test. 98'468 µs 5'242 µs 5'191'724 µs -#define USE_FUTEX 1 -#define THREADS 30 -#define ITERATIONS 30000 +#define SPIN 1 +#define FUTEX 2 +#define NSYNC 3 + +#define USE NSYNC + +#define THREADS 10 +#define ITERATIONS 50000 #define MUTEX_LOCKED(word) ((word) & 8) #define MUTEX_WAITING(word) ((word) & 16) @@ -130,7 +135,7 @@ void lock(atomic_int *futex) { word = atomic_exchange_explicit(futex, 2, memory_order_acquire); while (word > 0) { pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); -#if USE_FUTEX +#if USE == FUTEX nsync_futex_wait_(futex, 2, 0, 0); #endif pthread_setcancelstate(cs, 0); @@ -142,7 +147,7 @@ void unlock(atomic_int *futex) { int word = atomic_fetch_sub_explicit(futex, 1, memory_order_release); if (word == 2) { atomic_store_explicit(futex, 0, memory_order_release); -#if USE_FUTEX +#if USE == FUTEX nsync_futex_wake_(futex, 1, 0); #endif } @@ -154,9 +159,15 @@ pthread_mutex_t g_locker; void *worker(void *arg) { for (int i = 0; i < ITERATIONS; ++i) { +#if USE == NSYNC + pthread_mutex_lock(&g_locker); + ++g_chores; + pthread_mutex_unlock(&g_locker); +#else lock(&g_lock); ++g_chores; unlock(&g_lock); +#endif } return 0; } @@ -186,51 +197,52 @@ int main() { CheckForMemoryLeaks(); } -// COMPARE ULRICH DREPPER'S LOCKING ALGORITHM WITH MIKE BURROWS *NSYNC -// WHICH IS WHAT COSMOPOLITAN LIBC USES FOR YOUR POSIX THREADS MUTEXES - // x86 fleet // with pthread_mutex_t // 30 threads / 100000 iterations // -// 186,976 us real -// 43,609 us user -// 205,585 us sys -// footek_test on freebsd.test. 410 µs 2'054 µs 195'339 µs -// 238,902 us real -// 235,743 us user -// 97,881 us sys -// footek_test on rhel7.test. 343 µs 2'339 µs 246'926 µs -// 201,285 us real -// 249,612 us user -// 141,230 us sys -// footek_test on xnu.test. 1'960 µs 5'350 µs 265'758 µs -// 303,363 us real -// 60,000 us user -// 410,000 us sys -// footek_test on openbsd.test. 545 µs 3'023 µs 326'200 µs -// 386,085 us real -// 586,455 us user -// 466,991 us sys -// footek_test on netbsd.test. 344 µs 2'421 µs 413'440 µs -// 245,010 us real +// 177,702 us real +// 183,488 us user +// 54,921 us sys +// footek_test on rhel7.test. 304 µs 2'225 µs 185'809 µs +// 191,346 us real +// 43,746 us user +// 257,012 us sys +// footek_test on freebsd.test. 405 µs 2'186 µs 200'568 µs +// 194,344 us real +// 228,235 us user +// 143,203 us sys +// footek_test on xnu.test. 33'207 µs 5'164 µs 220'693 µs +// 199,882 us real +// 138,178 us user +// 329,501 us sys +// footek_test on netbsd.test. 350 µs 3'570 µs 262'186 µs +// 291,255 us real +// 70,000 us user +// 440,000 us sys +// footek_test on openbsd.test. 628 µs 3'232 µs 342'136 µs +// 250,072 us real // 437,500 us user -// 140,625 us sys -// footek_test on win10.test. 300 µs 18'574 µs 441'225 µs +// 93,750 us sys +// footek_test on win10.test. 996 µs 10'949 µs 398'435 µs // arm fleet // with pthread_mutex_t // 30 threads / 100000 iterations // -// 87,132 us real -// 183,517 us user -// 20,020 us sys -// footek_test on studio.test. 560 µs 12'418 µs 92'825 µs -// 679,374 us real -// 957,678 us user -// 605,078 us sys -// footek_test on pi.test. 462 µs 16'574 µs 702'833 µs -// 902,343 us real -// 1,459,706 us user -// 781,140 us sys -// footek_test on freebsdarm.test. 400 µs 16'261 µs 970'022 µs +// 88,681 us real +// 163,500 us user +// 22,183 us sys +// footek_test on studio.test. 651 µs 15'086 µs 98'632 µs +// 157,701 us real +// 215,597 us user +// 46,436 us sys +// footek_test on pi5.test. 296 µs 13'222 µs 159'805 µs +// 699,863 us real +// 1,027,981 us user +// 648,353 us sys +// footek_test on pi.test. 419 µs 16'716 µs 721'851 µs +// 843,858 us real +// 1,432,362 us user +// 696,613 us sys +// footek_test on freebsdarm.test. 349 µs 16'613 µs 876'863 µs diff --git a/tool/build/fixupobj.c b/tool/build/fixupobj.c index 09d1625b6..f2adb73ca 100644 --- a/tool/build/fixupobj.c +++ b/tool/build/fixupobj.c @@ -245,7 +245,7 @@ static void CheckPrivilegedCrossReferences(void) { if (~shdr->sh_flags & SHF_EXECINSTR) continue; // data reference if ((secname = GetElfString(elf, esize, secstrs, shdr->sh_name)) && - strcmp(".privileged", secname)) { + !startswith(secname, ".privileged")) { tinyprint(2, epath, ": code in .privileged section " "references symbol '", diff --git a/tool/cosmocc/bin/cosmocc b/tool/cosmocc/bin/cosmocc index 59364e18c..8ee4cf364 100755 --- a/tool/cosmocc/bin/cosmocc +++ b/tool/cosmocc/bin/cosmocc @@ -343,7 +343,7 @@ LDLIBS_X86_64="-lcosmo" CRT_AARCH64="$LIB_AARCH64/crt.o" CPPFLAGS_AARCH64="$CPPFLAGS -fsigned-char" -CFLAGS_AARCH64="$CFLAGS -ffixed-x18 -ffixed-x28 -mno-outline-atomics" +CFLAGS_AARCH64="$CFLAGS -ffixed-x18 -ffixed-x28" LDFLAGS_AARCH64="$LDFLAGS -L$LIB_AARCH64 -L$BIN/../aarch64-linux-cosmo/lib -Wl,-T,$LIB_AARCH64/aarch64.lds -Wl,-z,common-page-size=16384 -Wl,-z,max-page-size=16384" LDLIBS_AARCH64="-lcosmo" diff --git a/tool/cosmocc/bin/cosmocross b/tool/cosmocc/bin/cosmocross index ced49c754..65aa487ea 100755 --- a/tool/cosmocc/bin/cosmocross +++ b/tool/cosmocc/bin/cosmocross @@ -131,7 +131,7 @@ elif [ x"$ARCH" = x"aarch64" ]; then OBJCOPYFLAGS="-S" PAGESZ=16384 CPPFLAGS="$CPPFLAGS -fsigned-char" - CFLAGS="$CFLAGS -ffixed-x18 -ffixed-x28 -mno-outline-atomics" + CFLAGS="$CFLAGS -ffixed-x18 -ffixed-x28" LDFLAGS="$LDFLAGS -Wl,-T,$LIB/aarch64.lds" else fatal_error "$ARCH: unsupported architecture" diff --git a/tool/hello/BUILD.mk b/tool/hello/BUILD.mk index bb2cbb1cd..2a899b671 100644 --- a/tool/hello/BUILD.mk +++ b/tool/hello/BUILD.mk @@ -79,7 +79,7 @@ o/$(MODE)/tool/hello/hello-pe.ape: \ # elf2pe can generate binaries that don't have dll imports o/$(MODE)/tool/hello/life-pe.dbg: \ o/$(MODE)/tool/hello/life-pe.o - @$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain #-Ttext-segment=0x140000000 + @$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain -Ttext-segment=0x140000000 o/$(MODE)/tool/hello/life-pe.ape: \ o/$(MODE)/tool/hello/life-pe.dbg \ o/$(MODE)/tool/build/elf2pe From 914d52109099284951bc9391c162a10e4ed47284 Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Fri, 16 Aug 2024 14:55:49 -0400 Subject: [PATCH 18/39] Fix relative Windows path normalization (#1261) Fixes #1223 --- libc/calls/mkntpath.c | 13 +++++++++++++ test/libc/calls/mkntpath_test.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/libc/calls/mkntpath.c b/libc/calls/mkntpath.c index c3116d794..7c535de1a 100644 --- a/libc/calls/mkntpath.c +++ b/libc/calls/mkntpath.c @@ -55,6 +55,19 @@ textwindows size_t __normntpath(char16_t *p, size_t n) { // matched "/../" or "/..$" while (j && p[j - 1] == '\\') --j; + if (j && p[j - 1] == '.') { + // matched "." before + if (j >= 2 && p[j - 2] == '.' && // + (j == 2 || p[j - 3] == '\\')) { + // matched "^.." or "/.." before + p[++j] = '.'; + ++j; + continue; + } else if (j == 1 || p[j - 2] == '\\') { + // matched "^." or "/." before + continue; + } + } while (j && p[j - 1] != '\\') --j; } else { diff --git a/test/libc/calls/mkntpath_test.c b/test/libc/calls/mkntpath_test.c index 88f538e7c..f9e249fdd 100644 --- a/test/libc/calls/mkntpath_test.c +++ b/test/libc/calls/mkntpath_test.c @@ -51,4 +51,34 @@ TEST(mkntpath, testRemoveDoubleSlash) { EXPECT_STREQ(u"C:\\Users\\jart\\.config", p); } +TEST(mkntpath, testRelativeCurrentParent) { + EXPECT_EQ(3, __mkntpath("./../", p)); + EXPECT_STREQ(u"..\\", p); +} + +TEST(mkntpath, testRelativeParentParent) { + EXPECT_EQ(6, __mkntpath("../../", p)); + EXPECT_STREQ(u"..\\..\\", p); +} + +TEST(mkntpath, testRelativeParentParentParent) { + EXPECT_EQ(9, __mkntpath("../../../", p)); + EXPECT_STREQ(u"..\\..\\..\\", p); +} + +TEST(mkntpath, testRelativeDirParent) { + EXPECT_EQ(2, __mkntpath("abc/../", p)); + EXPECT_STREQ(u".\\", p); +} + +TEST(mkntpath, testRelativeDirCurrent) { + EXPECT_EQ(4, __mkntpath("abc/./", p)); + EXPECT_STREQ(u"abc\\", p); +} + +TEST(mkntpath, testRelativeDirDirParent) { + EXPECT_EQ(4, __mkntpath("abc/def/../", p)); + EXPECT_STREQ(u"abc\\", p); +} + #endif /* SupportsWindows() */ From 732554ce3a5cab270b07915e9d78b415ecb62492 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 11:56:47 -0700 Subject: [PATCH 19/39] Release Cosmopolitan v3.7.1 --- libc/integral/normalize.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/integral/normalize.inc b/libc/integral/normalize.inc index d92853152..3edf8c66e 100644 --- a/libc/integral/normalize.inc +++ b/libc/integral/normalize.inc @@ -4,7 +4,7 @@ #define __COSMOPOLITAN_MAJOR__ 3 #define __COSMOPOLITAN_MINOR__ 7 -#define __COSMOPOLITAN_PATCH__ 0 +#define __COSMOPOLITAN_PATCH__ 1 #define __COSMOPOLITAN__ \ (100000000 * __COSMOPOLITAN_MAJOR__ + 1000000 * __COSMOPOLITAN_MINOR__ + \ __COSMOPOLITAN_PATCH__) From 098638cc6ca85c54465f34dd0c8e1cd8ff9ba4c7 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 21:18:26 -0700 Subject: [PATCH 20/39] Fix pthread_kill_test flake on qemu --- libc/stdio/fleaks.c | 3 +++ test/libc/thread/footek_test.c | 32 +++++++++++++++---------------- tool/emacs/cosmo-cpp-constants.el | 1 + 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/libc/stdio/fleaks.c b/libc/stdio/fleaks.c index 20a1d4a7b..462c6ddb7 100644 --- a/libc/stdio/fleaks.c +++ b/libc/stdio/fleaks.c @@ -17,6 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" +#include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/itoa.h" #include "libc/runtime/runtime.h" @@ -31,6 +32,8 @@ void CheckForFileLeaks(void) { char *p = msg; char *pe = msg + 256; bool gotsome = false; + if (IsQemuUser()) + usleep(1); // weird qemu mt flake for (int fd = 3; fd < MIN_CLANDESTINE_FD; ++fd) { if (fcntl(fd, F_GETFL) != -1) { if (!gotsome) { diff --git a/test/libc/thread/footek_test.c b/test/libc/thread/footek_test.c index acaae0727..029e46522 100644 --- a/test/libc/thread/footek_test.c +++ b/test/libc/thread/footek_test.c @@ -14,22 +14,22 @@ // with futexes // 30 threads / 100000 iterations // -// 54,183 us real -// 84,723 us user -// 741,667 us sys -// footek_test on studio.test. 609 µs 14'106 µs 65'607 µs -// 406,588 us real -// 884,696 us user -// 720,567 us sys -// footek_test on pi5.test. 334 µs 13'398 µs 408'450 µs -// 1,253,808 us real -// 3,608,426 us user -// 1,378,765 us sys -// footek_test on freebsdarm.test. 367 µs 16'466 µs 1'287'915 µs -// 1,316,058 us real -// 3,286,528 us user -// 1,738,756 us sys -// footek_test on pi.test. 450 µs 16'787 µs 1'338'420 µs +// 46,481 us real +// 68,745 us user +// 586,871 us sys +// footek_test on studio.test. 585 µs 13'597 µs 57'473 µs +// 389,619 us real +// 839,848 us user +// 679,112 us sys +// footek_test on pi5.test. 335 µs 13'034 µs 432'358 µs +// 463,799 us real +// 1,259,267 us user +// 547,681 us sys +// footek_test on pi.test. 479 µs 16'539 µs 476'395 µs +// 1,256,134 us real +// 3,770,473 us user +// 1,214,755 us sys +// footek_test on freebsdarm.test. 364 µs 16'898 µs 1'288'594 µs // arm fleet // without futexes diff --git a/tool/emacs/cosmo-cpp-constants.el b/tool/emacs/cosmo-cpp-constants.el index 106c8bc17..80636c337 100644 --- a/tool/emacs/cosmo-cpp-constants.el +++ b/tool/emacs/cosmo-cpp-constants.el @@ -73,6 +73,7 @@ "__BMI2__" "__FMA__" "__FAST_MATH__" + "__FINITE_MATH_ONLY__" "__ROUNDING_MATH__" "__NO_MATH_ERRNO__" "__FMA4__" From 2eda50929b01aeebbe7ca6e73344e63547cd2580 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 21:38:00 -0700 Subject: [PATCH 21/39] Add stdfloat header Fixes #1260 --- third_party/libcxx/BUILD.mk | 1 + third_party/libcxx/stdfloat | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 third_party/libcxx/stdfloat diff --git a/third_party/libcxx/BUILD.mk b/third_party/libcxx/BUILD.mk index 953c37f8d..e33b96ee2 100644 --- a/third_party/libcxx/BUILD.mk +++ b/third_party/libcxx/BUILD.mk @@ -1040,6 +1040,7 @@ third_party/libcxx/ryu/d2s_intrinsics.h \ third_party/libcxx/ryu/digit_table.h \ third_party/libcxx/ryu/f2s.h \ third_party/libcxx/ryu/ryu.h \ +third_party/libcxx/stdfloat \ THIRD_PARTY_LIBCXX_A_SRCS = \ third_party/libcxx/algorithm.cpp \ diff --git a/third_party/libcxx/stdfloat b/third_party/libcxx/stdfloat new file mode 100644 index 000000000..4126b4a8c --- /dev/null +++ b/third_party/libcxx/stdfloat @@ -0,0 +1,25 @@ +// -*- C++ -*- + +export namespace std { + +#if defined(__STDCPP_FLOAT16_T__) + using float16_t = _Float16; +#endif + +#if defined(__STDCPP_FLOAT32_T__) + using float32_t = float; +#endif + +#if defined(__STDCPP_FLOAT64_T__) + using float64_t = double; +#endif + +#if defined(__STDCPP_FLOAT128_T__) + using float128_t = long double; +#endif + +#if defined(__STDCPP_BFLOAT16_T__) + using bfloat16_t = __bf16; +#endif + +} // namespace std From b2a1811c0167e56a7296dfa8273b6896c051b915 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 21:49:28 -0700 Subject: [PATCH 22/39] Add missing pragma --- third_party/libcxx/stdfloat | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/libcxx/stdfloat b/third_party/libcxx/stdfloat index 4126b4a8c..a3a27dcb5 100644 --- a/third_party/libcxx/stdfloat +++ b/third_party/libcxx/stdfloat @@ -1,4 +1,5 @@ // -*- C++ -*- +#pragma once export namespace std { From 1d532ba3f8fd2ca60eaffff52c130c110c701959 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 02:20:08 -0700 Subject: [PATCH 23/39] Disable some anti-Musl Lua tests --- third_party/lua/test/literals.lua | 39 ++++++++++++++++--------------- third_party/lua/test/strings.lua | 14 +++++++---- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/third_party/lua/test/literals.lua b/third_party/lua/test/literals.lua index 4831534a2..6394c4f88 100644 --- a/third_party/lua/test/literals.lua +++ b/third_party/lua/test/literals.lua @@ -294,30 +294,31 @@ end -- testing decimal point locale -if os.setlocale("pt_BR") or os.setlocale("ptb") then - assert(tonumber("3,4") == 3.4 and tonumber"3.4" == 3.4) - assert(tonumber(" -.4 ") == -0.4) - assert(tonumber(" +0x.41 ") == 0X0.41) - assert(not load("a = (3,4)")) - assert(assert(load("return 3.4"))() == 3.4) - assert(assert(load("return .4,3"))() == .4) - assert(assert(load("return 4."))() == 4.) - assert(assert(load("return 4.+.5"))() == 4.5) +-- +-- if os.setlocale("pt_BR") or os.setlocale("ptb") then +-- assert(tonumber("3,4") == 3.4 and tonumber"3.4" == 3.4) +-- assert(tonumber(" -.4 ") == -0.4) +-- assert(tonumber(" +0x.41 ") == 0X0.41) +-- assert(not load("a = (3,4)")) +-- assert(assert(load("return 3.4"))() == 3.4) +-- assert(assert(load("return .4,3"))() == .4) +-- assert(assert(load("return 4."))() == 4.) +-- assert(assert(load("return 4.+.5"))() == 4.5) - assert(" 0x.1 " + " 0x,1" + "-0X.1\t" == 0x0.1) +-- assert(" 0x.1 " + " 0x,1" + "-0X.1\t" == 0x0.1) - assert(not tonumber"inf" and not tonumber"NAN") +-- assert(not tonumber"inf" and not tonumber"NAN") - assert(assert(load(string.format("return %q", 4.51)))() == 4.51) +-- assert(assert(load(string.format("return %q", 4.51)))() == 4.51) - local a,b = load("return 4.5.") - assert(string.find(b, "'4%.5%.'")) +-- local a,b = load("return 4.5.") +-- assert(string.find(b, "'4%.5%.'")) - assert(os.setlocale("C")) -else - (Message or print)( - '\n >>> pt_BR locale not available: skipping decimal point tests <<<\n') -end +-- assert(os.setlocale("C")) +-- else +-- (Message or print)( +-- '\n >>> pt_BR locale not available: skipping decimal point tests <<<\n') +-- end -- testing %q x line ends diff --git a/third_party/lua/test/strings.lua b/third_party/lua/test/strings.lua index 3af86efd0..bc62cf192 100644 --- a/third_party/lua/test/strings.lua +++ b/third_party/lua/test/strings.lua @@ -430,14 +430,18 @@ if not _port then end if trylocale("collate") then - assert("alo" < "lo" and "lo" < "amo") + -- + -- assert("alo" < "lo" and "lo" < "amo") + -- end if trylocale("ctype") then - assert(string.gsub("", "%a", "x") == "xxxxx") - assert(string.gsub("", "%l", "x") == "xx") - assert(string.gsub("", "%u", "x") == "xx") - assert(string.upper"{xuxu}o" == "{XUXU}O") + -- + -- assert(string.gsub("", "%a", "x") == "xxxxx") + -- assert(string.gsub("", "%l", "x") == "xx") + -- assert(string.gsub("", "%u", "x") == "xx") + -- assert(string.upper"{xuxu}o" == "{XUXU}O") + -- end os.setlocale("C") From 8e14b27749e425f8f4496bdeec767070ec7ed2b0 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 02:57:22 -0700 Subject: [PATCH 24/39] Make fread() more consistent with glibc --- libc/stdio/fread_unlocked.c | 46 ++++++++++++++++++------------------ test/libc/stdio/fputc_test.c | 4 ++++ test/libc/stdio/fread_test.c | 31 +++++++++++++++++++++++- 3 files changed, 57 insertions(+), 24 deletions(-) diff --git a/libc/stdio/fread_unlocked.c b/libc/stdio/fread_unlocked.c index 2ebc08713..ef341d8ec 100644 --- a/libc/stdio/fread_unlocked.c +++ b/libc/stdio/fread_unlocked.c @@ -28,21 +28,27 @@ #include "libc/sysv/consts/o.h" #include "libc/sysv/errfuns.h" -static ssize_t readvall(int fd, struct iovec *iov, int iovlen) { +static ssize_t readvall(FILE *f, struct iovec *iov, int iovlen, size_t need) { ssize_t rc; size_t got, toto; - toto = 0; - do { - if ((rc = readv(fd, iov, iovlen)) == -1) { - if (toto) { - if (errno == EINTR) - continue; + for (toto = 0;;) { + + // perform i/o + if ((rc = readv(f->fd, iov, iovlen)) == -1) { + f->state = errno; + if (toto) return toto; - } return -1; } got = rc; toto += got; + if (!got) { + f->state = EOF; + return toto; + } + + // roll forward iov + // skip over empty elements for (;;) { if (!iov->iov_len) { --iovlen; @@ -56,9 +62,14 @@ static ssize_t readvall(int fd, struct iovec *iov, int iovlen) { iov->iov_len -= got; break; } + if (!iovlen) + return toto; } - } while (got && iovlen); - return toto; + + // don't trigger eof condition if we're rolling greed to fill buffer + if (toto >= need) + return toto; + } } /** @@ -134,27 +145,16 @@ size_t fread_unlocked(void *buf, size_t stride, size_t count, FILE *f) { iov[1].iov_base = NULL; iov[1].iov_len = 0; } - if (f->bufmode == _IONBF) { - rc = readv(f->fd, iov, 2); - } else { - rc = readvall(f->fd, iov, 2); - } - if (rc == -1) { - f->state = errno; + rc = readvall(f, iov, 2, need); + if (rc == -1) return 0; - } got = rc; // handle partial fulfillment if (got < need) { got += m; - if (got % stride) { - f->state = eio(); - return 0; - } f->beg = 0; f->end = 0; - f->state = EOF; return got / stride; } diff --git a/test/libc/stdio/fputc_test.c b/test/libc/stdio/fputc_test.c index 6520e77bb..b63ecc1c3 100644 --- a/test/libc/stdio/fputc_test.c +++ b/test/libc/stdio/fputc_test.c @@ -33,9 +33,13 @@ void SetUpOnce(void) { TEST(fputc, test) { ASSERT_NE(NULL, (f = fopen("hog", "w+"))); EXPECT_EQ('h', fputc('h', f)); + EXPECT_FALSE(feof(f)); EXPECT_EQ(0xFF, fputc(-1, f)); + EXPECT_FALSE(feof(f)); EXPECT_NE(-1, fseek(f, 0, SEEK_SET)); + EXPECT_FALSE(feof(f)); EXPECT_EQ('h', fgetc(f)); + EXPECT_FALSE(feof(f)); EXPECT_EQ(0, fread(NULL, 0, 0, f)); EXPECT_FALSE(feof(f)); EXPECT_EQ(0xFF, fgetc(f)); diff --git a/test/libc/stdio/fread_test.c b/test/libc/stdio/fread_test.c index 8e5e690e5..2fc4f00a5 100644 --- a/test/libc/stdio/fread_test.c +++ b/test/libc/stdio/fread_test.c @@ -17,6 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" +#include "libc/errno.h" #include "libc/stdio/stdio.h" #include "libc/testlib/testlib.h" @@ -45,7 +46,7 @@ TEST(fread, eofIsSticky) { } TEST(fread, seekWithBuffer) { - FILE *f; + FILE* f; char b[8] = "hellosup"; char c[8] = {0}; char d[8] = {0}; @@ -60,3 +61,31 @@ TEST(fread, seekWithBuffer) { ASSERT_STREQ("ellos", d); ASSERT_EQ(0, fclose(f)); } + +TEST(fread, zero) { + FILE* f; + char buf[8] = {0}; + ASSERT_NE(NULL, (f = fopen("foo", "w"))); + ASSERT_EQ(2, fwrite("hi", 1, 2, f)); + ASSERT_EQ(0, fclose(f)); + ASSERT_NE(NULL, (f = fopen("foo", "r"))); + ASSERT_EQ(0, fread(buf, 0, 0, f)); + ASSERT_EQ(0, ferror(stdin)); + ASSERT_EQ(0, feof(stdin)); + ASSERT_STREQ("", buf); + ASSERT_EQ(0, fclose(f)); +} + +TEST(fread, partial) { + FILE* f; + char buf[8] = {0}; + ASSERT_NE(NULL, (f = fopen("foo", "w"))); + ASSERT_EQ(2, fwrite("hi", 1, 2, f)); + ASSERT_EQ(0, fclose(f)); + ASSERT_NE(NULL, (f = fopen("foo", "r"))); + ASSERT_EQ(0, fread(buf, 8, 1, f)); + ASSERT_EQ(0, ferror(stdin)); + ASSERT_EQ(0, feof(stdin)); + ASSERT_EQ(0, fclose(f)); + ASSERT_STREQ("hi", buf); +} From 77be4602908c8a921113005747a3a7e17b3228e4 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 06:32:10 -0700 Subject: [PATCH 25/39] Make Windows REPLs great again --- third_party/linenoise/linenoise.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/third_party/linenoise/linenoise.c b/third_party/linenoise/linenoise.c index 972044bb1..fffa024e4 100644 --- a/third_party/linenoise/linenoise.c +++ b/third_party/linenoise/linenoise.c @@ -408,9 +408,7 @@ static int linenoiseIsUnsupportedTerm(void) { char *term; static char once, res; if (!once) { - if (IsWindows()) { - res = 1; - } else if ((term = getenv("TERM"))) { + if ((term = getenv("TERM"))) { for (i = 0; i < sizeof(kUnsupported) / sizeof(*kUnsupported); i++) { if (!strcasecmp(term, kUnsupported[i])) { res = 1; From eb6e96f036da6dee10f2d018c9d97eb1be32bb4f Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 06:44:51 -0700 Subject: [PATCH 26/39] Change InfoZIP to not auto-append .zip to pathname --- third_party/zip/README.cosmo | 1 + third_party/zip/zipfile.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/third_party/zip/README.cosmo b/third_party/zip/README.cosmo index 69fbf8c30..309554994 100644 --- a/third_party/zip/README.cosmo +++ b/third_party/zip/README.cosmo @@ -11,4 +11,5 @@ ORIGIN LOCAL CHANGES - Use Cosmopolitan's PCLMUL optimized CRC32 + - Don't magically append .zip extension to filename argument - Improve find_next_signature() performance using unlocked stdio diff --git a/third_party/zip/zipfile.c b/third_party/zip/zipfile.c index b03470d79..787e73ea4 100644 --- a/third_party/zip/zipfile.c +++ b/third_party/zip/zipfile.c @@ -413,6 +413,10 @@ char *ziptyp(s) if ((t = malloc(strlen(s) + 5)) == NULL) return NULL; strcpy(t, s); + + // [jart] don't magically append .zip extension to filename argument + if (1) return t; + # ifdef __human68k__ _toslash(t); # endif From ca2c30c977be907fec10509cefca15ead314812a Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 06:45:35 -0700 Subject: [PATCH 27/39] Release redbean v3.0.0 --- net/turfwar/BUILD.mk | 8 +++--- net/turfwar/turfwar.c | 4 +-- test/tool/net/redbean_test.c | 2 +- tool/net/help.txt | 53 ++++++++++++++++-------------------- tool/net/redbean.c | 9 ++++-- 5 files changed, 36 insertions(+), 40 deletions(-) diff --git a/net/turfwar/BUILD.mk b/net/turfwar/BUILD.mk index ffa291ea9..73a1fd2e6 100644 --- a/net/turfwar/BUILD.mk +++ b/net/turfwar/BUILD.mk @@ -9,8 +9,8 @@ NET_TURFWAR_OBJS = \ $(NET_TURFWAR_SRCS:%.c=o/$(MODE)/%.o) NET_TURFWAR_COMS = \ - $(NET_TURFWAR_SRCS:%.c=o/$(MODE)/%.com) \ - o/$(MODE)/net/turfwar/turfbean.com + $(NET_TURFWAR_SRCS:%.c=o/$(MODE)/%) \ + o/$(MODE)/net/turfwar/turfbean NET_TURFWAR_BINS = \ $(NET_TURFWAR_COMS) \ @@ -48,7 +48,7 @@ o/$(MODE)/net/turfwar/turfwar.pkg: \ $(NET_TURFWAR_OBJS) \ $(foreach x,$(NET_TURFWAR_DIRECTDEPS),$($(x)_A).pkg) -o/$(MODE)/net/turfwar/%.com.dbg: \ +o/$(MODE)/net/turfwar/%.dbg: \ $(NET_TURFWAR_DEPS) \ o/$(MODE)/net/turfwar/%.o \ o/$(MODE)/net/turfwar/turfwar.pkg \ @@ -56,7 +56,7 @@ o/$(MODE)/net/turfwar/%.com.dbg: \ $(APE_NO_MODIFY_SELF) @$(APELINK) -o/$(MODE)/net/turfwar/turfbean.com.dbg: \ +o/$(MODE)/net/turfwar/turfbean.dbg: \ $(TOOL_NET_DEPS) \ o/$(MODE)/tool/net/redbean.o \ $(TOOL_NET_REDBEAN_LUA_MODULES) \ diff --git a/net/turfwar/turfwar.c b/net/turfwar/turfwar.c index 3a717fc50..77efea1d3 100644 --- a/net/turfwar/turfwar.c +++ b/net/turfwar/turfwar.c @@ -892,9 +892,7 @@ void *HttpWorker(void *arg) { // get client address from frontend if (HasHeader(kHttpXForwardedFor)) { - if (!IsLoopbackIp(clientip) && // - !IsPrivateIp(clientip) && // - !IsCloudflareIp(clientip)) { + if (!IsLoopbackIp(clientip) && !IsPrivateIp(clientip)) { LOG("Got X-Forwarded-For from untrusted IPv4 client address " "%hhu.%hhu.%hhu.%hhu\n", clientip >> 24, clientip >> 16, clientip >> 8, clientip); diff --git a/test/tool/net/redbean_test.c b/test/tool/net/redbean_test.c index 685db685f..b25010030 100644 --- a/test/tool/net/redbean_test.c +++ b/test/tool/net/redbean_test.c @@ -263,7 +263,7 @@ Last-Modified: .*\r\n\ Accept-Ranges: bytes\r\n\ X-Content-Type-Options: nosniff\r\n\ Date: .*\r\n\ -Server: redbean/2.2.0\r\n\ +Server: redbean/.*\r\n\ Content-Length: 34\r\n\ \r\n\ J\n\ diff --git a/tool/net/help.txt b/tool/net/help.txt index f031a83ae..1be07e8a9 100644 --- a/tool/net/help.txt +++ b/tool/net/help.txt @@ -1,6 +1,6 @@ SYNOPSIS - redbean [-?BVabdfghjkmsuvz] [-p PORT] [-D DIR] [-- SCRIPTARGS...] + redbean.com [-?BVabdfghjkmsuvz] [-p PORT] [-D DIR] [-- SCRIPTARGS...] DESCRIPTION @@ -137,15 +137,15 @@ USAGE This executable is also a ZIP file that contains static assets. You can run redbean interactively in your terminal as follows: - ./redbean -vvvmbag # starts server verbosely + ./redbean.com -vvvmbag # starts server verbosely open http://127.0.0.1:8080/ # shows zip listing page CTRL-C # 1x: graceful shutdown CTRL-C # 2x: forceful shutdown You can override the default listing page by adding: - zip redbean index.lua # lua server pages take priority - zip redbean index.html # default page for directory + zip redbean.com index.lua # lua server pages take priority + zip redbean.com index.html # default page for directory The listing page only applies to the root directory. However the default index page applies to subdirectories too. In order for it @@ -160,7 +160,7 @@ USAGE --no-parent \ --no-if-modified-since \ http://a.example/index.html - zip -r redbean a.example/ # default page for directory + zip -r redbean.com a.example/ # default page for directory redbean normalizes the trailing slash for you automatically: @@ -198,18 +198,18 @@ USAGE by default, embedded as a bas64 data uri. You can override the custom page for various errors by adding files to the zip root. - zip redbean 404.html # custom not found page + zip redbean.com 404.html # custom not found page Audio video content should not be compressed in your ZIP files. Uncompressed assets enable browsers to send Range HTTP request. On the other hand compressed assets are best for gzip encoding. - zip redbean index.html # adds file - zip -0 redbean video.mp4 # adds without compression + zip redbean.com index.html # adds file + zip -0 redbean.com video.mp4 # adds without compression You can have redbean run as a daemon by doing the following: - sudo ./redbean -vvdp80 -p443 -L redbean.log -P redbean.pid + sudo ./redbean.com -vvdp80 -p443 -L redbean.log -P redbean.pid kill -TERM $(cat redbean.pid) # 1x: graceful shutdown kill -TERM $(cat redbean.pid) # 2x: forceful shutdown @@ -230,14 +230,7 @@ USAGE run on six different operating systems. To do that, it needs to extract a 4kb loader program to ${TMPDIR:-${HOME:-.}}/.ape that'll map your redbean into memory. It does however check to see if `ape` - is on the system path beforehand. You can also "assimilate" any - redbean into the platform-local executable format by running: - - $ file redbean - redbean: DOS/MBR boot sector - $ ./redbean --assimilate - $ file redbean - redbean: ELF 64-bit LSB executable + is on the system path beforehand. ──────────────────────────────────────────────────────────────────────────────── SECURITY @@ -406,12 +399,14 @@ REPL encoded in its preferred executable format. You can assimilate your redbean into the local format using the following commands: - $ file redbean - redbean: DOS/MBR boot sector - $ ./redbean --assimilate - $ file redbean - redbean: ELF 64-bit LSB executable - $ sudo cp redbean /usr/bin/redbean + $ file redbean.com + redbean.com: DOS/MBR boot sector + $ curl -o assimilate https://cosmo.zip/pub/cosmos/bin/assimilate + $ chmod +x assimilate + $ ./assimilate ./redbean.com + $ file redbean.com + redbean.com: ELF 64-bit LSB executable + $ sudo cp redbean.com /usr/bin/redbean By following the above steps, redbean can be installed systemwide for multiple user accounts. It's also possible to chmod the binary to have @@ -461,7 +456,7 @@ GLOBALS Then your `/.init.lua` file will have the `arg` array like: - arg[-1] = '/usr/bin/redbean' + arg[-1] = '/usr/bin/redbean arg[ 0] = '/zip/.init.lua' arg[ 1] = 'arg1' arg[ 2] = 'arg2' @@ -469,11 +464,11 @@ GLOBALS If you launch redbean in interpreter mode (rather than web server) mode, then an invocation like this: - ./redbean -i script.lua arg1 arg2 + ./redbean.com -i script.lua arg1 arg2 Would have an `arg` array like this: - arg[-1] = './redbean' + arg[-1] = './redbean.com' arg[ 0] = 'script.lua' arg[ 1] = 'arg1' arg[ 2] = 'arg2' @@ -3689,7 +3684,6 @@ UNIX MODULE - `CLOCK_MONOTONIC_RAW`: is actually monotonic but needs Linux 2.6.28+ - `CLOCK_PROCESS_CPUTIME_ID`: linux and bsd - `CLOCK_THREAD_CPUTIME_ID`: linux and bsd - - `CLOCK_MONOTONIC_COARSE`: linux, freebsd - `CLOCK_PROF`: linux and netbsd - `CLOCK_BOOTTIME`: linux and openbsd - `CLOCK_REALTIME_ALARM`: linux-only @@ -4477,9 +4471,8 @@ UNIX MODULE If the executable in question needs a loader, then you will need "rpath prot_exec" too. With APE, security is strongest when you - assimilate your binaries beforehand, using the --assimilate flag, - or the o//tool/build/assimilate program. On OpenBSD this is - mandatory. + assimilate your binaries beforehand using the assimilate program. + On OpenBSD this is mandatory. prot_exec diff --git a/tool/net/redbean.c b/tool/net/redbean.c index fe2080c32..6e6f196bd 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -71,6 +71,7 @@ #include "libc/stdio/hex.internal.h" #include "libc/stdio/rand.h" #include "libc/stdio/stdio.h" +#include "libc/str/locale.h" #include "libc/str/slice.h" #include "libc/str/str.h" #include "libc/str/strwidth.h" @@ -169,7 +170,8 @@ __static_yoink("blink_xnu_aarch64"); // is apple silicon #define REDBEAN "redbean" #endif -#define VERSION 0x020200 +// XXYYZZ +#define VERSION 0x030000 #define HASH_LOAD_FACTOR /* 1. / */ 4 #define READ(F, P, N) readv(F, &(struct iovec){P, N}, 1) #define WRITE(F, P, N) writev(F, &(struct iovec){P, N}, 1) @@ -2545,7 +2547,7 @@ static char *CommitOutput(char *p) { static char *ServeDefaultErrorPage(char *p, unsigned code, const char *reason, const char *details) { - p = AppendContentType(p, "text/html; charset=ISO-8859-1"); + p = AppendContentType(p, "text/html; charset=UTF-8"); reason = FreeLater(EscapeHtml(reason, -1, 0)); appends(&cpm.outbuf, "\ \r\n\ @@ -7428,6 +7430,9 @@ int main(int argc, char *argv[]) { ShowCrashReports(); #endif + // just in case + setlocale(LC_ALL, "C.UTF-8"); + LoadZipArgs(&argc, &argv); RedBean(argc, argv); From 4389f4709ac3e7f1f3886051f76effb08e7a1c6c Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 08:13:22 -0700 Subject: [PATCH 28/39] Expose wmempcpy() to _GNU_SOURCE --- libc/str/str.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/str/str.h b/libc/str/str.h index b7e65ba14..2075dcf4b 100644 --- a/libc/str/str.h +++ b/libc/str/str.h @@ -141,6 +141,7 @@ char *strcasestr(const char *, const char *) strlenesque; void *memmem(const void *, size_t, const void *, size_t) libcesque; void *memrchr(const void *, int, size_t) strlenesque; void *mempcpy(void *, const void *, size_t) memcpyesque; +wchar_t *wmempcpy(wchar_t *, const wchar_t *, size_t) memcpyesque; #endif #ifdef _COSMO_SOURCE @@ -185,7 +186,6 @@ bool32 wcsstartswith(const wchar_t *, const wchar_t *) strlenesque; bool32 wcsendswith(const wchar_t *, const wchar_t *) strlenesque; char *__join_paths(char *, size_t, const char *, const char *) libcesque __wur; int __mkntpathat(int, const char *, int, char16_t[hasatleast 1024]); -wchar_t *wmempcpy(wchar_t *, const wchar_t *, size_t) memcpyesque; #endif /* _COSMO_SOURCE */ COSMOPOLITAN_C_END_ From 60e697f7b23c79c18583454c27bbaf05925a0dab Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 12:06:27 -0700 Subject: [PATCH 29/39] Move LoadZipArgs() to cosmo.h --- libc/cosmo.h | 1 + libc/isystem/cosmo.h | 1 - test/tool/args/args_test.c | 2 +- third_party/awk/cmd.c | 2 +- third_party/lua/lua.main.c | 1 - third_party/python/python3.c | 2 +- third_party/python/pythontester.c | 2 +- third_party/python/repl.c | 2 +- third_party/sqlite3/shell.c | 2 +- tool/args/args.c | 1 - tool/args/args.h | 8 -------- tool/net/redbean.c | 1 - 12 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 tool/args/args.h diff --git a/libc/cosmo.h b/libc/cosmo.h index af2dc289c..ce7f3a5dc 100644 --- a/libc/cosmo.h +++ b/libc/cosmo.h @@ -14,6 +14,7 @@ char *GetProgramExecutableName(void) libcesque; void unleaf(void) libcesque; int __demangle(char *, const char *, size_t) libcesque; int __is_mangled(const char *) libcesque; +int LoadZipArgs(int *, char ***) libcesque; COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_COSMO_H_ */ diff --git a/libc/isystem/cosmo.h b/libc/isystem/cosmo.h index e8f15be72..5004c0a11 100644 --- a/libc/isystem/cosmo.h +++ b/libc/isystem/cosmo.h @@ -60,7 +60,6 @@ #include "libc/str/utf16.h" #include "libc/sysv/errfuns.h" #include "net/http/http.h" -#include "tool/args/args.h" #ifdef COSMO_ALREADY_DEFINED #undef COSMO_ALREADY_DEFINED diff --git a/test/tool/args/args_test.c b/test/tool/args/args_test.c index ec57b1044..0f7f6c47d 100644 --- a/test/tool/args/args_test.c +++ b/test/tool/args/args_test.c @@ -16,7 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "tool/args/args.h" +#include "libc/cosmo.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/testlib/testlib.h" diff --git a/third_party/awk/cmd.c b/third_party/awk/cmd.c index 54882575f..78ca032e8 100644 --- a/third_party/awk/cmd.c +++ b/third_party/awk/cmd.c @@ -17,7 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/awk/cmd.h" -#include "tool/args/args.h" +#include "libc/cosmo.h" int main(int argc, char *argv[]) { LoadZipArgs(&argc, &argv); diff --git a/third_party/lua/lua.main.c b/third_party/lua/lua.main.c index 469c5638f..0672809be 100644 --- a/third_party/lua/lua.main.c +++ b/third_party/lua/lua.main.c @@ -51,7 +51,6 @@ #include "third_party/lua/lualib.h" #include "third_party/lua/lunix.h" #include "libc/mem/leaks.h" -#include "tool/args/args.h" __static_yoink("lua_notice"); #if !defined(LUA_PROGNAME) diff --git a/third_party/python/python3.c b/third_party/python/python3.c index 907bd32a7..8f6bf3865 100644 --- a/third_party/python/python3.c +++ b/third_party/python/python3.c @@ -6,7 +6,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/python/Include/yoink.h" #include "third_party/python/runpythonmodule.h" -#include "tool/args/args.h" +#include "libc/cosmo.h" PYTHON_YOINK("xed"); PYTHON_YOINK("xterm"); diff --git a/third_party/python/pythontester.c b/third_party/python/pythontester.c index 07549673b..e55e63edd 100644 --- a/third_party/python/pythontester.c +++ b/third_party/python/pythontester.c @@ -8,7 +8,7 @@ #include "libc/runtime/runtime.h" #include "third_party/python/Include/yoink.h" #include "third_party/python/runpythonmodule.h" -#include "tool/args/args.h" +#include "libc/cosmo.h" int main(int argc, char **argv) diff --git a/third_party/python/repl.c b/third_party/python/repl.c index 9528e4e83..4b4aa7c22 100644 --- a/third_party/python/repl.c +++ b/third_party/python/repl.c @@ -6,7 +6,7 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "third_party/python/Include/yoink.h" #include "third_party/python/runpythonmodule.h" -#include "tool/args/args.h" +#include "libc/cosmo.h" int main(int argc, char **argv) diff --git a/third_party/sqlite3/shell.c b/third_party/sqlite3/shell.c index e81818669..5c29318c1 100644 --- a/third_party/sqlite3/shell.c +++ b/third_party/sqlite3/shell.c @@ -132,7 +132,7 @@ typedef unsigned short int u16; #include "libc/sysv/consts/s.h" #include "libc/runtime/runtime.h" #include "libc/runtime/symbols.internal.h" -#include "tool/args/args.h" +#include "libc/cosmo.h" #include "third_party/sqlite3/extensions.h" #include "third_party/sqlite3/sqlite3expert.h" #include "third_party/zlib/zlib.h" diff --git a/tool/args/args.c b/tool/args/args.c index cfb88fd59..2a6c0dc44 100644 --- a/tool/args/args.c +++ b/tool/args/args.c @@ -16,7 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "tool/args/args.h" #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/errno.h" diff --git a/tool/args/args.h b/tool/args/args.h deleted file mode 100644 index dbb517888..000000000 --- a/tool/args/args.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef COSMOPOLITAN_TOOL_ARGS_ARGS_H_ -#define COSMOPOLITAN_TOOL_ARGS_ARGS_H_ -COSMOPOLITAN_C_START_ - -int LoadZipArgs(int *, char ***) libcesque; - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_TOOL_ARGS_ARGS_H_ */ diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 6e6f196bd..1bfbc64d9 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -130,7 +130,6 @@ #include "third_party/mbedtls/x509_crt.h" #include "third_party/musl/netdb.h" #include "third_party/zlib/zlib.h" -#include "tool/args/args.h" #include "tool/build/lib/case.h" #include "tool/net/lfinger.h" #include "tool/net/lfuncs.h" From 863c704684ef4bf998bbebfec41cfe6bfcb5b999 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 17 Aug 2024 16:45:07 -0700 Subject: [PATCH 30/39] Add string similarity function --- libc/mem/alg.h | 5 +++- libc/mem/levenshtein.c | 48 ++++++++++++++++++++++++++++++++++ third_party/dlmalloc/locks.inc | 2 +- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 libc/mem/levenshtein.c diff --git a/libc/mem/alg.h b/libc/mem/alg.h index ae519f76f..f2824c8ba 100644 --- a/libc/mem/alg.h +++ b/libc/mem/alg.h @@ -7,7 +7,6 @@ void *bsearch(const void *, const void *, size_t, size_t, void *bsearch_r(const void *, const void *, size_t, size_t, int (*)(const void *, const void *, void *), void *) paramsnonnull((1, 2, 5)) nosideeffect; -void djbsort(int32_t *, size_t) libcesque; void qsort3(void *, size_t, size_t, int (*)(const void *, const void *)) libcesque paramsnonnull(); void qsort(void *, size_t, size_t, @@ -25,8 +24,12 @@ int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); int mergesort_r(void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); +#ifdef _COSMO_SOURCE +void djbsort(int32_t *, size_t) libcesque; int radix_sort_int32(int32_t *, size_t) libcesque; int radix_sort_int64(int64_t *, size_t) libcesque; +double levenshtein(const char *, const char *) libcesque; +#endif COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_ALG_ALG_H_ */ diff --git a/libc/mem/levenshtein.c b/libc/mem/levenshtein.c new file mode 100644 index 000000000..198ddf200 --- /dev/null +++ b/libc/mem/levenshtein.c @@ -0,0 +1,48 @@ +/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ +│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ +╞══════════════════════════════════════════════════════════════════════════════╡ +│ Copyright 2024 Justine Alexandra Roberts Tunney │ +│ │ +│ Permission to use, copy, modify, and/or distribute this software for │ +│ any purpose with or without fee is hereby granted, provided that the │ +│ above copyright notice and this permission notice appear in all copies. │ +│ │ +│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ +│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ +│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ +│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ +│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ +│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ +│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ +│ PERFORMANCE OF THIS SOFTWARE. │ +╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/mem/alg.h" +#include "libc/mem/mem.h" + +#define MIN3(a, b, c) \ + ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c))) + +/** + * Computes similarity between two strings. + */ +double levenshtein(const char *s0, const char *s1) { + int n0 = strlen(s0) + 1; + int n1 = strlen(s1) + 1; + int *col = (int *)malloc(n1 * sizeof(int)); + int *pol = (int *)malloc(n1 * sizeof(int)); + for (int i = 0; i < n1; i++) + pol[i] = i; + for (int i = 0; i < n0; i++) { + col[0] = i; + for (int j = 1; j < n1; j++) + col[j] = MIN3(1 + col[j - 1], 1 + pol[j], + pol[j - 1] + !(i > 0 && s0[i - 1] == s1[j - 1])); + int *t = col; + col = pol; + pol = t; + } + int dist = pol[n1 - 1]; + free(pol); + free(col); + return 1 - dist / ((n0 > n1 ? n0 : n1) - 1.); +} diff --git a/third_party/dlmalloc/locks.inc b/third_party/dlmalloc/locks.inc index bb2a149f8..4e6c0198a 100644 --- a/third_party/dlmalloc/locks.inc +++ b/third_party/dlmalloc/locks.inc @@ -34,7 +34,7 @@ #define MLOCK_T atomic_uint static int malloc_wipe(MLOCK_T *lk) { - bzero(lk, sizeof(*lk)); + atomic_store_explicit(lk, 0, memory_order_relaxed); return 0; } From 4bbc16e2ccb9270b25d219e756373f7fd23c1329 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Mon, 19 Aug 2024 07:28:49 -0700 Subject: [PATCH 31/39] Add helpful error messages --- ape/ape-m1.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ape/ape-m1.c b/ape/ape-m1.c index 8d188404a..2d677f22b 100644 --- a/ape/ape-m1.c +++ b/ape/ape-m1.c @@ -16,6 +16,12 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#ifndef __APPLE__ +#error "ape/ape-m1.c is for apple silicon. chances you want ape/loader.c" +#endif +#ifndef __aarch64__ +#error "ape/ape-m1.c is for apple silicon; you want: make o//ape/ape.macho" +#endif #include #include #include From 2d441424443327b9d143a1157ece8587509de05f Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Mon, 19 Aug 2024 08:40:18 -0700 Subject: [PATCH 32/39] Get Meson builds working See #917 --- tool/cosmocc/bin/cosmocc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tool/cosmocc/bin/cosmocc b/tool/cosmocc/bin/cosmocc index 8ee4cf364..1cbb13ff1 100755 --- a/tool/cosmocc/bin/cosmocc +++ b/tool/cosmocc/bin/cosmocc @@ -141,6 +141,18 @@ for x; do elif [ x"$x" != x"${x#-MF}" ]; then # startswith(x, "-MF") DEPENDENCY_OUTPUT=${x#-MF} continue + elif [ x"$x" = x"-MQ" ]; then + NEED_DEPENDENCY_OUTPUT=1 + continue + elif [ x"$x" = x"-Wl,--version" ]; then + cat < Date: Tue, 20 Aug 2024 08:46:21 -0700 Subject: [PATCH 33/39] Upgrade superconfigure and monorepo toolchain See #1260 --- Makefile | 4 ++-- tool/cosmocc/README.md | 2 +- tool/cosmocc/package.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c0c55c837..415eb36f8 100644 --- a/Makefile +++ b/Makefile @@ -147,10 +147,10 @@ export MODE export SOURCE_DATE_EPOCH export TMPDIR -COSMOCC = .cosmocc/3.6.2 +COSMOCC = .cosmocc/3.7.1 BOOTSTRAP = $(COSMOCC)/bin TOOLCHAIN = $(COSMOCC)/bin/$(ARCH)-linux-cosmo- -DOWNLOAD := $(shell build/download-cosmocc.sh $(COSMOCC) 3.6.2 268aa82d9bfd774f76951b250f87b8edcefd5c754b8b409e1639641e8bd8d5bc) +DOWNLOAD := $(shell build/download-cosmocc.sh $(COSMOCC) 3.7.1 13b65b0e659b493bd82f3d0a319d0265d66f849839e484aa2a54191024711e85) IGNORE := $(shell $(MKDIR) $(TMPDIR)) diff --git a/tool/cosmocc/README.md b/tool/cosmocc/README.md index da18a2aa6..5edf76573 100644 --- a/tool/cosmocc/README.md +++ b/tool/cosmocc/README.md @@ -417,7 +417,7 @@ statements instead, so that Cosmopolitan Libc's system constants will work as expected. Our modifications to GNU GCC are published under the ISC license at . The binaries you see here were first published at - which + which is regularly updated. ## Legal diff --git a/tool/cosmocc/package.sh b/tool/cosmocc/package.sh index c3271eceb..17635f8de 100755 --- a/tool/cosmocc/package.sh +++ b/tool/cosmocc/package.sh @@ -182,10 +182,10 @@ fetch() { OLD=$PWD cd "$OUTDIR/" if [ ! -x bin/x86_64-linux-cosmo-gcc ]; then - fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.51/aarch64-gcc.zip + fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.52/aarch64-gcc.zip unzip aarch64-gcc.zip rm -f aarch64-gcc.zip - fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.51/x86_64-gcc.zip + fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.52/x86_64-gcc.zip unzip x86_64-gcc.zip rm -f x86_64-gcc.zip fi From 1a9f82bc9f3c1a83f20d17757b958fc955de6585 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 20 Aug 2024 16:27:16 -0700 Subject: [PATCH 34/39] Romanize Hindi, Yiddish, Arabic, Cyrillic, etc. --- examples/romanize.c | 1021 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1021 insertions(+) create mode 100644 examples/romanize.c diff --git a/examples/romanize.c b/examples/romanize.c new file mode 100644 index 000000000..6bf885b1a --- /dev/null +++ b/examples/romanize.c @@ -0,0 +1,1021 @@ +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include +#include + +/** + * @fileoverview Roman Transliteration, e.g. + * + * $ echo 'gaius julius cæsar' | o//examples/romanize + * CAIVS IVLIVS CAESAR + * $ echo 'гаиус юлиус цаесар' | o//examples/romanize + * CAIVS IVLIVS TSAESAR + * $ echo 'عودة أبو تايه' | o//examples/romanize + * EVVDTA AEBVV TAIH + * + */ + +#define PASSPORT 0 + +enum Mode { + kArchaic, + kOld, + kClassical, + kMedieval, + kModern, +} mode = kModern; + +bool IsHindiConsonant(wint_t c) { + switch (c) { + case 0x915: // क + case 0x916: // ख + case 0x917: // ग + case 0x918: // घ + case 0x91a: // च + case 0x91b: // छ + case L'ज': + case L'झ': + case L'ट': + case L'ठ': + case L'ड': + case L'ढ': + case L'ण': + case 0x924: // त + case L'थ': + case L'द': + case L'ध': + case L'न': + case L'प': + case L'फ': + case L'ब': + case 0x92d: // भ + case L'म': + case L'य': + case 0x930: // र + case L'ल': + case L'व': + case L'श': + case L'ष': + case L'स': + case L'ह': + return true; + default: + return false; + } +} + +bool IsHindiMagicConsonant(wint_t c) { + switch (c) { + case 0x902: // ं + return true; + default: + return false; + } +} + +int main(int argc, char* argv[]) { + wint_t c1, c2; + while ((c1 = towupper(fgetwc(stdin))) != -1) { + if (!iswcntrl(c1)) { + c2 = fgetwc(stdin); + if (mode < kMedieval || !isascii(c2)) + c2 = towupper(c2); + } else { + c2 = 0; + } + switch (c1) { + case '.': + if (c2 == ' ') { + fputwc(L'·', stdout); + continue; + } + break; + case '"': + case '\'': + case ',': + case ';': + case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE (UTF-8 BOM) + case 0x200E: // LEFT-TO-RIGHT MARK + case 0x200F: // RIGHT-TO-LEFT MARK + fputwc(c1, stdout); + break; + case L'Ĵ': + case L'Ј': + case 'J': + J: + if (mode >= kModern) { + fputc('J', stdout); + } else { + fputc('I', stdout); + } + break; + case L'Ũ': + case L'Ū': + case L'Ŭ': + case L'Ů': + case L'Ű': + case L'Ų': + case L'Ù': + case L'Ú': + case L'Û': + case L'ў': + case L'У': + case 0x046A: + case 'U': + U: + if (mode >= kMedieval) { + fputc('U', stdout); + } else { + fputc('V', stdout); + } + break; + case L'Ŵ': + case L'Ƿ': + case 'W': + W: + if (mode >= kMedieval) { + fputc('W', stdout); + } else { + fputc('V', stdout); + fputc('V', stdout); + } + break; + case 'Y': + case L'Ý': + case L'Ŷ': + case L'Ÿ': + case L'Ы': + Y: + if (mode == kClassical) { + fputc('Y', stdout); + } else { + fputc('I', stdout); + } + break; + case L'Ẍ': + case L'ẍ': + case L'Ẋ': + case L'ẋ': + case 'X': + fputc('X', stdout); + break; + case L'Ź': + case L'Ż': + case L'Ž': + case L'З': + case 'Z': + Z: + if (mode == kOld) { + fputc('G', stdout); + } else { + fputc('Z', stdout); + } + break; + case L'Ĝ': + case L'Ğ': + case L'Ġ': + case L'Ģ': + case L'Ґ': + case L'Г': + case 0x0492: + case 'G': + if (mode >= kOld) { + fputc('G', stdout); + } else if (c2 == 'U' || c2 == 'O') { + fputc('Q', stdout); + } else { + fputc('C', stdout); + } + break; + case L'Ķ': + case L'К': + case 'K': + if (mode >= kMedieval) { + fputc('K', stdout); + break; + } + if (c2 == 'O') { + fputc('Q', stdout); + break; + } + if (c2 == 'N') { + break; + } + /* fallthrough */ + case 'C': + case 0x04BA: + switch (c2) { + case 'A': + if (mode >= kOld) { + fputc('C', stdout); + } else { + fputc('K', stdout); + } + break; + /* case 'O': */ + case 'U': + case 'V': + fputc('Q', stdout); + break; + default: + fputc('C', stdout); + break; + } + break; + case L'Æ': + case L'Ä': + fputc('A', stdout); + fputc('E', stdout); + break; + case L'IJ': + fputc('I', stdout); + goto J; + case L'Þ': + fputc('T', stdout); + fputc('H', stdout); + break; + case L'Œ': + case L'Ö': + case L'Ø': + fputc('O', stdout); + fputc('E', stdout); + break; + case L'Ü': + if (mode >= kMedieval) { + fputc('U', stdout); + } else { + fputc('V', stdout); + } + fputc('E', stdout); + break; + case L'ẞ': + fputc('S', stdout); + fputc('S', stdout); + break; + case L'À': + case L'Á': + case L'Â': + case L'Ã': + case L'Ā': + case L'Ă': + case L'Ą': + case L'А': + fputc('A', stdout); + break; + case L'Ç': + case L'Ć': + case L'Ĉ': + case L'Ċ': + case L'Č': + fputc('C', stdout); + break; + case L'È': + case L'É': + case L'Ê': + case L'Ë': + case L'Ē': + case L'Ĕ': + case L'Ė': + case L'Ę': + case L'Ě': + fputc('E', stdout); + break; + case L'Ì': + case L'Í': + case L'Î': + case L'Ï': + fputc('I', stdout); + break; + case L'Ð': + case L'Ď': + fputc('D', stdout); + break; + case L'Ñ': + case L'Ń': + case L'Ņ': + case L'Ň': + case L'Ŋ': + fputc('N', stdout); + break; + case L'Ò': + case L'Ó': + case L'Ô': + case L'Õ': + case L'Ō': + case L'Ŏ': + case L'Ő': + fputc('O', stdout); + break; + default: + fputwc(c1, stdout); + break; + case L'Ĥ': + case L'Ħ': + fputc('H', stdout); + break; + case L'Ĩ': + case L'Ī': + case L'Ĭ': + case L'Į': + case L'İ': + case L'I': + case L'И': + case L'Й': + fputc('I', stdout); + break; + case L'Ĺ': + case L'Ļ': + case L'Ľ': + case L'Ŀ': + case L'Ł': + fputc('L', stdout); + break; + case L'Ŕ': + case L'Ŗ': + case L'Ř': + fputc('R', stdout); + break; + case L'Ś': + case L'Ŝ': + case L'Ş': + case L'Š': + fputc('S', stdout); + break; + case L'Ţ': + case L'Ť': + case L'Ŧ': + fputc('T', stdout); + break; + case L'Ё': + fputc('E', stdout); + break; + case L'Ћ': + fputc('D', stdout); + break; + case L'Є': + fputc('I', stdout); + fputc('E', stdout); + break; + case L'Ѕ': + fputc('D', stdout); + fputc('Z', stdout); + break; + case L'І': + fputc('I', stdout); + break; + case L'Ї': + fputc('I', stdout); + break; + case L'Љ': + fputc('L', stdout); + if (mode >= kMedieval) { + fputc('J', stdout); + } else { + fputc('I', stdout); + } + break; + case L'Њ': + fputc('N', stdout); + goto J; + case L'Ќ': + fputc('K', stdout); + break; + case L'Џ': + fputc('D', stdout); + goto Z; + case L'Б': + fputc('B', stdout); + break; + case L'В': + fputc('V', stdout); + break; + case L'Д': + fputc('D', stdout); + break; + case L'Е': + fputc('E', stdout); + break; + case L'Ж': + if (mode == kOld) { + fputc('G', stdout); + } else { + fputc('Z', stdout); + } + fputc('H', stdout); + break; + case L'Л': + fputc('L', stdout); + break; + case L'М': + fputc('M', stdout); + break; + case L'Н': + fputc('N', stdout); + break; + case L'О': + fputc('O', stdout); + break; + case L'П': + fputc('P', stdout); + break; + case L'Р': + fputc('R', stdout); + break; + case L'С': + fputc('S', stdout); + break; + case L'Т': + fputc('T', stdout); + break; + case L'Ф': + fputc('F', stdout); + break; + case L'Х': + /* fputc('K', stdout); */ + fputc('H', stdout); + break; + case L'Ц': + fputc('T', stdout); + fputc('S', stdout); + break; + case L'Ч': + fputc('C', stdout); + fputc('H', stdout); + break; + case L'Ш': + fputc('S', stdout); + fputc('H', stdout); + break; + case L'Щ': + fputc('S', stdout); + fputc('H', stdout); + fputc('C', stdout); + fputc('H', stdout); + break; + case L'Ъ': + fputc('I', stdout); + fputc('E', stdout); + break; + case L'Э': + fputc('E', stdout); + break; + case L'Ю': + fputc('I', stdout); + goto U; + case L'Я': + fputc('I', stdout); + fputc('A', stdout); + break; + case L'Ȝ': + if (mode >= kOld) { + fputc('G', stdout); + } else if (mode == kArchaic) { + fputc('C', stdout); + } + fputc('H', stdout); + break; + case L'ſ': + fputc('S', stdout); + break; + case 0x0621: // hamza + if (PASSPORT) + fputc('X', stdout); + fputc('E', stdout); + break; + case 0x0622: // alef with madda above + if (PASSPORT) + fputc('X', stdout); + fputc('A', stdout); + fputc('A', stdout); + break; + case 0x0623: // alef with hamza above + if (PASSPORT) + fputc('X', stdout); + fputc('A', stdout); + fputc('E', stdout); + break; + case 0x0624: // waw with hamza above + goto U; + case 0x0625: // alef with hamza below + fputc('I', stdout); + break; + case 0x0626: // yeh with hamza above + if (PASSPORT) + fputc('X', stdout); + fputc('I', stdout); + break; + case 0x0627: // alef + fputc('A', stdout); + break; + case 0x0628: // beh + fputc('B', stdout); + break; + case 0x0629: // teh marbuta + if (PASSPORT) + fputc('X', stdout); + fputc('T', stdout); + fputc('A', stdout); + break; + case 0x062A: // teh + fputc('T', stdout); + break; + case 0x062B: // theh + if (PASSPORT) + fputc('X', stdout); + fputc('T', stdout); + fputc('H', stdout); + break; + case 0x062C: // jeem + goto J; + case 0x062D: // hah + if (PASSPORT) + fputc('X', stdout); + fputc('H', stdout); + break; + case 0x062E: // khah + if (PASSPORT) + fputc('X', stdout); + fputc('K', stdout); + fputc('H', stdout); + break; + case 0x062F: // dal + fputc('D', stdout); + break; + case 0x0630: // thal + if (PASSPORT) + fputc('X', stdout); + fputc('D', stdout); + fputc('H', stdout); + break; + case 0x0631: // reh + fputc('R', stdout); + break; + case 0x0632: // zain + fputc('Z', stdout); + break; + case 0x0633: // seen + fputc('S', stdout); + break; + case 0x0634: // sheen + if (PASSPORT) + fputc('X', stdout); + fputc('S', stdout); + fputc('H', stdout); + break; + case 0x0635: // sad + if (PASSPORT) + fputc('X', stdout); + fputc('S', stdout); + fputc('S', stdout); + break; + case 0x0636: // dad + if (PASSPORT) + fputc('X', stdout); + fputc('D', stdout); + fputc('Z', stdout); + break; + case 0x0637: // tah + if (PASSPORT) + fputc('X', stdout); + fputc('T', stdout); + fputc('T', stdout); + break; + case 0x0638: // zah + if (PASSPORT) + fputc('X', stdout); + fputc('Z', stdout); + fputc('Z', stdout); + break; + case 0x0639: // ain + fputc('E', stdout); + break; + case 0x063A: // ghain + fputc('G', stdout); + break; + case 0x0641: // feh + fputc('F', stdout); + break; + case 0x0642: // qaf + fputc('Q', stdout); + break; + case 0x0643: // kaf + fputc('K', stdout); + break; + case 0x0644: // lam + fputc('L', stdout); + break; + case 0x0645: // meem + fputc('M', stdout); + break; + case 0x0646: // noon + fputc('N', stdout); + break; + case 0x0647: // heh + fputc('H', stdout); + break; + case 0x0648: // waw + goto W; + case 0x0649: // alef maksura + if (PASSPORT) + fputc('X', stdout); + fputc('A', stdout); + goto Y; + case 0x064A: // yeh + goto Y; + case 0x0671: // alef wasla + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('A', stdout); + break; + case 0x0679: // tteh + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('T', stdout); + break; + case 0x067C: // teh with ring + if (PASSPORT) + fputc('X', stdout); + fputc('R', stdout); + fputc('T', stdout); + break; + case 0x067E: // peh + fputc('P', stdout); + break; + case 0x0681: // hah with hamza above + if (PASSPORT) + fputc('X', stdout); + fputc('K', stdout); + fputc('E', stdout); + break; + case 0x0685: // hah with 3 dots above + if (PASSPORT) + fputc('X', stdout); + fputc('X', stdout); + fputc('H', stdout); + break; + case 0x0686: // tcheh + if (PASSPORT) + fputc('X', stdout); + fputc('C', stdout); + break; + case 0x0688: // ddal + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('D', stdout); + break; + case 0x0689: // dal with ring + if (PASSPORT) + fputc('X', stdout); + fputc('D', stdout); + fputc('R', stdout); + break; + case 0x0691: // rreh + if (PASSPORT) + fputc('X', stdout); + fputc('X', stdout); + fputc('R', stdout); + break; + case 0x0693: // reh with ring + if (PASSPORT) + fputc('X', stdout); + fputc('R', stdout); + fputc('R', stdout); + break; + case 0x0696: // reh with dot below and dot above + if (PASSPORT) + fputc('X', stdout); + fputc('R', stdout); + fputc('X', stdout); + break; + case 0x0698: // jeh + if (PASSPORT) + fputc('X', stdout); + goto J; + case 0x069A: // seen with dot below and dot above + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('S', stdout); + break; + case 0x06A9: // keheh + if (PASSPORT) + fputc('X', stdout); + fputc('K', stdout); + fputc('K', stdout); + break; + case 0x06AB: // kaf with ring + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('K', stdout); + break; + case 0x06AD: // ng + if (PASSPORT) + fputc('X', stdout); + fputc('N', stdout); + fputc('G', stdout); + break; + case 0x06AF: // gaf + if (PASSPORT) + fputc('X', stdout); + fputc('G', stdout); + fputc('G', stdout); + break; + case 0x06BA: // noon ghunna + if (PASSPORT) + fputc('X', stdout); + fputc('N', stdout); + fputc('N', stdout); + break; + case 0x06BC: // noon with ring + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('N', stdout); + break; + case 0x06BE: // heh doachashmee + if (PASSPORT) + fputc('X', stdout); + fputc('D', stdout); + fputc('O', stdout); + break; + case 0x06C0: // heh with yeh above + if (PASSPORT) + fputc('X', stdout); + fputc('Y', stdout); + fputc('H', stdout); + break; + case 0x06C1: // heh goal + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('G', stdout); + break; + case 0x06C2: // heh goal with hamza above + if (PASSPORT) + fputc('X', stdout); + fputc('G', stdout); + fputc('E', stdout); + break; + case 0x06C3: // teh marbuta goal + if (PASSPORT) + fputc('X', stdout); + fputc('T', stdout); + fputc('G', stdout); + break; + case 0x06CC: // farsi yeh + if (PASSPORT) + fputc('X', stdout); + fputc('Y', stdout); + fputc('A', stdout); + break; + case 0x06CD: // yeh with tail + if (PASSPORT) + fputc('X', stdout); + if (PASSPORT) + fputc('X', stdout); + fputc('Y', stdout); + break; + case 0x06D0: // yeh + goto Y; + case 0x06D2: // yeh barree + if (PASSPORT) + fputc('X', stdout); + fputc('Y', stdout); + fputc('B', stdout); + break; + case 0x06D3: // yeh barree with hamza above + if (PASSPORT) + fputc('X', stdout); + fputc('B', stdout); + fputc('E', stdout); + break; + case 0x069C: // seen with 3 dots below and 3 dots above + case 0x06A2: // feh with dot moved below + case 0x06A7: // qaf with dot above + case 0x06A8: // qaf with 3 dots above + case 0x0651: // shadda + case 0x0652: // sukun + case 0x0670: // superscript alef + case 0x064B: // fathatan + case 0x064C: // dammatan + case 0x064D: // kasratan + case 0x064E: // fatha + case 0x064F: // damma + case 0x0650: // kasra + case 0x0640: // tatwheel + break; + + // + // HINDI + // + // The following C code for the romanization of Hindi was designed + // and written by vasant and jart on 2024-08-20. + // + // भारत देश का नाम है, + // तिरंगा झंडा इसकी शान है। + // अलग-अलग हैं बोली-भाषा, + // कहीं पहाड़, तो कहीं मैदान हैं। + // बहुत बड़ा है देश हमारा, + // परम्पराओं पर हमको अभिमान है। + // अनेकता में एकता, + // यही हमारा संविधान है। + // + // BHARAT DESH KA NAM HAI, + // TIRANGA JHANDA ISAKII SHAN HAI. + // ALAG-ALAG HAIN BOLII-BHASSA, + // KAHIIN PAHAD, TO KAHIIN MAIDAN HAIN. + // BAHUT BADA HAI DESH HAMARA, + // PARAMPARAON PAR HAMAKO ABHIMAN HAI. + // ANEKATA MEN EKATA, + // YAHII HAMARA SANVIDHAN HAI. + // + + // Hindi Consonants + case 0x915: // क + fputs("K", stdout); + break; + case 0x916: // ख + fputs("KH", stdout); + break; + case 0x917: // ग + fputs("G", stdout); + break; + case 0x918: // घ + fputs("GH", stdout); + break; + case 0x91a: // च + fputs("CH", stdout); + break; + case 0x91b: // छ + fputs("CHH", stdout); + break; + case L'ज': + fputs("J", stdout); + break; + case L'झ': + fputs("JH", stdout); + break; + case L'ट': + fputs("T", stdout); + break; + case L'ठ': + fputs("TH", stdout); + break; + case L'ड': + fputs("D", stdout); + break; + case L'ढ': + fputs("DH", stdout); + break; + case L'ण': + fputs("N", stdout); + break; + case 0x924: // त + fputs("T", stdout); + break; + case L'थ': + fputs("TH", stdout); + break; + case L'द': + fputs("D", stdout); + break; + case L'ध': + fputs("DH", stdout); + break; + case L'न': + fputs("N", stdout); + break; + case L'प': + fputs("P", stdout); + break; + case L'फ': + fputs("PH", stdout); + break; + case L'ब': + fputs("B", stdout); + break; + case 0x92d: // भ + fputs("BH", stdout); + break; + case L'म': + fputs("M", stdout); + break; + case L'य': + fputs("Y", stdout); + break; + case 0x930: // र + fputs("R", stdout); + break; + case L'ल': + fputs("L", stdout); + break; + case L'व': + fputs("V", stdout); + break; + case L'श': + fputs("SH", stdout); + break; + case L'ष': + fputs("SS", stdout); + break; + case L'स': + fputs("S", stdout); + break; + case L'ह': + fputs("H", stdout); + break; + + // Hindi Vowels + case 0x905: // अ + case 0x93e: // ा + fputs("A", stdout); + break; + case 0x906: // आ + fputs("AA", stdout); + break; + case 0x907: // इ + case 0x93f: // ि + fputs("I", stdout); + break; + case 0x940: // ी + case 0x908: // ई + fputs("II", stdout); + break; + case 0x942: // ू + case 0x90A: // ऊ + fputs("UU", stdout); + break; + case 0x947: // े + case 0x90F: // ए + fputs("E", stdout); + break; + case 0x948: // ै + case 0x910: // ऐ + fputs("AI", stdout); + break; + case 0x94b: // ो + case 0x913: // ओ + fputs("O", stdout); + break; + case 0x941: // ु + case 0x909: // उ + fputs("U", stdout); + break; + case 0x94c: // ौ + case 0x914: // औ + fputs("AU", stdout); + break; + + // Hindi Magic Consonants + case 0x902: // ं + fputs("N", stdout); + break; + + // Hindi Miscellaneous + case 0x93c: // ़ Devanagari Sign Nukta + break; + case 0x94d: // ् Devanagari Sign Virama + break; + + // Hindi Punctuation + case L'।': + fputc('.', stdout); + break; + } + + if ((IsHindiConsonant(c1) && IsHindiConsonant(c2)) || + (IsHindiConsonant(c1) && IsHindiMagicConsonant(c2))) + fputs("A", stdout); + + if (c2) { + ungetwc(c2, stdin); + } + } + return 0; +} From 37ca1badaf267020da90ece8612853f71919e936 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 23 Aug 2024 20:08:05 -0700 Subject: [PATCH 35/39] Make Emacs load 2x faster --- tool/emacs/cosmo-asm-mode.el | 7 +- tool/emacs/cosmo-format.el | 3 +- tool/emacs/cosmo-stuff.el | 144 ++++++++++++++++++++++++----------- tool/emacs/cosmo.el | 8 +- 4 files changed, 109 insertions(+), 53 deletions(-) diff --git a/tool/emacs/cosmo-asm-mode.el b/tool/emacs/cosmo-asm-mode.el index b948e12af..98699ddf0 100644 --- a/tool/emacs/cosmo-asm-mode.el +++ b/tool/emacs/cosmo-asm-mode.el @@ -336,9 +336,10 @@ (set (make-local-variable 'indent-tabs-mode) t) (set (make-local-variable 'tab-width) 8)) -(progn - (add-hook 'asm-mode-hook 'cosmo-asm-supplemental-hook) - (setq asm-font-lock-keywords cosmo-asm-font-lock-keywords)) +(eval-after-load 'asm-mode + '(progn + (add-hook 'asm-mode-hook 'cosmo-asm-supplemental-hook) + (setq asm-font-lock-keywords cosmo-asm-font-lock-keywords))) ;; Make -*-unix-assembly-*- mode line work correctly like GitHub. (define-derived-mode unix-assembly-mode asm-mode "UNIX Assembly") diff --git a/tool/emacs/cosmo-format.el b/tool/emacs/cosmo-format.el index 107c201e9..140c9e2d2 100644 --- a/tool/emacs/cosmo-format.el +++ b/tool/emacs/cosmo-format.el @@ -104,7 +104,8 @@ cosmo-format-blacklist)) (not (save-excursion (beginning-of-buffer) - (looking-at "/\\* clang-format off \\*/")))) + (or (looking-at "/\\* clang-format off \\*/") + (looking-at "// clang-format off"))))) (let* ((bin (cosmo--find-clang-format-bin)) (this (buffer-file-name)) (root (locate-dominating-file this ".clang-format"))) diff --git a/tool/emacs/cosmo-stuff.el b/tool/emacs/cosmo-stuff.el index f7c712b2d..ab45aeeb1 100644 --- a/tool/emacs/cosmo-stuff.el +++ b/tool/emacs/cosmo-stuff.el @@ -11,19 +11,19 @@ ;;; Code: -(require 'asm-mode) -(require 'cc-mode) -(require 'fortran) -(require 'cosmo-c-types) -(require 'cosmo-c-keywords) -(require 'cosmo-c-builtins) -(require 'cosmo-c-constants) -(require 'cosmo-cpp-constants) -(require 'cosmo-platform-constants) -(require 'dired) -(require 'javadown) -(require 'ld-script) -(require 'make-mode) +;; (require 'asm-mode) +;; (require 'cc-mode) +;; (require 'fortran) +;; (require 'cosmo-c-types) +;; (require 'cosmo-c-keywords) +;; (require 'cosmo-c-builtins) +;; (require 'cosmo-c-constants) +;; (require 'cosmo-cpp-constants) +;; (require 'cosmo-platform-constants) +;; (require 'dired) +;; (require 'javadown) +;; (require 'ld-script) +;; (require 'make-mode) (setq cosmo-arch (let ((arch (string-trim-right @@ -149,8 +149,12 @@ (format "%s/TAGS" (or (locate-dominating-file (buffer-name) "Makefile") (file-name-directory (buffer-name)))))) -(add-hook 'c-mode-common-hook 'stop-asking-questions-etags) -(add-hook 'c++-mode-common-hook 'stop-asking-questions-etags) + +(eval-after-load 'cc-mode + '(progn + (add-hook 'c-mode-common-hook 'stop-asking-questions-etags) + (add-hook 'c++-mode-common-hook 'stop-asking-questions-etags))) + (setq tags-revert-without-query t) (setq kill-buffer-query-functions ;; disable kill buffer w/ process question (delq 'process-kill-buffer-query-function kill-buffer-query-functions)) @@ -299,15 +303,30 @@ (local-set-key (kbd "C-c C-c") 'cosmo-compile)) (progn - (add-hook 'makefile-mode-hook 'cosmo-compile-hook) - (add-hook 'asm-mode-hook 'cosmo-compile-hook) - (add-hook 'ld-script-mode-hook 'cosmo-compile-hook) - (add-hook 'dired-mode-hook 'cosmo-compile-hook) - (add-hook 'c-mode-common-hook 'cosmo-compile-hook) - (add-hook 'c++-mode-common-hook 'cosmo-compile-hook) (add-hook 'fortran-mode-hook 'cosmo-compile-hook) (add-hook 'protobuf-mode-hook 'cosmo-compile-hook)) +(eval-after-load 'make-mode + '(progn + (add-hook 'makefile-mode-hook 'cosmo-compile-hook))) + +(eval-after-load 'asm-mode + '(progn + (add-hook 'asm-mode-hook 'cosmo-compile-hook))) + +(eval-after-load 'dired + '(progn + (add-hook 'dired-mode-hook 'cosmo-compile-hook))) + +(eval-after-load 'ld-script + '(progn + (add-hook 'ld-script-mode-hook 'cosmo-compile-hook))) + +(eval-after-load 'cc-mode + '(progn + (add-hook 'c-mode-common-hook 'cosmo-compile-hook) + (add-hook 'c++-mode-common-hook 'cosmo-compile-hook))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Display assembly for C/C++ buffer @@ -606,10 +625,13 @@ (add-hook 'asm-mode-hook 'cosmo-assemble-hook) (add-hook 'ld-script-mode-hook 'cosmo-assemble-hook) (add-hook 'dired-mode-hook 'cosmo-assemble-hook) - (add-hook 'c-mode-common-hook 'cosmo-assemble-hook) (add-hook 'fortran-mode-hook 'cosmo-assemble-hook) (add-hook 'protobuf-mode-hook 'cosmo-assemble-hook)) +(eval-after-load 'cc-mode + '(progn + (add-hook 'c-mode-common-hook 'cosmo-assemble-hook))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Run buffer. @@ -688,18 +710,34 @@ ('t (error "cosmo-run: unknown major mode"))))))) -(progn - (define-key asm-mode-map (kbd "C-c C-r") 'cosmo-run) - (define-key c-mode-base-map (kbd "C-c C-r") 'cosmo-run) - (define-key fortran-mode-map (kbd "C-c C-r") 'cosmo-run) - (define-key sh-mode-map (kbd "C-c C-r") 'cosmo-run) - (define-key lua-mode-map (kbd "C-c C-r") 'cosmo-run) - (define-key python-mode-map (kbd "C-c C-r") 'cosmo-run) - (define-key c-mode-map (kbd "C-c C-s") 'cosmo-run-test) - (define-key c++-mode-map (kbd "C-c C-s") 'cosmo-run-test) - (define-key c-mode-map (kbd "C-c C-_") 'cosmo-run-win7) - (define-key c-mode-map (kbd "C-c C-_") 'cosmo-run-win10) - (define-key c++-mode-map (kbd "C-c C-_") 'cosmo-run-win10)) +(eval-after-load 'cc-mode + '(progn + (define-key c-mode-base-map (kbd "C-c C-r") 'cosmo-run) + (define-key c-mode-map (kbd "C-c C-s") 'cosmo-run-test) + (define-key c++-mode-map (kbd "C-c C-s") 'cosmo-run-test) + (define-key c-mode-map (kbd "C-c C-_") 'cosmo-run-win7) + (define-key c-mode-map (kbd "C-c C-_") 'cosmo-run-win10) + (define-key c++-mode-map (kbd "C-c C-_") 'cosmo-run-win10))) + +(eval-after-load 'fortran-mode + '(progn + (define-key fortran-mode-map (kbd "C-c C-r") 'cosmo-run))) + +(eval-after-load 'asm-mode + '(progn + (define-key asm-mode-map (kbd "C-c C-r") 'cosmo-run))) + +(eval-after-load 'sh-script + '(progn + (define-key sh-mode-map (kbd "C-c C-r") 'cosmo-run))) + +(eval-after-load 'lua-mode + '(progn + (define-key lua-mode-map (kbd "C-c C-r") 'cosmo-run))) + +(eval-after-load 'python + '(progn + (define-key python-mode-map (kbd "C-c C-r") 'cosmo-run))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -725,9 +763,13 @@ (compile compile-command) (gdb (format "gdb -q -i=mi %s -ex run" exec)))))) -(progn - (define-key asm-mode-map (kbd "C-c C-d") 'cosmo-debug) - (define-key c-mode-base-map (kbd "C-c C-d") 'cosmo-debug)) +(eval-after-load 'cc-mode + '(progn + (define-key c-mode-base-map (kbd "C-c C-d") 'cosmo-debug))) + +(eval-after-load 'asm-mode + '(progn + (define-key asm-mode-map (kbd "C-c C-d") 'cosmo-debug))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -819,10 +861,16 @@ (message header)))) (progn - (define-key prog-mode-map (kbd "C-c C-h") 'cosmo-add-include) - (define-key asm-mode-map (kbd "C-c C-h") 'cosmo-add-include) - (define-key c-mode-base-map (kbd "C-c C-h") 'cosmo-add-include) - (define-key c++-mode-map (kbd "C-c C-h") 'cosmo-add-include)) + (define-key prog-mode-map (kbd "C-c C-h") 'cosmo-add-include)) + +(eval-after-load 'cc-mode + '(progn + (define-key c-mode-base-map (kbd "C-c C-h") 'cosmo-add-include) + (define-key c++-mode-map (kbd "C-c C-h") 'cosmo-add-include))) + +(eval-after-load 'asm-mode + '(progn + (define-key asm-mode-map (kbd "C-c C-h") 'cosmo-add-include))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -843,11 +891,17 @@ (defun cosmo-lisp-is-the-best () (define-key c-mode-base-map (kbd "C-c C-o") 'cosmo-show-optinfo)) -(add-hook 'c-mode-common-hook 'cosmo-lisp-is-the-best) + +(eval-after-load 'cc-mode + '(progn + (add-hook 'c-mode-common-hook 'cosmo-lisp-is-the-best))) (defun cosmo-lisp-is-the-best++ () (define-key c++-mode-base-map (kbd "C-c C-o") 'cosmo-show-optinfo)) -(add-hook 'c++-mode-common-hook 'cosmo-lisp-is-the-best++) + +(eval-after-load 'cc-mode + '(progn + (add-hook 'c++-mode-common-hook 'cosmo-lisp-is-the-best++))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -867,8 +921,8 @@ nil `((,cosmo-cpp-constants-regex . font-lock-constant-face) (,cosmo-platform-constants-regex . font-lock-constant-face)))) -(add-hook 'c-mode-common-hook 'cosmo-c-keywords-hook) -(add-hook 'c++-mode-common-hook 'cosmo-c-keywords-hook) +;; (add-hook 'c-mode-common-hook 'cosmo-c-keywords-hook) +;; (add-hook 'c++-mode-common-hook 'cosmo-c-keywords-hook) (add-hook 'asm-mode-hook 'cosmo-asm-keywords-hook) diff --git a/tool/emacs/cosmo.el b/tool/emacs/cosmo.el index 88fb36d7f..704bd9b39 100644 --- a/tool/emacs/cosmo.el +++ b/tool/emacs/cosmo.el @@ -1,7 +1,7 @@ -(require 'ld-script) -(require 'optinfo-mode) -(require 'protobuf-mode) +;; (require 'ld-script) +;; (require 'optinfo-mode) +;; (require 'protobuf-mode) (require 'cosmo-format) -(require 'cosmo-asm-mode) +;; (require 'cosmo-asm-mode) (require 'cosmo-stuff) (provide 'cosmo) From 38cc4b3c68b34aad75d0e45d3a8407360f31a63c Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 24 Aug 2024 17:53:30 -0700 Subject: [PATCH 36/39] Get rid of some legacy code --- dsp/scale/BUILD.mk | 6 ++++ libc/intrin/pandn.c | 34 --------------------- libc/intrin/pandn.h | 12 -------- libc/intrin/pcmpgtb.c | 38 ----------------------- libc/intrin/pcmpgtb.h | 12 -------- libc/intrin/pcmpgtw.c | 36 ---------------------- libc/intrin/pcmpgtw.h | 12 -------- libc/intrin/pmovmskb.c | 34 --------------------- libc/intrin/pmovmskb.h | 27 ----------------- libc/intrin/psraw.h | 3 -- libc/intrin/psrawv.c | 34 --------------------- libc/intrin/punpckhbw.c | 46 ---------------------------- libc/intrin/punpckhbw.h | 13 -------- libc/intrin/punpckhwd.c | 49 ------------------------------ libc/intrin/punpckhwd.h | 13 -------- libc/intrin/punpcklbw.c | 56 ---------------------------------- libc/intrin/punpcklbw.h | 13 -------- libc/intrin/punpcklwd.c | 48 ----------------------------- libc/intrin/punpcklwd.h | 13 -------- libc/str/strnwidth.c | 2 -- libc/str/tprecode16to8.c | 60 ++++++++++++++++++++++++++----------- libc/str/tprecode8to16.c | 65 +++++++++++++++++++++++++++++----------- libc/x/utf16to8.c | 29 +++++++----------- libc/x/utf8to32.c | 40 +++++++++++-------------- net/http/decodelatin1.c | 13 -------- net/http/encodelatin1.c | 2 -- net/http/underlong.c | 13 -------- 27 files changed, 123 insertions(+), 600 deletions(-) delete mode 100644 libc/intrin/pandn.c delete mode 100644 libc/intrin/pandn.h delete mode 100644 libc/intrin/pcmpgtb.c delete mode 100644 libc/intrin/pcmpgtb.h delete mode 100644 libc/intrin/pcmpgtw.c delete mode 100644 libc/intrin/pcmpgtw.h delete mode 100644 libc/intrin/pmovmskb.c delete mode 100644 libc/intrin/pmovmskb.h delete mode 100644 libc/intrin/psrawv.c delete mode 100644 libc/intrin/punpckhbw.c delete mode 100644 libc/intrin/punpckhbw.h delete mode 100644 libc/intrin/punpckhwd.c delete mode 100644 libc/intrin/punpckhwd.h delete mode 100644 libc/intrin/punpcklbw.c delete mode 100644 libc/intrin/punpcklbw.h delete mode 100644 libc/intrin/punpcklwd.c delete mode 100644 libc/intrin/punpcklwd.h diff --git a/dsp/scale/BUILD.mk b/dsp/scale/BUILD.mk index bd4f6df7e..80397cd97 100644 --- a/dsp/scale/BUILD.mk +++ b/dsp/scale/BUILD.mk @@ -45,6 +45,12 @@ $(DSP_SCALE_A).pkg: \ $(DSP_SCALE_A_OBJS) \ $(foreach x,$(DSP_SCALE_A_DIRECTDEPS),$($(x)_A).pkg) +ifeq ($(ARCH),x86_64) +o/$(MODE)/dsp/scale/cdecimate2xuint8x8.o: private \ + CFLAGS += \ + -mssse3 +endif + o/$(MODE)/dsp/scale/cdecimate2xuint8x8.o \ o/$(MODE)/dsp/scale/gyarados.o \ o/$(MODE)/dsp/scale/magikarp.o \ diff --git a/libc/intrin/pandn.c b/libc/intrin/pandn.c deleted file mode 100644 index 10d91c52b..000000000 --- a/libc/intrin/pandn.c +++ /dev/null @@ -1,34 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pandn.h" - -/** - * Nands 128-bit integers. - * - * @param 𝑎 [w/o] receives result - * @param 𝑏 [r/o] supplies first input vector - * @param 𝑐 [r/o] supplies second input vector - * @mayalias - */ -void(pandn)(uint64_t a[2], const uint64_t b[2], const uint64_t c[2]) { - unsigned i; - for (i = 0; i < 2; ++i) { - a[i] = ~b[i] & c[i]; - } -} diff --git a/libc/intrin/pandn.h b/libc/intrin/pandn.h deleted file mode 100644 index bb4687614..000000000 --- a/libc/intrin/pandn.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PANDN_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PANDN_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void pandn(uint64_t[2], const uint64_t[2], const uint64_t[2]); - -#define pandn(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(pandn, SSE2, "pandn", INTRIN_NONCOMMUTATIVE, A, B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PANDN_H_ */ diff --git a/libc/intrin/pcmpgtb.c b/libc/intrin/pcmpgtb.c deleted file mode 100644 index f1c895d72..000000000 --- a/libc/intrin/pcmpgtb.c +++ /dev/null @@ -1,38 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pcmpgtb.h" -#include "libc/str/str.h" - -/** - * Compares signed 8-bit integers w/ greater than predicate. - * - * Note that operands can be xor'd with 0x80 for unsigned compares. - * - * @param 𝑎 [w/o] receives result - * @param 𝑏 [r/o] supplies first input vector - * @param 𝑐 [r/o] supplies second input vector - * @mayalias - */ -void(pcmpgtb)(int8_t a[16], const int8_t b[16], const int8_t c[16]) { - unsigned i; - int8_t r[16]; - for (i = 0; i < 16; ++i) - r[i] = -(b[i] > c[i]); - __builtin_memcpy(a, r, 16); -} diff --git a/libc/intrin/pcmpgtb.h b/libc/intrin/pcmpgtb.h deleted file mode 100644 index 043cedf4f..000000000 --- a/libc/intrin/pcmpgtb.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PCMPGTB_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PCMPGTB_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void pcmpgtb(int8_t[16], const int8_t[16], const int8_t[16]); - -#define pcmpgtb(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(pcmpgtb, SSE2, "pcmpgtb", INTRIN_NONCOMMUTATIVE, A, B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PCMPGTB_H_ */ diff --git a/libc/intrin/pcmpgtw.c b/libc/intrin/pcmpgtw.c deleted file mode 100644 index 7bf94ef49..000000000 --- a/libc/intrin/pcmpgtw.c +++ /dev/null @@ -1,36 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pcmpgtw.h" -#include "libc/str/str.h" - -/** - * Compares signed 16-bit integers w/ greater than predicate. - * - * @param 𝑎 [w/o] receives result - * @param 𝑏 [r/o] supplies first input vector - * @param 𝑐 [r/o] supplies second input vector - * @mayalias - */ -void(pcmpgtw)(int16_t a[8], const int16_t b[8], const int16_t c[8]) { - unsigned i; - int16_t r[8]; - for (i = 0; i < 8; ++i) - r[i] = -(b[i] > c[i]); - __builtin_memcpy(a, r, 16); -} diff --git a/libc/intrin/pcmpgtw.h b/libc/intrin/pcmpgtw.h deleted file mode 100644 index bb9707d19..000000000 --- a/libc/intrin/pcmpgtw.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PCMPGTW_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PCMPGTW_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void pcmpgtw(int16_t[8], const int16_t[8], const int16_t[8]); - -#define pcmpgtw(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(pcmpgtw, SSE2, "pcmpgtw", INTRIN_NONCOMMUTATIVE, A, B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PCMPGTW_H_ */ diff --git a/libc/intrin/pmovmskb.c b/libc/intrin/pmovmskb.c deleted file mode 100644 index 0ff024d1d..000000000 --- a/libc/intrin/pmovmskb.c +++ /dev/null @@ -1,34 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pmovmskb.h" - -/** - * Turns result of byte comparison into bitmask. - * - * @param 𝑝 is byte vector to crunch - * @see pcmpeqb(), bsf(), etc. - */ -uint32_t(pmovmskb)(const uint8_t p[16]) { - uint32_t i, m; - for (m = i = 0; i < 16; ++i) { - if (p[i] & 0x80) - m |= 1 << i; - } - return m; -} diff --git a/libc/intrin/pmovmskb.h b/libc/intrin/pmovmskb.h deleted file mode 100644 index e17e1fb16..000000000 --- a/libc/intrin/pmovmskb.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PMOVMSKB_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PMOVMSKB_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -uint32_t pmovmskb(const uint8_t[16]); - -#if defined(__x86_64__) && defined(__GNUC__) -#define pmovmskb(A) \ - ({ \ - uint32_t Mask; \ - if (!IsModeDbg() && X86_HAVE(SSE2)) { \ - const __intrin_xmm_t *Xmm = (const __intrin_xmm_t *)(A); \ - if (!X86_NEED(AVX)) { \ - asm("pmovmskb\t%1,%0" : "=r"(Mask) : "x"(*Xmm)); \ - } else { \ - asm("vpmovmskb\t%1,%0" : "=r"(Mask) : "x"(*Xmm)); \ - } \ - } else { \ - Mask = pmovmskb(A); \ - } \ - Mask; \ - }) -#endif - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PMOVMSKB_H_ */ diff --git a/libc/intrin/psraw.h b/libc/intrin/psraw.h index 4814b073c..083bb7445 100644 --- a/libc/intrin/psraw.h +++ b/libc/intrin/psraw.h @@ -4,11 +4,8 @@ COSMOPOLITAN_C_START_ void psraw(int16_t[8], const int16_t[8], unsigned char) libcesque; -void psrawv(int16_t[8], const int16_t[8], const uint64_t[2]) libcesque; #define psraw(A, B, I) INTRIN_SSEVEX_X_I_(psraw, SSE2, "psraw", A, B, I) -#define psrawv(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(psrawv, SSE2, "psraw", INTRIN_NONCOMMUTATIVE, A, B, C) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_INTRIN_PSRAW_H_ */ diff --git a/libc/intrin/psrawv.c b/libc/intrin/psrawv.c deleted file mode 100644 index 5409db233..000000000 --- a/libc/intrin/psrawv.c +++ /dev/null @@ -1,34 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/psraw.h" - -/** - * Divides shorts by two power. - * - * @note arithmetic shift right will sign extend negatives - * @mayalias - */ -void(psrawv)(int16_t a[8], const int16_t b[8], const uint64_t c[2]) { - unsigned i; - unsigned char k; - k = c[0] > 15 ? 15 : c[0]; - for (i = 0; i < 8; ++i) { - a[i] = b[i] >> k; - } -} diff --git a/libc/intrin/punpckhbw.c b/libc/intrin/punpckhbw.c deleted file mode 100644 index 151530c77..000000000 --- a/libc/intrin/punpckhbw.c +++ /dev/null @@ -1,46 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/punpckhbw.h" - -/** - * Interleaves high bytes. - * - * @param 𝑎 [w/o] receives reduced 𝑏 and 𝑐 interleaved - * @param 𝑏 [r/o] supplies eight words - * @param 𝑐 [r/o] supplies eight words - * @mayalias - */ -void(punpckhbw)(uint8_t a[16], const uint8_t b[16], const uint8_t c[16]) { - a[0x0] = b[0x8]; - a[0x1] = c[0x8]; - a[0x2] = b[0x9]; - a[0x3] = c[0x9]; - a[0x4] = b[0xa]; - a[0x5] = c[0xa]; - a[0x6] = b[0xb]; - a[0x7] = c[0xb]; - a[0x8] = b[0xc]; - a[0x9] = c[0xc]; - a[0xa] = b[0xd]; - a[0xb] = c[0xd]; - a[0xc] = b[0xe]; - a[0xd] = c[0xe]; - a[0xe] = b[0xf]; - a[0xf] = c[0xf]; -} diff --git a/libc/intrin/punpckhbw.h b/libc/intrin/punpckhbw.h deleted file mode 100644 index 306cb1597..000000000 --- a/libc/intrin/punpckhbw.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKHBW_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKHBW_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void punpckhbw(uint8_t[16], const uint8_t[16], const uint8_t[16]); - -#define punpckhbw(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(punpckhbw, SSE2, "punpckhbw", INTRIN_NONCOMMUTATIVE, A, \ - B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKHBW_H_ */ diff --git a/libc/intrin/punpckhwd.c b/libc/intrin/punpckhwd.c deleted file mode 100644 index 5aad8b10b..000000000 --- a/libc/intrin/punpckhwd.c +++ /dev/null @@ -1,49 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/punpckhwd.h" -#include "libc/str/str.h" - -/** - * Interleaves high words. - * - * 0 1 2 3 4 5 6 7 - * B aa bb cc dd EE FF GG HH - * C ii jj kk ll MM NN OO PP - * └┤ └┤ └┤ └┤ - * ┌────────┘ │ │ │ - * │ ┌─────┘ │ │ - * │ │ ┌──┘ │ - * ┌───┤ ┌───┤ ┌───┤ ┌───┤ - * → A EE MM FF NN GG OO HH PP - * - * @param 𝑎 [w/o] receives reduced 𝑏 and 𝑐 interleaved - * @param 𝑏 [r/o] supplies eight words - * @param 𝑐 [r/o] supplies eight words - * @mayalias - */ -void(punpckhwd)(uint16_t a[8], const uint16_t b[8], const uint16_t c[8]) { - a[0] = b[4]; - a[1] = c[4]; - a[2] = b[5]; - a[3] = c[5]; - a[4] = b[6]; - a[5] = c[6]; - a[6] = b[7]; - a[7] = c[7]; -} diff --git a/libc/intrin/punpckhwd.h b/libc/intrin/punpckhwd.h deleted file mode 100644 index 548e6ee92..000000000 --- a/libc/intrin/punpckhwd.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKHWD_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKHWD_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void punpckhwd(uint16_t[8], const uint16_t[8], const uint16_t[8]); - -#define punpckhwd(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(punpckhwd, SSE2, "punpckhwd", INTRIN_NONCOMMUTATIVE, A, \ - B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKHWD_H_ */ diff --git a/libc/intrin/punpcklbw.c b/libc/intrin/punpcklbw.c deleted file mode 100644 index 559d8a553..000000000 --- a/libc/intrin/punpcklbw.c +++ /dev/null @@ -1,56 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/punpcklbw.h" - -/** - * Interleaves low bytes. - * - * 0 1 2 3 4 5 6 7 8 9 A B C D E F - * B A B C D E F G H i j k l m n o p - * C Q R S T U V W X y z α σ π μ τ ε - * │ │ │ │ │ │ │ │ - * │ │ │ └─────┐ - * │ │ └───┐ │ etc... - * │ └─┐ │ │ - * ├─┐ ├─┐ ├─┐ ├─┐ - * → A A Q B R C S D T E U F V G W H X - * - * @param 𝑎 [w/o] receives reduced 𝑏 and 𝑐 interleaved - * @param 𝑏 [r/o] supplies eight words - * @param 𝑐 [r/o] supplies eight words - * @mayalias - */ -void(punpcklbw)(uint8_t a[16], const uint8_t b[16], const uint8_t c[16]) { - a[0xf] = c[7]; - a[0xe] = b[7]; - a[0xd] = c[6]; - a[0xc] = b[6]; - a[0xb] = c[5]; - a[0xa] = b[5]; - a[0x9] = c[4]; - a[0x8] = b[4]; - a[0x7] = c[3]; - a[0x6] = b[3]; - a[0x5] = c[2]; - a[0x4] = b[2]; - a[0x3] = c[1]; - a[0x2] = b[1]; - a[0x1] = c[0]; - a[0x0] = b[0]; -} diff --git a/libc/intrin/punpcklbw.h b/libc/intrin/punpcklbw.h deleted file mode 100644 index 40c9cef89..000000000 --- a/libc/intrin/punpcklbw.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKLBW_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKLBW_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void punpcklbw(uint8_t[16], const uint8_t[16], const uint8_t[16]); - -#define punpcklbw(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(punpcklbw, SSE2, "punpcklbw", INTRIN_NONCOMMUTATIVE, A, \ - B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKLBW_H_ */ diff --git a/libc/intrin/punpcklwd.c b/libc/intrin/punpcklwd.c deleted file mode 100644 index 11936c456..000000000 --- a/libc/intrin/punpcklwd.c +++ /dev/null @@ -1,48 +0,0 @@ -/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ -│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2020 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/punpcklwd.h" - -/** - * Interleaves low words. - * - * 0 1 2 3 4 5 6 7 - * B AA BB CC DD ee ff gg hh - * C II JJ KK LL mm nn oo pp - * ├┘ ├┘ ├┘ ├┘ - * │ │ │ └────────┐ - * │ │ └─────┐ │ - * │ └──┐ │ │ - * ├───┐ ├───┐ ├───┐ ├───┐ - * → A AA II BB JJ CC KK DD LL - * - * @param 𝑎 [w/o] receives reduced 𝑏 and 𝑐 interleaved - * @param 𝑏 [r/o] supplies eight words - * @param 𝑐 [r/o] supplies eight words - * @mayalias - */ -void(punpcklwd)(uint16_t a[8], const uint16_t b[8], const uint16_t c[8]) { - a[7] = c[3]; - a[6] = b[3]; - a[5] = c[2]; - a[4] = b[2]; - a[3] = c[1]; - a[2] = b[1]; - a[1] = c[0]; - a[0] = b[0]; -} diff --git a/libc/intrin/punpcklwd.h b/libc/intrin/punpcklwd.h deleted file mode 100644 index e286ba9c2..000000000 --- a/libc/intrin/punpcklwd.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef COSMOPOLITAN_LIBC_INTRIN_PUNPCKLWD_H_ -#define COSMOPOLITAN_LIBC_INTRIN_PUNPCKLWD_H_ -#include "libc/intrin/macros.h" -COSMOPOLITAN_C_START_ - -void punpcklwd(uint16_t[8], const uint16_t[8], const uint16_t[8]); - -#define punpcklwd(A, B, C) \ - INTRIN_SSEVEX_X_X_X_(punpcklwd, SSE2, "punpcklwd", INTRIN_NONCOMMUTATIVE, A, \ - B, C) - -COSMOPOLITAN_C_END_ -#endif /* COSMOPOLITAN_LIBC_INTRIN_PUNPCKLWD_H_ */ diff --git a/libc/str/strnwidth.c b/libc/str/strnwidth.c index 761994e80..b67436e57 100644 --- a/libc/str/strnwidth.c +++ b/libc/str/strnwidth.c @@ -17,8 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/bsf.h" -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pmovmskb.h" #include "libc/macros.h" #include "libc/str/str.h" #include "libc/str/thompike.h" diff --git a/libc/str/tprecode16to8.c b/libc/str/tprecode16to8.c index 9bea83682..d23eb0b5d 100644 --- a/libc/str/tprecode16to8.c +++ b/libc/str/tprecode16to8.c @@ -18,35 +18,55 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/fmt/conv.h" -#include "libc/intrin/packsswb.h" -#include "libc/intrin/pandn.h" -#include "libc/intrin/pcmpgtw.h" -#include "libc/intrin/pmovmskb.h" #include "libc/str/str.h" #include "libc/str/utf16.h" +#include "third_party/aarch64/arm_neon.internal.h" +#include "third_party/intel/emmintrin.internal.h" -static const int16_t kDel16[8] = {127, 127, 127, 127, 127, 127, 127, 127}; +#if !IsModeDbg() +#if defined(__x86_64__) -/* 10x speedup for ascii */ static axdx_t tprecode16to8_sse2(char *dst, size_t dstsize, const char16_t *src, axdx_t r) { - int16_t v1[8], v2[8], v3[8], vz[8]; - memset(vz, 0, 16); + __m128i v1, v2, v3, vz; + vz = _mm_setzero_si128(); while (r.ax + 8 < dstsize) { - memcpy(v1, src + r.dx, 16); - pcmpgtw(v2, v1, vz); - pcmpgtw(v3, v1, kDel16); - pandn((void *)v2, (void *)v3, (void *)v2); - if (pmovmskb((void *)v2) != 0xFFFF) + v1 = _mm_loadu_si128((__m128i *)(src + r.dx)); + v2 = _mm_cmpgt_epi16(v1, vz); + v3 = _mm_cmpgt_epi16(v1, _mm_set1_epi16(0x7F)); + v2 = _mm_andnot_si128(v3, v2); + if (_mm_movemask_epi8(v2) != 0xFFFF) break; - packsswb((void *)v1, v1, v1); - memcpy(dst + r.ax, v1, 8); + v1 = _mm_packs_epi16(v1, v1); + _mm_storel_epi64((__m128i *)(dst + r.ax), v1); r.ax += 8; r.dx += 8; } return r; } +#elif defined(__aarch64__) + +static axdx_t tprecode16to8_neon(char *dst, size_t dstsize, const char16_t *src, + axdx_t r) { + uint16x8_t v1, v2, v3; + while (r.ax + 8 < dstsize) { + v1 = vld1q_u16((const uint16_t *)(src + r.dx)); + v2 = vcgtq_u16(v1, vdupq_n_u16(0)); + v3 = vcgtq_u16(v1, vdupq_n_u16(0x7F)); + v2 = vbicq_u16(v2, v3); + if (vaddvq_u16(v2) != 8 * 0xFFFF) + break; + vst1_u8((uint8_t *)(dst + r.ax), vqmovn_u16(v1)); + r.ax += 8; + r.dx += 8; + } + return r; +} + +#endif +#endif + /** * Transcodes UTF-16 to UTF-8. * @@ -66,10 +86,14 @@ axdx_t tprecode16to8(char *dst, size_t dstsize, const char16_t *src) { r.ax = 0; r.dx = 0; for (;;) { -#if defined(__x86_64__) && !IsModeDbg() && !IsTiny() - if (!((uintptr_t)(src + r.dx) & 15)) { +#if !IsModeDbg() +#if defined(__x86_64__) + if (!((uintptr_t)(src + r.dx) & 15)) r = tprecode16to8_sse2(dst, dstsize, src, r); - } +#elif defined(__aarch64__) + if (!((uintptr_t)(src + r.dx) & 15)) + r = tprecode16to8_neon(dst, dstsize, src, r); +#endif #endif if (!(x = src[r.dx++])) break; diff --git a/libc/str/tprecode8to16.c b/libc/str/tprecode8to16.c index d823f3163..2924184f8 100644 --- a/libc/str/tprecode8to16.c +++ b/libc/str/tprecode8to16.c @@ -16,34 +16,61 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pmovmskb.h" -#include "libc/intrin/punpckhbw.h" -#include "libc/intrin/punpcklbw.h" +#include +#include +#include +#include "libc/dce.h" #include "libc/str/str.h" #include "libc/str/thompike.h" #include "libc/str/utf16.h" +#include "third_party/aarch64/arm_neon.internal.h" +#include "third_party/intel/emmintrin.internal.h" + +#if !IsModeDbg() +#if defined(__x86_64__) -// 34x speedup for ascii static inline axdx_t tprecode8to16_sse2(char16_t *dst, size_t dstsize, const char *src, axdx_t r) { - uint8_t v1[16], v2[16], vz[16]; - memset(vz, 0, 16); + __m128i v1, v2, vz; + vz = _mm_setzero_si128(); while (r.ax + 16 < dstsize) { - memcpy(v1, src + r.dx, 16); - pcmpgtb((int8_t *)v2, (int8_t *)v1, (int8_t *)vz); - if (pmovmskb(v2) != 0xFFFF) + v1 = _mm_loadu_si128((__m128i *)(src + r.dx)); + v2 = _mm_cmpgt_epi8(v1, vz); + if (_mm_movemask_epi8(v2) != 0xFFFF) break; - punpcklbw(v2, v1, vz); - punpckhbw(v1, v1, vz); - memcpy(dst + r.ax + 0, v2, 16); - memcpy(dst + r.ax + 8, v1, 16); + __m128i lo = _mm_unpacklo_epi8(v1, vz); + __m128i hi = _mm_unpackhi_epi8(v1, vz); + _mm_storeu_si128((__m128i *)(dst + r.ax), lo); + _mm_storeu_si128((__m128i *)(dst + r.ax + 8), hi); r.ax += 16; r.dx += 16; } return r; } +#elif defined(__aarch64__) + +static inline axdx_t tprecode8to16_neon(char16_t *dst, size_t dstsize, + const char *src, axdx_t r) { + uint8x16_t v1; + while (r.ax + 16 < dstsize) { + v1 = vld1q_u8((const uint8_t *)(src + r.dx)); + uint8x16_t cmp = vcgtq_u8(v1, vdupq_n_u8(0)); + if (vaddvq_u8(cmp) != 16 * 0xFF) + break; + uint16x8_t lo = vmovl_u8(vget_low_u8(v1)); + uint16x8_t hi = vmovl_u8(vget_high_u8(v1)); + vst1q_u16((uint16_t *)(dst + r.ax), lo); + vst1q_u16((uint16_t *)(dst + r.ax + 8), hi); + r.ax += 16; + r.dx += 16; + } + return r; +} + +#endif +#endif + /** * Transcodes UTF-8 to UTF-16. * @@ -64,10 +91,14 @@ axdx_t tprecode8to16(char16_t *dst, size_t dstsize, const char *src) { r.ax = 0; r.dx = 0; for (;;) { -#if defined(__x86_64__) && !IsModeDbg() - if (!((uintptr_t)(src + r.dx) & 15)) { +#if !IsModeDbg() +#if defined(__x86_64__) + if (!((uintptr_t)(src + r.dx) & 15)) r = tprecode8to16_sse2(dst, dstsize, src, r); - } +#elif defined(__aarch64__) + if (!((uintptr_t)(src + r.dx) & 15)) + r = tprecode8to16_neon(dst, dstsize, src, r); +#endif #endif x = src[r.dx++] & 0377; if (x >= 0300) { diff --git a/libc/x/utf16to8.c b/libc/x/utf16to8.c index 219c2e2a9..dfcd4dea3 100644 --- a/libc/x/utf16to8.c +++ b/libc/x/utf16to8.c @@ -17,21 +17,13 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/bsr.h" -#include "libc/intrin/packsswb.h" -#include "libc/intrin/pandn.h" -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pcmpgtw.h" -#include "libc/intrin/pmovmskb.h" -#include "libc/intrin/punpckhbw.h" -#include "libc/intrin/punpcklbw.h" #include "libc/mem/mem.h" #include "libc/serialize.h" #include "libc/str/str.h" #include "libc/str/thompike.h" #include "libc/str/utf16.h" #include "libc/x/x.h" - -static const int16_t kDel16[8] = {127, 127, 127, 127, 127, 127, 127, 127}; +#include "third_party/intel/emmintrin.internal.h" /** * Transcodes UTF-16 to UTF-8. @@ -45,28 +37,27 @@ char *utf16to8(const char16_t *p, size_t n, size_t *z) { char *r, *q; wint_t x, y; const char16_t *e; - int16_t v1[8], v2[8], v3[8], vz[8]; if (z) *z = 0; if (n == -1) n = p ? strlen16(p) : 0; if ((q = r = malloc(n * 4 + 8 + 1))) { for (e = p + n; p < e;) { - if (p + 8 < e) { /* 17x ascii */ - bzero(vz, 16); +#if defined(__x86_64__) + if (p + 8 < e) { do { - memcpy(v1, p, 16); - pcmpgtw(v2, v1, vz); - pcmpgtw(v3, v1, kDel16); - pandn((void *)v2, (void *)v3, (void *)v2); - if (pmovmskb((void *)v2) != 0xFFFF) + __m128i v1 = _mm_loadu_si128((__m128i *)p); + __m128i v2 = _mm_cmpgt_epi16(v1, _mm_setzero_si128()); + __m128i v3 = _mm_cmpgt_epi16(v1, _mm_set1_epi16(127)); + v2 = _mm_andnot_si128(v3, v2); + if (_mm_movemask_epi8(v2) != 0xFFFF) break; - packsswb((void *)v1, v1, v1); - memcpy(q, v1, 8); + _mm_storel_epi64((__m128i *)q, _mm_packs_epi16(v1, v1)); p += 8; q += 8; } while (p + 8 < e); } +#endif x = *p++ & 0xffff; if (!IsUcs2(x)) { if (p < e) { diff --git a/libc/x/utf8to32.c b/libc/x/utf8to32.c index f1a8568cc..15170e1a2 100644 --- a/libc/x/utf8to32.c +++ b/libc/x/utf8to32.c @@ -16,18 +16,12 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/likely.h" -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pmovmskb.h" -#include "libc/intrin/punpckhbw.h" -#include "libc/intrin/punpckhwd.h" -#include "libc/intrin/punpcklbw.h" -#include "libc/intrin/punpcklwd.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/str/thompike.h" #include "libc/str/utf16.h" #include "libc/x/x.h" +#include "third_party/intel/emmintrin.internal.h" /** * Transcodes UTF-8 to UTF-32. @@ -41,35 +35,35 @@ wchar_t *utf8to32(const char *p, size_t n, size_t *z) { unsigned m, j; wint_t x, a, b; wchar_t *r, *q; - uint8_t v1[16], v2[16], v3[16], v4[16], vz[16]; if (z) *z = 0; if (n == -1) n = p ? strlen(p) : 0; if ((q = r = malloc(n * sizeof(wchar_t) + sizeof(wchar_t)))) { for (i = 0; i < n;) { +#ifdef __x86_64__ if (!((uintptr_t)(p + i) & 15) && i + 16 < n) { - /* 10x speedup for ascii */ - bzero(vz, 16); do { - memcpy(v1, p + i, 16); - pcmpgtb((int8_t *)v2, (int8_t *)v1, (int8_t *)vz); - if (pmovmskb(v2) != 0xFFFF) + __m128i v1, v2, v3, v4; + v1 = _mm_loadu_si128((__m128i *)(p + i)); + v2 = _mm_cmpgt_epi8(v1, _mm_setzero_si128()); + if (_mm_movemask_epi8(v2) != 0xFFFF) break; - punpcklbw(v3, v1, vz); - punpckhbw(v1, v1, vz); - punpcklwd((void *)v4, (void *)v3, (void *)vz); - punpckhwd((void *)v3, (void *)v3, (void *)vz); - punpcklwd((void *)v2, (void *)v1, (void *)vz); - punpckhwd((void *)v1, (void *)v1, (void *)vz); - memcpy(q + 0, v4, 16); - memcpy(q + 4, v3, 16); - memcpy(q + 8, v2, 16); - memcpy(q + 12, v1, 16); + v3 = _mm_unpacklo_epi8(v1, _mm_setzero_si128()); + v1 = _mm_unpackhi_epi8(v1, _mm_setzero_si128()); + v4 = _mm_unpacklo_epi16(v3, _mm_setzero_si128()); + v3 = _mm_unpackhi_epi16(v3, _mm_setzero_si128()); + v2 = _mm_unpacklo_epi16(v1, _mm_setzero_si128()); + v1 = _mm_unpackhi_epi16(v1, _mm_setzero_si128()); + _mm_storeu_si128((__m128i *)(q + 0), v4); + _mm_storeu_si128((__m128i *)(q + 4), v3); + _mm_storeu_si128((__m128i *)(q + 8), v2); + _mm_storeu_si128((__m128i *)(q + 12), v1); i += 16; q += 16; } while (i + 16 < n); } +#endif x = p[i++] & 0xff; if (x >= 0300) { a = ThomPikeByte(x); diff --git a/net/http/decodelatin1.c b/net/http/decodelatin1.c index 4799d8a9d..ce9aed209 100644 --- a/net/http/decodelatin1.c +++ b/net/http/decodelatin1.c @@ -16,8 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pmovmskb.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "net/http/escape.h" @@ -34,23 +32,12 @@ char *DecodeLatin1(const char *p, size_t n, size_t *z) { int c; size_t i; char *r, *q; - int8_t v1[16], v2[16], vz[16]; if (z) *z = 0; if (n == -1) n = p ? strlen(p) : 0; if ((q = r = malloc(n * 2 + 1))) { for (i = 0; i < n;) { - bzero(vz, 16); /* 3x speedup for ASCII */ - while (i + 16 < n) { - memcpy(v1, p + i, 16); - pcmpgtb(v2, v1, vz); - if (pmovmskb((void *)v2) != 0xFFFF) - break; - memcpy(q, v1, 16); - q += 16; - i += 16; - } c = p[i++] & 0xff; if (c < 0200) { *q++ = c; diff --git a/net/http/encodelatin1.c b/net/http/encodelatin1.c index 4d6798ec7..9d3bc0ed8 100644 --- a/net/http/encodelatin1.c +++ b/net/http/encodelatin1.c @@ -17,8 +17,6 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pmovmskb.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/net/http/underlong.c b/net/http/underlong.c index a48e7f48c..1d0906582 100644 --- a/net/http/underlong.c +++ b/net/http/underlong.c @@ -16,8 +16,6 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/pcmpgtb.h" -#include "libc/intrin/pmovmskb.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/str/thompike.h" @@ -40,23 +38,12 @@ char *Underlong(const char *p, size_t n, size_t *z) { char *r, *q; size_t i, j, m; wint_t x, a, b; - int8_t v1[16], v2[16], vz[16]; if (z) *z = 0; if (n == -1) n = p ? strlen(p) : 0; if ((q = r = malloc(n * 2 + 1))) { for (i = 0; i < n;) { - bzero(vz, 16); /* 50x speedup for ASCII */ - while (i + 16 < n) { - memcpy(v1, p + i, 16); - pcmpgtb(v2, v1, vz); - if (pmovmskb((void *)v2) != 0xFFFF) - break; - memcpy(q, v1, 16); - q += 16; - i += 16; - } x = p[i++] & 0xff; if (x >= 0300) { a = ThomPikeByte(x); From bb06230f1ed860545960d11f0469c23959daeb4a Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sat, 24 Aug 2024 18:10:22 -0700 Subject: [PATCH 37/39] Avoid linker conflicts on DescribeFoo symbols These symbols belong to the user. It caused a confusing error for Blink. --- libc/calls/groups.internal.h | 4 +- libc/calls/printfds.c | 4 +- libc/calls/seccomp.c | 2 +- libc/calls/sig.c | 6 +- libc/calls/struct/flock.internal.h | 4 +- libc/calls/struct/iovec.internal.h | 6 +- libc/calls/struct/itimerval.internal.h | 4 +- libc/calls/struct/rlimit.internal.h | 4 +- libc/calls/struct/sched_param.internal.h | 4 +- libc/calls/struct/sigaction.internal.h | 4 +- libc/calls/struct/sigaltstack.internal.h | 4 +- libc/calls/struct/siginfo.internal.h | 4 +- libc/calls/struct/sigset.internal.h | 4 +- libc/calls/struct/stat.internal.h | 4 +- libc/calls/struct/statfs.internal.h | 4 +- libc/calls/struct/termios.internal.h | 4 +- libc/calls/struct/timespec.internal.h | 4 +- libc/calls/struct/timeval.internal.h | 4 +- libc/calls/struct/winsize.internal.h | 6 +- libc/fmt/magnumstrs.internal.h | 3 +- libc/intrin/cp.c | 2 +- libc/intrin/createfile.c | 10 +- libc/intrin/describearchprctlcode.c | 2 +- libc/intrin/describebacktrace.c | 4 +- libc/intrin/describebacktrace.h | 4 +- libc/intrin/describecancelstate.c | 2 +- libc/intrin/describecapability.c | 2 +- libc/intrin/describeclockname.c | 4 +- libc/intrin/describecontrolkeystate.c | 6 +- libc/intrin/describedirfd.c | 2 +- libc/intrin/describednotify.c | 6 +- libc/intrin/describeerrnoresult.c | 2 +- libc/intrin/describefcntlcmd.c | 2 +- libc/intrin/describefdset.c | 2 +- libc/intrin/describeflags.c | 4 +- libc/intrin/describeflags.h | 226 +++++++++--------- libc/intrin/describeflock.c | 2 +- libc/intrin/describeflocktype.c | 2 +- libc/intrin/describefutexop.c | 2 +- libc/intrin/describegidlist.c | 4 +- libc/intrin/describehow.c | 2 +- libc/intrin/describeinoutint64.c | 2 +- libc/intrin/describeiovec.c | 4 +- libc/intrin/describeiovnt.c | 2 +- libc/intrin/describeitimer.c | 2 +- libc/intrin/describeitimerval.c | 4 +- libc/intrin/describemagnums.c | 4 +- libc/intrin/describemapflags.c | 4 +- libc/intrin/describemapping.c | 2 +- libc/intrin/describemremapflags.c | 6 +- libc/intrin/describemsyncflags.c | 4 +- libc/intrin/describentconsolemodeinputflags.c | 6 +- .../intrin/describentconsolemodeoutputflags.c | 6 +- libc/intrin/describentcreationdisposition.c | 2 +- libc/intrin/describentfileaccessflags.c | 4 +- libc/intrin/describentfileflagattr.c | 6 +- libc/intrin/describentfilemapflags.c | 6 +- libc/intrin/describentfileshareflags.c | 6 +- libc/intrin/describentfiletypeflags.c | 6 +- libc/intrin/describentlockfileflags.c | 6 +- libc/intrin/describentmovfileinpflags.c | 6 +- libc/intrin/describentoverlapped.c | 2 +- libc/intrin/describentoverlapped.h | 4 +- libc/intrin/describentpageflags.c | 4 +- libc/intrin/describentpipemodeflags.c | 6 +- libc/intrin/describentpipeopenflags.c | 6 +- libc/intrin/describentprocaccessflags.c | 6 +- libc/intrin/describentsecurityattributes.c | 5 +- libc/intrin/describentstartflags.c | 6 +- libc/intrin/describentsymlinkflags.c | 6 +- libc/intrin/describeopenflags.c | 4 +- libc/intrin/describeopenmode.c | 2 +- libc/intrin/describepersonalityflags.c | 6 +- libc/intrin/describepollfds.c | 8 +- libc/intrin/describepollflags.c | 4 +- libc/intrin/describeprotflags.c | 4 +- libc/intrin/describeptrace.c | 2 +- libc/intrin/describeptraceevent.c | 2 +- libc/intrin/describerlimit.c | 2 +- libc/intrin/describerlimitname.c | 4 +- libc/intrin/describeschedparam.c | 2 +- libc/intrin/describeschedpolicy.c | 2 +- libc/intrin/describeseccompoperation.c | 2 +- libc/intrin/describesicode.c | 2 +- libc/intrin/describesigaction.c | 6 +- libc/intrin/describesigaltstack.c | 4 +- libc/intrin/describesigaltstackflags.c | 6 +- libc/intrin/describesiginfo.c | 2 +- libc/intrin/describesigset.c | 2 +- libc/intrin/describesleepflags.c | 2 +- libc/intrin/describesocketfamily.c | 2 +- libc/intrin/describesocketprotocol.c | 2 +- libc/intrin/describesockettype.c | 2 +- libc/intrin/describesocklevel.c | 2 +- libc/intrin/describesockoptname.c | 2 +- libc/intrin/describestat.c | 2 +- libc/intrin/describestatfs.c | 2 +- libc/intrin/describestdiostate.c | 2 +- libc/intrin/describestringlist.c | 2 +- libc/intrin/describetermios.c | 16 +- libc/intrin/describethreadcreationflags.c | 6 +- libc/intrin/describetimespec.c | 3 +- libc/intrin/describetimeval.c | 2 +- libc/intrin/describevirtualkeycode.c | 2 +- libc/intrin/describewhence.c | 2 +- libc/intrin/describewhichprio.c | 2 +- libc/intrin/describewinsize.c | 2 +- libc/intrin/mmap.c | 2 +- libc/intrin/printmaps.c | 2 +- libc/log/printwindowsmemory.c | 10 +- libc/proc/posix_spawn.c | 14 +- libc/sock/select.internal.h | 4 +- libc/sock/sockdebug.c | 4 +- libc/sock/struct/pollfd.internal.h | 4 +- libc/sock/struct/sockaddr.internal.h | 4 +- libc/stdio/printargs.c | 4 +- test/libc/calls/sigprocmask_test.c | 2 +- test/libc/intrin/describeflags_test.c | 2 +- tool/viz/rlimit.c | 2 +- tool/viz/virtualquery.c | 10 +- 120 files changed, 346 insertions(+), 347 deletions(-) diff --git a/libc/calls/groups.internal.h b/libc/calls/groups.internal.h index d7d0c80b7..2fca2ca10 100644 --- a/libc/calls/groups.internal.h +++ b/libc/calls/groups.internal.h @@ -5,9 +5,9 @@ COSMOPOLITAN_C_START_ int sys_getgroups(int size, uint32_t list[]); int sys_setgroups(size_t size, const uint32_t list[]); -const char *DescribeGidList(char[128], int, int, const uint32_t list[]); +const char *_DescribeGidList(char[128], int, int, const uint32_t list[]); #define DescribeGidList(rc, length, gidlist) \ - DescribeGidList(alloca(128), rc, length, gidlist) + _DescribeGidList(alloca(128), rc, length, gidlist) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_GROUPS_INTERNAL_H_ */ diff --git a/libc/calls/printfds.c b/libc/calls/printfds.c index 36cb548d7..4786357ef 100644 --- a/libc/calls/printfds.c +++ b/libc/calls/printfds.c @@ -18,8 +18,8 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" #include "libc/calls/state.internal.h" -#include "libc/intrin/fds.h" #include "libc/intrin/describeflags.h" +#include "libc/intrin/fds.h" #include "libc/intrin/kprintf.h" static const char *__fdkind2str(int x) { @@ -55,7 +55,7 @@ void __printfds(struct Fd *fds, size_t fdslen) { continue; kprintf("%3d %s", i, __fdkind2str(fds[i].kind)); if (fds[i].flags) { - kprintf(" flags=%s", (DescribeOpenFlags)(buf, fds[i].flags)); + kprintf(" flags=%s", _DescribeOpenFlags(buf, fds[i].flags)); } if (fds[i].mode) kprintf(" mode=%#o", fds[i].mode); diff --git a/libc/calls/seccomp.c b/libc/calls/seccomp.c index 3048745d0..1d004fe2d 100644 --- a/libc/calls/seccomp.c +++ b/libc/calls/seccomp.c @@ -82,7 +82,7 @@ int seccomp(unsigned operation, unsigned flags, void *args) { } else { rc = enosys(); } - STRACE("seccomp(%s, %#x, %p) → %d% m", DescribeSeccompOperation(operation), + STRACE("seccomp(%s, %#x, %p) → %d% m", _DescribeSeccompOperation(operation), flags, args, rc); return rc; } diff --git a/libc/calls/sig.c b/libc/calls/sig.c index 247c56746..9cb94f141 100644 --- a/libc/calls/sig.c +++ b/libc/calls/sig.c @@ -194,7 +194,7 @@ textwindows int __sig_raise(volatile int sig, int sic) { char ssbuf[128]; siginfo_t si = {.si_signo = sig, .si_code = sic}; STRACE("__sig_raise(%G, %t) mask %s", sig, __sig_handler(rva), - (DescribeSigset)(ssbuf, 0, (sigset_t *)&pt->tib->tib_sigmask)); + _DescribeSigset(ssbuf, 0, (sigset_t *)&pt->tib->tib_sigmask)); __sig_handler(rva)(sig, &si, &ctx); // record this handler @@ -265,8 +265,8 @@ static textwindows wontreturn void __sig_tramp(struct SignalFrame *sf) { // call the user's signal handler char ssbuf[2][128]; STRACE("__sig_tramp(%G, %t) mask %s → %s", sig, __sig_handler(sf->rva), - (DescribeSigset)(ssbuf[0], 0, &sf->ctx.uc_sigmask), - (DescribeSigset)(ssbuf[1], 0, (sigset_t *)&tib->tib_sigmask)); + _DescribeSigset(ssbuf[0], 0, &sf->ctx.uc_sigmask), + _DescribeSigset(ssbuf[1], 0, (sigset_t *)&tib->tib_sigmask)); __sig_handler(sf->rva)(sig, &sf->si, &sf->ctx); // restore the signal mask that was used by the interrupted code diff --git a/libc/calls/struct/flock.internal.h b/libc/calls/struct/flock.internal.h index aea17b09e..52b14ad66 100644 --- a/libc/calls/struct/flock.internal.h +++ b/libc/calls/struct/flock.internal.h @@ -4,8 +4,8 @@ #include "libc/mem/alloca.h" COSMOPOLITAN_C_START_ -const char *DescribeFlock(char[300], int, const struct flock *); -#define DescribeFlock(c, l) DescribeFlock(alloca(300), c, l) +const char *_DescribeFlock(char[300], int, const struct flock *); +#define DescribeFlock(c, l) _DescribeFlock(alloca(300), c, l) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_FLOCK_INTERNAL_H_ */ diff --git a/libc/calls/struct/iovec.internal.h b/libc/calls/struct/iovec.internal.h index cfa58b479..6c6a3661a 100644 --- a/libc/calls/struct/iovec.internal.h +++ b/libc/calls/struct/iovec.internal.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ -#include "libc/intrin/fds.h" #include "libc/calls/struct/iovec.h" +#include "libc/intrin/fds.h" #include "libc/mem/alloca.h" COSMOPOLITAN_C_START_ @@ -22,8 +22,8 @@ ssize_t sys_send_nt(int, const struct iovec *, size_t, uint32_t); ssize_t sys_sendto_nt(int, const struct iovec *, size_t, uint32_t, const void *, uint32_t); -const char *DescribeIovec(char[300], ssize_t, const struct iovec *, int); -#define DescribeIovec(x, y, z) DescribeIovec(alloca(300), x, y, z) +const char *_DescribeIovec(char[300], ssize_t, const struct iovec *, int); +#define DescribeIovec(x, y, z) _DescribeIovec(alloca(300), x, y, z) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_INTERNAL_H_ */ diff --git a/libc/calls/struct/itimerval.internal.h b/libc/calls/struct/itimerval.internal.h index ababa1bee..9bad9b7a0 100644 --- a/libc/calls/struct/itimerval.internal.h +++ b/libc/calls/struct/itimerval.internal.h @@ -8,8 +8,8 @@ int sys_getitimer(int, struct itimerval *); int sys_setitimer(int, const struct itimerval *, struct itimerval *); int sys_setitimer_nt(int, const struct itimerval *, struct itimerval *); -const char *DescribeItimerval(char[90], int, const struct itimerval *); -#define DescribeItimerval(rc, ts) DescribeItimerval(alloca(90), rc, ts) +const char *_DescribeItimerval(char[90], int, const struct itimerval *); +#define DescribeItimerval(rc, ts) _DescribeItimerval(alloca(90), rc, ts) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_ITIMERVAL_INTERNAL_H_ */ diff --git a/libc/calls/struct/rlimit.internal.h b/libc/calls/struct/rlimit.internal.h index fa8ce9200..5818c6d5a 100644 --- a/libc/calls/struct/rlimit.internal.h +++ b/libc/calls/struct/rlimit.internal.h @@ -8,8 +8,8 @@ int sys_getrlimit(int, struct rlimit *); int sys_setrlimit(int, const struct rlimit *); int sys_setrlimit_nt(int, const struct rlimit *); -const char *DescribeRlimit(char[64], int, const struct rlimit *); -#define DescribeRlimit(rc, rl) DescribeRlimit(alloca(64), rc, rl) +const char *_DescribeRlimit(char[64], int, const struct rlimit *); +#define DescribeRlimit(rc, rl) _DescribeRlimit(alloca(64), rc, rl) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_RLIMIT_INTERNAL_H_ */ diff --git a/libc/calls/struct/sched_param.internal.h b/libc/calls/struct/sched_param.internal.h index 9df42312e..565d661b3 100644 --- a/libc/calls/struct/sched_param.internal.h +++ b/libc/calls/struct/sched_param.internal.h @@ -4,8 +4,8 @@ #include "libc/mem/alloca.h" COSMOPOLITAN_C_START_ -const char *DescribeSchedParam(char[32], const struct sched_param *); -#define DescribeSchedParam(x) DescribeSchedParam(alloca(32), x) +const char *_DescribeSchedParam(char[32], const struct sched_param *); +#define DescribeSchedParam(x) _DescribeSchedParam(alloca(32), x) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SCHED_PARAM_INTERNAL_H_ */ diff --git a/libc/calls/struct/sigaction.internal.h b/libc/calls/struct/sigaction.internal.h index bf69a81db..19b1177a5 100644 --- a/libc/calls/struct/sigaction.internal.h +++ b/libc/calls/struct/sigaction.internal.h @@ -66,8 +66,8 @@ void __sigenter_netbsd(int, siginfo_t *, void *); void __sigenter_freebsd(int, siginfo_t *, void *); void __sigenter_openbsd(int, siginfo_t *, void *); -const char *DescribeSigaction(char[256], int, const struct sigaction *); -#define DescribeSigaction(rc, sa) DescribeSigaction(alloca(256), rc, sa) +const char *_DescribeSigaction(char[256], int, const struct sigaction *); +#define DescribeSigaction(rc, sa) _DescribeSigaction(alloca(256), rc, sa) void _init_onntconsoleevent(void); diff --git a/libc/calls/struct/sigaltstack.internal.h b/libc/calls/struct/sigaltstack.internal.h index c95eea696..b2416b560 100644 --- a/libc/calls/struct/sigaltstack.internal.h +++ b/libc/calls/struct/sigaltstack.internal.h @@ -4,8 +4,8 @@ #include "libc/mem/alloca.h" COSMOPOLITAN_C_START_ -const char *DescribeSigaltstack(char[128], int, const struct sigaltstack *); -#define DescribeSigaltstack(rc, ss) DescribeSigaltstack(alloca(128), rc, ss) +const char *_DescribeSigaltstack(char[128], int, const struct sigaltstack *); +#define DescribeSigaltstack(rc, ss) _DescribeSigaltstack(alloca(128), rc, ss) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGALTSTACK_INTERNAL_H_ */ diff --git a/libc/calls/struct/siginfo.internal.h b/libc/calls/struct/siginfo.internal.h index 99b2e4eda..d5479c464 100644 --- a/libc/calls/struct/siginfo.internal.h +++ b/libc/calls/struct/siginfo.internal.h @@ -6,8 +6,8 @@ COSMOPOLITAN_C_START_ int sys_sigqueueinfo(int, const siginfo_t *); -const char *DescribeSiginfo(char[300], int, const siginfo_t *); -#define DescribeSiginfo(x, y) DescribeSiginfo(alloca(300), x, y) +const char *_DescribeSiginfo(char[300], int, const siginfo_t *); +#define DescribeSiginfo(x, y) _DescribeSiginfo(alloca(300), x, y) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGINFO_INTERNAL_H_ */ diff --git a/libc/calls/struct/sigset.internal.h b/libc/calls/struct/sigset.internal.h index ad4fe0a78..b31093dbb 100644 --- a/libc/calls/struct/sigset.internal.h +++ b/libc/calls/struct/sigset.internal.h @@ -34,8 +34,8 @@ int sys_sigprocmask(int, const sigset_t *, sigset_t *); int sys_sigsuspend(const uint64_t *, uint64_t); int sys_sigpending(uint64_t *, size_t); -const char *DescribeSigset(char[128], int, const sigset_t *); -#define DescribeSigset(rc, ss) DescribeSigset(alloca(128), rc, ss) +const char *_DescribeSigset(char[128], int, const sigset_t *); +#define DescribeSigset(rc, ss) _DescribeSigset(alloca(128), rc, ss) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGSET_INTERNAL_H_ */ diff --git a/libc/calls/struct/stat.internal.h b/libc/calls/struct/stat.internal.h index 5d1c9fed6..eb9aa1ca6 100644 --- a/libc/calls/struct/stat.internal.h +++ b/libc/calls/struct/stat.internal.h @@ -13,8 +13,8 @@ int sys_fstatat_nt(int, const char *, struct stat *, int); int sys_lstat_nt(const char *, struct stat *); int sys_fstat_metal(int, struct stat *); -const char *DescribeStat(char[300], int, const struct stat *); -#define DescribeStat(rc, st) DescribeStat(alloca(300), rc, st) +const char *_DescribeStat(char[300], int, const struct stat *); +#define DescribeStat(rc, st) _DescribeStat(alloca(300), rc, st) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STAT_INTERNAL_H_ */ diff --git a/libc/calls/struct/statfs.internal.h b/libc/calls/struct/statfs.internal.h index ab3919628..b98073dc4 100644 --- a/libc/calls/struct/statfs.internal.h +++ b/libc/calls/struct/statfs.internal.h @@ -12,8 +12,8 @@ int sys_fstatfs_nt(int64_t, struct statfs *); int sys_statfs_nt(const char *, struct statfs *); void statfs2statvfs(struct statvfs *, const struct statfs *); -const char *DescribeStatfs(char[300], int, const struct statfs *); -#define DescribeStatfs(rc, sf) DescribeStatfs(alloca(300), rc, sf) +const char *_DescribeStatfs(char[300], int, const struct statfs *); +#define DescribeStatfs(rc, sf) _DescribeStatfs(alloca(300), rc, sf) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STATFS_INTERNAL_H_ */ diff --git a/libc/calls/struct/termios.internal.h b/libc/calls/struct/termios.internal.h index c116d4d04..ac85545dc 100644 --- a/libc/calls/struct/termios.internal.h +++ b/libc/calls/struct/termios.internal.h @@ -4,9 +4,9 @@ #include "libc/mem/alloca.h" COSMOPOLITAN_C_START_ -const char *DescribeTermios(char[1024], ssize_t, const struct termios *); +const char *_DescribeTermios(char[1024], ssize_t, const struct termios *); -#define DescribeTermios(rc, tio) DescribeTermios(alloca(1024), rc, tio) +#define DescribeTermios(rc, tio) _DescribeTermios(alloca(1024), rc, tio) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TERMIOS_INTERNAL_H_ */ diff --git a/libc/calls/struct/timespec.internal.h b/libc/calls/struct/timespec.internal.h index fc15a2061..bc4ff4d47 100644 --- a/libc/calls/struct/timespec.internal.h +++ b/libc/calls/struct/timespec.internal.h @@ -26,8 +26,8 @@ int sys_utimensat(int, const char *, const struct timespec[2], int); int sys_utimensat_nt(int, const char *, const struct timespec[2], int); int sys_utimensat_old(int, const char *, const struct timespec[2], int); -const char *DescribeTimespec(char[45], int, const struct timespec *); -#define DescribeTimespec(rc, ts) DescribeTimespec(alloca(45), rc, ts) +const char *_DescribeTimespec(char[45], int, const struct timespec *); +#define DescribeTimespec(rc, ts) _DescribeTimespec(alloca(45), rc, ts) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMESPEC_INTERNAL_H_ */ diff --git a/libc/calls/struct/timeval.internal.h b/libc/calls/struct/timeval.internal.h index ceaf8f73e..a3cf06847 100644 --- a/libc/calls/struct/timeval.internal.h +++ b/libc/calls/struct/timeval.internal.h @@ -11,8 +11,8 @@ int sys_lutimes(const char *, const struct timeval *); int sys_utimes(const char *, const struct timeval *); int sys_utimes_nt(const char *, const struct timeval[2]); -const char *DescribeTimeval(char[45], int, const struct timeval *); -#define DescribeTimeval(rc, ts) DescribeTimeval(alloca(45), rc, ts) +const char *_DescribeTimeval(char[45], int, const struct timeval *); +#define DescribeTimeval(rc, ts) _DescribeTimeval(alloca(45), rc, ts) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TIMEVAL_INTERNAL_H_ */ diff --git a/libc/calls/struct/winsize.internal.h b/libc/calls/struct/winsize.internal.h index 642b995d8..8c5e07fad 100644 --- a/libc/calls/struct/winsize.internal.h +++ b/libc/calls/struct/winsize.internal.h @@ -1,13 +1,13 @@ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ -#include "libc/intrin/fds.h" #include "libc/calls/struct/winsize.h" +#include "libc/intrin/fds.h" #include "libc/mem/alloca.h" COSMOPOLITAN_C_START_ int tcgetwinsize_nt(int, struct winsize *); -const char *DescribeWinsize(char[64], int, const struct winsize *); -#define DescribeWinsize(rc, ws) DescribeWinsize(alloca(64), rc, ws) +const char *_DescribeWinsize(char[64], int, const struct winsize *); +#define DescribeWinsize(rc, ws) _DescribeWinsize(alloca(64), rc, ws) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_WINSIZE_INTERNAL_H_ */ diff --git a/libc/fmt/magnumstrs.internal.h b/libc/fmt/magnumstrs.internal.h index 77833499c..8899b27ce 100644 --- a/libc/fmt/magnumstrs.internal.h +++ b/libc/fmt/magnumstrs.internal.h @@ -28,7 +28,8 @@ extern const struct MagnumStr kSockOptnames[]; extern const struct MagnumStr kTcpOptnames[]; extern const struct MagnumStr kPollNames[]; -const char *DescribeMagnum(char *, const struct MagnumStr *, const char *, int); +const char *_DescribeMagnum(char *, const struct MagnumStr *, const char *, + int); __funline const char *GetMagnumStr(const struct MagnumStr *ms, int x) { int i; diff --git a/libc/intrin/cp.c b/libc/intrin/cp.c index d65670cee..d98c36e66 100644 --- a/libc/intrin/cp.c +++ b/libc/intrin/cp.c @@ -53,7 +53,7 @@ void report_cancelation_point(int sysv_ordinal, int xnu_ordinal) { char bt[160]; struct StackFrame *bp = __builtin_frame_address(0); kprintf("error: report_cancelation_point(%#x, %#x) %s\n", sysv_ordinal, - xnu_ordinal, (DescribeBacktrace)(bt, bp)); + xnu_ordinal, _DescribeBacktrace(bt, bp)); __builtin_trap(); } diff --git a/libc/intrin/createfile.c b/libc/intrin/createfile.c index 265675a1b..3bac501f4 100644 --- a/libc/intrin/createfile.c +++ b/libc/intrin/createfile.c @@ -57,11 +57,11 @@ TryAgain: opt_lpSecurity, dwCreationDisposition, dwFlagsAndAttributes, opt_hTemplateFile); NTTRACE("CreateFile(%#hs, %s, %s, %s, %s, %s, %ld) → {%ld, %d}", lpFileName, - (DescribeNtFileAccessFlags)(buf_accessflags, dwDesiredAccess), - (DescribeNtFileShareFlags)(buf_shareflags, dwShareMode), - (DescribeNtSecurityAttributes)(buf_secattr, opt_lpSecurity), - DescribeNtCreationDisposition(dwCreationDisposition), - (DescribeNtFileFlagAttr)(buf_flagattr, dwFlagsAndAttributes), + _DescribeNtFileAccessFlags(buf_accessflags, dwDesiredAccess), + _DescribeNtFileShareFlags(buf_shareflags, dwShareMode), + _DescribeNtSecurityAttributes(buf_secattr, opt_lpSecurity), + _DescribeNtCreationDisposition(dwCreationDisposition), + _DescribeNtFileFlagAttr(buf_flagattr, dwFlagsAndAttributes), opt_hTemplateFile, hHandle, __imp_GetLastError()); if (hHandle == -1) { switch (__imp_GetLastError()) { diff --git a/libc/intrin/describearchprctlcode.c b/libc/intrin/describearchprctlcode.c index 9c1fea1f9..b260b73ba 100644 --- a/libc/intrin/describearchprctlcode.c +++ b/libc/intrin/describearchprctlcode.c @@ -21,7 +21,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/arch.h" -const char *(DescribeArchPrctlCode)(char buf[12], int x) { +const char *_DescribeArchPrctlCode(char buf[12], int x) { if (x == ARCH_SET_FS) return "ARCH_SET_FS"; if (x == ARCH_GET_FS) diff --git a/libc/intrin/describebacktrace.c b/libc/intrin/describebacktrace.c index 440c4921c..8c92e93eb 100644 --- a/libc/intrin/describebacktrace.c +++ b/libc/intrin/describebacktrace.c @@ -39,8 +39,8 @@ privileged static char *FormatHex(char *p, unsigned long x) { return p; } -privileged dontinstrument const char *( - DescribeBacktrace)(char buf[N], const struct StackFrame *fr) { +privileged dontinstrument const char *_DescribeBacktrace( + char buf[N], const struct StackFrame *fr) { char *p = buf; char *pe = p + N; bool gotsome = false; diff --git a/libc/intrin/describebacktrace.h b/libc/intrin/describebacktrace.h index c9e600d66..ee8614317 100644 --- a/libc/intrin/describebacktrace.h +++ b/libc/intrin/describebacktrace.h @@ -4,8 +4,8 @@ #include "libc/nexgen32e/stackframe.h" COSMOPOLITAN_C_START_ -const char *DescribeBacktrace(char[160], const struct StackFrame *) libcesque; -#define DescribeBacktrace(x) DescribeBacktrace(alloca(160), x) +const char *_DescribeBacktrace(char[160], const struct StackFrame *) libcesque; +#define DescribeBacktrace(x) _DescribeBacktrace(alloca(160), x) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEBACKTRACE_H_ */ diff --git a/libc/intrin/describecancelstate.c b/libc/intrin/describecancelstate.c index 4b5856666..ccaa1d139 100644 --- a/libc/intrin/describecancelstate.c +++ b/libc/intrin/describecancelstate.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/thread/thread.h" -const char *(DescribeCancelState)(char buf[12], int err, int *state) { +const char *_DescribeCancelState(char buf[12], int err, int *state) { if (err) return "n/a"; if (!state) diff --git a/libc/intrin/describecapability.c b/libc/intrin/describecapability.c index 7ef9e97fd..67ddcf829 100644 --- a/libc/intrin/describecapability.c +++ b/libc/intrin/describecapability.c @@ -69,7 +69,7 @@ static const struct thatispacked { {CAP_CHECKPOINT_RESTORE, "CHECKPOINT_RESTORE"}, // }; -const char *(DescribeCapability)(char buf[32], int x) { +const char *_DescribeCapability(char buf[32], int x) { int i; for (i = 0; i < ARRAYLEN(kCapabilityName); ++i) { if (kCapabilityName[i].x == x) { diff --git a/libc/intrin/describeclockname.c b/libc/intrin/describeclockname.c index c8e704ca5..58d73b86f 100644 --- a/libc/intrin/describeclockname.c +++ b/libc/intrin/describeclockname.c @@ -22,6 +22,6 @@ /** * Describes clock_gettime() clock argument. */ -const char *(DescribeClockName)(char buf[32], int x) { - return DescribeMagnum(buf, kClockNames, "CLOCK_", x); +const char *_DescribeClockName(char buf[32], int x) { + return _DescribeMagnum(buf, kClockNames, "CLOCK_", x); } diff --git a/libc/intrin/describecontrolkeystate.c b/libc/intrin/describecontrolkeystate.c index f8231d108..f2e75e300 100644 --- a/libc/intrin/describecontrolkeystate.c +++ b/libc/intrin/describecontrolkeystate.c @@ -32,7 +32,7 @@ static const struct DescribeFlags kControlKeyState[] = { {kNtEnhancedKey, "EnhancedKey"}, // }; -const char *(DescribeControlKeyState)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kControlKeyState, ARRAYLEN(kControlKeyState), - "kNt", x); +const char *_DescribeControlKeyState(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kControlKeyState, ARRAYLEN(kControlKeyState), + "kNt", x); } diff --git a/libc/intrin/describedirfd.c b/libc/intrin/describedirfd.c index 6b33d8ebf..36f729296 100644 --- a/libc/intrin/describedirfd.c +++ b/libc/intrin/describedirfd.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/at.h" -const char *(DescribeDirfd)(char buf[12], int dirfd) { +const char *_DescribeDirfd(char buf[12], int dirfd) { if (dirfd == AT_FDCWD) return "AT_FDCWD"; FormatInt32(buf, dirfd); diff --git a/libc/intrin/describednotify.c b/libc/intrin/describednotify.c index 2739ccca1..2a56e1557 100644 --- a/libc/intrin/describednotify.c +++ b/libc/intrin/describednotify.c @@ -31,7 +31,7 @@ static const struct DescribeFlags kDnotifyFlags[] = { {DN_MULTISHOT, "MULTISHOT"}, // }; -const char *(DescribeDnotifyFlags)(char buf[80], int x) { - return DescribeFlags(buf, 80, kDnotifyFlags, ARRAYLEN(kDnotifyFlags), "DN_", - x); +const char *_DescribeDnotifyFlags(char buf[80], int x) { + return _DescribeFlags(buf, 80, kDnotifyFlags, ARRAYLEN(kDnotifyFlags), "DN_", + x); } diff --git a/libc/intrin/describeerrnoresult.c b/libc/intrin/describeerrnoresult.c index 0deed696e..9f3817e02 100644 --- a/libc/intrin/describeerrnoresult.c +++ b/libc/intrin/describeerrnoresult.c @@ -22,7 +22,7 @@ #include "libc/log/libfatal.internal.h" #include "libc/str/str.h" -const char *(DescribeErrno)(char buf[30], int ax) { +const char *_DescribeErrno(char buf[30], int ax) { char *p = buf; const char *s; if (ax < 0) { diff --git a/libc/intrin/describefcntlcmd.c b/libc/intrin/describefcntlcmd.c index bcebd1b19..dbdef8513 100644 --- a/libc/intrin/describefcntlcmd.c +++ b/libc/intrin/describefcntlcmd.c @@ -21,7 +21,7 @@ #include "libc/intrin/describeflags.h" #include "libc/str/str.h" -const char *(DescribeFcntlCmd)(char buf[20], int x) { +const char *_DescribeFcntlCmd(char buf[20], int x) { const char *s; if (x >= 0 && (s = GetMagnumStr(kFcntlCmds, x))) { buf[0] = 'F'; diff --git a/libc/intrin/describefdset.c b/libc/intrin/describefdset.c index 1ef26444d..62ffccaad 100644 --- a/libc/intrin/describefdset.c +++ b/libc/intrin/describefdset.c @@ -26,7 +26,7 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeFdSet)(char buf[N], ssize_t rc, int nfds, fd_set *fds) { +const char *_DescribeFdSet(char buf[N], ssize_t rc, int nfds, fd_set *fds) { int o = 0; if (!fds) diff --git a/libc/intrin/describeflags.c b/libc/intrin/describeflags.c index 10aa0ea1c..b4ea4ed98 100644 --- a/libc/intrin/describeflags.c +++ b/libc/intrin/describeflags.c @@ -18,8 +18,8 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/intrin/describeflags.h" -const char *DescribeFlags(char *p, size_t n, const struct DescribeFlags *d, - size_t m, const char *prefix, unsigned x) { +const char *_DescribeFlags(char *p, size_t n, const struct DescribeFlags *d, + size_t m, const char *prefix, unsigned x) { bool t; char b[21]; size_t i, j, k; diff --git a/libc/intrin/describeflags.h b/libc/intrin/describeflags.h index 9bcf96218..917ef0f46 100644 --- a/libc/intrin/describeflags.h +++ b/libc/intrin/describeflags.h @@ -8,121 +8,121 @@ struct thatispacked DescribeFlags { const char *name; }; -const char *DescribeFlags(char *, size_t, const struct DescribeFlags *, size_t, - const char *, unsigned) libcesque; +const char *_DescribeFlags(char *, size_t, const struct DescribeFlags *, + size_t, const char *, unsigned) libcesque; -const char *DescribeArchPrctlCode(char[12], int) libcesque; -const char *DescribeCancelState(char[12], int, int *) libcesque; -const char *DescribeClockName(char[32], int) libcesque; -const char *DescribeControlKeyState(char[64], uint32_t) libcesque; -const char *DescribeDirfd(char[12], int) libcesque; -const char *DescribeDnotifyFlags(char[80], int) libcesque; -const char *DescribeErrno(char[30], int) libcesque; -const char *DescribeFcntlCmd(char[20], int) libcesque; -const char *DescribeFlockType(char[12], int) libcesque; -const char *DescribeFutexOp(char[64], int) libcesque; -const char *DescribeHow(char[12], int) libcesque; -const char *DescribeInOutInt64(char[23], ssize_t, int64_t *) libcesque; -const char *DescribeItimer(char[12], int) libcesque; -const char *DescribeMapFlags(char[64], int) libcesque; -const char *DescribeMapping(char[8], int, int) libcesque; -const char *DescribeMremapFlags(char[30], int) libcesque; -const char *DescribeMsyncFlags(char[48], int) libcesque; -const char *DescribeNtConsoleInFlags(char[256], uint32_t) libcesque; -const char *DescribeNtConsoleOutFlags(char[128], uint32_t) libcesque; -const char *DescribeNtCreationDisposition(uint32_t) libcesque; -const char *DescribeNtFileAccessFlags(char[512], uint32_t) libcesque; -const char *DescribeNtFileFlagAttr(char[256], uint32_t) libcesque; -const char *DescribeNtFileMapFlags(char[64], uint32_t) libcesque; -const char *DescribeNtFileShareFlags(char[64], uint32_t) libcesque; -const char *DescribeNtFiletypeFlags(char[64], uint32_t) libcesque; -const char *DescribeNtLockFileFlags(char[64], uint32_t) libcesque; -const char *DescribeNtMovFileInpFlags(char[256], uint32_t) libcesque; -const char *DescribeNtPageFlags(char[64], uint32_t) libcesque; -const char *DescribeNtPipeModeFlags(char[64], uint32_t) libcesque; -const char *DescribeNtPipeOpenFlags(char[64], uint32_t) libcesque; -const char *DescribeNtProcAccessFlags(char[256], uint32_t) libcesque; -const char *DescribeNtStartFlags(char[128], uint32_t) libcesque; -const char *DescribeNtSymlinkFlags(char[64], uint32_t) libcesque; -const char *DescribeOpenFlags(char[128], int) libcesque; -const char *DescribeOpenMode(char[15], int, int) libcesque; -const char *DescribePersonalityFlags(char[128], int) libcesque; -const char *DescribePollFlags(char[64], int) libcesque; -const char *DescribeProtFlags(char[48], int) libcesque; -const char *DescribePtrace(char[12], int) libcesque; -const char *DescribePtraceEvent(char[32], int) libcesque; -const char *DescribeRlimitName(char[20], int) libcesque; -const char *DescribeSchedPolicy(char[48], int) libcesque; -const char *DescribeSeccompOperation(int) libcesque; -const char *DescribeSiCode(char[20], int, int) libcesque; -const char *DescribeSigaltstackFlags(char[22], int) libcesque; -const char *DescribeSleepFlags(char[16], int) libcesque; -const char *DescribeSockLevel(char[12], int) libcesque; -const char *DescribeSockOptname(char[32], int, int) libcesque; -const char *DescribeSocketFamily(char[12], int) libcesque; -const char *DescribeSocketProtocol(char[12], int) libcesque; -const char *DescribeSocketType(char[64], int) libcesque; -const char *DescribeStdioState(char[12], int) libcesque; -const char *DescribeStringList(char[300], char *const[]) libcesque; -const char *DescribeThreadCreateFlags(char[64], uint32_t) libcesque; -const char *DescribeVirtualKeyCode(char[32], uint32_t) libcesque; -const char *DescribeWhence(char[12], int) libcesque; -const char *DescribeWhichPrio(char[12], int) libcesque; +const char *_DescribeArchPrctlCode(char[12], int) libcesque; +const char *_DescribeCancelState(char[12], int, int *) libcesque; +const char *_DescribeClockName(char[32], int) libcesque; +const char *_DescribeControlKeyState(char[64], uint32_t) libcesque; +const char *_DescribeDirfd(char[12], int) libcesque; +const char *_DescribeDnotifyFlags(char[80], int) libcesque; +const char *_DescribeErrno(char[30], int) libcesque; +const char *_DescribeFcntlCmd(char[20], int) libcesque; +const char *_DescribeFlockType(char[12], int) libcesque; +const char *_DescribeFutexOp(char[64], int) libcesque; +const char *_DescribeHow(char[12], int) libcesque; +const char *_DescribeInOutInt64(char[23], ssize_t, int64_t *) libcesque; +const char *_DescribeItimer(char[12], int) libcesque; +const char *_DescribeMapFlags(char[64], int) libcesque; +const char *_DescribeMapping(char[8], int, int) libcesque; +const char *_DescribeMremapFlags(char[30], int) libcesque; +const char *_DescribeMsyncFlags(char[48], int) libcesque; +const char *_DescribeNtConsoleInFlags(char[256], uint32_t) libcesque; +const char *_DescribeNtConsoleOutFlags(char[128], uint32_t) libcesque; +const char *_DescribeNtCreationDisposition(uint32_t) libcesque; +const char *_DescribeNtFileAccessFlags(char[512], uint32_t) libcesque; +const char *_DescribeNtFileFlagAttr(char[256], uint32_t) libcesque; +const char *_DescribeNtFileMapFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtFileShareFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtFiletypeFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtLockFileFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtMovFileInpFlags(char[256], uint32_t) libcesque; +const char *_DescribeNtPageFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtPipeModeFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtPipeOpenFlags(char[64], uint32_t) libcesque; +const char *_DescribeNtProcAccessFlags(char[256], uint32_t) libcesque; +const char *_DescribeNtStartFlags(char[128], uint32_t) libcesque; +const char *_DescribeNtSymlinkFlags(char[64], uint32_t) libcesque; +const char *_DescribeOpenFlags(char[128], int) libcesque; +const char *_DescribeOpenMode(char[15], int, int) libcesque; +const char *_DescribePersonalityFlags(char[128], int) libcesque; +const char *_DescribePollFlags(char[64], int) libcesque; +const char *_DescribeProtFlags(char[48], int) libcesque; +const char *_DescribePtrace(char[12], int) libcesque; +const char *_DescribePtraceEvent(char[32], int) libcesque; +const char *_DescribeRlimitName(char[20], int) libcesque; +const char *_DescribeSchedPolicy(char[48], int) libcesque; +const char *_DescribeSeccompOperation(int) libcesque; +const char *_DescribeSiCode(char[20], int, int) libcesque; +const char *_DescribeSigaltstackFlags(char[22], int) libcesque; +const char *_DescribeSleepFlags(char[16], int) libcesque; +const char *_DescribeSockLevel(char[12], int) libcesque; +const char *_DescribeSockOptname(char[32], int, int) libcesque; +const char *_DescribeSocketFamily(char[12], int) libcesque; +const char *_DescribeSocketProtocol(char[12], int) libcesque; +const char *_DescribeSocketType(char[64], int) libcesque; +const char *_DescribeStdioState(char[12], int) libcesque; +const char *_DescribeStringList(char[300], char *const[]) libcesque; +const char *_DescribeThreadCreateFlags(char[64], uint32_t) libcesque; +const char *_DescribeVirtualKeyCode(char[32], uint32_t) libcesque; +const char *_DescribeWhence(char[12], int) libcesque; +const char *_DescribeWhichPrio(char[12], int) libcesque; -#define DescribeCancelState(x, y) DescribeCancelState(alloca(12), x, y) -#define DescribeClockName(x) DescribeClockName(alloca(32), x) -#define DescribeControlKeyState(x) DescribeControlKeyState(alloca(64), x) -#define DescribeDirfd(x) DescribeDirfd(alloca(12), x) -#define DescribeDnotifyFlags(x) DescribeDnotifyFlags(alloca(80), x) -#define DescribeErrno(x) DescribeErrno(alloca(30), x) -#define DescribeFcntlCmd(x) DescribeFcntlCmd(alloca(20), x) -#define DescribeFlockType(x) DescribeFlockType(alloca(12), x) -#define DescribeFutexOp(x) DescribeFutexOp(alloca(64), x) -#define DescribeHow(x) DescribeHow(alloca(12), x) -#define DescribeInOutInt64(rc, x) DescribeInOutInt64(alloca(23), rc, x) -#define DescribeItimer(x) DescribeItimer(alloca(12), x) -#define DescribeMapFlags(x) DescribeMapFlags(alloca(64), x) -#define DescribeMapping(x, y) DescribeMapping(alloca(8), x, y) -#define DescribeMremapFlags(x) DescribeMremapFlags(alloca(30), x) -#define DescribeMsyncFlags(x) DescribeMsyncFlags(alloca(48), x) -#define DescribeNtConsoleInFlags(x) DescribeNtConsoleInFlags(alloca(256), x) -#define DescribeNtConsoleOutFlags(x) DescribeNtConsoleOutFlags(alloca(128), x) -#define DescribeNtFileAccessFlags(x) DescribeNtFileAccessFlags(alloca(512), x) -#define DescribeNtFileFlagAttr(x) DescribeNtFileFlagAttr(alloca(256), x) -#define DescribeNtFileMapFlags(x) DescribeNtFileMapFlags(alloca(64), x) -#define DescribeNtFileShareFlags(x) DescribeNtFileShareFlags(alloca(64), x) -#define DescribeNtFiletypeFlags(x) DescribeNtFiletypeFlags(alloca(64), x) -#define DescribeNtLockFileFlags(x) DescribeNtLockFileFlags(alloca(64), x) -#define DescribeNtMovFileInpFlags(x) DescribeNtMovFileInpFlags(alloca(256), x) -#define DescribeNtPageFlags(x) DescribeNtPageFlags(alloca(64), x) -#define DescribeNtPipeModeFlags(x) DescribeNtPipeModeFlags(alloca(64), x) -#define DescribeNtPipeOpenFlags(x) DescribeNtPipeOpenFlags(alloca(64), x) -#define DescribeNtProcAccessFlags(x) DescribeNtProcAccessFlags(alloca(256), x) -#define DescribeNtStartFlags(x) DescribeNtStartFlags(alloca(128), x) -#define DescribeNtSymlinkFlags(x) DescribeNtSymlinkFlags(alloca(64), x) -#define DescribeOpenFlags(x) DescribeOpenFlags(alloca(128), x) -#define DescribeOpenMode(x, y) DescribeOpenMode(alloca(15), x, y) -#define DescribePersonalityFlags(p) DescribePersonalityFlags(alloca(128), p) -#define DescribePollFlags(p) DescribePollFlags(alloca(64), p) -#define DescribeProtFlags(x) DescribeProtFlags(alloca(48), x) -#define DescribePtrace(i) DescribePtrace(alloca(12), i) -#define DescribePtraceEvent(x) DescribePtraceEvent(alloca(32), x) -#define DescribeRlimitName(rl) DescribeRlimitName(alloca(20), rl) -#define DescribeSchedPolicy(x) DescribeSchedPolicy(alloca(48), x) -#define DescribeSiCode(x, y) DescribeSiCode(alloca(20), x, y) -#define DescribeSigaltstackFlags(x) DescribeSigaltstackFlags(alloca(22), x) -#define DescribeSleepFlags(x) DescribeSleepFlags(alloca(16), x) -#define DescribeSockLevel(x) DescribeSockLevel(alloca(12), x) -#define DescribeSockOptname(x, y) DescribeSockOptname(alloca(32), x, y) -#define DescribeSocketFamily(x) DescribeSocketFamily(alloca(12), x) -#define DescribeSocketProtocol(x) DescribeSocketProtocol(alloca(12), x) -#define DescribeSocketType(x) DescribeSocketType(alloca(64), x) -#define DescribeStdioState(x) DescribeStdioState(alloca(12), x) -#define DescribeStringList(x) DescribeStringList(alloca(300), x) -#define DescribeThreadCreateFlags(x) DescribeThreadCreateFlags(alloca(64), x) -#define DescribeVirtualKeyCode(x) DescribeVirtualKeyCode(alloca(32), x) -#define DescribeWhence(x) DescribeWhence(alloca(12), x) -#define DescribeWhichPrio(x) DescribeWhichPrio(alloca(12), x) +#define DescribeCancelState(x, y) _DescribeCancelState(alloca(12), x, y) +#define DescribeClockName(x) _DescribeClockName(alloca(32), x) +#define DescribeControlKeyState(x) _DescribeControlKeyState(alloca(64), x) +#define DescribeDirfd(x) _DescribeDirfd(alloca(12), x) +#define DescribeDnotifyFlags(x) _DescribeDnotifyFlags(alloca(80), x) +#define DescribeErrno(x) _DescribeErrno(alloca(30), x) +#define DescribeFcntlCmd(x) _DescribeFcntlCmd(alloca(20), x) +#define DescribeFlockType(x) _DescribeFlockType(alloca(12), x) +#define DescribeFutexOp(x) _DescribeFutexOp(alloca(64), x) +#define DescribeHow(x) _DescribeHow(alloca(12), x) +#define DescribeInOutInt64(rc, x) _DescribeInOutInt64(alloca(23), rc, x) +#define DescribeItimer(x) _DescribeItimer(alloca(12), x) +#define DescribeMapFlags(x) _DescribeMapFlags(alloca(64), x) +#define DescribeMapping(x, y) _DescribeMapping(alloca(8), x, y) +#define DescribeMremapFlags(x) _DescribeMremapFlags(alloca(30), x) +#define DescribeMsyncFlags(x) _DescribeMsyncFlags(alloca(48), x) +#define DescribeNtConsoleInFlags(x) _DescribeNtConsoleInFlags(alloca(256), x) +#define DescribeNtConsoleOutFlags(x) _DescribeNtConsoleOutFlags(alloca(128), x) +#define DescribeNtFileAccessFlags(x) _DescribeNtFileAccessFlags(alloca(512), x) +#define DescribeNtFileFlagAttr(x) _DescribeNtFileFlagAttr(alloca(256), x) +#define DescribeNtFileMapFlags(x) _DescribeNtFileMapFlags(alloca(64), x) +#define DescribeNtFileShareFlags(x) _DescribeNtFileShareFlags(alloca(64), x) +#define DescribeNtFiletypeFlags(x) _DescribeNtFiletypeFlags(alloca(64), x) +#define DescribeNtLockFileFlags(x) _DescribeNtLockFileFlags(alloca(64), x) +#define DescribeNtMovFileInpFlags(x) _DescribeNtMovFileInpFlags(alloca(256), x) +#define DescribeNtPageFlags(x) _DescribeNtPageFlags(alloca(64), x) +#define DescribeNtPipeModeFlags(x) _DescribeNtPipeModeFlags(alloca(64), x) +#define DescribeNtPipeOpenFlags(x) _DescribeNtPipeOpenFlags(alloca(64), x) +#define DescribeNtProcAccessFlags(x) _DescribeNtProcAccessFlags(alloca(256), x) +#define DescribeNtStartFlags(x) _DescribeNtStartFlags(alloca(128), x) +#define DescribeNtSymlinkFlags(x) _DescribeNtSymlinkFlags(alloca(64), x) +#define DescribeOpenFlags(x) _DescribeOpenFlags(alloca(128), x) +#define DescribeOpenMode(x, y) _DescribeOpenMode(alloca(15), x, y) +#define DescribePersonalityFlags(p) _DescribePersonalityFlags(alloca(128), p) +#define DescribePollFlags(p) _DescribePollFlags(alloca(64), p) +#define DescribeProtFlags(x) _DescribeProtFlags(alloca(48), x) +#define DescribePtrace(i) _DescribePtrace(alloca(12), i) +#define DescribePtraceEvent(x) _DescribePtraceEvent(alloca(32), x) +#define DescribeRlimitName(rl) _DescribeRlimitName(alloca(20), rl) +#define DescribeSchedPolicy(x) _DescribeSchedPolicy(alloca(48), x) +#define DescribeSiCode(x, y) _DescribeSiCode(alloca(20), x, y) +#define DescribeSigaltstackFlags(x) _DescribeSigaltstackFlags(alloca(22), x) +#define DescribeSleepFlags(x) _DescribeSleepFlags(alloca(16), x) +#define DescribeSockLevel(x) _DescribeSockLevel(alloca(12), x) +#define DescribeSockOptname(x, y) _DescribeSockOptname(alloca(32), x, y) +#define DescribeSocketFamily(x) _DescribeSocketFamily(alloca(12), x) +#define DescribeSocketProtocol(x) _DescribeSocketProtocol(alloca(12), x) +#define DescribeSocketType(x) _DescribeSocketType(alloca(64), x) +#define DescribeStdioState(x) _DescribeStdioState(alloca(12), x) +#define DescribeStringList(x) _DescribeStringList(alloca(300), x) +#define DescribeThreadCreateFlags(x) _DescribeThreadCreateFlags(alloca(64), x) +#define DescribeVirtualKeyCode(x) _DescribeVirtualKeyCode(alloca(32), x) +#define DescribeWhence(x) _DescribeWhence(alloca(12), x) +#define DescribeWhichPrio(x) _DescribeWhichPrio(alloca(12), x) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBEFLAGS_INTERNAL_H_ */ diff --git a/libc/intrin/describeflock.c b/libc/intrin/describeflock.c index ea7b744bd..7f95445c4 100644 --- a/libc/intrin/describeflock.c +++ b/libc/intrin/describeflock.c @@ -27,7 +27,7 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeFlock)(char buf[N], int cmd, const struct flock *l) { +const char *_DescribeFlock(char buf[N], int cmd, const struct flock *l) { int o = 0; if (!l) diff --git a/libc/intrin/describeflocktype.c b/libc/intrin/describeflocktype.c index 67c13a024..ffb13879f 100644 --- a/libc/intrin/describeflocktype.c +++ b/libc/intrin/describeflocktype.c @@ -19,7 +19,7 @@ #include "libc/fmt/itoa.h" #include "libc/sysv/consts/f.h" -const char *(DescribeFlockType)(char buf[12], int x) { +const char *_DescribeFlockType(char buf[12], int x) { if (x == F_RDLCK) return "F_RDLCK"; if (x == F_WRLCK) diff --git a/libc/intrin/describefutexop.c b/libc/intrin/describefutexop.c index 7a4b0c783..7777a4755 100644 --- a/libc/intrin/describefutexop.c +++ b/libc/intrin/describefutexop.c @@ -21,7 +21,7 @@ #include "libc/str/str.h" #include "libc/sysv/consts/futex.h" -const char *(DescribeFutexOp)(char buf[64], int x) { +const char *_DescribeFutexOp(char buf[64], int x) { bool priv = false; if (x & FUTEX_PRIVATE_FLAG) { diff --git a/libc/intrin/describegidlist.c b/libc/intrin/describegidlist.c index c2c106136..f915da80b 100644 --- a/libc/intrin/describegidlist.c +++ b/libc/intrin/describegidlist.c @@ -25,8 +25,8 @@ #define N 128 -const char *(DescribeGidList)(char buf[N], int rc, int size, - const uint32_t list[]) { +const char *_DescribeGidList(char buf[N], int rc, int size, + const uint32_t list[]) { if ((rc == -1) || (size < 0)) return "n/a"; if (!size) diff --git a/libc/intrin/describehow.c b/libc/intrin/describehow.c index f4fc6798d..9a92abd7a 100644 --- a/libc/intrin/describehow.c +++ b/libc/intrin/describehow.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/sig.h" -const char *(DescribeHow)(char buf[12], int how) { +const char *_DescribeHow(char buf[12], int how) { if (how == SIG_BLOCK) return "SIG_BLOCK"; if (how == SIG_UNBLOCK) diff --git a/libc/intrin/describeinoutint64.c b/libc/intrin/describeinoutint64.c index 49fe1015b..19a8f31ad 100644 --- a/libc/intrin/describeinoutint64.c +++ b/libc/intrin/describeinoutint64.c @@ -20,7 +20,7 @@ #include "libc/fmt/itoa.h" #include "libc/intrin/describeflags.h" -const char *(DescribeInOutInt64)(char buf[23], ssize_t rc, int64_t *x) { +const char *_DescribeInOutInt64(char buf[23], ssize_t rc, int64_t *x) { if (!x) return "NULL"; char *p = buf; diff --git a/libc/intrin/describeiovec.c b/libc/intrin/describeiovec.c index a39c69c3f..30a2f3afb 100644 --- a/libc/intrin/describeiovec.c +++ b/libc/intrin/describeiovec.c @@ -27,8 +27,8 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeIovec)(char buf[N], ssize_t rc, const struct iovec *iov, - int iovlen) { +const char *_DescribeIovec(char buf[N], ssize_t rc, const struct iovec *iov, + int iovlen) { const char *d; int i, j, o = 0; diff --git a/libc/intrin/describeiovnt.c b/libc/intrin/describeiovnt.c index 58e60ec41..e33b493fb 100644 --- a/libc/intrin/describeiovnt.c +++ b/libc/intrin/describeiovnt.c @@ -22,7 +22,7 @@ #include "libc/macros.h" #include "libc/nt/winsock.h" -void DescribeIovNt(const struct NtIovec *iov, uint32_t iovlen, ssize_t rem) { +void _DescribeIovNt(const struct NtIovec *iov, uint32_t iovlen, ssize_t rem) { int i; if (kisdangerous(iov)) { kprintf("%p", iov); diff --git a/libc/intrin/describeitimer.c b/libc/intrin/describeitimer.c index 98c4e2a8c..aa1f96c75 100644 --- a/libc/intrin/describeitimer.c +++ b/libc/intrin/describeitimer.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/itimer.h" -const char *(DescribeItimer)(char buf[12], int which) { +const char *_DescribeItimer(char buf[12], int which) { if (which == ITIMER_REAL) return "ITIMER_REAL"; if (which == ITIMER_VIRTUAL) diff --git a/libc/intrin/describeitimerval.c b/libc/intrin/describeitimerval.c index 1e5661f50..94af2a008 100644 --- a/libc/intrin/describeitimerval.c +++ b/libc/intrin/describeitimerval.c @@ -25,8 +25,8 @@ #define N 90 -const char *(DescribeItimerval)(char buf[N], int rc, - const struct itimerval *it) { +const char *_DescribeItimerval(char buf[N], int rc, + const struct itimerval *it) { if (!it) return "NULL"; if (rc == -1) diff --git a/libc/intrin/describemagnums.c b/libc/intrin/describemagnums.c index fe76de780..c5540cfc1 100644 --- a/libc/intrin/describemagnums.c +++ b/libc/intrin/describemagnums.c @@ -20,8 +20,8 @@ #include "libc/fmt/magnumstrs.internal.h" #include "libc/str/str.h" -const char *DescribeMagnum(char *b, const struct MagnumStr *m, const char *p, - int x) { +const char *_DescribeMagnum(char *b, const struct MagnumStr *m, const char *p, + int x) { const char *s; if (x == 127) return "CLOCK_INVALID"; diff --git a/libc/intrin/describemapflags.c b/libc/intrin/describemapflags.c index e46b28a3d..9367ee083 100644 --- a/libc/intrin/describemapflags.c +++ b/libc/intrin/describemapflags.c @@ -22,7 +22,7 @@ #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/prot.h" -const char *(DescribeMapFlags)(char buf[64], int x) { +const char *_DescribeMapFlags(char buf[64], int x) { const struct DescribeFlags kMapFlags[] = { {MAP_PRIVATE, "PRIVATE"}, // {MAP_ANONYMOUS, "ANONYMOUS"}, // @@ -36,5 +36,5 @@ const char *(DescribeMapFlags)(char buf[64], int x) { {MAP_NONBLOCK, "NONBLOCK"}, // {MAP_POPULATE, "POPULATE"}, // }; - return DescribeFlags(buf, 64, kMapFlags, ARRAYLEN(kMapFlags), "MAP_", x); + return _DescribeFlags(buf, 64, kMapFlags, ARRAYLEN(kMapFlags), "MAP_", x); } diff --git a/libc/intrin/describemapping.c b/libc/intrin/describemapping.c index 79f1cf706..6510e9848 100644 --- a/libc/intrin/describemapping.c +++ b/libc/intrin/describemapping.c @@ -45,7 +45,7 @@ char *DescribeProt(char p[4], int prot) { return p; } -const char *(DescribeMapping)(char p[8], int prot, int flags) { +const char *_DescribeMapping(char p[8], int prot, int flags) { /* asan runtime depends on this function */ DescribeProt(p, prot); p[3] = DescribeMapType(flags); diff --git a/libc/intrin/describemremapflags.c b/libc/intrin/describemremapflags.c index a4505131a..152f8a4ce 100644 --- a/libc/intrin/describemremapflags.c +++ b/libc/intrin/describemremapflags.c @@ -25,7 +25,7 @@ static const struct DescribeFlags kMremapFlags[] = { {MREMAP_FIXED, "FIXED"}, // }; -const char *(DescribeMremapFlags)(char buf[30], int x) { - return DescribeFlags(buf, 30, kMremapFlags, ARRAYLEN(kMremapFlags), "MREMAP_", - x); +const char *_DescribeMremapFlags(char buf[30], int x) { + return _DescribeFlags(buf, 30, kMremapFlags, ARRAYLEN(kMremapFlags), + "MREMAP_", x); } diff --git a/libc/intrin/describemsyncflags.c b/libc/intrin/describemsyncflags.c index 2223afe62..56a838e97 100644 --- a/libc/intrin/describemsyncflags.c +++ b/libc/intrin/describemsyncflags.c @@ -20,11 +20,11 @@ #include "libc/macros.h" #include "libc/sysv/consts/msync.h" -const char *(DescribeMsyncFlags)(char buf[48], int x) { +const char *_DescribeMsyncFlags(char buf[48], int x) { const struct DescribeFlags kMsyncFlags[] = { {MS_SYNC, "SYNC"}, // {MS_ASYNC, "ASYNC"}, // {MS_INVALIDATE, "INVALIDATE"}, // }; - return DescribeFlags(buf, 48, kMsyncFlags, ARRAYLEN(kMsyncFlags), "MS_", x); + return _DescribeFlags(buf, 48, kMsyncFlags, ARRAYLEN(kMsyncFlags), "MS_", x); } diff --git a/libc/intrin/describentconsolemodeinputflags.c b/libc/intrin/describentconsolemodeinputflags.c index fdea2e249..a53575481 100644 --- a/libc/intrin/describentconsolemodeinputflags.c +++ b/libc/intrin/describentconsolemodeinputflags.c @@ -33,7 +33,7 @@ static const struct DescribeFlags kConsoleModeInputFlags[] = { {kNtEnableVirtualTerminalInput, "VirtualTerminalInput"}, // }; -const char *(DescribeNtConsoleInFlags)(char buf[256], uint32_t x) { - return DescribeFlags(buf, 256, kConsoleModeInputFlags, - ARRAYLEN(kConsoleModeInputFlags), "kNtEnable", x); +const char *_DescribeNtConsoleInFlags(char buf[256], uint32_t x) { + return _DescribeFlags(buf, 256, kConsoleModeInputFlags, + ARRAYLEN(kConsoleModeInputFlags), "kNtEnable", x); } diff --git a/libc/intrin/describentconsolemodeoutputflags.c b/libc/intrin/describentconsolemodeoutputflags.c index 78f1d39d5..2686e765a 100644 --- a/libc/intrin/describentconsolemodeoutputflags.c +++ b/libc/intrin/describentconsolemodeoutputflags.c @@ -28,7 +28,7 @@ static const struct DescribeFlags kConsoleModeOutputFlags[] = { {kNtEnableLvbGridWorldwide, "EnableLvbGridWorldwide"}, // }; -const char *(DescribeNtConsoleOutFlags)(char buf[128], uint32_t x) { - return DescribeFlags(buf, 128, kConsoleModeOutputFlags, - ARRAYLEN(kConsoleModeOutputFlags), "kNt", x); +const char *_DescribeNtConsoleOutFlags(char buf[128], uint32_t x) { + return _DescribeFlags(buf, 128, kConsoleModeOutputFlags, + ARRAYLEN(kConsoleModeOutputFlags), "kNt", x); } diff --git a/libc/intrin/describentcreationdisposition.c b/libc/intrin/describentcreationdisposition.c index 136a8119f..00636b1f7 100644 --- a/libc/intrin/describentcreationdisposition.c +++ b/libc/intrin/describentcreationdisposition.c @@ -19,7 +19,7 @@ #include "libc/intrin/describeflags.h" #include "libc/nt/enum/creationdisposition.h" -const char *DescribeNtCreationDisposition(uint32_t x) { +const char *_DescribeNtCreationDisposition(uint32_t x) { switch (x) { case kNtCreateNew: return "kNtCreateNew"; diff --git a/libc/intrin/describentfileaccessflags.c b/libc/intrin/describentfileaccessflags.c index b1d935a55..582f519e4 100644 --- a/libc/intrin/describentfileaccessflags.c +++ b/libc/intrin/describentfileaccessflags.c @@ -72,7 +72,7 @@ static const struct DescribeFlags kFileAccessflags[] = { {kNtTokenAdjustSessionid, "kNtTokenAdjustSessionid"}, }; -const char *(DescribeNtFileAccessFlags)(char buf[512], uint32_t x) { - return DescribeFlags(buf, 512, kFileAccessflags, ARRAYLEN(kFileAccessflags), +const char *_DescribeNtFileAccessFlags(char buf[512], uint32_t x) { + return _DescribeFlags(buf, 512, kFileAccessflags, ARRAYLEN(kFileAccessflags), "", x); } diff --git a/libc/intrin/describentfileflagattr.c b/libc/intrin/describentfileflagattr.c index 5dc9ee8cc..4dc9528df 100644 --- a/libc/intrin/describentfileflagattr.c +++ b/libc/intrin/describentfileflagattr.c @@ -50,9 +50,9 @@ static const struct DescribeFlags kFileFlags[] = { {kNtFileFlagFirstPipeInstance, "FlagFirstPipeInstance"}, // }; -const char *(DescribeNtFileFlagAttr)(char buf[256], uint32_t x) { +const char *_DescribeNtFileFlagAttr(char buf[256], uint32_t x) { if (x == -1u) return "-1u"; - return DescribeFlags(buf, 256, kFileFlags, ARRAYLEN(kFileFlags), "kNtFile", - x); + return _DescribeFlags(buf, 256, kFileFlags, ARRAYLEN(kFileFlags), "kNtFile", + x); } diff --git a/libc/intrin/describentfilemapflags.c b/libc/intrin/describentfilemapflags.c index 316fb0894..08ba98242 100644 --- a/libc/intrin/describentfilemapflags.c +++ b/libc/intrin/describentfilemapflags.c @@ -30,7 +30,7 @@ static const struct DescribeFlags kFileMapFlags[] = { {kNtFileMapLargePages, "LargePages"}, // }; -const char *(DescribeNtFileMapFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kFileMapFlags, ARRAYLEN(kFileMapFlags), - "kNtFileMap", x); +const char *_DescribeNtFileMapFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kFileMapFlags, ARRAYLEN(kFileMapFlags), + "kNtFileMap", x); } diff --git a/libc/intrin/describentfileshareflags.c b/libc/intrin/describentfileshareflags.c index 49e771979..52f3aeee4 100644 --- a/libc/intrin/describentfileshareflags.c +++ b/libc/intrin/describentfileshareflags.c @@ -26,7 +26,7 @@ static const struct DescribeFlags kFileShareflags[] = { {kNtFileShareDelete, "Delete"}, // }; -const char *(DescribeNtFileShareFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kFileShareflags, ARRAYLEN(kFileShareflags), - "kNtFileShare", x); +const char *_DescribeNtFileShareFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kFileShareflags, ARRAYLEN(kFileShareflags), + "kNtFileShare", x); } diff --git a/libc/intrin/describentfiletypeflags.c b/libc/intrin/describentfiletypeflags.c index 5f7c9d134..7cecebc04 100644 --- a/libc/intrin/describentfiletypeflags.c +++ b/libc/intrin/describentfiletypeflags.c @@ -28,7 +28,7 @@ static const struct DescribeFlags kFiletypeFlags[] = { {kNtFileTypeChar, "Char"}, // }; -const char *(DescribeNtFiletypeFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kFiletypeFlags, ARRAYLEN(kFiletypeFlags), - "kNtFileType", x); +const char *_DescribeNtFiletypeFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kFiletypeFlags, ARRAYLEN(kFiletypeFlags), + "kNtFileType", x); } diff --git a/libc/intrin/describentlockfileflags.c b/libc/intrin/describentlockfileflags.c index a32a75bca..007b5c74d 100644 --- a/libc/intrin/describentlockfileflags.c +++ b/libc/intrin/describentlockfileflags.c @@ -25,7 +25,7 @@ static const struct DescribeFlags kNtLockFileFlags[] = { {kNtLockfileExclusiveLock, "ExclusiveLock"}, // }; -const char *(DescribeNtLockFileFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kNtLockFileFlags, ARRAYLEN(kNtLockFileFlags), - "kNtLockfile", x); +const char *_DescribeNtLockFileFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kNtLockFileFlags, ARRAYLEN(kNtLockFileFlags), + "kNtLockfile", x); } diff --git a/libc/intrin/describentmovfileinpflags.c b/libc/intrin/describentmovfileinpflags.c index e4ba860ca..311a3992b 100644 --- a/libc/intrin/describentmovfileinpflags.c +++ b/libc/intrin/describentmovfileinpflags.c @@ -29,7 +29,7 @@ static const struct DescribeFlags kMoveFileInputFlags[] = { {kNtMovefileFailIfNotTrackable, "FailIfNotTrackable"}, // }; -const char *(DescribeNtMovFileInpFlags)(char buf[256], uint32_t x) { - return DescribeFlags(buf, 256, kMoveFileInputFlags, - ARRAYLEN(kMoveFileInputFlags), "kNtMovefile", x); +const char *_DescribeNtMovFileInpFlags(char buf[256], uint32_t x) { + return _DescribeFlags(buf, 256, kMoveFileInputFlags, + ARRAYLEN(kMoveFileInputFlags), "kNtMovefile", x); } diff --git a/libc/intrin/describentoverlapped.c b/libc/intrin/describentoverlapped.c index c516c51d8..c21e231e5 100644 --- a/libc/intrin/describentoverlapped.c +++ b/libc/intrin/describentoverlapped.c @@ -20,7 +20,7 @@ #include "libc/intrin/kprintf.h" #include "libc/macros.h" -const char *(DescribeNtOverlapped)(char b[128], const struct NtOverlapped *o) { +const char *_DescribeNtOverlapped(char b[128], const struct NtOverlapped *o) { int i = 0, n = 128; bool gotsome = false; if (!o) diff --git a/libc/intrin/describentoverlapped.h b/libc/intrin/describentoverlapped.h index 009dad0c1..b7d97f6d3 100644 --- a/libc/intrin/describentoverlapped.h +++ b/libc/intrin/describentoverlapped.h @@ -4,8 +4,8 @@ #include "libc/nt/struct/overlapped.h" COSMOPOLITAN_C_START_ -const char *DescribeNtOverlapped(char[128], const struct NtOverlapped *); -#define DescribeNtOverlapped(x) DescribeNtOverlapped(alloca(128), x) +const char *_DescribeNtOverlapped(char[128], const struct NtOverlapped *); +#define DescribeNtOverlapped(x) _DescribeNtOverlapped(alloca(128), x) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_INTRIN_DESCRIBENTOVERLAPPED_INTERNAL_H_ */ diff --git a/libc/intrin/describentpageflags.c b/libc/intrin/describentpageflags.c index 55ef2e63c..aac644adb 100644 --- a/libc/intrin/describentpageflags.c +++ b/libc/intrin/describentpageflags.c @@ -41,6 +41,6 @@ static const struct DescribeFlags kPageFlags[] = { {kNtSecWritecombine, "SecWritecombine"}, // }; -const char *(DescribeNtPageFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kPageFlags, ARRAYLEN(kPageFlags), "kNt", x); +const char *_DescribeNtPageFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kPageFlags, ARRAYLEN(kPageFlags), "kNt", x); } diff --git a/libc/intrin/describentpipemodeflags.c b/libc/intrin/describentpipemodeflags.c index f64125eb8..0c8f58bfc 100644 --- a/libc/intrin/describentpipemodeflags.c +++ b/libc/intrin/describentpipemodeflags.c @@ -32,7 +32,7 @@ static const struct DescribeFlags kPipeModeFlags[] = { //{kNtPipeTypeByte, "TypeByte"}, // 0x00000000 }; -const char *(DescribeNtPipeModeFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kPipeModeFlags, ARRAYLEN(kPipeModeFlags), - "kNtPipe", x); +const char *_DescribeNtPipeModeFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kPipeModeFlags, ARRAYLEN(kPipeModeFlags), + "kNtPipe", x); } diff --git a/libc/intrin/describentpipeopenflags.c b/libc/intrin/describentpipeopenflags.c index 8f4b0d783..623075468 100644 --- a/libc/intrin/describentpipeopenflags.c +++ b/libc/intrin/describentpipeopenflags.c @@ -35,7 +35,7 @@ static const struct DescribeFlags kPipeOpenFlags[] = { {kNtAccessSystemSecurity, "kNtAccessSystemSecurity"}, }; -const char *(DescribeNtPipeOpenFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kPipeOpenFlags, ARRAYLEN(kPipeOpenFlags), "", - x); +const char *_DescribeNtPipeOpenFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kPipeOpenFlags, ARRAYLEN(kPipeOpenFlags), "", + x); } diff --git a/libc/intrin/describentprocaccessflags.c b/libc/intrin/describentprocaccessflags.c index 732f7df18..63b94754b 100644 --- a/libc/intrin/describentprocaccessflags.c +++ b/libc/intrin/describentprocaccessflags.c @@ -37,7 +37,7 @@ static const struct DescribeFlags kProcessAccessflags[] = { {kNtProcessSynchronize, "Synchronize"}, // }; -const char *(DescribeNtProcAccessFlags)(char buf[256], uint32_t x) { - return DescribeFlags(buf, 256, kProcessAccessflags, - ARRAYLEN(kProcessAccessflags), "kNtProcess", x); +const char *_DescribeNtProcAccessFlags(char buf[256], uint32_t x) { + return _DescribeFlags(buf, 256, kProcessAccessflags, + ARRAYLEN(kProcessAccessflags), "kNtProcess", x); } diff --git a/libc/intrin/describentsecurityattributes.c b/libc/intrin/describentsecurityattributes.c index 058c2a49f..674fe2f28 100644 --- a/libc/intrin/describentsecurityattributes.c +++ b/libc/intrin/describentsecurityattributes.c @@ -21,9 +21,8 @@ #include "libc/intrin/describeflags.h" #include "libc/nt/struct/securityattributes.h" -const char *( - DescribeNtSecurityAttributes)(char buf[32], - const struct NtSecurityAttributes *p) { +const char *_DescribeNtSecurityAttributes( + char buf[32], const struct NtSecurityAttributes *p) { FormatInt64(buf, (uintptr_t)p); return buf; } diff --git a/libc/intrin/describentstartflags.c b/libc/intrin/describentstartflags.c index 082dd026f..6af9c8744 100644 --- a/libc/intrin/describentstartflags.c +++ b/libc/intrin/describentstartflags.c @@ -38,7 +38,7 @@ static const struct DescribeFlags kNtStartFlags[] = { {kNtStartfUntrustedsource, "Untrustedsource"}, // }; -const char *(DescribeNtStartFlags)(char buf[128], uint32_t x) { - return DescribeFlags(buf, 128, kNtStartFlags, ARRAYLEN(kNtStartFlags), - "kNtStartf", x); +const char *_DescribeNtStartFlags(char buf[128], uint32_t x) { + return _DescribeFlags(buf, 128, kNtStartFlags, ARRAYLEN(kNtStartFlags), + "kNtStartf", x); } diff --git a/libc/intrin/describentsymlinkflags.c b/libc/intrin/describentsymlinkflags.c index 2da9dfb10..c9924fba5 100644 --- a/libc/intrin/describentsymlinkflags.c +++ b/libc/intrin/describentsymlinkflags.c @@ -25,7 +25,7 @@ static const struct DescribeFlags kSymbolicLinkflags[] = { {kNtSymbolicLinkFlagAllowUnprivilegedCreate, "AllowUnprivilegedCreate"}, // }; -const char *(DescribeNtSymlinkFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kSymbolicLinkflags, - ARRAYLEN(kSymbolicLinkflags), "kNtSymbolicLinkFlag", x); +const char *_DescribeNtSymlinkFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kSymbolicLinkflags, + ARRAYLEN(kSymbolicLinkflags), "kNtSymbolicLinkFlag", x); } diff --git a/libc/intrin/describeopenflags.c b/libc/intrin/describeopenflags.c index c8741e9ef..0f640288f 100644 --- a/libc/intrin/describeopenflags.c +++ b/libc/intrin/describeopenflags.c @@ -30,7 +30,7 @@ /** * Describes clock_gettime() clock argument. */ -const char *(DescribeOpenFlags)(char buf[128], int x) { +const char *_DescribeOpenFlags(char buf[128], int x) { char *p; int i, n; const char *pipe; @@ -68,7 +68,7 @@ const char *(DescribeOpenFlags)(char buf[128], int x) { d[i].flag = MAGNUM_NUMBER(kOpenFlags, i); d[i].name = MAGNUM_STRING(kOpenFlags, i); } - DescribeFlags(p, 128 - (p - buf), d, n, "O_", x); + _DescribeFlags(p, 128 - (p - buf), d, n, "O_", x); } return buf; } diff --git a/libc/intrin/describeopenmode.c b/libc/intrin/describeopenmode.c index bbfa86e8e..bfcc3397e 100644 --- a/libc/intrin/describeopenmode.c +++ b/libc/intrin/describeopenmode.c @@ -28,7 +28,7 @@ static bool IsCreatingFile(int flags) { (IsLinux() && (flags & O_TMPFILE_LINUX) == O_TMPFILE_LINUX); } -const char *(DescribeOpenMode)(char buf[15], int flags, int mode) { +const char *_DescribeOpenMode(char buf[15], int flags, int mode) { if (!IsCreatingFile(flags)) { return ""; } diff --git a/libc/intrin/describepersonalityflags.c b/libc/intrin/describepersonalityflags.c index ea2ce49ee..88fab3203 100644 --- a/libc/intrin/describepersonalityflags.c +++ b/libc/intrin/describepersonalityflags.c @@ -36,7 +36,7 @@ static const struct DescribeFlags kPersonalityFlags[] = { {UNAME26, "UNAME26"}, // }; -const char *(DescribePersonalityFlags)(char buf[128], int x) { - return DescribeFlags(buf, 128, kPersonalityFlags, ARRAYLEN(kPersonalityFlags), - "", x); +const char *_DescribePersonalityFlags(char buf[128], int x) { + return _DescribeFlags(buf, 128, kPersonalityFlags, + ARRAYLEN(kPersonalityFlags), "", x); } diff --git a/libc/intrin/describepollfds.c b/libc/intrin/describepollfds.c index 60691a984..94ebd2da5 100644 --- a/libc/intrin/describepollfds.c +++ b/libc/intrin/describepollfds.c @@ -28,8 +28,8 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribePollFds)(char buf[N], ssize_t rc, struct pollfd *fds, - size_t nfds) { +const char *_DescribePollFds(char buf[N], ssize_t rc, struct pollfd *fds, + size_t nfds) { char b64[64]; int i, o = 0; @@ -45,9 +45,9 @@ const char *(DescribePollFds)(char buf[N], ssize_t rc, struct pollfd *fds, for (i = 0; i < nfds; ++i) { if (i) append(", "); - append("{%d, %s", fds[i].fd, (DescribePollFlags)(b64, fds[i].events)); + append("{%d, %s", fds[i].fd, _DescribePollFlags(b64, fds[i].events)); if (rc >= 0) { - append(", [%s]", (DescribePollFlags)(b64, fds[i].revents)); + append(", [%s]", _DescribePollFlags(b64, fds[i].revents)); } append("}"); } diff --git a/libc/intrin/describepollflags.c b/libc/intrin/describepollflags.c index f552d9651..6445b4e54 100644 --- a/libc/intrin/describepollflags.c +++ b/libc/intrin/describepollflags.c @@ -21,7 +21,7 @@ #include "libc/nt/enum/filemapflags.h" #include "libc/sysv/consts/poll.h" -const char *(DescribePollFlags)(char buf[64], int x) { +const char *_DescribePollFlags(char buf[64], int x) { const struct DescribeFlags kPollFlags[] = { {POLLIN, "IN"}, // order matters {POLLOUT, "OUT"}, // order matters @@ -35,5 +35,5 @@ const char *(DescribePollFlags)(char buf[64], int x) { {POLLWRBAND, "WRBAND"}, // {POLLWRNORM, "WRNORM"}, // }; - return DescribeFlags(buf, 64, kPollFlags, ARRAYLEN(kPollFlags), "POLL", x); + return _DescribeFlags(buf, 64, kPollFlags, ARRAYLEN(kPollFlags), "POLL", x); } diff --git a/libc/intrin/describeprotflags.c b/libc/intrin/describeprotflags.c index 03492a9b2..44008757b 100644 --- a/libc/intrin/describeprotflags.c +++ b/libc/intrin/describeprotflags.c @@ -20,12 +20,12 @@ #include "libc/macros.h" #include "libc/sysv/consts/prot.h" -const char *(DescribeProtFlags)(char buf[48], int x) { +const char *_DescribeProtFlags(char buf[48], int x) { const struct DescribeFlags kProtFlags[] = { {PROT_READ, "READ"}, // {PROT_WRITE, "WRITE"}, // {PROT_EXEC, "EXEC"}, // {PROT_GUARD, "GUARD"}, // }; - return DescribeFlags(buf, 48, kProtFlags, ARRAYLEN(kProtFlags), "PROT_", x); + return _DescribeFlags(buf, 48, kProtFlags, ARRAYLEN(kProtFlags), "PROT_", x); } diff --git a/libc/intrin/describeptrace.c b/libc/intrin/describeptrace.c index d4c6f4fec..84baa0e5d 100644 --- a/libc/intrin/describeptrace.c +++ b/libc/intrin/describeptrace.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/ptrace.h" -const char *(DescribePtrace)(char buf[12], int x) { +const char *_DescribePtrace(char buf[12], int x) { if (x == -1) return "-1"; if (x == PTRACE_TRACEME) diff --git a/libc/intrin/describeptraceevent.c b/libc/intrin/describeptraceevent.c index b3ba1ee18..11c0c4699 100644 --- a/libc/intrin/describeptraceevent.c +++ b/libc/intrin/describeptraceevent.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/ptrace.h" -const char *(DescribePtraceEvent)(char buf[32], int x) { +const char *_DescribePtraceEvent(char buf[32], int x) { if (x == PTRACE_EVENT_FORK) return "PTRACE_EVENT_FORK"; if (x == PTRACE_EVENT_VFORK) diff --git a/libc/intrin/describerlimit.c b/libc/intrin/describerlimit.c index feb7574ee..7c58a965b 100644 --- a/libc/intrin/describerlimit.c +++ b/libc/intrin/describerlimit.c @@ -24,7 +24,7 @@ #include "libc/str/str.h" #include "libc/sysv/consts/rlim.h" -const char *DescribeRlimit(char buf[64], int rc, const struct rlimit *rlim) { +const char *_DescribeRlimit(char buf[64], int rc, const struct rlimit *rlim) { if (rc == -1) return "n/a"; if (!rlim) diff --git a/libc/intrin/describerlimitname.c b/libc/intrin/describerlimitname.c index 15ee5a7b9..1872e7792 100644 --- a/libc/intrin/describerlimitname.c +++ b/libc/intrin/describerlimitname.c @@ -22,8 +22,8 @@ /** * Describes setrlimit() / getrlimit() argument. */ -const char *(DescribeRlimitName)(char buf[20], int x) { +const char *_DescribeRlimitName(char buf[20], int x) { if (x == 127) return "n/a"; - return DescribeMagnum(buf, kRlimitNames, "RLIMIT_", x); + return _DescribeMagnum(buf, kRlimitNames, "RLIMIT_", x); } diff --git a/libc/intrin/describeschedparam.c b/libc/intrin/describeschedparam.c index 369f52d93..f559ffad5 100644 --- a/libc/intrin/describeschedparam.c +++ b/libc/intrin/describeschedparam.c @@ -24,7 +24,7 @@ /** * Describes clock_gettime() clock argument. */ -const char *(DescribeSchedParam)(char buf[32], const struct sched_param *x) { +const char *_DescribeSchedParam(char buf[32], const struct sched_param *x) { char *p; if (!x) return "0"; diff --git a/libc/intrin/describeschedpolicy.c b/libc/intrin/describeschedpolicy.c index 5e65a554f..24c7eb67c 100644 --- a/libc/intrin/describeschedpolicy.c +++ b/libc/intrin/describeschedpolicy.c @@ -26,7 +26,7 @@ /** * Describes clock_gettime() clock argument. */ -const char *(DescribeSchedPolicy)(char buf[48], int x) { +const char *_DescribeSchedPolicy(char buf[48], int x) { char *p = buf; if (x == -1) { goto DoNumber; diff --git a/libc/intrin/describeseccompoperation.c b/libc/intrin/describeseccompoperation.c index a18b18d6f..824f10841 100644 --- a/libc/intrin/describeseccompoperation.c +++ b/libc/intrin/describeseccompoperation.c @@ -19,7 +19,7 @@ #include "libc/calls/struct/seccomp.internal.h" #include "libc/intrin/describeflags.h" -const char *DescribeSeccompOperation(int x) { +const char *_DescribeSeccompOperation(int x) { switch (x) { case SECCOMP_SET_MODE_STRICT: return "SECCOMP_SET_MODE_STRICT"; diff --git a/libc/intrin/describesicode.c b/libc/intrin/describesicode.c index 56dcf898d..a9e33ca4a 100644 --- a/libc/intrin/describesicode.c +++ b/libc/intrin/describesicode.c @@ -38,7 +38,7 @@ static void NameIt(char p[20], const char *s, int si_code) { /** * Returns symbolic name for siginfo::si_code value. */ -const char *(DescribeSiCode)(char b[20], int sig, int si_code) { +const char *_DescribeSiCode(char b[20], int sig, int si_code) { NameIt(b, "SI_", si_code); if (si_code == SI_QUEUE) { strcpy(b + 3, "QUEUE"); /* sent by sigqueue(2) */ diff --git a/libc/intrin/describesigaction.c b/libc/intrin/describesigaction.c index e9c0413d3..5a7a417a6 100644 --- a/libc/intrin/describesigaction.c +++ b/libc/intrin/describesigaction.c @@ -51,15 +51,15 @@ static const char *DescribeSigFlags(char buf[64], int x) { {SA_ONESHOT, "ONESHOT"}, // {0x04000000, "RESTORER"}, // }; - return DescribeFlags(buf, 64, kSigFlags, ARRAYLEN(kSigFlags), "SA_", x); + return _DescribeFlags(buf, 64, kSigFlags, ARRAYLEN(kSigFlags), "SA_", x); } #define N 256 #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeSigaction)(char buf[N], int rc, - const struct sigaction *sa) { +const char *_DescribeSigaction(char buf[N], int rc, + const struct sigaction *sa) { int o = 0; char b64[64]; diff --git a/libc/intrin/describesigaltstack.c b/libc/intrin/describesigaltstack.c index 32cdb3bc2..71ed50335 100644 --- a/libc/intrin/describesigaltstack.c +++ b/libc/intrin/describesigaltstack.c @@ -21,8 +21,8 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" -const char *(DescribeSigaltstack)(char buf[128], int rc, - const struct sigaltstack *ss) { +const char *_DescribeSigaltstack(char buf[128], int rc, + const struct sigaltstack *ss) { if (rc == -1) return "n/a"; if (!ss) diff --git a/libc/intrin/describesigaltstackflags.c b/libc/intrin/describesigaltstackflags.c index 537ebae65..33354d07e 100644 --- a/libc/intrin/describesigaltstackflags.c +++ b/libc/intrin/describesigaltstackflags.c @@ -20,11 +20,11 @@ #include "libc/macros.h" #include "libc/sysv/consts/ss.h" -const char *(DescribeSigaltstackFlags)(char buf[22], int x) { +const char *_DescribeSigaltstackFlags(char buf[22], int x) { const struct DescribeFlags kSigaltstackFlags[] = { {SS_ONSTACK, "ONSTACK"}, // {SS_DISABLE, "DISABLE"}, // }; - return DescribeFlags(buf, 48, kSigaltstackFlags, ARRAYLEN(kSigaltstackFlags), - "SS_", x); + return _DescribeFlags(buf, 48, kSigaltstackFlags, ARRAYLEN(kSigaltstackFlags), + "SS_", x); } diff --git a/libc/intrin/describesiginfo.c b/libc/intrin/describesiginfo.c index 8235b078b..074e09442 100644 --- a/libc/intrin/describesiginfo.c +++ b/libc/intrin/describesiginfo.c @@ -29,7 +29,7 @@ #define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__) -const char *(DescribeSiginfo)(char buf[N], int rc, const siginfo_t *si) { +const char *_DescribeSiginfo(char buf[N], int rc, const siginfo_t *si) { int i = 0; if (rc == -1) diff --git a/libc/intrin/describesigset.c b/libc/intrin/describesigset.c index e05758d49..ee1529155 100644 --- a/libc/intrin/describesigset.c +++ b/libc/intrin/describesigset.c @@ -31,7 +31,7 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeSigset)(char buf[N], int rc, const sigset_t *ss) { +const char *_DescribeSigset(char buf[N], int rc, const sigset_t *ss) { int olderr; bool gotsome; const char *s; diff --git a/libc/intrin/describesleepflags.c b/libc/intrin/describesleepflags.c index 858a254f6..2bcfaf4d7 100644 --- a/libc/intrin/describesleepflags.c +++ b/libc/intrin/describesleepflags.c @@ -24,7 +24,7 @@ /** * Describes clock_nanosleep() flags argument. */ -const char *(DescribeSleepFlags)(char buf[16], int x) { +const char *_DescribeSleepFlags(char buf[16], int x) { switch (x) { case 0: return "0"; diff --git a/libc/intrin/describesocketfamily.c b/libc/intrin/describesocketfamily.c index e4bacb527..1144ec8da 100644 --- a/libc/intrin/describesocketfamily.c +++ b/libc/intrin/describesocketfamily.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/af.h" -const char *(DescribeSocketFamily)(char buf[12], int family) { +const char *_DescribeSocketFamily(char buf[12], int family) { if (family == AF_UNIX) return "AF_UNIX"; if (family == AF_INET) diff --git a/libc/intrin/describesocketprotocol.c b/libc/intrin/describesocketprotocol.c index 39086245f..16059fa1f 100644 --- a/libc/intrin/describesocketprotocol.c +++ b/libc/intrin/describesocketprotocol.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/ipproto.h" -const char *(DescribeSocketProtocol)(char buf[12], int family) { +const char *_DescribeSocketProtocol(char buf[12], int family) { if (family == IPPROTO_IP) return "IPPROTO_IP"; if (family == IPPROTO_ICMP) diff --git a/libc/intrin/describesockettype.c b/libc/intrin/describesockettype.c index f28ffc5b8..c8084b573 100644 --- a/libc/intrin/describesockettype.c +++ b/libc/intrin/describesockettype.c @@ -21,7 +21,7 @@ #include "libc/str/str.h" #include "libc/sysv/consts/sock.h" -const char *(DescribeSocketType)(char buf[64], int type) { +const char *_DescribeSocketType(char buf[64], int type) { int x; char *p; p = buf; diff --git a/libc/intrin/describesocklevel.c b/libc/intrin/describesocklevel.c index 8edadadc5..d2b981a36 100644 --- a/libc/intrin/describesocklevel.c +++ b/libc/intrin/describesocklevel.c @@ -23,7 +23,7 @@ /** * Describes setsockopt() level arguments. */ -const char *(DescribeSockLevel)(char buf[12], int x) { +const char *_DescribeSockLevel(char buf[12], int x) { if (x == SOL_SOCKET) return "SOL_SOCKET"; if (x == SOL_IP) diff --git a/libc/intrin/describesockoptname.c b/libc/intrin/describesockoptname.c index baf37f81b..adf162606 100644 --- a/libc/intrin/describesockoptname.c +++ b/libc/intrin/describesockoptname.c @@ -25,7 +25,7 @@ /** * Describes setsockopt() optname arguments. */ -const char *(DescribeSockOptname)(char buf[32], int l, int x) { +const char *_DescribeSockOptname(char buf[32], int l, int x) { char *p; const char *s; const struct MagnumStr *ms; diff --git a/libc/intrin/describestat.c b/libc/intrin/describestat.c index 102e58ef7..530708568 100644 --- a/libc/intrin/describestat.c +++ b/libc/intrin/describestat.c @@ -25,7 +25,7 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeStat)(char buf[N], int rc, const struct stat *st) { +const char *_DescribeStat(char buf[N], int rc, const struct stat *st) { int o = 0; if (rc == -1) diff --git a/libc/intrin/describestatfs.c b/libc/intrin/describestatfs.c index 787062edc..439fb925f 100644 --- a/libc/intrin/describestatfs.c +++ b/libc/intrin/describestatfs.c @@ -27,7 +27,7 @@ #define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__) -const char *(DescribeStatfs)(char buf[N], int rc, const struct statfs *f) { +const char *_DescribeStatfs(char buf[N], int rc, const struct statfs *f) { int i = 0; char ibuf[21]; int64_t flags; diff --git a/libc/intrin/describestdiostate.c b/libc/intrin/describestdiostate.c index 822bd2ed9..ec7fdba3e 100644 --- a/libc/intrin/describestdiostate.c +++ b/libc/intrin/describestdiostate.c @@ -21,7 +21,7 @@ #include "libc/intrin/describeflags.h" #include "libc/str/str.h" -const char *(DescribeStdioState)(char buf[12], int x) { +const char *_DescribeStdioState(char buf[12], int x) { if (!x) return ""; if (x == -1) diff --git a/libc/intrin/describestringlist.c b/libc/intrin/describestringlist.c index 9f0e5949f..67baea91e 100644 --- a/libc/intrin/describestringlist.c +++ b/libc/intrin/describestringlist.c @@ -24,7 +24,7 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeStringList)(char buf[N], char *const list[]) { +const char *_DescribeStringList(char buf[N], char *const list[]) { int i, o = 0; if (!list) diff --git a/libc/intrin/describetermios.c b/libc/intrin/describetermios.c index 36ad691bd..1cbb40694 100644 --- a/libc/intrin/describetermios.c +++ b/libc/intrin/describetermios.c @@ -29,8 +29,8 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeTermios)(char buf[N], ssize_t rc, - const struct termios *tio) { +const char *_DescribeTermios(char buf[N], ssize_t rc, + const struct termios *tio) { int o = 0; char b128[128]; @@ -61,7 +61,7 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc, {IUTF8, "IUTF8"}, // }; append(".c_iflag=%s", - DescribeFlags(b128, 128, kInput, ARRAYLEN(kInput), "", tio->c_iflag)); + _DescribeFlags(b128, 128, kInput, ARRAYLEN(kInput), "", tio->c_iflag)); struct DescribeFlags kOutput[] = { {OPOST, "OPOST"}, // @@ -83,8 +83,8 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc, {VT1, "VT1"}, // {FF1, "FF1"}, // }; - append(", .c_oflag=%s", DescribeFlags(b128, 128, kOutput, ARRAYLEN(kOutput), - "", tio->c_oflag)); + append(", .c_oflag=%s", _DescribeFlags(b128, 128, kOutput, ARRAYLEN(kOutput), + "", tio->c_oflag)); struct DescribeFlags kControl[] = { {CS8, "CS8"}, // @@ -98,8 +98,8 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc, {CLOCAL, "CLOCAL"}, // {CRTSCTS, "CRTSCTS"}, // }; - append(", .c_cflag=%s", DescribeFlags(b128, 128, kControl, ARRAYLEN(kControl), - "", tio->c_cflag)); + append(", .c_cflag=%s", _DescribeFlags(b128, 128, kControl, + ARRAYLEN(kControl), "", tio->c_cflag)); struct DescribeFlags kLocal[] = { {ISIG, "ISIG"}, // @@ -125,7 +125,7 @@ const char *(DescribeTermios)(char buf[N], ssize_t rc, ".c_cc[VTIME]=%d, " ".c_cc[VINTR]=CTRL(%#c), " ".c_cc[VQUIT]=CTRL(%#c)", - DescribeFlags(b128, 128, kLocal, ARRAYLEN(kLocal), "", tio->c_lflag), + _DescribeFlags(b128, 128, kLocal, ARRAYLEN(kLocal), "", tio->c_lflag), tio->c_cc[VMIN], tio->c_cc[VTIME], CTRL(tio->c_cc[VINTR]), CTRL(tio->c_cc[VQUIT])); diff --git a/libc/intrin/describethreadcreationflags.c b/libc/intrin/describethreadcreationflags.c index a53064a27..d77faee10 100644 --- a/libc/intrin/describethreadcreationflags.c +++ b/libc/intrin/describethreadcreationflags.c @@ -25,7 +25,7 @@ static const struct DescribeFlags kThreadCreationFlags[] = { {kNtStackSizeParamIsAReservation, "kNtStackSizeParamIsAReservation"}, // }; -const char *(DescribeThreadCreateFlags)(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kThreadCreationFlags, - ARRAYLEN(kThreadCreationFlags), "", x); +const char *_DescribeThreadCreateFlags(char buf[64], uint32_t x) { + return _DescribeFlags(buf, 64, kThreadCreationFlags, + ARRAYLEN(kThreadCreationFlags), "", x); } diff --git a/libc/intrin/describetimespec.c b/libc/intrin/describetimespec.c index a07f0c992..121c7f479 100644 --- a/libc/intrin/describetimespec.c +++ b/libc/intrin/describetimespec.c @@ -22,8 +22,7 @@ #include "libc/intrin/kprintf.h" #include "libc/str/str.h" -const char *(DescribeTimespec)(char buf[45], int rc, - const struct timespec *ts) { +const char *_DescribeTimespec(char buf[45], int rc, const struct timespec *ts) { if (rc == -1) return "n/a"; if (!ts) diff --git a/libc/intrin/describetimeval.c b/libc/intrin/describetimeval.c index 896b10c3d..10d0abb3d 100644 --- a/libc/intrin/describetimeval.c +++ b/libc/intrin/describetimeval.c @@ -21,7 +21,7 @@ #include "libc/intrin/describeflags.h" #include "libc/intrin/kprintf.h" -const char *(DescribeTimeval)(char buf[45], int rc, const struct timeval *tv) { +const char *_DescribeTimeval(char buf[45], int rc, const struct timeval *tv) { if (!tv) return "NULL"; if (rc == -1) diff --git a/libc/intrin/describevirtualkeycode.c b/libc/intrin/describevirtualkeycode.c index 4131b31f3..8655ca081 100644 --- a/libc/intrin/describevirtualkeycode.c +++ b/libc/intrin/describevirtualkeycode.c @@ -205,7 +205,7 @@ static const struct VirtualKeyCodeName { }; // clang-format on -const char *(DescribeVirtualKeyCode)(char buf[32], uint32_t x) { +const char *_DescribeVirtualKeyCode(char buf[32], uint32_t x) { for (int i = 0; i < ARRAYLEN(kVirtualKeyCodeNames); ++i) { if (x == kVirtualKeyCodeNames[i].code) { return kVirtualKeyCodeNames[i].name; diff --git a/libc/intrin/describewhence.c b/libc/intrin/describewhence.c index 3d166fcbd..3c0820b7c 100644 --- a/libc/intrin/describewhence.c +++ b/libc/intrin/describewhence.c @@ -20,7 +20,7 @@ #include "libc/fmt/itoa.h" #include "libc/intrin/describeflags.h" -const char *(DescribeWhence)(char buf[12], int whence) { +const char *_DescribeWhence(char buf[12], int whence) { if (whence == SEEK_SET) return "SEEK_SET"; if (whence == SEEK_CUR) diff --git a/libc/intrin/describewhichprio.c b/libc/intrin/describewhichprio.c index c72bf5eca..121e026f9 100644 --- a/libc/intrin/describewhichprio.c +++ b/libc/intrin/describewhichprio.c @@ -20,7 +20,7 @@ #include "libc/intrin/describeflags.h" #include "libc/sysv/consts/prio.h" -const char *(DescribeWhichPrio)(char buf[12], int x) { +const char *_DescribeWhichPrio(char buf[12], int x) { if (x == PRIO_PROCESS) return "PRIO_PROCESS"; if (x == PRIO_PGRP) diff --git a/libc/intrin/describewinsize.c b/libc/intrin/describewinsize.c index de671b7ea..a84c15907 100644 --- a/libc/intrin/describewinsize.c +++ b/libc/intrin/describewinsize.c @@ -28,7 +28,7 @@ #define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__) -const char *(DescribeWinsize)(char buf[N], int rc, const struct winsize *ws) { +const char *_DescribeWinsize(char buf[N], int rc, const struct winsize *ws) { int o = 0; if (!ws) return "NULL"; diff --git a/libc/intrin/mmap.c b/libc/intrin/mmap.c index 4a1c02486..f10287369 100644 --- a/libc/intrin/mmap.c +++ b/libc/intrin/mmap.c @@ -59,7 +59,7 @@ char bt[160]; \ struct StackFrame *bp = __builtin_frame_address(0); \ kprintf("%!s:%d: assertion failed: %!s\n", __FILE__, __LINE__, #x); \ - kprintf("bt %!s\n", (DescribeBacktrace)(bt, bp)); \ + kprintf("bt %!s\n", _DescribeBacktrace(bt, bp)); \ __print_maps(0); \ __builtin_trap(); \ } \ diff --git a/libc/intrin/printmaps.c b/libc/intrin/printmaps.c index 48a84127d..0747a50dc 100644 --- a/libc/intrin/printmaps.c +++ b/libc/intrin/printmaps.c @@ -35,7 +35,7 @@ void __print_maps(size_t limit) { for (struct Tree *e = tree_first(__maps.maps); e; e = tree_next(e)) { struct Map *map = MAP_TREE_CONTAINER(e); kprintf("%012lx-%012lx %!s", map->addr, map->addr + map->size, - (DescribeMapping)(mappingbuf, map->prot, map->flags)); + _DescribeMapping(mappingbuf, map->prot, map->flags)); sizefmt(sb, map->size, 1024); kprintf(" %!sb", sb); if (map->hand && map->hand != -1) diff --git a/libc/log/printwindowsmemory.c b/libc/log/printwindowsmemory.c index a305aae67..9353b00ee 100644 --- a/libc/log/printwindowsmemory.c +++ b/libc/log/printwindowsmemory.c @@ -33,8 +33,8 @@ static const struct DescribeFlags kNtMemState[] = { }; static const char *DescribeNtMemState(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kNtMemState, ARRAYLEN(kNtMemState), "kNtMem", - x); + return _DescribeFlags(buf, 64, kNtMemState, ARRAYLEN(kNtMemState), "kNtMem", + x); } static const struct DescribeFlags kNtMemType[] = { @@ -44,7 +44,7 @@ static const struct DescribeFlags kNtMemType[] = { }; static const char *DescribeNtMemType(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kNtMemType, ARRAYLEN(kNtMemType), "kNtMem", x); + return _DescribeFlags(buf, 64, kNtMemType, ARRAYLEN(kNtMemType), "kNtMem", x); } /** @@ -77,7 +77,7 @@ void PrintWindowsMemory(const char *high, size_t size) { mi.AllocationBase, mi.BaseAddress, b[0], DescribeNtMemState(b[1], mi.State), DescribeNtMemType(b[2], mi.Type), - (DescribeNtPageFlags)(b[3], mi.AllocationProtect), - (DescribeNtPageFlags)(b[4], mi.Protect), stop); + _DescribeNtPageFlags(b[3], mi.AllocationProtect), + _DescribeNtPageFlags(b[4], mi.Protect), stop); } } diff --git a/libc/proc/posix_spawn.c b/libc/proc/posix_spawn.c index 467c791be..e0f13f5a5 100644 --- a/libc/proc/posix_spawn.c +++ b/libc/proc/posix_spawn.c @@ -302,30 +302,30 @@ static textwindows errno_t posix_spawn_nt_impl( case _POSIX_SPAWN_CLOSE: err = spawnfds_close(&fds, a->fildes); STRACE("spawnfds_close(%d) → %s", a->fildes, - (DescribeErrno)(errno_buf, err)); + _DescribeErrno(errno_buf, err)); break; case _POSIX_SPAWN_DUP2: err = spawnfds_dup2(&fds, a->fildes, a->newfildes); STRACE("spawnfds_dup2(%d, %d) → %s", a->fildes, a->newfildes, - (DescribeErrno)(errno_buf, err)); + _DescribeErrno(errno_buf, err)); break; case _POSIX_SPAWN_OPEN: err = spawnfds_open(&fds, dirhand, a->path, a->oflag, a->mode, a->fildes); STRACE("spawnfds_open(%#s, %s, %s, %d) → %s", a->path, - (DescribeOpenFlags)(oflags_buf, a->oflag), - (DescribeOpenMode)(openmode_buf, a->oflag, a->mode), a->fildes, - (DescribeErrno)(errno_buf, err)); + _DescribeOpenFlags(oflags_buf, a->oflag), + _DescribeOpenMode(openmode_buf, a->oflag, a->mode), a->fildes, + _DescribeErrno(errno_buf, err)); break; case _POSIX_SPAWN_CHDIR: err = spawnfds_chdir(&fds, dirhand, a->path, &dirhand); STRACE("spawnfds_chdir(%#s) → %s", a->path, - (DescribeErrno)(errno_buf, err)); + _DescribeErrno(errno_buf, err)); break; case _POSIX_SPAWN_FCHDIR: err = spawnfds_fchdir(&fds, a->fildes, &dirhand); STRACE("spawnfds_fchdir(%d) → %s", a->fildes, - (DescribeErrno)(errno_buf, err)); + _DescribeErrno(errno_buf, err)); break; default: __builtin_unreachable(); diff --git a/libc/sock/select.internal.h b/libc/sock/select.internal.h index d565635a6..5de28441a 100644 --- a/libc/sock/select.internal.h +++ b/libc/sock/select.internal.h @@ -4,8 +4,8 @@ #include "libc/sock/select.h" COSMOPOLITAN_C_START_ -const char *DescribeFdSet(char[100], ssize_t, int, fd_set *) libcesque; -#define DescribeFdSet(x, y, z) DescribeFdSet(alloca(100), x, y, z) +const char *_DescribeFdSet(char[100], ssize_t, int, fd_set *) libcesque; +#define DescribeFdSet(x, y, z) _DescribeFdSet(alloca(100), x, y, z) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SOCK_SELECT_INTERNAL_H_ */ diff --git a/libc/sock/sockdebug.c b/libc/sock/sockdebug.c index d26bc3a4b..cb2631e04 100644 --- a/libc/sock/sockdebug.c +++ b/libc/sock/sockdebug.c @@ -28,8 +28,8 @@ #include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/sock.h" -const char *(DescribeSockaddr)(char buf[128], const struct sockaddr *sa, - size_t sasize) { +const char *_DescribeSockaddr(char buf[128], const struct sockaddr *sa, + size_t sasize) { int e; size_t n; char *p, ip[72]; diff --git a/libc/sock/struct/pollfd.internal.h b/libc/sock/struct/pollfd.internal.h index 70b452258..0594fa57c 100644 --- a/libc/sock/struct/pollfd.internal.h +++ b/libc/sock/struct/pollfd.internal.h @@ -13,8 +13,8 @@ int sys_ppoll(struct pollfd *, size_t, const struct timespec *, int sys_poll_metal(struct pollfd *, size_t, unsigned); int sys_poll_nt(struct pollfd *, uint64_t, uint32_t *, const sigset_t *); -const char *DescribePollFds(char[300], ssize_t, struct pollfd *, size_t); -#define DescribePollFds(x, y, z) DescribePollFds(alloca(300), x, y, z) +const char *_DescribePollFds(char[300], ssize_t, struct pollfd *, size_t); +#define DescribePollFds(x, y, z) _DescribePollFds(alloca(300), x, y, z) COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_POLLFD_INTERNAL_H_ */ diff --git a/libc/sock/struct/sockaddr.internal.h b/libc/sock/struct/sockaddr.internal.h index 59d996d4a..724478d2c 100644 --- a/libc/sock/struct/sockaddr.internal.h +++ b/libc/sock/struct/sockaddr.internal.h @@ -40,8 +40,8 @@ union sockaddr_storage_linux { struct sockaddr_un sun; }; -const char *DescribeSockaddr(char[128], const struct sockaddr *, size_t); -#define DescribeSockaddr(sa, sz) DescribeSockaddr(alloca(128), sa, sz) +const char *_DescribeSockaddr(char[128], const struct sockaddr *, size_t); +#define DescribeSockaddr(sa, sz) _DescribeSockaddr(alloca(128), sa, sz) void __convert_bsd_to_sockaddr(struct sockaddr_storage *); void __convert_sockaddr_to_bsd(struct sockaddr_storage *); diff --git a/libc/stdio/printargs.c b/libc/stdio/printargs.c index 16226c8c2..b21008128 100644 --- a/libc/stdio/printargs.c +++ b/libc/stdio/printargs.c @@ -306,7 +306,7 @@ textstartup void __printargs(const char *prologue) { if (i && (u.pfds[i].revents & POLLNVAL)) continue; PRINT(" ☼ %d (revents=%#hx fcntl(F_GETFL)=%s isatty()=%hhhd)", i, - u.pfds[i].revents, (DescribeOpenFlags)(oflagbuf, fcntl(i, F_GETFL)), + u.pfds[i].revents, _DescribeOpenFlags(oflagbuf, fcntl(i, F_GETFL)), isatty(i)); } } else { @@ -375,7 +375,7 @@ textstartup void __printargs(const char *prologue) { rlim.rlim_cur = -1; if (rlim.rlim_max == RLIM_INFINITY) rlim.rlim_max = -1; - PRINT(" ☼ %-20s %,16ld %,16ld", (DescribeRlimitName)(buf, i), + PRINT(" ☼ %-20s %,16ld %,16ld", _DescribeRlimitName(buf, i), rlim.rlim_cur, rlim.rlim_max); gotsome = true; } diff --git a/test/libc/calls/sigprocmask_test.c b/test/libc/calls/sigprocmask_test.c index e794b2b3c..5d378bb6b 100644 --- a/test/libc/calls/sigprocmask_test.c +++ b/test/libc/calls/sigprocmask_test.c @@ -45,7 +45,7 @@ const char *DescribeMask(void) { sigset_t ss; _Thread_local static char buf[128]; unassert(!sigprocmask(SIG_SETMASK, 0, &ss)); - return (DescribeSigset)(buf, 0, &ss); + return _DescribeSigset(buf, 0, &ss); } TEST(sigprocmask, testMultipleBlockedDeliveries) { diff --git a/test/libc/intrin/describeflags_test.c b/test/libc/intrin/describeflags_test.c index 65be2c1e7..a805f5605 100644 --- a/test/libc/intrin/describeflags_test.c +++ b/test/libc/intrin/describeflags_test.c @@ -27,7 +27,7 @@ static const struct DescribeFlags kFlags[] = { const char *DescribeIt(uint32_t x) { static char s[64]; - return DescribeFlags(s, ARRAYLEN(s), kFlags, ARRAYLEN(kFlags), "x", x); + return _DescribeFlags(s, ARRAYLEN(s), kFlags, ARRAYLEN(kFlags), "x", x); } TEST(describeflags, test) { diff --git a/tool/viz/rlimit.c b/tool/viz/rlimit.c index 1e4296b26..6923626ec 100644 --- a/tool/viz/rlimit.c +++ b/tool/viz/rlimit.c @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) { for (i = 0; i < RLIM_NLIMITS; ++i) { rc = getrlimit(i, &rlim); printf("SETRLIMIT(%-20s, %,16ld, %,16ld) → %d %s\n", - (DescribeRlimitName)(rlnbuf, i), rlim.rlim_cur, rlim.rlim_max, rc, + _DescribeRlimitName(rlnbuf, i), rlim.rlim_cur, rlim.rlim_max, rc, !rc ? "" : strerror(errno)); } diff --git a/tool/viz/virtualquery.c b/tool/viz/virtualquery.c index 27e0fc9e0..92558fa60 100644 --- a/tool/viz/virtualquery.c +++ b/tool/viz/virtualquery.c @@ -40,8 +40,8 @@ static const struct DescribeFlags kNtMemState[] = { }; const char *DescribeNtMemState(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kNtMemState, ARRAYLEN(kNtMemState), "kNtMem", - x); + return _DescribeFlags(buf, 64, kNtMemState, ARRAYLEN(kNtMemState), "kNtMem", + x); } static const struct DescribeFlags kNtMemType[] = { @@ -51,7 +51,7 @@ static const struct DescribeFlags kNtMemType[] = { }; const char *DescribeNtMemType(char buf[64], uint32_t x) { - return DescribeFlags(buf, 64, kNtMemType, ARRAYLEN(kNtMemType), "kNtMem", x); + return _DescribeFlags(buf, 64, kNtMemType, ARRAYLEN(kNtMemType), "kNtMem", x); } int main(int argc, char *argv[]) { @@ -72,8 +72,8 @@ int main(int argc, char *argv[]) { printf("%.12lx %.12lx %10s %16s %16s %32s %32s\n", mi.AllocationBase, mi.BaseAddress, b[0], DescribeNtMemState(b[1], mi.State), DescribeNtMemType(b[2], mi.Type), - (DescribeNtPageFlags)(b[3], mi.AllocationProtect), - (DescribeNtPageFlags)(b[4], mi.Protect)); + _DescribeNtPageFlags(b[3], mi.AllocationProtect), + _DescribeNtPageFlags(b[4], mi.Protect)); } } From 908b7a82cafc847dd72e81270ebbff22987fcef2 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 25 Aug 2024 11:02:31 -0700 Subject: [PATCH 38/39] Add VSCode settings --- .vscode/settings.json | 36 ++++++++++++++++++++++++++++++++++++ libc/dlopen/stubs.c | 2 +- libc/log/log.h | 3 --- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..8fba11c48 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,36 @@ +{ + "C_Cpp.default.compilerPath": ".cosmocc/3.7.1/bin/aarch64-linux-cosmo-c++", + "C_Cpp.default.compilerArgs": [ + "-nostdinc", + "-nostdlib", + "-iquote.", + "-isystemlibc/isystem", + "-isystemthird_party/libcxx", + "-includelibc/integral/normalize.inc", + "-D_COSMO_SOURCE", + "-D__aarch64__" + ], + "[c]": { + "editor.tabSize": 2, + "editor.insertSpaces": true + }, + "[cpp]": { + "editor.tabSize": 2, + "editor.insertSpaces": true + }, + "[makefile]": { + "editor.tabSize": 8, + "editor.insertSpaces": false + }, + "[make]": { + "editor.tabSize": 8, + "editor.insertSpaces": false + }, + "[assembly]": { + "editor.tabSize": 8, + "editor.insertSpaces": true + }, + "files.associations": { + "log.h": "c" + } +} \ No newline at end of file diff --git a/libc/dlopen/stubs.c b/libc/dlopen/stubs.c index 9a94e891b..57c3f0724 100644 --- a/libc/dlopen/stubs.c +++ b/libc/dlopen/stubs.c @@ -27,7 +27,7 @@ * * @return null always */ -void *dlopen(const char *, int) { +void *dlopen(const char *, int) { return 0; } diff --git a/libc/log/log.h b/libc/log/log.h index d8e62f7ea..7f2498cc4 100644 --- a/libc/log/log.h +++ b/libc/log/log.h @@ -48,8 +48,6 @@ void PrintGarbage(void); void PrintGarbageNumeric(FILE *); void PrintWindowsMemory(const char *, size_t); -#ifndef __STRICT_ANSI__ - #define _LOG_UNLIKELY(x) __builtin_expect(!!(x), 0) extern unsigned __log_level; /* log level for runtime check */ @@ -245,7 +243,6 @@ void vffatalf(ARGS, va_list) asm("vflogf") ATTRV relegated wontreturn libcesque; #undef ATTR #undef ATTRV -#endif /* __STRICT_ANSI__ */ COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_LOG_LOG_H_ */ #endif /* _COSMO_SOURCE */ From f3ce684aef3735be6b4fe27dd09cedf64fe6ebf6 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 25 Aug 2024 11:26:21 -0700 Subject: [PATCH 39/39] Fix getpeername() bug on Windows The WIN32 getpeername() function returns ENOTCONN when it uses connect() the SOCK_NONBLOCK way. So we simply store the address, provided earlier. --- libc/intrin/fds.h | 2 ++ libc/sock/connect-nt.c | 9 +++++- libc/sock/getsockname.c | 10 +++++-- test/libc/sock/connect_test.c | 53 +++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) diff --git a/libc/intrin/fds.h b/libc/intrin/fds.h index b9d0f490a..a2b7e228b 100644 --- a/libc/intrin/fds.h +++ b/libc/intrin/fds.h @@ -1,5 +1,6 @@ #ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_ +#include "libc/sock/struct/sockaddr.h" #include "libc/thread/thread.h" COSMOPOLITAN_C_START_ @@ -37,6 +38,7 @@ struct Fd { unsigned sndtimeo; /* millis; 0 means wait forever */ void *connect_op; struct Cursor *cursor; + struct sockaddr_storage peer; }; struct Fds { diff --git a/libc/sock/connect-nt.c b/libc/sock/connect-nt.c index 6fbd14937..1bcc1ced1 100644 --- a/libc/sock/connect-nt.c +++ b/libc/sock/connect-nt.c @@ -18,10 +18,11 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" #include "libc/atomic.h" -#include "libc/intrin/fds.h" #include "libc/calls/struct/sigset.internal.h" #include "libc/cosmo.h" #include "libc/errno.h" +#include "libc/intrin/fds.h" +#include "libc/macros.h" #include "libc/mem/mem.h" #include "libc/nt/enum/wsaid.h" #include "libc/nt/errors.h" @@ -34,6 +35,7 @@ #include "libc/sock/struct/sockaddr.h" #include "libc/sock/syscall_fd.internal.h" #include "libc/sock/wsaid.internal.h" +#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/sol.h" #include "libc/sysv/errfuns.h" @@ -109,6 +111,7 @@ static textwindows int sys_connect_nt_impl(struct Fd *f, const void *addr, // perform normal connect if (!(f->flags & O_NONBLOCK)) { + f->peer.ss_family = AF_UNSPEC; ssize_t rc = __winsock_block(f->handle, 0, false, f->sndtimeo, mask, sys_connect_nt_start, &(struct ConnectArgs){addr, addrsize}); @@ -122,6 +125,10 @@ static textwindows int sys_connect_nt_impl(struct Fd *f, const void *addr, return rc; } + // win32 getpeername() stops working in non-blocking connect mode + if (addrsize) + memcpy(&f->peer, addr, MIN(addrsize, sizeof(struct sockaddr_storage))); + // perform nonblocking connect(), i.e. // 1. connect(O_NONBLOCK) → EINPROGRESS // 2. poll(POLLOUT) diff --git a/libc/sock/getsockname.c b/libc/sock/getsockname.c index b09543f2f..cc596d4d0 100644 --- a/libc/sock/getsockname.c +++ b/libc/sock/getsockname.c @@ -17,8 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" -#include "libc/intrin/fds.h" #include "libc/dce.h" +#include "libc/intrin/fds.h" #include "libc/intrin/strace.h" #include "libc/nt/errors.h" #include "libc/nt/thunk/msabi.h" @@ -28,6 +28,7 @@ #include "libc/sock/struct/sockaddr.h" #include "libc/sock/struct/sockaddr.internal.h" #include "libc/sock/syscall_fd.internal.h" +#include "libc/sysv/consts/af.h" #include "libc/sysv/errfuns.h" __msabi extern typeof(__sys_getsockname_nt) *const __imp_getsockname; @@ -45,7 +46,12 @@ static int __getsockpeername(int fd, struct sockaddr *out_addr, if (IsWindows()) { if (__isfdkind(fd, kFdSocket)) { if ((rc = impl_win32(g_fds.p[fd].handle, &ss, &size))) { - if (impl_win32 == __imp_getsockname && WSAGetLastError() == WSAEINVAL) { + if (impl_win32 == __imp_getpeername && + g_fds.p[fd].peer.ss_family != AF_UNSPEC) { + ss = g_fds.p[fd].peer; + rc = 0; + } else if (impl_win32 == __imp_getsockname && + WSAGetLastError() == WSAEINVAL) { // The socket has not been bound to an address with bind, or // ADDR_ANY is specified in bind but connection has not yet // occurred. -MSDN diff --git a/test/libc/sock/connect_test.c b/test/libc/sock/connect_test.c index 806961eb0..60bca4bb8 100644 --- a/test/libc/sock/connect_test.c +++ b/test/libc/sock/connect_test.c @@ -34,6 +34,55 @@ #include "libc/testlib/testlib.h" #include "libc/thread/thread.h" +TEST(connect, blocking) { + char buf[16] = {0}; + atomic_uint *sem = _mapshared(sizeof(unsigned)); + uint32_t addrsize = sizeof(struct sockaddr_in); + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(0x7f000001), + }; + ASSERT_SYS(0, 3, socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); + ASSERT_SYS(0, 0, bind(3, (struct sockaddr *)&addr, sizeof(addr))); + ASSERT_SYS(0, 0, getsockname(3, (struct sockaddr *)&addr, &addrsize)); + ASSERT_SYS(0, 0, listen(3, SOMAXCONN)); + SPAWN(fork); + while (!*sem) + pthread_yield(); + ASSERT_SYS(0, 4, accept(3, (struct sockaddr *)&addr, &addrsize)); + ASSERT_SYS(0, 2, read(4, buf, 16)); // hi + ASSERT_SYS(0, 5, write(4, "hello", 5)); + ASSERT_SYS(0, 3, read(4, buf, 16)); // bye + PARENT(); + ASSERT_SYS(0, 0, close(3)); + ASSERT_SYS(0, 3, socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); + ASSERT_SYS(0, 0, connect(3, (struct sockaddr *)&addr, sizeof(addr))); + *sem = 1; + { // wait until connected + struct pollfd pfd = {3, POLLOUT}; + ASSERT_SYS(0, 1, poll(&pfd, 1, -1)); + ASSERT_TRUE(!!(POLLOUT & pfd.revents)); + } + struct sockaddr_in peer; + uint32_t sz = sizeof(peer); + ASSERT_SYS(0, 0, getsockname(3, (struct sockaddr *)&peer, &sz)); + ASSERT_EQ(htonl(0x7f000001), peer.sin_addr.s_addr); + ASSERT_SYS(0, 0, getpeername(3, (struct sockaddr *)&peer, &sz)); + ASSERT_EQ(htonl(0x7f000001), peer.sin_addr.s_addr); + ASSERT_SYS(0, 2, write(3, "hi", 2)); + { // wait for other process to send us stuff + struct pollfd pfd = {3, POLLIN}; + ASSERT_SYS(0, 1, poll(&pfd, 1, -1)); + ASSERT_TRUE(!!(POLLIN & pfd.revents)); + } + ASSERT_SYS(0, 5, read(3, buf, 16)); + ASSERT_STREQ("hello", buf); + ASSERT_SYS(0, 3, write(3, "bye", 3)); + ASSERT_SYS(0, 0, close(3)); + WAIT(exit, 0); + munmap(sem, sizeof(unsigned)); +} + TEST(connect, nonblocking) { if (IsFreebsd()) return; // TODO(jart): why did this start flaking? @@ -74,6 +123,10 @@ TEST(connect, nonblocking) { ASSERT_SYS(0, 1, poll(&pfd, 1, -1)); ASSERT_TRUE(!!(POLLOUT & pfd.revents)); } + struct sockaddr_in peer; + uint32_t sz = sizeof(peer); + ASSERT_SYS(0, 0, getpeername(3, (struct sockaddr *)&peer, &sz)); + ASSERT_EQ(htonl(0x7f000001), peer.sin_addr.s_addr); ASSERT_SYS(0, 2, write(3, "hi", 2)); { // wait for other process to send us stuff struct pollfd pfd = {3, POLLIN};