diff --git a/Makefile b/Makefile
index 1e9d4180c..1e50651fc 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@
# build/config.mk
SHELL = /bin/sh
-HOSTS ?= freebsd openbsd netbsd rhel7 rhel5 xnu win7 win10
+HOSTS ?= freebsd openbsd netbsd rhel7 rhel5 xnu #win7 win10
SANITY := $(shell build/sanitycheck $$PPID)
.SUFFIXES:
@@ -210,7 +210,7 @@ CHECKS = $(foreach x,$(PKGS),$($(x)_CHECKS))
bins: $(BINS)
check: $(CHECKS)
-test: $(TESTS) all
+test: $(TESTS)
depend: o/$(MODE)/depend
tags: TAGS HTAGS
diff --git a/ape/ape.S b/ape/ape.S
index f816582d0..83dd7c7dd 100644
--- a/ape/ape.S
+++ b/ape/ape.S
@@ -1070,18 +1070,12 @@ str.error:
str.crlf:
.asciz "\r\n"
.endobj str.crlf
-str.cpuid:
- .asciz "cpuid"
- .endobj str.cpuid
-str.oldskool:
- .asciz "oldskool"
- .endobj str.oldskool
str.e820:
.asciz "e820"
.endobj str.e820
-str.long:
- .asciz "nolong"
- .endobj str.long
+str.oldcpu:
+ .asciz "oldcpu"
+ .endobj str.oldcpu
// Serial Line Configuration (8250 UART 16550)
// If it's hacked, it'll at least get hacked very slowly.
@@ -1264,7 +1258,7 @@ longmodeloader:
lcheck: pushf # check for i8086 / i8088 / i80186
pop %ax
test $0x80,%ah # see intel manual volume 1 20.1.2
- jnz 9f # we now assume 32bit is supported
+ jnz 10f # we now assume 32bit is supported
pushfl # now check for i386 or early i486
pop %eax # test ability to change cpuid bit
mov %eax,%ecx
@@ -1275,7 +1269,7 @@ lcheck: pushf # check for i8086 / i8088 / i80186
pushfl
pop %eax
cmp %eax,%ecx
- je 12f # we assume cpuid inst is available
+ je 10f # we assume cpuid inst is available
or %ebx,%eax # puts cpuid bit in the on position
push %eax
popfl
@@ -1293,11 +1287,7 @@ lcheck: pushf # check for i8086 / i8088 / i80186
jne 10f
xor %ax,%ax
1: ret
-9: mov $REAL(str.oldskool),%di
- jmp 20f
-10: mov $REAL(str.long),%di
- jmp 20f
-12: mov $REAL(str.cpuid),%di
+10: mov $REAL(str.oldcpu),%di
20: call rldie
.endfn lcheck
diff --git a/build/bootstrap/ar.com b/build/bootstrap/ar.com
index 7e7731355..90bd84a8f 100755
Binary files a/build/bootstrap/ar.com and b/build/bootstrap/ar.com differ
diff --git a/build/bootstrap/compile.com b/build/bootstrap/compile.com
index 7e8a6e705..f6093f72d 100755
Binary files a/build/bootstrap/compile.com and b/build/bootstrap/compile.com differ
diff --git a/build/bootstrap/mkdeps.com b/build/bootstrap/mkdeps.com
index 92a6b88a7..9b9e0cc16 100755
Binary files a/build/bootstrap/mkdeps.com and b/build/bootstrap/mkdeps.com differ
diff --git a/build/bootstrap/package.com b/build/bootstrap/package.com
index 4266ab544..cdf356dd0 100755
Binary files a/build/bootstrap/package.com and b/build/bootstrap/package.com differ
diff --git a/build/definitions.mk b/build/definitions.mk
index 005cf546f..86c77d595 100644
--- a/build/definitions.mk
+++ b/build/definitions.mk
@@ -301,6 +301,9 @@ OBJECTIFY.greg.c = \
-fno-instrument-functions \
-fno-optimize-sibling-calls \
-fno-sanitize=all \
+ -ffreestanding \
+ -mno-fentry \
+ -fwrapv \
-c
OBJECTIFY.ansi.c = $(CC) $(OBJECTIFY.c.flags) -ansi -Wextra -Werror -pedantic-errors -c
diff --git a/dsp/mpeg/mpeg1.c b/dsp/mpeg/mpeg1.c
index 6a8471088..e3830207e 100644
--- a/dsp/mpeg/mpeg1.c
+++ b/dsp/mpeg/mpeg1.c
@@ -72,7 +72,8 @@ static const float PLM_VIDEO_PIXEL_ASPECT_RATIO[] = {
0.6735, /* 3:4? */
0.7031, /* MPEG-1 / MPEG-2 video encoding divergence? */
0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815,
- 1.0255, 1.0695, 1.0950, 1.1575, 1.2051};
+ 1.0255, 1.0695, 1.0950, 1.1575, 1.2051,
+};
static const float PLM_VIDEO_PICTURE_RATE[] = {
23.976, /* NTSC-Film */
diff --git a/dsp/scale/gyarados.c b/dsp/scale/gyarados.c
index f996378ce..5367ce4e0 100644
--- a/dsp/scale/gyarados.c
+++ b/dsp/scale/gyarados.c
@@ -101,7 +101,7 @@ struct SamplingSolution *ComputeSamplingSolution(long dn, long sn, double dar,
if (!off) off = (dar - 1) / 2;
f = dar < 1 ? 1 / dar : dar;
s = 3 * f + 4;
- fweights = gc(xcalloc(s, sizeof(double)));
+ fweights = gc(xcalloc(s + /*xxx*/ 2, sizeof(double)));
res = NewSamplingSolution(dn, s);
weights = res->weights;
indices = res->indices;
diff --git a/examples/auto-launch-gdb-on-crash.c b/examples/auto-launch-gdb-on-crash.c
index 734b870ef..24b18c57e 100644
--- a/examples/auto-launch-gdb-on-crash.c
+++ b/examples/auto-launch-gdb-on-crash.c
@@ -18,9 +18,12 @@
* make -j12 o//examples/auto-launch-gdb-on-crash.com
* o//examples/auto-launch-gdb-on-crash.com
*
- * Backtrace is logged instead if run outside interactive terminal.
- * Environmental factors such as GDB, MAKEFLAGS, ADDR2LINE, TERM, and
- * isatty(STDERR_FILENO) should also be taken into consideration:
+ * Backtrace is logged instead if run outside interactive terminal. We
+ * also don't auto-launch GDB on non-Linux since the development tools
+ * on other platforms generally can't be relied upon to correctly debug
+ * binaries built with a Linux toolchain. Environmental factors such as
+ * GDB, MAKEFLAGS, ADDR2LINE, TERM, and isatty(STDERR_FILENO) should
+ * also be taken into consideration:
*
* $ export GDB=eoatuhshtuone
* $ o//examples/auto-launch-gdb-on-crash.com
diff --git a/examples/curl.c b/examples/curl.c
index 1fb7e8e69..82d2f5ab8 100644
--- a/examples/curl.c
+++ b/examples/curl.c
@@ -65,11 +65,26 @@
#define HeaderEqualCase(H, S) \
SlicesEqualCase(S, strlen(S), HeaderData(H), HeaderLength(H))
+int sock;
+
static bool TuneSocket(int fd, int a, int b, int x) {
if (!b) return false;
return setsockopt(fd, a, b, &x, sizeof(x)) != -1;
}
+static void Write(const void *p, size_t n) {
+ ssize_t rc;
+ rc = write(1, p, n);
+ if (rc == -1 && errno == EPIPE) {
+ close(sock);
+ exit(128 + SIGPIPE);
+ }
+ if (rc != n) {
+ fprintf(stderr, "write failed: %m\n");
+ exit(1);
+ }
+}
+
static int TlsSend(void *c, const unsigned char *p, size_t n) {
int rc;
NOISEF("begin send %zu", n);
@@ -107,7 +122,6 @@ static wontreturn void PrintUsage(FILE *f, int rc) {
int main(int argc, char *argv[]) {
if (!NoDebug()) showcrashreports();
- xsigaction(SIGPIPE, SIG_IGN, 0, 0, 0);
/*
* Read flags.
@@ -258,7 +272,7 @@ int main(int argc, char *argv[]) {
/*
* Connect to server.
*/
- int ret, sock;
+ int ret;
CHECK_NE(-1, (sock = GoodSocket(addr->ai_family, addr->ai_socktype,
addr->ai_protocol, false,
&(struct timeval){-60})));
@@ -283,6 +297,8 @@ int main(int argc, char *argv[]) {
CHECK_EQ(n, write(sock, request, n));
}
+ xsigaction(SIGPIPE, SIG_IGN, 0, 0, 0);
+
/*
* Handle response.
*/
@@ -330,7 +346,7 @@ int main(int argc, char *argv[]) {
break;
}
if (method == kHttpHead) {
- CHECK_EQ(hdrlen, write(1, p, hdrlen));
+ Write(p, hdrlen);
goto Finished;
} else if (msg.status == 204 || msg.status == 304) {
goto Finished;
@@ -348,32 +364,32 @@ int main(int argc, char *argv[]) {
t = kHttpClientStateBodyLengthed;
paylen = rc;
if (paylen > i - hdrlen) {
- CHECK_EQ(i - hdrlen, write(1, p + hdrlen, i - hdrlen));
+ Write(p + hdrlen, i - hdrlen);
} else {
- CHECK_EQ(paylen, write(1, p + hdrlen, paylen));
+ Write(p + hdrlen, paylen);
goto Finished;
}
} else {
t = kHttpClientStateBody;
- CHECK_EQ(i - hdrlen, write(1, p + hdrlen, i - hdrlen));
+ Write(p + hdrlen, i - hdrlen);
}
}
break;
case kHttpClientStateBody:
if (!g) goto Finished;
- CHECK_EQ(g, write(1, p + i - g, g));
+ Write(p + i - g, g);
break;
case kHttpClientStateBodyLengthed:
CHECK(g);
if (i - hdrlen > paylen) g = hdrlen + paylen - (i - g);
- CHECK_EQ(g, write(1, p + i - g, g));
+ Write(p + i - g, g);
if (i - hdrlen >= paylen) goto Finished;
break;
case kHttpClientStateBodyChunked:
Chunked:
CHECK_NE(-1, (rc = Unchunk(&u, p + hdrlen, i - hdrlen, &paylen)));
if (rc) {
- CHECK_EQ(paylen, write(1, p + hdrlen, paylen));
+ Write(p + hdrlen, paylen);
goto Finished;
}
break;
diff --git a/examples/datauri.c b/examples/datauri.c
new file mode 100644
index 000000000..6758d063f
--- /dev/null
+++ b/examples/datauri.c
@@ -0,0 +1,63 @@
+#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 "libc/log/log.h"
+#include "libc/runtime/gc.internal.h"
+#include "libc/stdio/stdio.h"
+#include "libc/x/x.h"
+#include "net/http/escape.h"
+#include "net/http/http.h"
+#include "third_party/getopt/getopt.h"
+#include "third_party/stb/stb_image.h"
+
+#define USAGE \
+ " [FLAGS] FILE...\n\
+Utility for printing data:base64 URIs.\n\
+\n\
+FLAGS\n\
+\n\
+ -h Help\n"
+
+void PrintUsage(int rc, FILE *f) {
+ fputs("Usage: ", f);
+ fputs(program_invocation_name, f);
+ fputs(USAGE, f);
+ exit(rc);
+}
+
+void PrintUri(const char *path) {
+ size_t n;
+ void *img, *src, *mime;
+ int opt, i;
+ if (!(img = gc(xslurp(path, &n)))) exit(2);
+ fputs("data:", stdout);
+ fputs(FindContentType(path, -1), stdout);
+ fputs(";base64,", stdout);
+ fputs(gc(EncodeBase64(img, n, 0)), stdout);
+}
+
+int main(int argc, char *argv[]) {
+ showcrashreports();
+ int i;
+ while ((i = getopt(argc, argv, "?h")) != -1) {
+ switch (i) {
+ case '?':
+ case 'h':
+ PrintUsage(0, stdout);
+ default:
+ PrintUsage(1, stderr);
+ }
+ }
+ if (optind == argc) {
+ PrintUsage(1, stderr);
+ }
+ for (i = optind; i < argc; ++i) {
+ PrintUri(argv[i]);
+ }
+}
diff --git a/examples/forkexec.c b/examples/forkexec.c
new file mode 100644
index 000000000..418e16485
--- /dev/null
+++ b/examples/forkexec.c
@@ -0,0 +1,23 @@
+#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 "libc/calls/calls.h"
+#include "libc/stdio/stdio.h"
+
+int main(int argc, char *argv[]) {
+ int pid;
+ if (argc < 3) {
+ fputs("USAGE: FORKEXEC.COM PROG ARGV₀ [ARGV₁...]\n", stderr);
+ return 1;
+ }
+ if (!fork()) {
+ execv(argv[1], argv + 2);
+ return 127;
+ }
+}
diff --git a/examples/forkexecwait.c b/examples/forkexecwait.c
new file mode 100644
index 000000000..eca2b20cd
--- /dev/null
+++ b/examples/forkexecwait.c
@@ -0,0 +1,25 @@
+#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 "libc/calls/calls.h"
+#include "libc/stdio/stdio.h"
+
+int main(int argc, char *argv[]) {
+ int pid;
+ volatile void *p;
+ if (argc < 3) {
+ fputs("USAGE: FORKEXECWAIT.COM PROG ARGV₀ [ARGV₁...]\n", stderr);
+ return 1;
+ }
+ if (!fork()) {
+ execv(argv[1], argv + 2);
+ return 127;
+ }
+ wait(0);
+}
diff --git a/examples/img.c b/examples/img.c
index bfb21a4d7..34d4a840f 100644
--- a/examples/img.c
+++ b/examples/img.c
@@ -7,23 +7,97 @@
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
╚─────────────────────────────────────────────────────────────────*/
#endif
+#include "libc/log/log.h"
+#include "libc/runtime/gc.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/x/x.h"
+#include "net/http/escape.h"
+#include "net/http/http.h"
+#include "third_party/getopt/getopt.h"
#include "third_party/stb/stb_image.h"
-/**
- * @fileoverview Utility for printing HTML
tags.
- */
+#define USAGE \
+ " [FLAGS] IMG...\n\
+Utility for printing HTML
tags.\n\
+\n\
+FLAGS\n\
+\n\
+ -h Help\n\
+ -a Wrap with tag\n\
+ -u Embed data:base64 URI\n"
+
+int scale;
+bool linktag;
+bool datauri;
+bool sizeonly;
+
+void PrintUsage(int rc, FILE *f) {
+ fputs("Usage: ", f);
+ fputs(program_invocation_name, f);
+ fputs(USAGE, f);
+ exit(rc);
+}
+
+void PrintImg(const char *path) {
+ size_t n;
+ int opt, i, yn, xn, cn, w, h;
+ void *img, *pix, *src, *mime;
+ if (!(img = gc(xslurp(path, &n)))) exit(2);
+ if (!(pix = gc(stbi_load_from_memory(img, n, &xn, &yn, &cn, 0)))) exit(3);
+ if (linktag) {
+ printf("", path);
+ }
+ src = path;
+ if (datauri) {
+ src = xasprintf("data:%s;base64,%s", FindContentType(path, -1),
+ gc(EncodeBase64(img, n, &n)));
+ }
+ w = (xn + (1 << scale) / 2) >> scale;
+ h = (yn + (1 << scale) / 2) >> scale;
+ if (sizeonly) {
+ printf("width=\"%d\" height=\"%d\"", w, h);
+ } else {
+ printf("
", w,
+ h, path, src);
+ }
+ if (linktag) {
+ printf("");
+ }
+ printf("\n");
+}
int main(int argc, char *argv[]) {
- void *p;
- size_t n;
- int yn, xn, cn;
- if (argc != 2) return 1;
- if (!(p = xslurp(argv[1], &n))) return 2;
- if (!(p = stbi_load_from_memory(p, n, &xn, &yn, &cn, 0))) return 3;
- printf("
\n",
- argv[1], (xn + 1) >> 1, (yn + 1) >> 1, argv[1]);
- return 0;
+ showcrashreports();
+ int i;
+ while ((i = getopt(argc, argv, "?huas01234")) != -1) {
+ switch (i) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ scale = i - '0';
+ break;
+ case 's':
+ sizeonly = true;
+ break;
+ case 'a':
+ linktag = true;
+ break;
+ case 'u':
+ datauri = true;
+ break;
+ case '?':
+ case 'h':
+ PrintUsage(0, stdout);
+ default:
+ PrintUsage(1, stderr);
+ }
+ }
+ if (optind == argc) {
+ PrintUsage(1, stderr);
+ }
+ for (i = optind; i < argc; ++i) {
+ PrintImg(argv[i]);
+ }
}
diff --git a/examples/nesemu1.cc b/examples/nesemu1.cc
index 274973066..e0dc738dc 100644
--- a/examples/nesemu1.cc
+++ b/examples/nesemu1.cc
@@ -1703,7 +1703,7 @@ int PlayGame(const char* romfile, const char* opt_tasfile) {
if ((ffplay = commandvenv("FFPLAY", "ffplay"))) {
devnull = open("/dev/null", O_WRONLY | O_CLOEXEC);
pipe2(pipefds, O_CLOEXEC);
- if (!(playpid_ = vfork())) {
+ if (!(playpid_ = fork())) {
const char* const args[] = {
"ffplay", "-nodisp", "-loglevel", "quiet", "-fflags",
"nobuffer", "-ac", "1", "-ar", "1789773",
diff --git a/examples/printargs.c b/examples/printargs.c
index 7c9a13ffc..b81f8efc7 100644
--- a/examples/printargs.c
+++ b/examples/printargs.c
@@ -8,10 +8,14 @@
╚─────────────────────────────────────────────────────────────────*/
#endif
#include "libc/calls/calls.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
+#include "libc/mem/mem.h"
#include "libc/nt/process.h"
+#include "libc/runtime/gc.h"
#include "libc/runtime/runtime.h"
+#include "libc/runtime/stack.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/auxv.h"
@@ -22,44 +26,53 @@ const struct AuxiliaryValue {
const char *name;
const char *description;
} kAuxiliaryValues[] = {
- {"%012lx", &AT_EXECFD, "AT_EXECFD", "file descriptor of program"},
- {"%012lx", &AT_PHDR, "AT_PHDR", "address of elf program headers"},
- {"%012lx", &AT_PHENT, "AT_PHENT", "size of program header entry"},
- {"%012lx", &AT_PHNUM, "AT_PHNUM", "number of program headers"},
- {"%012lx", &AT_PAGESZ, "AT_PAGESZ", "system page size"},
- {"%012lx", &AT_BASE, "AT_BASE", "base address of the program interpreter"},
- {"%012lx", &AT_ENTRY, "AT_ENTRY", "entry address of executable"},
- {"%012lx", &AT_NOTELF, "AT_NOTELF", "set if not an elf"},
- {"%-12d", &AT_UID, "AT_UID", "real user id of thread"},
- {"%-12d", &AT_EUID, "AT_EUID", "effective user id of thread"},
- {"%-12d", &AT_GID, "AT_GID", "real group id of thread"},
- {"%-12d", &AT_EGID, "AT_EGID", "effective group id of thread"},
- {"%-12d", &AT_CLKTCK, "AT_CLKTCK", "frequency of times() counts"},
- {"%012lx", &AT_OSRELDATE, "AT_OSRELDATE",
+ {"%-14p", &AT_EXECFD, "AT_EXECFD", "file descriptor of program"},
+ {"%-14p", &AT_PHDR, "AT_PHDR", "address of elf program headers"},
+ {"%-14p", &AT_PHENT, "AT_PHENT", "size of program header entry"},
+ {"%-14p", &AT_PHNUM, "AT_PHNUM", "number of program headers"},
+ {"%-14p", &AT_PAGESZ, "AT_PAGESZ", "system page size"},
+ {"%-14p", &AT_BASE, "AT_BASE", "base address of the program interpreter"},
+ {"%-14p", &AT_ENTRY, "AT_ENTRY", "entry address of executable"},
+ {"%-14p", &AT_NOTELF, "AT_NOTELF", "set if not an elf"},
+ {"%-14d", &AT_UID, "AT_UID", "real user id of thread"},
+ {"%-14d", &AT_EUID, "AT_EUID", "effective user id of thread"},
+ {"%-14d", &AT_GID, "AT_GID", "real group id of thread"},
+ {"%-14d", &AT_EGID, "AT_EGID", "effective group id of thread"},
+ {"%-14d", &AT_CLKTCK, "AT_CLKTCK", "frequency of times() counts"},
+ {"%-14d", &AT_OSRELDATE, "AT_OSRELDATE",
"freebsd release number, e.g. 1200086"},
- {"%012lx", &AT_PLATFORM, "AT_PLATFORM",
+ {"%-14p", &AT_PLATFORM, "AT_PLATFORM",
"string identifying hardware platform"},
- {"%012lx", &AT_DCACHEBSIZE, "AT_DCACHEBSIZE", "data cache block size"},
- {"%012lx", &AT_ICACHEBSIZE, "AT_ICACHEBSIZE",
+ {"%-14p", &AT_DCACHEBSIZE, "AT_DCACHEBSIZE", "data cache block size"},
+ {"%-14p", &AT_ICACHEBSIZE, "AT_ICACHEBSIZE",
"instruction cache block size"},
- {"%012lx", &AT_UCACHEBSIZE, "AT_UCACHEBSIZE", "unified cache block size"},
- {"%012lx", &AT_SECURE, "AT_SECURE",
+ {"%-14p", &AT_UCACHEBSIZE, "AT_UCACHEBSIZE", "unified cache block size"},
+ {"%-14p", &AT_SECURE, "AT_SECURE",
"for set{u,g}id binz & security blankets"},
- {"%-12s", &AT_BASE_PLATFORM, "AT_BASE_PLATFORM",
+ {"%-14s", &AT_BASE_PLATFORM, "AT_BASE_PLATFORM",
"string identifying real platform"},
- {"%012lx", &AT_RANDOM, "AT_RANDOM", "address of sixteen random bytes"},
- {"%-12s", &AT_EXECFN, "AT_EXECFN", "pathname used to execute program"},
- {"%012lx", &AT_SYSINFO_EHDR, "AT_SYSINFO_EHDR",
+ {"%-14p", &AT_RANDOM, "AT_RANDOM", "address of sixteen random bytes"},
+ {"%-14s (%p)", &AT_EXECFN, "AT_EXECFN", "pathname used to execute program"},
+ {"%-14p", &AT_SYSINFO_EHDR, "AT_SYSINFO_EHDR",
"linux virtual dso page address"},
- {"%012lx", &AT_FLAGS, "AT_FLAGS", "unused?"},
- {"%012lx", &AT_HWCAP, "AT_HWCAP", "cpu stuff"},
- {"%012lx", &AT_HWCAP2, "AT_HWCAP2", "more cpu stuff"},
+ {"%-14p", &AT_FLAGS, "AT_FLAGS", "unused?"},
+ {"%-14p", &AT_HWCAP, "AT_HWCAP", "cpu stuff"},
+ {"%-14p", &AT_HWCAP2, "AT_HWCAP2", "more cpu stuff"},
+ {"%-14p", &AT_STACKBASE, "AT_STACKBASE", "NetBSD stack base"},
+ {"%-14p", &AT_CANARY, "AT_CANARY", "FreeBSD AT_CANARY"},
+ {"%-14p", &AT_CANARYLEN, "AT_CANARYLEN", "FreeBSD AT_CANARYLEN"},
+ {"%-14ld", &AT_NCPUS, "AT_NCPUS", "FreeBSD AT_NCPUS"},
+ {"%-14p", &AT_PAGESIZES, "AT_PAGESIZES", "FreeBSD AT_PAGESIZES"},
+ {"%-14d", &AT_PAGESIZESLEN, "AT_PAGESIZESLEN", "FreeBSD AT_PAGESIZESLEN"},
+ {"%-14p", &AT_TIMEKEEP, "AT_TIMEKEEP", "FreeBSD AT_TIMEKEEP"},
+ {"%-14p", &AT_STACKPROT, "AT_STACKPROT", "FreeBSD AT_STACKPROT"},
+ {"%-14p", &AT_EHDRFLAGS, "AT_EHDRFLAGS", "FreeBSD AT_EHDRFLAGS"},
};
const struct AuxiliaryValue *DescribeAuxv(unsigned long x) {
int i;
for (i = 0; i < ARRAYLEN(kAuxiliaryValues); ++i) {
- if (x == *kAuxiliaryValues[i].id) {
+ if (*kAuxiliaryValues[i].id && x == *kAuxiliaryValues[i].id) {
return kAuxiliaryValues + i;
}
}
@@ -68,33 +81,41 @@ const struct AuxiliaryValue *DescribeAuxv(unsigned long x) {
int main(int argc, char *argv[], char **envp) {
long key;
+ char **env;
unsigned i;
unsigned long *auxp;
- char fmt[64], **env;
struct AuxiliaryValue *auxinfo;
uint32_t varlen;
char16_t var[PATH_MAX];
- printf("\nArguments:\n");
+ kprintf("%nArguments:%n");
for (i = 0; i < __argc; ++i) {
- printf(" ☼ %s\n", argv[i]);
+ kprintf(" ☼ %s%n", argv[i]);
}
- printf("\nEnvironment:\n");
+ kprintf("%nEnvironment:%n");
for (env = envp; *env; ++env) {
- printf(" ☼ %s\n", *env);
+ kprintf(" ☼ %s%n", *env);
}
- printf("\nAuxiliary Values:\n");
+ kprintf("%nAuxiliary Values:%n");
for (auxp = __auxv; *auxp; auxp += 2) {
if ((auxinfo = DescribeAuxv(auxp[0]))) {
- stpcpy(stpcpy(stpcpy(fmt, "%16s[%4ld] = "), auxinfo->fmt), " # %s\n");
- printf(fmt, auxinfo->name, auxp[0], auxp[1], auxinfo->description);
+ kprintf(" ☼ %16s[%4ld] = ", auxinfo->name, auxp[0]);
+ kprintf(auxinfo->fmt, auxp[1], auxp[1]);
+ kprintf(" # %s%n", auxinfo->description);
} else {
- printf("%16s[%4ld] = %012lx\n", "unknown", auxp[0], auxp[1]);
+ kprintf(" ☼ %16s[%4ld] = %014p%n", "unknown", auxp[0], auxp[1]);
}
}
- printf("\nSpecial Directories:\n");
- printf(" ☼ kTmpPath = %`'s\n", kTmpPath);
- printf(" ☼ kNtSystemDirectory = %`'s\n", kNtSystemDirectory);
- printf(" ☼ kNtWindowsDirectory = %`'s\n", kNtWindowsDirectory);
- printf(" ☼ program_executable_name = %`'s\n", program_executable_name);
+ kprintf("%nSpecial Parameters:%n");
+ kprintf(" ☼ kTmpPath = %#s%n", kTmpPath);
+ kprintf(" ☼ kNtSystemDirectory = %#s%n", kNtSystemDirectory);
+ kprintf(" ☼ kNtWindowsDirectory = %#s%n", kNtWindowsDirectory);
+ kprintf(" ☼ program_executable_name = %#s (%p)%n", program_executable_name,
+ program_executable_name);
+ kprintf(" ☼ GetInterpreterExecutableName() → %#s%n",
+ GetInterpreterExecutableName(_gc(malloc(1024)), 1024));
+ kprintf(" ☼ RSP → %p%n", __builtin_frame_address(0));
+ kprintf(" ☼ GetStackAddr() → %p%n", GetStackAddr(0));
+ kprintf(" ☼ GetStaticStackAddr() → %p%n", GetStaticStackAddr(0));
+ kprintf(" ☼ GetStackSize() → %p%n", GetStackSize());
return 0;
}
diff --git a/examples/rusage.c b/examples/rusage.c
index 2112c184a..969bba592 100644
--- a/examples/rusage.c
+++ b/examples/rusage.c
@@ -101,7 +101,7 @@ int main(int argc, char *argv[]) {
sigaddset(&chldmask, SIGCHLD);
sigprocmask(SIG_BLOCK, &chldmask, &savemask);
ts1 = nowl();
- CHECK_NE(-1, (pid = vfork()));
+ CHECK_NE(-1, (pid = fork()));
if (!pid) {
sigaction(SIGINT, &dflt, 0);
sigaction(SIGQUIT, &dflt, 0);
diff --git a/examples/ttyinfo.c b/examples/ttyinfo.c
index f6a2e3341..575e964dc 100644
--- a/examples/ttyinfo.c
+++ b/examples/ttyinfo.c
@@ -27,6 +27,7 @@
#include "libc/x/x.h"
#define CTRL(C) ((C) ^ 0b01000000)
+#define WRITE(FD, SLIT) write(FD, SLIT, strlen(SLIT))
#define ENABLE_SAFE_PASTE "\e[?2004h"
#define ENABLE_MOUSE_TRACKING "\e[?1000;1002;1015;1006h"
#define DISABLE_MOUSE_TRACKING "\e[?1000;1002;1015;1006l"
@@ -46,7 +47,7 @@ void onkilled(int sig) {
}
void restoretty(void) {
- write(1, DISABLE_MOUSE_TRACKING, strlen(DISABLE_MOUSE_TRACKING));
+ WRITE(1, DISABLE_MOUSE_TRACKING);
ioctl(1, TCSETS, &oldterm);
}
@@ -72,9 +73,9 @@ int rawmode(void) {
t.c_cflag |= CS8;
t.c_iflag |= IUTF8;
ioctl(1, TCSETS, &t);
- write(1, ENABLE_SAFE_PASTE, strlen(ENABLE_SAFE_PASTE));
- write(1, ENABLE_MOUSE_TRACKING, strlen(ENABLE_MOUSE_TRACKING));
- write(1, PROBE_DISPLAY_SIZE, strlen(PROBE_DISPLAY_SIZE));
+ WRITE(1, ENABLE_SAFE_PASTE);
+ WRITE(1, ENABLE_MOUSE_TRACKING);
+ WRITE(1, PROBE_DISPLAY_SIZE);
return 0;
}
diff --git a/libc/alg/bisect.internal.h b/libc/alg/bisect.internal.h
index 0616a859d..1d97a9a62 100644
--- a/libc/alg/bisect.internal.h
+++ b/libc/alg/bisect.internal.h
@@ -14,7 +14,7 @@ forceinline void *bisect(const void *k, const void *data, size_t n, size_t size,
r = n - 1;
p = data;
while (l <= r) {
- m = (l + r) >> 1;
+ m = (l & r) + ((l ^ r) >> 1);
c = cmp(k, p + m * size, arg);
if (c > 0) {
l = m + 1;
diff --git a/libc/calls/addtimespec.c b/libc/calls/addtimespec.c
index 94b8e1bfe..889a64484 100644
--- a/libc/calls/addtimespec.c
+++ b/libc/calls/addtimespec.c
@@ -19,7 +19,7 @@
#include "libc/calls/math.h"
/**
- * Adds two microsecond timestamps.
+ * Adds two nanosecond timestamps.
*/
struct timespec AddTimespec(struct timespec x, struct timespec y) {
x.tv_sec += y.tv_sec;
diff --git a/libc/calls/clock_gettime.c b/libc/calls/clock_gettime.c
index 7b5ef8e39..e6936c511 100644
--- a/libc/calls/clock_gettime.c
+++ b/libc/calls/clock_gettime.c
@@ -40,13 +40,18 @@
* @asyncsignalsafe
*/
int clock_gettime(int clockid, struct timespec *ts) {
- int rc;
+ int rc, e;
axdx_t ad;
- if (!ts) return efault();
- if (IsAsan() && !__asan_is_valid(ts, sizeof(*ts))) return efault();
- if (clockid == -1) return einval();
- if (!IsWindows()) {
- if ((rc = sys_clock_gettime(clockid, ts)) == -1 && errno == ENOSYS) {
+ if (!ts) {
+ rc = efault();
+ } else if (IsAsan() && !__asan_is_valid(ts, sizeof(*ts))) {
+ rc = efault();
+ } else if (clockid == -1) {
+ rc = einval();
+ } else if (!IsWindows()) {
+ e = errno;
+ if ((rc = sys_clock_gettime(clockid, ts))) {
+ errno = e;
ad = sys_gettimeofday((struct timeval *)ts, NULL, NULL);
assert(ad.ax != -1);
if (SupportsXnu() && ad.ax) {
@@ -56,8 +61,9 @@ int clock_gettime(int clockid, struct timespec *ts) {
ts->tv_nsec *= 1000;
rc = 0;
}
- return rc;
} else {
- return sys_clock_gettime_nt(clockid, ts);
+ rc = sys_clock_gettime_nt(clockid, ts);
}
+ /* TODO(jart): Add get_clock_gettime() so we can STRACE() */
+ return rc;
}
diff --git a/libc/calls/commandv.c b/libc/calls/commandv.c
index ced97a9b1..fde8e689a 100644
--- a/libc/calls/commandv.c
+++ b/libc/calls/commandv.c
@@ -16,60 +16,69 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
+#include "libc/bits/bits.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
+#include "libc/calls/sysdebug.internal.h"
+#include "libc/dce.h"
+#include "libc/errno.h"
#include "libc/log/libfatal.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
+#include "libc/sysv/consts/ok.h"
#include "libc/sysv/errfuns.h"
-static noasan bool EndsWithIgnoreCase(const char *p, size_t n, const char *s) {
- size_t i, m;
- m = __strlen(s);
- if (n >= m) {
- for (i = n - m; i < n; ++i) {
- if (kToLower[p[i] & 255] != (*s++ & 255)) {
- return false;
- }
- }
- return true;
- } else {
- return false;
- }
+static noasan bool IsExePath(const char *s, size_t n) {
+ return n >= 4 && (READ32LE(s + n - 4) == READ32LE(".exe") ||
+ READ32LE(s + n - 4) == READ32LE(".EXE"));
+}
+
+static noasan bool IsComPath(const char *s, size_t n) {
+ return n >= 4 && (READ32LE(s + n - 4) == READ32LE(".com") ||
+ READ32LE(s + n - 4) == READ32LE(".COM"));
+}
+
+static noasan bool IsComDbgPath(const char *s, size_t n) {
+ return n >= 8 && (READ64LE(s + n - 8) == READ64LE(".com.dbg") ||
+ READ64LE(s + n - 8) == READ64LE(".COM.DBG"));
}
static noasan bool AccessCommand(const char *name,
char path[hasatleast PATH_MAX], size_t namelen,
- const char *suffix, size_t pathlen) {
+ int *err, const char *suffix, size_t pathlen) {
size_t suffixlen;
- suffixlen = __strlen(suffix);
- if (pathlen + 1 + namelen + suffixlen + 1 > PATH_MAX) return -1;
+ suffixlen = strlen(suffix);
+ if (pathlen + 1 + namelen + suffixlen + 1 > PATH_MAX) return false;
if (pathlen && (path[pathlen - 1] != '/' && path[pathlen - 1] != '\\')) {
- path[pathlen] = !IsWindows() ? '/'
- : __memchr(path, '\\', pathlen) ? '\\'
- : '/';
+ path[pathlen] = !IsWindows() ? '/'
+ : memchr(path, '\\', pathlen) ? '\\'
+ : '/';
pathlen++;
}
- __repmovsb(path + pathlen, name, namelen);
- __repmovsb(path + pathlen + namelen, suffix, suffixlen + 1);
- return isexecutable(path);
+ memcpy(path + pathlen, name, namelen);
+ memcpy(path + pathlen + namelen, suffix, suffixlen + 1);
+ if (!access(path, X_OK)) return true;
+ if (errno == EACCES || *err != EACCES) *err = errno;
+ return false;
}
static noasan bool SearchPath(const char *name, char path[hasatleast PATH_MAX],
- size_t namelen, const char *suffix) {
+ size_t namelen, int *err, const char *suffix) {
+ char sep;
size_t i;
const char *p;
- p = firstnonnull(emptytonull(getenv("PATH")), "/bin:/usr/local/bin:/usr/bin");
+ if (!(p = getenv("PATH"))) p = "/bin:/usr/local/bin:/usr/bin";
+ sep = IsWindows() && strchr(p, ';') ? ';' : ':';
for (;;) {
- for (i = 0; p[i] && p[i] != ':' && p[i] != ';'; ++i) {
+ for (i = 0; p[i] && p[i] != sep; ++i) {
if (i < PATH_MAX) {
path[i] = p[i];
}
}
- if (AccessCommand(name, path, namelen, suffix, i)) {
+ if (AccessCommand(name, path, namelen, err, suffix, i)) {
return true;
}
- if (p[i] == ':' || p[i] == ';') {
+ if (p[i] == sep) {
p += i + 1;
} else {
break;
@@ -80,19 +89,37 @@ static noasan bool SearchPath(const char *name, char path[hasatleast PATH_MAX],
static noasan bool FindCommand(const char *name,
char pathbuf[hasatleast PATH_MAX],
- size_t namelen, const char *suffix) {
- if (memchr(name, '/', namelen) || memchr(name, '\\', namelen)) {
+ size_t namelen, bool priorityonly,
+ const char *suffix, int *err) {
+ if (priorityonly &&
+ (memchr(name, '/', namelen) || memchr(name, '\\', namelen))) {
pathbuf[0] = 0;
- return AccessCommand(name, pathbuf, namelen, suffix, 0);
+ return AccessCommand(name, pathbuf, namelen, err, suffix, 0);
}
- return ((IsWindows() &&
- (AccessCommand(name, pathbuf, namelen, suffix,
- stpcpy(pathbuf, kNtSystemDirectory) - pathbuf) ||
- AccessCommand(name, pathbuf, namelen, suffix,
- stpcpy(pathbuf, kNtWindowsDirectory) - pathbuf) ||
- AccessCommand(name, pathbuf, namelen, suffix,
- stpcpy(pathbuf, ".") - pathbuf))) ||
- SearchPath(name, pathbuf, namelen, suffix));
+ if (IsWindows() && priorityonly) {
+ return AccessCommand(name, pathbuf, namelen, err, suffix,
+ stpcpy(pathbuf, kNtSystemDirectory) - pathbuf) ||
+ AccessCommand(name, pathbuf, namelen, err, suffix,
+ stpcpy(pathbuf, kNtWindowsDirectory) - pathbuf);
+ }
+ return (IsWindows() && AccessCommand(name, pathbuf, namelen, err, suffix,
+ stpcpy(pathbuf, ".") - pathbuf)) ||
+ SearchPath(name, pathbuf, namelen, err, suffix);
+}
+
+static noasan bool FindVerbatim(const char *name,
+ char pathbuf[hasatleast PATH_MAX],
+ size_t namelen, bool priorityonly, int *err) {
+ return FindCommand(name, pathbuf, namelen, priorityonly, "", err);
+}
+
+static noasan bool FindSuffixed(const char *name,
+ char pathbuf[hasatleast PATH_MAX],
+ size_t namelen, bool priorityonly, int *err) {
+ return !IsExePath(name, namelen) && !IsComPath(name, namelen) &&
+ !IsComDbgPath(name, namelen) &&
+ (FindCommand(name, pathbuf, namelen, priorityonly, ".com", err) ||
+ FindCommand(name, pathbuf, namelen, priorityonly, ".exe", err));
}
/**
@@ -105,28 +132,33 @@ static noasan bool FindCommand(const char *name,
* @vforksafe
*/
noasan char *commandv(const char *name, char pathbuf[hasatleast PATH_MAX]) {
- int olderr;
+ int e, f;
+ char *res;
size_t namelen;
+ res = 0;
if (!name) {
efault();
- return 0;
- }
- if (!(namelen = __strlen(name))) {
+ } else if (!(namelen = strlen(name))) {
enoent();
- return 0;
- }
- if (namelen + 1 > PATH_MAX) {
+ } else if (namelen + 1 > PATH_MAX) {
enametoolong();
- return 0;
- }
- if (FindCommand(name, pathbuf, namelen, "") ||
- (!EndsWithIgnoreCase(name, namelen, ".exe") &&
- !EndsWithIgnoreCase(name, namelen, ".com") &&
- !EndsWithIgnoreCase(name, namelen, ".com.dbg") &&
- (FindCommand(name, pathbuf, namelen, ".com") ||
- FindCommand(name, pathbuf, namelen, ".exe")))) {
- return pathbuf;
} else {
- return 0;
+ e = errno;
+ f = ENOENT;
+ if ((IsWindows() && (FindSuffixed(name, pathbuf, namelen, true, &f) ||
+ FindSuffixed(name, pathbuf, namelen, true, &f) ||
+ FindVerbatim(name, pathbuf, namelen, false, &f) ||
+ FindVerbatim(name, pathbuf, namelen, false, &f))) ||
+ (!IsWindows() && (FindVerbatim(name, pathbuf, namelen, true, &f) ||
+ FindSuffixed(name, pathbuf, namelen, true, &f) ||
+ FindVerbatim(name, pathbuf, namelen, false, &f) ||
+ FindSuffixed(name, pathbuf, namelen, false, &f)))) {
+ errno = e;
+ res = pathbuf;
+ } else {
+ errno = f;
+ }
}
+ SYSDEBUG("commandv(%#s, %p) → %#s% m", name, pathbuf, res);
+ return res;
}
diff --git a/libc/calls/copyfile.c b/libc/calls/copyfile.c
index 5c4c91196..c9e9cc93a 100644
--- a/libc/calls/copyfile.c
+++ b/libc/calls/copyfile.c
@@ -20,6 +20,7 @@
#include "libc/calls/internal.h"
#include "libc/calls/struct/stat.h"
#include "libc/dce.h"
+#include "libc/intrin/kprintf.h"
#include "libc/nt/createfile.h"
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/creationdisposition.h"
@@ -66,12 +67,12 @@ static int sys_copyfile(const char *src, const char *dst, int flags) {
int64_t inoffset, outoffset;
int rc, srcfd, dstfd, oflags, omode;
rc = -1;
- if ((srcfd = sys_openat(AT_FDCWD, src, O_RDONLY, 0)) != -1) {
- if (sys_fstat(srcfd, &st) != -1) {
+ if ((srcfd = openat(AT_FDCWD, src, O_RDONLY, 0)) != -1) {
+ if (fstat(srcfd, &st) != -1) {
omode = st.st_mode & 0777;
oflags = O_WRONLY | O_CREAT;
if (flags & COPYFILE_NOCLOBBER) oflags |= O_EXCL;
- if ((dstfd = sys_openat(AT_FDCWD, dst, oflags, omode)) != -1) {
+ if ((dstfd = openat(AT_FDCWD, dst, oflags, omode)) != -1) {
remaining = st.st_size;
ftruncate(dstfd, remaining);
inoffset = 0;
@@ -86,13 +87,13 @@ static int sys_copyfile(const char *src, const char *dst, int flags) {
if (flags & COPYFILE_PRESERVE_TIMESTAMPS) {
amtime[0] = st.st_atim;
amtime[1] = st.st_mtim;
- sys_utimensat(dstfd, NULL, amtime, 0);
+ utimensat(dstfd, NULL, amtime, 0);
}
}
- rc |= sys_close(dstfd);
+ rc |= close(dstfd);
}
}
- rc |= sys_close(srcfd);
+ rc |= close(srcfd);
}
return rc;
}
@@ -108,7 +109,7 @@ static int sys_copyfile(const char *src, const char *dst, int flags) {
* @return 0 on success, or -1 w/ errno
*/
int copyfile(const char *src, const char *dst, int flags) {
- if (!IsWindows()) {
+ if (!IsWindows() || startswith(src, "/zip/") || startswith(dst, "/zip/")) {
return sys_copyfile(src, dst, flags);
} else {
return sys_copyfile_nt(src, dst, flags);
diff --git a/libc/calls/execve.c b/libc/calls/execve.c
index a02843476..8e9fa67ae 100644
--- a/libc/calls/execve.c
+++ b/libc/calls/execve.c
@@ -21,6 +21,7 @@
#include "libc/calls/sysdebug.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/errfuns.h"
@@ -47,17 +48,17 @@ int execve(const char *program, char *const argv[], char *const envp[]) {
return efault();
}
if (DEBUGSYS) {
- __printf("SYS: execve(%s, {", program);
+ kprintf("SYS: execve(%s, {", program);
for (i = 0; argv[i]; ++i) {
- if (i) __printf(", ");
- __printf("%s", argv[i]);
+ if (i) kprintf(", ");
+ kprintf("%s", argv[i]);
}
- __printf("}, {");
+ kprintf("}, {");
for (i = 0; envp[i]; ++i) {
- if (i) __printf(", ");
- __printf("%s", envp[i]);
+ if (i) kprintf(", ");
+ kprintf("%s", envp[i]);
}
- __printf("})\n");
+ kprintf("})\n");
}
for (i = 3; i < g_fds.n; ++i) {
if (g_fds.p[i].kind != kFdEmpty && (g_fds.p[i].flags & O_CLOEXEC)) {
diff --git a/libc/calls/getpid.c b/libc/calls/getpid.c
index 5db92d62d..d13708d33 100644
--- a/libc/calls/getpid.c
+++ b/libc/calls/getpid.c
@@ -16,27 +16,10 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
-#include "libc/assert.h"
-#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
-#include "libc/dce.h"
-#include "libc/nt/process.h"
-#include "libc/runtime/runtime.h"
-static int __pid;
-
-static int __getpid(void) {
- if (!IsWindows()) {
- return sys_getpid().ax;
- } else {
- return GetCurrentProcessId();
- }
-}
-
-static void __updatepid(void) {
- __pid = __getpid();
-}
+extern int __pid;
/**
* Returns process id.
@@ -44,15 +27,11 @@ static void __updatepid(void) {
* @vforksafe
*/
int getpid(void) {
- static bool once;
- if (__vforked) {
- return sys_getpid().ax;
+ int rc;
+ if (!__vforked) {
+ rc = __pid;
+ } else {
+ rc = sys_getpid().ax;
}
- if (!once) {
- __updatepid();
- if (cmpxchg(&once, false, true)) {
- atfork(__updatepid, NULL);
- }
- }
- return __pid;
+ return rc;
}
diff --git a/libc/calls/internal.h b/libc/calls/internal.h
index c5de5d92d..becf6f1b6 100644
--- a/libc/calls/internal.h
+++ b/libc/calls/internal.h
@@ -12,6 +12,7 @@
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/timespec.h"
#include "libc/calls/struct/timeval.h"
+#include "libc/calls/struct/winsize.h"
#include "libc/calls/ucontext.h"
#include "libc/dce.h"
#include "libc/limits.h"
@@ -299,6 +300,7 @@ ssize_t sys_open_nt(int, const char *, u32, i32) nodiscard hidden;
ssize_t sys_read_nt(struct Fd *, const struct iovec *, size_t, ssize_t) hidden;
ssize_t sys_readlinkat_nt(int, const char *, char *, size_t) hidden;
ssize_t sys_write_nt(struct Fd *, const struct iovec *, size_t, ssize_t) hidden;
+int ioctl_tiocgwinsz_nt(struct Fd *, struct winsize *) hidden;
/*───────────────────────────────────────────────────────────────────────────│─╗
│ cosmopolitan § syscalls » windows nt » support ─╬─│┼
diff --git a/libc/calls/ioctl_tcsets.c b/libc/calls/ioctl_tcsets.c
index 8986bfebd..a89abb0b8 100644
--- a/libc/calls/ioctl_tcsets.c
+++ b/libc/calls/ioctl_tcsets.c
@@ -25,6 +25,8 @@
#include "libc/sysv/consts/termios.h"
#include "libc/sysv/errfuns.h"
+extern bool __nomultics;
+
int ioctl_tcsets_nt(int, uint64_t, const struct termios *);
static int ioctl_tcsets_metal(int fd, uint64_t request,
@@ -35,7 +37,7 @@ static int ioctl_tcsets_metal(int fd, uint64_t request,
static inline void *__termios2host(union metatermios *mt,
const struct termios *lt) {
if (!IsXnu() && !IsFreebsd() && !IsOpenbsd() && !IsNetbsd()) {
- return lt;
+ return (/*unconst*/ void *)lt;
} else if (IsXnu()) {
COPY_TERMIOS(&mt->xnu, lt);
return &mt->xnu;
@@ -60,23 +62,29 @@ static int ioctl_tcsets_sysv(int fd, uint64_t request,
* @see ioctl(fd, TIOCGETA{,W,F}, tio) dispatches here
*/
int ioctl_tcsets(int fd, uint64_t request, ...) {
+ int rc;
va_list va;
const struct termios *tio;
va_start(va, request);
tio = va_arg(va, const struct termios *);
va_end(va);
- if (!tio) return efault();
- if (fd >= 0) {
+ if (!tio) {
+ rc = efault();
+ } else if (fd >= 0) {
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
- return enotty();
+ rc = enotty();
} else if (IsMetal()) {
- return ioctl_tcsets_metal(fd, request, tio);
+ rc = ioctl_tcsets_metal(fd, request, tio);
} else if (!IsWindows()) {
- return ioctl_tcsets_sysv(fd, request, tio);
+ rc = ioctl_tcsets_sysv(fd, request, tio);
} else {
- return ioctl_tcsets_nt(fd, request, tio);
+ rc = ioctl_tcsets_nt(fd, request, tio);
}
} else {
- return einval();
+ rc = einval();
}
+ if (rc != -1) {
+ __nomultics = !(tio->c_oflag & OPOST);
+ }
+ return rc;
}
diff --git a/libc/calls/ioctl_tiocgwinsz-nt.c b/libc/calls/ioctl_tiocgwinsz-nt.c
index 1a061683e..7933dbf14 100644
--- a/libc/calls/ioctl_tiocgwinsz-nt.c
+++ b/libc/calls/ioctl_tiocgwinsz-nt.c
@@ -27,20 +27,21 @@
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
-textwindows int ioctl_tiocgwinsz_nt(int fd, struct winsize *ws) {
- int i, fds[3];
+textwindows int ioctl_tiocgwinsz_nt(struct Fd *fd, struct winsize *ws) {
+ int i;
uint32_t mode;
+ struct Fd *fds[3];
struct NtStartupInfo startinfo;
struct NtConsoleScreenBufferInfoEx sbinfo;
if (!ws) return efault();
- fds[0] = fd, fds[1] = 1, fds[2] = 0;
+ fds[0] = fd, fds[1] = g_fds.p + 1, fds[2] = g_fds.p + 0;
GetStartupInfo(&startinfo);
for (i = 0; i < ARRAYLEN(fds); ++i) {
- if (__isfdkind(fds[i], kFdFile) || __isfdkind(fds[i], kFdConsole)) {
- if (GetConsoleMode(g_fds.p[fds[i]].handle, &mode)) {
+ if (fds[i]->kind == kFdFile || fds[i]->kind == kFdConsole) {
+ if (GetConsoleMode(fds[i]->handle, &mode)) {
bzero(&sbinfo, sizeof(sbinfo));
sbinfo.cbSize = sizeof(sbinfo);
- if (GetConsoleScreenBufferInfoEx(g_fds.p[fds[i]].handle, &sbinfo)) {
+ if (GetConsoleScreenBufferInfoEx(fds[i]->handle, &sbinfo)) {
ws->ws_col = sbinfo.srWindow.Right - sbinfo.srWindow.Left + 1;
ws->ws_row = sbinfo.srWindow.Bottom - sbinfo.srWindow.Top + 1;
ws->ws_xpixel = 0;
diff --git a/libc/calls/ioctl_tiocgwinsz.c b/libc/calls/ioctl_tiocgwinsz.c
index 7a2caa4f3..4a46c1021 100644
--- a/libc/calls/ioctl_tiocgwinsz.c
+++ b/libc/calls/ioctl_tiocgwinsz.c
@@ -24,8 +24,6 @@
#include "libc/sysv/consts/termios.h"
#include "libc/sysv/errfuns.h"
-int ioctl_tiocgwinsz_nt(int, struct winsize *);
-
/**
* Returns width and height of terminal.
*
@@ -44,7 +42,7 @@ int ioctl_tiocgwinsz(int fd, ...) {
} else if (!IsWindows()) {
return sys_ioctl(fd, TIOCGWINSZ, ws);
} else {
- return ioctl_tiocgwinsz_nt(fd, ws);
+ return ioctl_tiocgwinsz_nt(g_fds.p + fd, ws);
}
} else {
return einval();
diff --git a/libc/calls/mprotect.greg.c b/libc/calls/mprotect.greg.c
index 00d7dfaa9..37ddfd915 100644
--- a/libc/calls/mprotect.greg.c
+++ b/libc/calls/mprotect.greg.c
@@ -25,8 +25,6 @@
#include "libc/nt/thunk/msabi.h"
#include "libc/sysv/consts/nr.h"
-extern __msabi typeof(VirtualProtect) *const __imp_VirtualProtect;
-
/**
* Modifies restrictions on virtual memory address range.
*
diff --git a/libc/calls/nanosleep-nt.c b/libc/calls/nanosleep-nt.c
index 9c8a6438a..57e3b875c 100644
--- a/libc/calls/nanosleep-nt.c
+++ b/libc/calls/nanosleep-nt.c
@@ -1,7 +1,7 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
-│ Copyright 2020 Justine Alexandra Roberts Tunney │
+│ Copyright 2021 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 │
@@ -16,29 +16,33 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
+#define ShouldUseMsabiAttribute() 1
#include "libc/calls/internal.h"
-#include "libc/nexgen32e/nexgen32e.h"
-#include "libc/nt/enum/status.h"
+#include "libc/errno.h"
+#include "libc/macros.internal.h"
#include "libc/nt/errors.h"
#include "libc/nt/nt/time.h"
#include "libc/nt/synchronization.h"
-#include "libc/str/str.h"
-#include "libc/sysv/errfuns.h"
-textwindows int sys_nanosleep_nt(const struct timespec *req,
- struct timespec *rem) {
+textwindows noinstrument int sys_nanosleep_nt(const struct timespec *req,
+ struct timespec *rem) {
+ /* no function tracing because timing sensitive */
int64_t millis, hectonanos, relasleep;
if (rem) memcpy(rem, req, sizeof(*rem));
- hectonanos = req->tv_sec * 10000000ull + div100int64(req->tv_nsec);
+ hectonanos = req->tv_sec * 10000000 + req->tv_nsec / 100;
hectonanos = MAX(1, hectonanos);
relasleep = -hectonanos;
- if (NtError(NtDelayExecution(true, &relasleep))) {
- millis = div10000int64(hectonanos);
+ if (NtError(__imp_NtDelayExecution(true, &relasleep))) {
+ millis = hectonanos / 10000;
millis = MAX(1, millis);
- if (SleepEx(millis, true) == kNtWaitIoCompletion) {
- return eintr();
+ if (__imp_SleepEx(millis, true) == kNtWaitIoCompletion) {
+ errno = EINTR;
+ return -1;
}
}
- if (rem) bzero(rem, sizeof(*rem));
+ if (rem) {
+ rem->tv_sec = 0;
+ rem->tv_nsec = 0;
+ }
return 0;
}
diff --git a/libc/calls/ntspawn.c b/libc/calls/ntspawn.c
index b42505089..a9f30a27a 100644
--- a/libc/calls/ntspawn.c
+++ b/libc/calls/ntspawn.c
@@ -84,7 +84,7 @@ textwindows int ntspawn(
(block =
MapViewOfFileExNuma(handle, kNtFileMapRead | kNtFileMapWrite, 0, 0,
blocksize, NULL, kNtNumaNoPreferredNode))) {
- if (mkntcmdline(block->cmdline, prog, argv) != -1 &&
+ if (mkntcmdline(block->cmdline, prog, argv + 1) != -1 &&
mkntenvblock(block->envvars, envp, extravar) != -1) {
if (CreateProcess(prog16, block->cmdline, opt_lpProcessAttributes,
opt_lpThreadAttributes, bInheritHandles,
diff --git a/libc/calls/preadv.c b/libc/calls/preadv.c
index 3ad2b28f2..92e302f4b 100644
--- a/libc/calls/preadv.c
+++ b/libc/calls/preadv.c
@@ -63,7 +63,7 @@ ssize_t preadv(int fd, struct iovec *iov, int iovlen, int64_t off) {
/*
* NT, XNU, and 2007-era Linux don't support this system call.
*/
- if (!once) {
+ if (!__vforked && !once) {
err = errno;
rc = sys_preadv(fd, iov, iovlen, off, off);
if (rc == -1 && errno == ENOSYS) {
diff --git a/libc/runtime/program_executable_name.c b/libc/calls/program_executable_name.c
similarity index 78%
rename from libc/runtime/program_executable_name.c
rename to libc/calls/program_executable_name.c
index 6069e327e..38845cf97 100644
--- a/libc/runtime/program_executable_name.c
+++ b/libc/calls/program_executable_name.c
@@ -22,6 +22,7 @@
#include "libc/calls/internal.h"
#include "libc/calls/sysdebug.internal.h"
#include "libc/dce.h"
+#include "libc/errno.h"
#include "libc/log/libfatal.internal.h"
#include "libc/macros.internal.h"
#include "libc/mem/alloca.h"
@@ -45,8 +46,17 @@
* Absolute path of executable.
*
* This variable is initialized automatically at startup. The path is
- * guaranteed to exist, except on XNU and OpenBSD. It may be a symlink.
- * It may be spoofed.
+ * basically `argv[0]` except some extra vetting is done to provide
+ * stronger assurance that the path can be counted upon to exist.
+ *
+ * For example, if your program is executed as a relative path and then
+ * your program calls `chdir()`, then `argv[0]` will be incorrect; but
+ * `program_executable_name` will work, because it prefixed `getcwd()`
+ * early in the initialization phase.
+ *
+ * @see GetInterpreterExecutableName()
+ * @see program_invocation_short_name
+ * @see program_invocation_name
*/
char program_executable_name[SIZE];
@@ -75,45 +85,31 @@ static textwindows bool GetNtExePath(char executable[SIZE]) {
}
static textstartup void GetProgramExecutableName(char executable[SIZE],
- char *p) {
- char *t;
+ char *argv0, intptr_t *auxv) {
size_t m;
+ ssize_t n;
int cmd[4];
- ssize_t n = 0;
+ char *p, *t;
if (IsWindows() && GetNtExePath(executable)) return;
- if (fileexists(p)) {
+ for (p = 0; *auxv; auxv += 2) {
+ if (*auxv == AT_EXECFN) {
+ p = (char *)auxv[1];
+ break;
+ }
+ }
+ n = 0;
+ if (!p) p = argv0;
+ if (p) {
if (!_isabspath(p)) {
if (getcwd(executable, SIZE - 1)) {
n = strlen(executable);
executable[n++] = '/';
}
}
- } else if ((n = sys_readlinkat(AT_FDCWD, "/proc/self/exe", executable,
- SIZE - 1)) > 0) {
- executable[n] = 0;
- return;
- } else if ((n = sys_readlinkat(AT_FDCWD, "/proc/curproc/file", executable,
- SIZE - 1)) > 0) {
- executable[n] = 0;
- return;
- } else if (IsFreebsd() || IsNetbsd()) {
- cmd[0] = CTL_KERN;
- cmd[1] = KERN_PROC;
- if (IsFreebsd()) {
- cmd[2] = KERN_PROC_PATHNAME_FREEBSD;
- } else {
- cmd[2] = KERN_PROC_PATHNAME_NETBSD;
- }
- cmd[3] = -1;
- m = SIZE;
- if (sysctl(cmd, ARRAYLEN(cmd), executable, &m, 0, 0) != -1) {
- return;
- }
- }
- if (n < 0) n = 0;
- for (; *p; ++p) {
- if (n + 1 < SIZE) {
- executable[n++] = *p;
+ for (; *p; ++p) {
+ if (n + 1 < SIZE) {
+ executable[n++] = *p;
+ }
}
}
executable[n] = 0;
@@ -121,13 +117,15 @@ static textstartup void GetProgramExecutableName(char executable[SIZE],
textstartup void program_executable_name_init(int argc, char **argv,
char **envp, intptr_t *auxv) {
+ int e;
static bool once;
char executable[SIZE];
if (!cmpxchg(&once, 0, 1)) return;
- __stpcpy(program_executable_name, argv[0]);
- GetProgramExecutableName(executable, argv[0]);
+ e = errno;
+ GetProgramExecutableName(executable, argv[0], auxv);
+ errno = e;
__stpcpy(program_executable_name, executable);
- SYSDEBUG("GetProgramExecutableName() -> %s", program_executable_name);
+ SYSDEBUG("program_executable_name → %#s", program_executable_name);
}
const void *const program_executable_name_init_ctor[] initarray = {
diff --git a/libc/calls/read-nt.c b/libc/calls/read-nt.c
index 024acb67b..374f273de 100644
--- a/libc/calls/read-nt.c
+++ b/libc/calls/read-nt.c
@@ -17,6 +17,7 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/assert.h"
+#include "libc/bits/weaken.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/iovec.h"
#include "libc/errno.h"
@@ -45,6 +46,7 @@ textwindows ssize_t sys_read_nt(struct Fd *fd, const struct iovec *iov,
ssize_t rc;
uint32_t size;
size_t i, total;
+ if (weaken(_check_sigwinch) && weaken(_check_sigwinch)(fd)) return eintr();
while (iovlen && !iov[0].iov_len) iov++, iovlen--;
if (iovlen) {
for (total = i = 0; i < iovlen; ++i) {
diff --git a/libc/calls/readv-serial.c b/libc/calls/readv-serial.c
index f60993f18..f9b1d120b 100644
--- a/libc/calls/readv-serial.c
+++ b/libc/calls/readv-serial.c
@@ -35,21 +35,12 @@ static int GetFirstIov(struct iovec *iov, int iovlen) {
}
ssize_t sys_readv_serial(struct Fd *fd, const struct iovec *iov, int iovlen) {
- size_t i, j, got = 0;
+ size_t i;
if ((i = GetFirstIov(iov, iovlen)) != -1) {
while (!IsDataAvailable(fd)) asm("pause");
- i = 0;
- j = 0;
- do {
- ++got;
- ((char *)iov[i].iov_base)[j] = inb(fd->handle);
- if (++j == iov[i].iov_len) {
- j = 0;
- if (++i == iovlen) {
- break;
- }
- }
- } while (IsDataAvailable(fd));
+ ((char *)iov[i].iov_base)[0] = inb(fd->handle);
+ return 1;
+ } else {
+ return 0;
}
- return got;
}
diff --git a/libc/calls/realpath.c b/libc/calls/realpath.c
index fafa4dcdf..4f0a5aed6 100644
--- a/libc/calls/realpath.c
+++ b/libc/calls/realpath.c
@@ -25,13 +25,14 @@
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
│ │
╚─────────────────────────────────────────────────────────────────────────────*/
+#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
-#include "libc/calls/sysdebug.internal.h"
#include "libc/errno.h"
#include "libc/limits.h"
+#include "libc/log/backtrace.internal.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
@@ -73,12 +74,13 @@ static char *ResolvePath(char *d, const char *s, size_t n)
* symbolic link then it's resolved.
*
* @param resolved needs PATH_MAX bytes or NULL to use malloc()
+ * @return resolved or NULL w/ errno
*/
char *realpath(const char *filename, char *resolved)
{
- ssize_t k;
- int up, check_dir=0;
- size_t p, q, l, l0, cnt=0, nup=0;
+ ssize_t rc;
+ int e, up, check_dir=0;
+ size_t k, p, q, l, l0, cnt=0, nup=0;
char output[PATH_MAX], stack[PATH_MAX+1], *z;
if (!filename) {
@@ -160,15 +162,10 @@ restart:
* directories, processing .. can skip readlink. */
if (!check_dir) goto skip_readlink;
}
- k = readlink(output, stack, p);
- if (k<0) SYSDEBUG("realpath readlink failed %d", (long)errno);
- if (k==p) goto toolong;
- if (!k) {
- errno = ENOENT;
- return 0;
- }
- if (k<0) {
+ e = errno;
+ if ((rc = readlink(output, stack, p)) == -1) {
if (errno != EINVAL) return 0;
+ errno = e; /* [jart] undirty errno if not a symlink */
skip_readlink:
check_dir = 0;
if (up) {
@@ -180,6 +177,14 @@ skip_readlink:
check_dir = stack[p];
continue;
}
+ k = rc;
+ assert(k <= p);
+ if (k==p)
+ goto toolong;
+ if (!k) {
+ errno = ENOENT;
+ return 0;
+ }
if (++cnt == SYMLOOP_MAX) {
errno = ELOOP;
return 0;
diff --git a/libc/calls/sigwinch-nt.c b/libc/calls/sigwinch-nt.c
new file mode 100644
index 000000000..a9bb56e03
--- /dev/null
+++ b/libc/calls/sigwinch-nt.c
@@ -0,0 +1,58 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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/calls/internal.h"
+#include "libc/calls/struct/winsize.h"
+#include "libc/calls/sysdebug.internal.h"
+#include "libc/errno.h"
+#include "libc/nt/struct/consolescreenbufferinfoex.h"
+#include "libc/str/str.h"
+
+static struct winsize __ws;
+
+textwindows bool _check_sigwinch(struct Fd *fd) {
+ int e;
+ siginfo_t si;
+ struct winsize ws, old;
+ struct NtConsoleScreenBufferInfoEx sbinfo;
+ old = __ws;
+ if (old.ws_row != 0xffff) {
+ e = errno;
+ if (ioctl_tiocgwinsz_nt(fd, &ws) != -1) {
+ if (old.ws_col != ws.ws_col || old.ws_row != ws.ws_row) {
+ __ws = ws;
+ if (old.ws_col | old.ws_row) {
+ SYSDEBUG("SIGWINCH %hhu×%hhu → %hhu×%hhu", old.ws_col, old.ws_row,
+ ws.ws_col, ws.ws_row);
+ if (__sighandrvas[SIGWINCH] >= kSigactionMinRva) {
+ bzero(&si, sizeof(si));
+ ((sigaction_f)(_base + __sighandrvas[SIGWINCH]))(SIGWINCH, &si, 0);
+ return true;
+ }
+ }
+ }
+ } else {
+ errno = e;
+ if (!old.ws_row && !old.ws_col) {
+ __ws.ws_row = 0xffff;
+ }
+ }
+ }
+ return false;
+}
diff --git a/libc/calls/splice.c b/libc/calls/splice.c
index bfe272af7..08cf2d8fc 100644
--- a/libc/calls/splice.c
+++ b/libc/calls/splice.c
@@ -32,9 +32,10 @@ static ssize_t splicer(int infd, int64_t *inoffset, int outfd,
if (!uptobytes || flags == -1) return einval();
if (IsModeDbg() && uptobytes > 1) uptobytes >>= 1;
olderr = errno;
- if ((transferred =
+ if (__isfdkind(infd, kFdZip) || __isfdkind(outfd, kFdZip) ||
+ (transferred =
impl(infd, inoffset, outfd, outoffset, uptobytes, flags)) == -1 &&
- errno == ENOSYS) {
+ errno == ENOSYS) {
errno = olderr;
transferred = copyfd(infd, inoffset, outfd, outoffset, uptobytes, flags);
}
diff --git a/libc/calls/struct/sigaction.h b/libc/calls/struct/sigaction.h
index 1fcfb06af..b14078d80 100644
--- a/libc/calls/struct/sigaction.h
+++ b/libc/calls/struct/sigaction.h
@@ -24,6 +24,7 @@ COSMOPOLITAN_C_START_
void _init_onntconsoleevent(void);
void _init_wincrash(void);
+bool _check_sigwinch();
#ifndef __SIGACTION_YOINK
#define __SIGACTION_YOINK(SIG) \
@@ -44,12 +45,16 @@ void _init_wincrash(void);
case SIGFPE: \
YOINK(_init_wincrash); \
break; \
+ case SIGWINCH: \
+ YOINK(_check_sigwinch); \
+ break; \
default: \
break; \
} \
} else { \
YOINK(_init_onntconsoleevent); \
YOINK(_init_wincrash); \
+ YOINK(_check_sigwinch); \
} \
} \
} while (0)
diff --git a/libc/calls/sysdebug.internal.h b/libc/calls/sysdebug.internal.h
index 614f66ec1..bc9efeb3c 100644
--- a/libc/calls/sysdebug.internal.h
+++ b/libc/calls/sysdebug.internal.h
@@ -7,7 +7,7 @@
#endif
#if DEBUGSYS
-#define SYSDEBUG(FMT, ...) __printf("SYS: " FMT "\n", ##__VA_ARGS__)
+#define SYSDEBUG(FMT, ...) kprintf("SYS: " FMT "\n", ##__VA_ARGS__)
#else
#define SYSDEBUG(FMT, ...) (void)0
#endif
diff --git a/libc/crt/crt.S b/libc/crt/crt.S
index 4d0f82a63..8ef3cce6c 100644
--- a/libc/crt/crt.S
+++ b/libc/crt/crt.S
@@ -28,12 +28,21 @@
// @note FreeBSD is special (see freebsd/lib/csu/amd64/...)
// @noreturn
_start:
+
+// Get startup timestamp as early as possible.
+// Used by --strace flag and kprintf() %T.
+ rdtsc
+ ezlea kStartTsc,bx
+ mov %eax,(%rbx)
+ mov %edx,4(%rbx)
+
#if SupportsFreebsd()
test %rdi,%rdi
cmovnz %rdi,%rsp
jz 0f
movb $FREEBSD,__hostos(%rip)
#endif
+
0: mov (%rsp),%ebx # argc
lea 8(%rsp),%rsi # argv
lea 16(%rsp,%rbx,8),%rdx # envp
diff --git a/libc/elf/def.h b/libc/elf/def.h
index b282babcb..0578d108b 100644
--- a/libc/elf/def.h
+++ b/libc/elf/def.h
@@ -5,6 +5,8 @@
* @fileoverview Executable and Linkable Format Definitions.
*/
+#define EI_NIDENT 16
+
#define EI_MAG0 0
#define EI_MAG1 1
#define EI_MAG2 2
diff --git a/libc/elf/getelfstringtable.c b/libc/elf/getelfstringtable.c
index e12f4da72..83106a156 100644
--- a/libc/elf/getelfstringtable.c
+++ b/libc/elf/getelfstringtable.c
@@ -24,13 +24,15 @@ char *GetElfStringTable(const Elf64_Ehdr *elf, size_t mapsize) {
char *name;
Elf64_Half i;
Elf64_Shdr *shdr;
- for (i = 0; i < elf->e_shnum; ++i) {
- shdr = GetElfSectionHeaderAddress(elf, mapsize, i);
- if (shdr->sh_type == SHT_STRTAB) {
- name = GetElfSectionName(elf, mapsize,
- GetElfSectionHeaderAddress(elf, mapsize, i));
- if (name && !strcmp(name, ".strtab")) {
- return GetElfSectionAddress(elf, mapsize, shdr);
+ if (elf->e_shentsize) {
+ for (i = 0; i < elf->e_shnum; ++i) {
+ shdr = GetElfSectionHeaderAddress(elf, mapsize, i);
+ if (shdr->sh_type == SHT_STRTAB) {
+ name = GetElfSectionName(elf, mapsize,
+ GetElfSectionHeaderAddress(elf, mapsize, i));
+ if (name && !strcmp(name, ".strtab")) {
+ return GetElfSectionAddress(elf, mapsize, shdr);
+ }
}
}
}
diff --git a/libc/elf/getelfsymboltable.c b/libc/elf/getelfsymboltable.c
index 5e0244793..76384bf41 100644
--- a/libc/elf/getelfsymboltable.c
+++ b/libc/elf/getelfsymboltable.c
@@ -23,12 +23,14 @@ Elf64_Sym *GetElfSymbolTable(const Elf64_Ehdr *elf, size_t mapsize,
Elf64_Xword *out_count) {
Elf64_Half i;
Elf64_Shdr *shdr;
- for (i = elf->e_shnum; i > 0; --i) {
- shdr = GetElfSectionHeaderAddress(elf, mapsize, i - 1);
- if (shdr->sh_type == SHT_SYMTAB) {
- if (shdr->sh_entsize != sizeof(Elf64_Sym)) continue;
- if (out_count) *out_count = shdr->sh_size / shdr->sh_entsize;
- return GetElfSectionAddress(elf, mapsize, shdr);
+ if (elf->e_shentsize) {
+ for (i = elf->e_shnum; i > 0; --i) {
+ shdr = GetElfSectionHeaderAddress(elf, mapsize, i - 1);
+ if (shdr->sh_type == SHT_SYMTAB) {
+ if (shdr->sh_entsize != sizeof(Elf64_Sym)) continue;
+ if (out_count) *out_count = shdr->sh_size / shdr->sh_entsize;
+ return GetElfSectionAddress(elf, mapsize, shdr);
+ }
}
}
return NULL;
diff --git a/libc/fmt/divmod10.internal.h b/libc/fmt/divmod10.internal.h
new file mode 100644
index 000000000..048cbdc60
--- /dev/null
+++ b/libc/fmt/divmod10.internal.h
@@ -0,0 +1,26 @@
+#ifndef COSMOPOLITAN_LIBC_FMT_DIVMOD10_H_
+#define COSMOPOLITAN_LIBC_FMT_DIVMOD10_H_
+#if !(__ASSEMBLER__ + __LINKER__ + 0)
+
+forceinline uint64_t DivMod10(uint64_t x, unsigned *r) {
+#if defined(__STRICT_ANSI__) || !defined(__GNUC__) || \
+ (defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__))
+ *r = x % 10;
+ return x / 10;
+#else
+ uint128_t dw;
+ unsigned long long hi, rm;
+ dw = x;
+ dw *= 0xcccccccccccccccdull;
+ hi = dw >> 64;
+ hi >>= 3;
+ rm = hi;
+ rm += rm << 2;
+ rm += rm;
+ *r = x - rm;
+ return hi;
+#endif
+}
+
+#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
+#endif /* COSMOPOLITAN_LIBC_FMT_DIVMOD10_H_ */
diff --git a/libc/fmt/fmt.h b/libc/fmt/fmt.h
index 6ecc118a2..e87589837 100644
--- a/libc/fmt/fmt.h
+++ b/libc/fmt/fmt.h
@@ -27,6 +27,8 @@ int vsscanf(const char *, const char *, va_list);
int vcscanf(int (*)(void *), int (*)(int, void *), void *, const char *,
va_list);
int strerror_r(int, char *, size_t) nothrow nocallback;
+const char *strerror_short(int) nosideeffect;
+const char *strerror_long(int) nosideeffect;
int __fmt(void *, void *, const char *, va_list) hidden;
char *itoa(int, char *, int) compatfn;
char *fcvt(double, int, int *, int *);
diff --git a/libc/fmt/kerrornames.S b/libc/fmt/kerrornames.S
index fa3072923..6badb85b5 100644
--- a/libc/fmt/kerrornames.S
+++ b/libc/fmt/kerrornames.S
@@ -29,6 +29,7 @@
.section .rodata
.align 4
kErrorNames:
+ .e EINVAL
.e ENOSYS
.e EPERM
.e ENOENT
@@ -51,7 +52,6 @@ kErrorNames:
.e ENODEV
.e ENOTDIR
.e EISDIR
- .e EINVAL
.e ENFILE
.e EMFILE
.e ENOTTY
diff --git a/libc/fmt/kerrornameslong.S b/libc/fmt/kerrornameslong.S
index c5baeb694..ac897dd21 100644
--- a/libc/fmt/kerrornameslong.S
+++ b/libc/fmt/kerrornameslong.S
@@ -29,155 +29,90 @@
.section .rodata
.align 4
kErrorNamesLong:
- .e EPIPE,"EPIPE[Broken pipe]"
- .e ENODEV,"ENODEV[No such device]"
- .e EINVAL,"EINVAL[Invalid argument]"
- .e EINTR,"EINTR[Interrupted system call]"
- .e ENOTBLK,"ENOTBLK[Block device required]"
- .e ENOSYS,"ENOSYS[Function not implemented]"
- .e EHOSTUNREACH,"EHOSTUNREACH[No route to host]"
- .e ESRCH,"ESRCH[No such process]"
- .e EUSERS,"EUSERS[Too many users]"
- .e EXDEV,"EXDEV[Cross-device link]"
- .e E2BIG,"E2BIG[Arg list too long]"
- .e EREMOTE,"EREMOTE[Object is remote]"
- .e ECHILD,"ECHILD[No child processes]"
- .e EMSGSIZE,"EMSGSIZE[Message too long]"
- .e ENOTEMPTY,"ENOTEMPTY[Directory not empty]"
- .e ENOBUFS,"ENOBUFS[No buffer space available]"
- .e ELOOP,"ELOOP[Too many symbolic links encountered]"
- .e EAFNOSUPPORT,"EAFNOSUPPORT[Address family not supported by protocol]"
- .e EHOSTDOWN,"EHOSTDOWN[Host is down]"
- .e EPFNOSUPPORT,"EPFNOSUPPORT[Protocol family not supported]"
- .e ENOPROTOOPT,"ENOPROTOOPT[Protocol not available]"
- .e EBUSY,"EBUSY[Device or resource busy]"
- .e EWOULDBLOCK,"EWOULDBLOCK[Operation would block]"
- .e EBADFD,"EBADFD[File descriptor in bad state]"
- .e EISCONN,"EISCONN[Transport endpoint is already connected]"
- .e ESHUTDOWN,"ESHUTDOWN[Cannot send after transport endpoint shutdown]"
- .e ENONET,"ENONET[Machine is not on the network]"
- .e EBADE,"EBADE[Invalid exchange]"
- .e EBADF,"EBADF[Bad file number]"
- .e EMULTIHOP,"EMULTIHOP[Multihop attempted]"
- .e EIO,"EIO[I/O error]"
- .e EUNATCH,"EUNATCH[Protocol driver not attached]"
- .e EPROTOTYPE,"EPROTOTYPE[Protocol wrong type for socket]"
- .e ENOSPC,"ENOSPC[No space left on device]"
- .e ENOEXEC,"ENOEXEC[Exec format error]"
- .e EALREADY,"EALREADY[Operation already in progress]"
- .e ENETDOWN,"ENETDOWN[Network is down]"
- .e ENOTNAM,"ENOTNAM[Not a XENIX named type file]"
- .e EACCES,"EACCES[Permission denied]"
- .e ELNRNG,"ELNRNG[Link number out of range]"
- .e EILSEQ,"EILSEQ[Illegal byte sequence]"
- .e ENOTDIR,"ENOTDIR[Not a directory]"
- .e ENOTUNIQ,"ENOTUNIQ[Name not unique on network]"
- .e EPERM,"EPERM[Operation not permitted]"
- .e EDOM,"EDOM[Math argument out of domain of func]"
- .e EXFULL,"EXFULL[Exchange full]"
- .e ECONNREFUSED,"ECONNREFUSED[Connection refused]"
- .e EISDIR,"EISDIR[Is a directory]"
- .e EPROTONOSUPPORT,"EPROTONOSUPPORT[Protocol not supported]"
- .e EROFS,"EROFS[Read-only file system]"
- .e EADDRNOTAVAIL,"EADDRNOTAVAIL[Cannot assign requested address]"
- .e EIDRM,"EIDRM[Identifier removed]"
- .e ECOMM,"ECOMM[Communication error on send]"
- .e ESRMNT,"ESRMNT[Srmount error]"
- .e EREMOTEIO,"EREMOTEIO[Remote I/O error]"
- .e EL3RST,"EL3RST[Level 3 reset]"
- .e EBADMSG,"EBADMSG[Not a data message]"
- .e ENFILE,"ENFILE[File table overflow]"
- .e ELIBMAX,"ELIBMAX[Attempting to link in too many shared libraries]"
- .e ESPIPE,"ESPIPE[Illegal seek]"
- .e ENOLINK,"ENOLINK[Link has been severed]"
- .e ENETRESET,"ENETRESET[Network dropped connection because of reset]"
- .e ETIMEDOUT,"ETIMEDOUT[Connection timed out]"
- .e ENOENT,"ENOENT[No such file or directory]"
- .e EEXIST,"EEXIST[File exists]"
- .e EDQUOT,"EDQUOT[Quota exceeded]"
- .e ENOSTR,"ENOSTR[Device not a stream]"
- .e EBADSLT,"EBADSLT[Invalid slot]"
- .e EBADRQC,"EBADRQC[Invalid request code]"
- .e ELIBACC,"ELIBACC[Can not access a needed shared library]"
- .e EFAULT,"EFAULT[Bad address]"
- .e EFBIG,"EFBIG[File too large]"
- .e EDEADLK,"EDEADLK[Resource deadlock would occur]"
- .e ENOTCONN,"ENOTCONN[Transport endpoint is not connected]"
- .e EDESTADDRREQ,"EDESTADDRREQ[Destination address required]"
- .e ELIBSCN,"ELIBSCN[.lib section in a.out corrupted]"
- .e ENOLCK,"ENOLCK[No record locks available]"
- .e EISNAM,"EISNAM[Is a named type file]"
- .e ECONNABORTED,"ECONNABORTED[Software caused connection abort]"
- .e ENETUNREACH,"ENETUNREACH[Network is unreachable]"
- .e ESTALE,"ESTALE[Stale NFS file handle]"
- .e ENOSR,"ENOSR[Out of streams resources]"
- .e ENOMEM,"ENOMEM[Out of memory]"
- .e ENOTSOCK,"ENOTSOCK[Socket operation on non-socket]"
- .e ESTRPIPE,"ESTRPIPE[Streams pipe error]"
- .e EMLINK,"EMLINK[Too many links]"
- .e ERANGE,"ERANGE[Math result not representable]"
- .e ELIBEXEC,"ELIBEXEC[Cannot exec a shared library directly]"
- .e EL3HLT,"EL3HLT[Level 3 halted]"
- .e ECONNRESET,"ECONNRESET[Connection reset by peer]"
- .e EADDRINUSE,"EADDRINUSE[Address already in use]"
- .e EOPNOTSUPP,"EOPNOTSUPP[Operation not supported on transport endpoint]"
- .e EREMCHG,"EREMCHG[Remote address changed]"
- .e EAGAIN,"EAGAIN[Try again]"
- .e ENAMETOOLONG,"ENAMETOOLONG[File name too long]"
- .e ENOTTY,"ENOTTY[Not a typewriter]"
- .e ERESTART,"ERESTART[Interrupted system call should be restarted]"
- .e ESOCKTNOSUPPORT,"ESOCKTNOSUPPORT[Socket type not supported]"
- .e ETIME,"ETIME[Timer expired]"
- .e ETOOMANYREFS,"ETOOMANYREFS[Too many references: cannot splice]"
- .e EMFILE,"EMFILE[Too many open files]"
- .e ETXTBSY,"ETXTBSY[Text file busy]"
- .e EINPROGRESS,"EINPROGRESS[Operation now in progress]"
- .e ENXIO,"ENXIO[No such device or address]"
- .e ENOTSUP,"ENOTSUP[Operation not supported]"
- .e EPROTO,"EPROTO[Protocol error]"
- .e ENOMSG,"ENOMSG[No message of desired type]"
- .e ENODATA,"ENODATA[No data available]"
- .e EOVERFLOW,"EOVERFLOW[Value too large for defined data type]"
- .e ENOMEDIUM,"ENOMEDIUM[No medium found]"
- .e EMEDIUMTYPE,"EMEDIUMTYPE[Wrong medium type]"
- .e ECANCELED,"ECANCELED[Operation Canceled]"
- .e EOWNERDEAD,"EOWNERDEAD[Owner died]"
- .e ENOTRECOVERABLE,"ENOTRECOVERABLE[State not recoverable]"
- .e EOWNERDEAD,"EOWNERDEAD[Process died with the lock]"
- .e ENOTRECOVERABLE,"ENOTRECOVERABLE[Lock is not recoverable]"
- .e EFTYPE,"EFTYPE[Inappropriate file type or format]"
- .e EAUTH,"EAUTH[Authentication error]"
- .e EBADRPC,"EBADRPC[RPC struct is bad]"
- .e ENEEDAUTH,"ENEEDAUTH[Need authenticator]"
- .e ENOATTR,"ENOATTR[Attribute not found]"
- .e EPROCUNAVAIL,"EPROCUNAVAIL[Bad procedure for program]"
- .e EPROGMISMATCH,"EPROGMISMATCH[Program version wrong]"
- .e EPROGUNAVAIL,"EPROGUNAVAIL[RPC prog. not avail]"
- .e ERPCMISMATCH,"ERPCMISMATCH[RPC version wrong]"
- .e EPROCLIM,"EPROCLIM[Too many processes]"
- .e EBADARCH,"EBADARCH[Bad CPU type in executable]"
- .e EBADEXEC,"EBADEXEC[Bad executable (or shared library)]"
- .e EBADMACHO,"EBADMACHO[Malformed Mach-o file]"
- .e EDEVERR,"EDEVERR[Device error]"
- .e ENOPOLICY,"ENOPOLICY[Policy not found]"
- .e EPWROFF,"EPWROFF[Device power is off]"
- .e ESHLIBVERS,"ESHLIBVERS[Shared library version mismatch]"
- .e ENOANO,"ENOANO[No anode]"
- .e EADV,"EADV[Advertise error]"
- .e EL2HLT,"EL2HLT[Level 2 halted]"
- .e EDOTDOT,"EDOTDOT[RFS specific error]"
- .e ENOPKG,"ENOPKG[Package not installed]"
- .e EBADR,"EBADR[Invalid request descriptor]"
- .e ENOCSI,"ENOCSI[No CSI structure available]"
- .e ENOKEY,"ENOKEY[Required key not available]"
- .e EUCLEAN,"EUCLEAN[Structure needs cleaning]"
- .e ECHRNG,"ECHRNG[Channel number out of range]"
- .e EL2NSYNC,"EL2NSYNC[Level 2 not synchronized]"
- .e EKEYEXPIRED,"EKEYEXPIRED[Key has expired]"
- .e ENAVAIL,"ENAVAIL[No XENIX semaphores available]"
- .e EKEYREVOKED,"EKEYREVOKED[Key has been revoked]"
- .e ELIBBAD,"ELIBBAD[Accessing a corrupted shared library]"
- .e EKEYREJECTED,"EKEYREJECTED[Key was rejected by service]"
- .e ERFKILL,"ERFKILL[Operation not possible due to RF-kill]"
+ .e EINVAL,"Invalid argument"
+ .e ENOSYS,"Function not implemented"
+ .e EPERM,"Operation not permitted"
+ .e ENOENT,"No such file or directory"
+ .e ESRCH,"No such process"
+ .e EINTR,"Interrupted system call"
+ .e EIO,"I/O error"
+ .e ENXIO,"No such device or address"
+ .e E2BIG,"Arg list too long"
+ .e ENOEXEC,"Exec format error"
+ .e EBADF,"Bad file number"
+ .e ECHILD,"No child processes"
+ .e EAGAIN,"Try again"
+ .e ENOMEM,"Out of memory"
+ .e EACCES,"Permission denied"
+ .e EFAULT,"Bad address"
+ .e ENOTBLK,"Block device required"
+ .e EBUSY,"Device or resource busy"
+ .e EEXIST,"File exists"
+ .e EXDEV,"Cross-device link"
+ .e ENODEV,"No such device"
+ .e ENOTDIR,"Not a directory"
+ .e EISDIR,"Is a directory"
+ .e ENFILE,"File table overflow"
+ .e EMFILE,"Too many open files"
+ .e ENOTTY,"Not a typewriter"
+ .e ETXTBSY,"Text file busy"
+ .e EFBIG,"File too large"
+ .e ENOSPC,"No space left on device"
+ .e EDQUOT,"Quota exceeded"
+ .e ESPIPE,"Illegal seek"
+ .e EROFS,"Read-only file system"
+ .e EMLINK,"Too many links"
+ .e EPIPE,"Broken pipe"
+ .e EDOM,"Math argument out of domain of func"
+ .e ERANGE,"Math result not representable"
+ .e EDEADLK,"Resource deadlock would occur"
+ .e ENAMETOOLONG,"File name too long"
+ .e ENOLCK,"No record locks available"
+ .e ENOTEMPTY,"Directory not empty"
+ .e ELOOP,"Too many symbolic links encountered"
+ .e ENOMSG,"No message of desired type"
+ .e EIDRM,"Identifier removed"
+ .e ETIME,"Timer expired"
+ .e EPROTO,"Protocol error"
+ .e EOVERFLOW,"Value too large for defined data type"
+ .e EILSEQ,"Illegal byte sequence"
+ .e EUSERS,"Too many users"
+ .e ENOTSOCK,"Socket operation on non-socket"
+ .e EDESTADDRREQ,"Destination address required"
+ .e EMSGSIZE,"Message too long"
+ .e EPROTOTYPE,"Protocol wrong type for socket"
+ .e ENOPROTOOPT,"Protocol not available"
+ .e EPROTONOSUPPORT,"Protocol not supported"
+ .e ESOCKTNOSUPPORT,"Socket type not supported"
+ .e ENOTSUP,"Operation not supported"
+ .e EOPNOTSUPP,"Operation not supported on transport endpoint"
+ .e EPFNOSUPPORT,"Protocol family not supported"
+ .e EAFNOSUPPORT,"Address family not supported by protocol"
+ .e EADDRINUSE,"Address already in use"
+ .e EADDRNOTAVAIL,"Cannot assign requested address"
+ .e ENETDOWN,"Network is down"
+ .e ENETUNREACH,"Network is unreachable"
+ .e ENETRESET,"Network dropped connection because of reset"
+ .e ECONNABORTED,"Software caused connection abort"
+ .e ECONNRESET,"Connection reset by peer"
+ .e ENOBUFS,"No buffer space available"
+ .e EISCONN,"Transport endpoint is already connected"
+ .e ENOTCONN,"Transport endpoint is not connected"
+ .e ESHUTDOWN,"Cannot send after transport endpoint shutdown"
+ .e ETOOMANYREFS,"Too many references: cannot splice"
+ .e ETIMEDOUT,"Connection timed out"
+ .e ECONNREFUSED,"Connection refused"
+ .e EHOSTDOWN,"Host is down"
+ .e EHOSTUNREACH,"No route to host"
+ .e EALREADY,"Operation already in progress"
+ .e EINPROGRESS,"Operation now in progress"
+ .e ESTALE,"Stale NFS file handle"
+ .e EREMOTE,"Object is remote"
+ .e EBADMSG,"Not a data message"
+ .e ECANCELED,"Operation Canceled"
+ .e EOWNERDEAD,"Owner died"
+ .e ENOTRECOVERABLE,"State not recoverable"
+ .e ENONET,"Machine is not on the network"
+ .e ERESTART,"Interrupted system call should be restarted"
.long 0
.endobj kErrorNamesLong,globl,hidden
diff --git a/libc/fmt/strerror_long.greg.c b/libc/fmt/strerror_long.greg.c
new file mode 100644
index 000000000..844a1569b
--- /dev/null
+++ b/libc/fmt/strerror_long.greg.c
@@ -0,0 +1,40 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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/fmt/fmt.h"
+
+extern const struct { int x, s; } kErrorNamesLong[];
+
+/**
+ * Converts errno value to descriptive sentence.
+ * @return non-null rodata string or null if not found
+ */
+privileged const char *strerror_long(int x) {
+ /* kprintf() weakly depends on this function */
+ int i;
+ if (x) {
+ for (i = 0; kErrorNamesLong[i].x; ++i) {
+ if (x ==
+ *(const long *)((uintptr_t)kErrorNamesLong + kErrorNamesLong[i].x)) {
+ return (const char *)((uintptr_t)kErrorNamesLong +
+ kErrorNamesLong[i].s);
+ }
+ }
+ }
+ return 0;
+}
diff --git a/libc/fmt/strerror_r.c b/libc/fmt/strerror_r.greg.c
similarity index 53%
rename from libc/fmt/strerror_r.c
rename to libc/fmt/strerror_r.greg.c
index dc024cb6a..961698ace 100644
--- a/libc/fmt/strerror_r.c
+++ b/libc/fmt/strerror_r.greg.c
@@ -16,11 +16,13 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
+#define ShouldUseMsabiAttribute() 1
#include "libc/bits/safemacros.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/bsr.h"
@@ -32,93 +34,48 @@
#include "libc/str/str.h"
#include "libc/str/tpenc.h"
-#if !IsTiny()
+#if !IsTiny() && SupportsWindows()
+/*
+ * If we're paying the code size costs for all the system five magnums
+ * that this module pulls in then we might as well pull in support for
+ * the improved accuracy windows errno conversions used by __winerr()
+ */
STATIC_YOINK("__dos2errno");
#endif
-struct Error {
- int x;
- int s;
-};
-
-extern const struct Error kErrorNames[];
-extern const struct Error kErrorNamesLong[];
-
-noasan static inline const char *GetErrorName(long x) {
- int i;
- if (x) {
- for (i = 0; kErrorNames[i].x; ++i) {
- if (x == *(const long *)((uintptr_t)kErrorNames + kErrorNames[i].x)) {
- return (const char *)((uintptr_t)kErrorNames + kErrorNames[i].s);
- }
- }
- }
- return "EUNKNOWN";
-}
-
-noasan static inline const char *GetErrorNameLong(long x) {
- int i;
- if (x) {
- for (i = 0; kErrorNamesLong[i].x; ++i) {
- if (x ==
- *(const long *)((uintptr_t)kErrorNamesLong + kErrorNamesLong[i].x)) {
- return (const char *)((uintptr_t)kErrorNamesLong +
- kErrorNamesLong[i].s);
- }
- }
- }
- return "EUNKNOWN[No error information]";
-}
-
/**
* Converts errno value to string.
+ *
+ * @param err is error number or zero if unknown
* @return 0 on success, or error code
*/
-noasan int strerror_r(int err, char *buf, size_t size) {
- uint64_t w;
- int c, i, n;
- char *p, *e;
- const char *s;
- char16_t *ws = 0;
- p = buf;
- e = p + size;
- err &= 0xFFFF;
- s = IsTiny() ? GetErrorName(err) : GetErrorNameLong(err);
- while ((c = *s++)) {
- if (p + 1 + 1 <= e) *p++ = c;
- }
- if (!IsTiny()) {
- if (p + 1 + 5 + 1 + 1 <= e) {
- *p++ = '[';
- p = __intcpy(p, err);
- *p++ = ']';
- }
- if (IsWindows()) {
- err = GetLastError() & 0xffff;
- if ((n = FormatMessage(
- kNtFormatMessageAllocateBuffer | kNtFormatMessageFromSystem |
- kNtFormatMessageIgnoreInserts,
- 0, err, MAKELANGID(kNtLangNeutral, kNtSublangDefault),
- (char16_t *)&ws, 0, 0))) {
- while (n && ws[n - 1] <= L' ' || ws[n - 1] == L'.') --n;
- if (p + 1 + 1 <= e) *p++ = '[';
- for (i = 0; i < n; ++i) {
- w = tpenc(ws[i] & 0xffff);
- if (p + (bsrll(w) >> 3) + 1 + 1 <= e) {
- do *p++ = w;
- while ((w >>= 8));
- }
- }
- if (p + 1 + 1 <= e) *p++ = ']';
- LocalFree(ws);
- }
- if (p + 1 + 5 + 1 + 1 <= e) {
- *p++ = '[';
- p = __intcpy(p, err);
- *p++ = ']';
- }
+privileged int strerror_r(int err, char *buf, size_t size) {
+ /* kprintf() weakly depends on this function */
+ int c, n, winerr;
+ char16_t winmsg[256];
+ const char *sym, *msg;
+ sym = firstnonnull(strerror_short(err), "EUNKNOWN");
+ msg = firstnonnull(strerror_long(err), "No error information");
+ if (IsTiny()) {
+ if (!sym) sym = "EUNKNOWN";
+ for (; (c = *sym++); --size)
+ if (size > 1) *buf++ = c;
+ if (size) *buf = 0;
+ } else if (!IsWindows()) {
+ ksnprintf(buf, size, "%s[%d][%s]", sym, err, msg);
+ } else {
+ winerr = __imp_GetLastError();
+ if ((n = __imp_FormatMessageW(
+ kNtFormatMessageFromSystem | kNtFormatMessageIgnoreInserts, 0,
+ winerr, MAKELANGID(kNtLangNeutral, kNtSublangDefault), winmsg,
+ ARRAYLEN(winmsg), 0))) {
+ while ((n && winmsg[n - 1] <= ' ') || winmsg[n - 1] == '.') --n;
+ ksnprintf(buf, size, "%s[%d][%s][%.*hs][%d]", sym, err, msg, n, winmsg,
+ winerr);
+ } else {
+ ksnprintf(buf, size, "%s[%d][%s][%d]", sym, err, msg, winerr);
}
+ __imp_SetLastError(winerr);
}
- if (p + 1 <= e) *p = 0;
return 0;
}
diff --git a/libc/fmt/strerror_short.greg.c b/libc/fmt/strerror_short.greg.c
new file mode 100644
index 000000000..1166fbfb3
--- /dev/null
+++ b/libc/fmt/strerror_short.greg.c
@@ -0,0 +1,38 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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/fmt/fmt.h"
+
+extern const struct { int x, s; } kErrorNames[];
+
+/**
+ * Converts errno value to symbolic name.
+ * @return non-null rodata string or null if not found
+ */
+privileged const char *strerror_short(int x) {
+ /* kprintf() weakly depends on this function */
+ int i;
+ if (x) {
+ for (i = 0; kErrorNames[i].x; ++i) {
+ if (x == *(const *)((uintptr_t)kErrorNames + kErrorNames[i].x)) {
+ return (const char *)((uintptr_t)kErrorNames + kErrorNames[i].s);
+ }
+ }
+ }
+ return 0;
+}
diff --git a/libc/intrin/asan.c b/libc/intrin/asan.c
index c5befbf12..da393332b 100644
--- a/libc/intrin/asan.c
+++ b/libc/intrin/asan.c
@@ -22,10 +22,11 @@
#include "libc/bits/likely.h"
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
+#include "libc/calls/internal.h"
#include "libc/calls/struct/iovec.h"
-#include "libc/calls/sysdebug.internal.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/internal.h"
#include "libc/log/libfatal.internal.h"
@@ -89,12 +90,13 @@ STATIC_YOINK("_init_asan");
} \
} while (0)
-#define REQUIRE(FUNC) \
- do { \
- if (!weaken(FUNC)) { \
- __asan_die("error: asan needs " #FUNC "\n")(); \
- __asan_unreachable(); \
- } \
+#define REQUIRE(FUNC) \
+ do { \
+ if (!weaken(FUNC)) { \
+ kprintf("error: asan needs %s%n", #FUNC); \
+ __asan_die()(); \
+ __asan_unreachable(); \
+ } \
} while (0)
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
@@ -139,6 +141,7 @@ struct AsanMorgue {
};
bool __asan_noreentry;
+extern bool __nomultics;
static struct AsanMorgue __asan_morgue;
static wontreturn void __asan_unreachable(void) {
@@ -227,7 +230,8 @@ static void *__asan_memset(void *p, char c, size_t n) {
static void *__asan_mempcpy(void *dst, const void *src, size_t n) {
size_t i;
- char *d, *s;
+ char *d;
+ const char *s;
uint64_t a, b;
d = dst;
s = src;
@@ -303,14 +307,13 @@ static char *__asan_hexcpy(char *p, uint64_t x, uint8_t k) {
}
static void __asan_exit(void) {
- __printf("your asan runtime needs\n"
- "\tSTATIC_YOINK(\"__die\");\n"
- "in order to show you backtraces\n");
+ kprintf("your asan runtime needs%n"
+ "\tSTATIC_YOINK(\"__die\");%n"
+ "in order to show you backtraces%n");
_Exit(99);
}
-nodiscard static __asan_die_f *__asan_die(const char *msg) {
- __printf("%s", msg);
+nodiscard static __asan_die_f *__asan_die(void) {
if (weaken(__die)) {
return weaken(__die);
} else {
@@ -358,7 +361,7 @@ static bool __asan_is_mapped(int x) {
struct MemoryIntervals *m;
m = weaken(_mmi);
i = FindMemoryInterval(m, x);
- return i < m->i && m->p[i].x <= x && x <= m->p[i].y;
+ return i < m->i && x >= m->p[i].x;
}
static bool __asan_is_image(const unsigned char *p) {
@@ -366,7 +369,7 @@ static bool __asan_is_image(const unsigned char *p) {
}
static bool __asan_exists(const void *x) {
- return __asan_is_image(x) || __asan_is_mapped((intptr_t)x >> 16);
+ return !kisdangerous(x);
}
static struct AsanFault __asan_fault(const signed char *s, signed char dflt) {
@@ -385,13 +388,13 @@ static struct AsanFault __asan_fault(const signed char *s, signed char dflt) {
static struct AsanFault __asan_checka(const signed char *s, long ndiv8) {
intptr_t a;
uint64_t w;
- signed char c, *e = s + ndiv8;
+ const signed char *e = s + ndiv8;
for (; ((intptr_t)s & 7) && s < e; ++s) {
if (*s) return __asan_fault(s - 1, kAsanHeapOverrun);
}
for (; s + 8 <= e; s += 8) {
if (UNLIKELY(!((a = (intptr_t)s) & 0xffff))) {
- if (!__asan_is_mapped(a >> 16)) {
+ if (kisdangerous((void *)a)) {
return (struct AsanFault){kAsanUnmapped, s};
}
}
@@ -422,7 +425,6 @@ static struct AsanFault __asan_checka(const signed char *s, long ndiv8) {
*/
struct AsanFault __asan_check(const void *p, long n) {
intptr_t a;
- uint64_t w;
struct AsanFault f;
signed char c, k, *s;
if (n > 0) {
@@ -431,7 +433,7 @@ struct AsanFault __asan_check(const void *p, long n) {
s = (signed char *)a;
if (OverlapsShadowSpace(p, n)) {
return (struct AsanFault){kAsanProtected, s};
- } else if (IsLegalPointer(a) && !__asan_is_mapped(a >> 16)) {
+ } else if (kisdangerous((void *)a)) {
return (struct AsanFault){kAsanUnmapped, s};
}
if (UNLIKELY(k)) {
@@ -491,19 +493,6 @@ bool __asan_is_valid_strlist(char *const *p) {
}
}
-static const char *__asan_dscribe_heap_poison(signed char c) {
- switch (c) {
- case kAsanHeapFree:
- return "heap double free";
- case kAsanStackFree:
- return "free stack after return";
- case kAsanHeapRelocated:
- return "free after relocate";
- default:
- return "this corruption";
- }
-}
-
wint_t __asan_symbolize_access_poison(signed char kind) {
switch (kind) {
case kAsanNullPage:
@@ -544,6 +533,10 @@ wint_t __asan_symbolize_access_poison(signed char kind) {
return L'G';
case kAsanGlobalGone:
return L'𝐺';
+ case kAsanGlobalUnderrun:
+ return L'μ';
+ case kAsanGlobalOverrun:
+ return L'Ω';
default:
return L'?';
}
@@ -589,16 +582,19 @@ const char *__asan_describe_access_poison(signed char kind) {
return "global redzone";
case kAsanGlobalGone:
return "global gone";
+ case kAsanGlobalUnderrun:
+ return "global underrun";
+ case kAsanGlobalOverrun:
+ return "global overrun";
default:
return "poisoned";
}
}
-nodiscard static __asan_die_f *__asan_report_invalid_pointer(void *addr) {
- __printf("\r\n%sasan error%s: this corruption at 0x%p shadow 0x%p\r\n",
- !g_isterminalinarticulate ? "\e[J\e[1;91m" : "",
- !g_isterminalinarticulate ? "\e[0m" : "", addr, SHADOW(addr));
- return __asan_die("");
+nodiscard static __asan_die_f *__asan_report_invalid_pointer(const void *addr) {
+ kprintf("%n\e[J\e[1;31masan error\e[0m: this corruption at %p shadow %p%n",
+ addr, SHADOW(addr));
+ return __asan_die();
}
static char *__asan_format_interval(char *p, intptr_t a, intptr_t b) {
@@ -607,8 +603,8 @@ static char *__asan_format_interval(char *p, intptr_t a, intptr_t b) {
return p;
}
-static char *__asan_format_section(char *p, void *p1, void *p2,
- const char *name, void *addr) {
+static char *__asan_format_section(char *p, const void *p1, const void *p2,
+ const char *name, const void *addr) {
intptr_t a, b;
if ((a = (intptr_t)p1) < (b = (intptr_t)p2)) {
p = __asan_format_interval(p, a, b), *p++ = ' ';
@@ -616,26 +612,25 @@ static char *__asan_format_section(char *p, void *p1, void *p2,
if (a <= (intptr_t)addr && (intptr_t)addr <= b) {
p = __stpcpy(p, " ←address");
}
- *p++ = '\r', *p++ = '\n';
+ if (__nomultics) *p++ = '\r';
+ *p++ = '\n';
}
return p;
}
-nodiscard static __asan_die_f *__asan_report(void *addr, int size,
+nodiscard static __asan_die_f *__asan_report(const void *addr, int size,
const char *message,
signed char kind) {
+ int i;
wint_t c;
- int i, cc;
signed char t;
uint64_t x, y, z;
char *p, *q, *base;
struct MemoryIntervals *m;
p = __fatalbuf;
- __printf("\r\n%sasan error%s: %s %d-byte %s at 0x%p shadow 0x%p\r\n",
- !g_isterminalinarticulate ? "\e[J\e[1;91m" : "",
- !g_isterminalinarticulate ? "\e[0m" : "",
- __asan_describe_access_poison(kind), size, message, addr,
- SHADOW(addr));
+ kprintf("%n\e[J\e[1;31masan error\e[0m: %s %d-byte %s at %p shadow %p%n%s%n",
+ __asan_describe_access_poison(kind), size, message, addr,
+ SHADOW(addr), __argv[0]);
if (0 < size && size < 80) {
base = (char *)addr - ((80 >> 1) - (size >> 1));
for (i = 0; i < 80; ++i) {
@@ -649,30 +644,32 @@ nodiscard static __asan_die_f *__asan_report(void *addr, int size,
*p++ = ' ';
}
}
- *p++ = '\r', *p++ = '\n';
+ if (__nomultics) *p++ = '\r';
+ *p++ = '\n';
for (c = i = 0; i < 80; ++i) {
if (!(t = __asan_check(base + i, 1).kind)) {
- if (!g_isterminalinarticulate && c != 32) {
+ if (c != 32) {
p = __stpcpy(p, "\e[32m");
c = 32;
}
*p++ = '.';
} else {
- if (!g_isterminalinarticulate && c != 31) {
+ if (c != 31) {
p = __stpcpy(p, "\e[31m");
c = 31;
}
p = __asan_utf8cpy(p, __asan_symbolize_access_poison(t));
}
}
- if (!g_isterminalinarticulate) p = __stpcpy(p, "\e[39m");
- *p++ = '\r', *p++ = '\n';
+ p = __stpcpy(p, "\e[39m");
+ if (__nomultics) *p++ = '\r';
+ *p++ = '\n';
for (i = 0; (intptr_t)(base + i) & 7; ++i) *p++ = ' ';
for (; i + 8 <= 80; i += 8) {
q = p + 8;
*p++ = '|';
z = ((intptr_t)(base + i) >> 3) + 0x7fff8000;
- if (__asan_is_mapped(z >> 16)) {
+ if (!kisdangerous((void *)z)) {
p = __intcpy(p, *(signed char *)z);
} else {
*p++ = '!';
@@ -682,13 +679,15 @@ nodiscard static __asan_die_f *__asan_report(void *addr, int size,
}
}
for (; i < 80; ++i) *p++ = ' ';
- *p++ = '\r', *p++ = '\n';
+ if (__nomultics) *p++ = '\r';
+ *p++ = '\n';
for (i = 0; i < 80; ++i) {
p = __asan_utf8cpy(p, __asan_exists(base + i)
? kCp437[((unsigned char *)base)[i]]
: L'⋅');
}
- *p++ = '\r', *p++ = '\n';
+ if (__nomultics) *p++ = '\r';
+ *p++ = '\n';
}
p = __asan_format_section(p, _base, _etext, ".text", addr);
p = __asan_format_section(p, _etext, _edata, ".data", addr);
@@ -701,10 +700,12 @@ nodiscard static __asan_die_f *__asan_report(void *addr, int size,
if (x <= z && z <= y) p = __stpcpy(p, " ←address");
z = (((intptr_t)addr >> 3) + 0x7fff8000) >> 16;
if (x <= z && z <= y) p = __stpcpy(p, " ←shadow");
- *p++ = '\r', *p++ = '\n';
+ if (__nomultics) *p++ = '\r';
+ *p++ = '\n';
}
*p = 0;
- return __asan_die(__fatalbuf);
+ kprintf("%s", __fatalbuf);
+ return __asan_die();
}
void __asan_verify(const void *p, size_t n) {
@@ -726,7 +727,7 @@ nodiscard __asan_die_f *__asan_report_memory_fault(void *addr, int size,
__asan_fault(SHADOW(addr), -128).kind);
}
-const void *__asan_morgue_add(void *p) {
+void *__asan_morgue_add(void *p) {
void *r;
int i, j;
for (;;) {
@@ -785,6 +786,17 @@ static bool __asan_read48(uint64_t value, uint64_t *x) {
return cookie == ('J' | 'T' << 8);
}
+static void __asan_rawtrace(struct AsanTrace *bt, const struct StackFrame *bp) {
+ size_t i;
+ for (i = 0; bp && i < ARRAYLEN(bt->p); ++i, bp = bp->next) {
+ if (kisdangerous(bp)) break;
+ bt->p[i] = bp->addr;
+ }
+ for (; i < ARRAYLEN(bt->p); ++i) {
+ bt->p[i] = 0;
+ }
+}
+
static void __asan_trace(struct AsanTrace *bt, const struct StackFrame *bp) {
int f1, f2;
size_t i, gi;
@@ -792,10 +804,9 @@ static void __asan_trace(struct AsanTrace *bt, const struct StackFrame *bp) {
struct Garbages *garbage;
garbage = weaken(__garbage);
gi = garbage ? garbage->i : 0;
- __asan_memset(bt, 0, sizeof(*bt));
for (f1 = -1, i = 0; bp && i < ARRAYLEN(bt->p); ++i, bp = bp->next) {
if (f1 != (f2 = ((intptr_t)bp >> 16))) {
- if (!__asan_is_mapped(f2)) break;
+ if (kisdangerous(bp)) break;
f1 = f2;
}
if (!__asan_checka(SHADOW(bp), sizeof(*bp) >> 3).kind) {
@@ -809,8 +820,13 @@ static void __asan_trace(struct AsanTrace *bt, const struct StackFrame *bp) {
break;
}
}
+ for (; i < ARRAYLEN(bt->p); ++i) {
+ bt->p[i] = 0;
+ }
}
+#define __asan_trace __asan_rawtrace
+
static void *__asan_allocate(size_t a, size_t n, int underrun, int overrun,
struct AsanTrace *bt) {
char *p;
@@ -830,17 +846,14 @@ static void *__asan_allocate(size_t a, size_t n, int underrun, int overrun,
return p;
}
-static struct AsanExtra *__asan_get_extra(void *p, size_t *c) {
+static struct AsanExtra *__asan_get_extra(const void *p, size_t *c) {
int f;
long x, n;
struct AsanExtra *e;
- if ((0 < (intptr_t)p && (intptr_t)p < 0x800000000000) &&
- __asan_is_mapped((f = (intptr_t)p >> 16)) &&
- (LIKELY(f == (int)(((intptr_t)p - 16) >> 16)) ||
- __asan_is_mapped(((intptr_t)p - 16) >> 16)) &&
- (n = weaken(dlmalloc_usable_size)(p)) > sizeof(*e) &&
+ f = (intptr_t)p >> 16;
+ if (!kisdangerous(p) && (n = weaken(dlmalloc_usable_size)(p)) > sizeof(*e) &&
!__builtin_add_overflow((intptr_t)p, n, &x) && x <= 0x800000000000 &&
- (LIKELY(f == (int)((x - 1) >> 16)) || __asan_is_mapped((x - 1) >> 16)) &&
+ (LIKELY(f == (int)((x - 1) >> 16)) || !kisdangerous((void *)(x - 1))) &&
(LIKELY(f == (int)((x = x - sizeof(*e)) >> 16)) ||
__asan_is_mapped(x >> 16)) &&
!(x & (alignof(struct AsanExtra) - 1))) {
@@ -882,27 +895,25 @@ static size_t __asan_malloc_usable_size(const void *p) {
}
int __asan_print_trace(void *p) {
- intptr_t x;
size_t c, i, n;
- const char *name;
struct AsanExtra *e;
if (!(e = __asan_get_extra(p, &c))) {
- __printf(" bad pointer");
+ kprintf(" bad pointer");
return einval();
}
if (!__asan_read48(e->size, &n)) {
- __printf(" bad cookie");
+ kprintf(" bad cookie");
return -1;
}
- __printf(" %,d used", n);
+ kprintf(" %'zu used", n);
if (!__asan_is_mapped((((intptr_t)p >> 3) + 0x7fff8000) >> 16)) {
- __printf(" (shadow not mapped?!)");
+ kprintf(" (shadow not mapped?!)");
}
for (i = 0; i < ARRAYLEN(e->bt.p) && e->bt.p[i]; ++i) {
- __printf("\n%*x %s", 12, e->bt.p[i],
- weaken(__get_symbol_by_addr)
- ? weaken(__get_symbol_by_addr)(e->bt.p[i])
- : "please STATIC_YOINK(\"__get_symbol_by_addr\")");
+ kprintf("%n%*lx %s", 12, e->bt.p[i],
+ weaken(__get_symbol_by_addr)
+ ? weaken(__get_symbol_by_addr)(e->bt.p[i])
+ : "please STATIC_YOINK(\"__get_symbol_by_addr\")");
}
return 0;
}
@@ -1078,21 +1089,36 @@ void __asan_unregister_globals(struct AsanGlobal g[], int n) {
}
}
+void __asan_evil(uint8_t *addr, int size, const char *s1, const char *s2) {
+ struct AsanTrace tr;
+ __asan_rawtrace(&tr, __builtin_frame_address(0));
+ kprintf("WARNING: ASAN error during %s bad %d byte %s at %p bt %p %p %p %p%n",
+ s1, size, s2, addr, tr.p[0], tr.p[1], tr.p[2], tr.p[3]);
+}
+
void __asan_report_load(uint8_t *addr, int size) {
if (cmpxchg(&__asan_noreentry, false, true)) {
- __asan_report_memory_fault(addr, size, "load")();
- __asan_unreachable();
+ if (!__vforked) {
+ __asan_report_memory_fault(addr, size, "load")();
+ __asan_unreachable();
+ } else {
+ __asan_evil(addr, size, "vfork()", "load");
+ }
} else {
- __printf("WARNING: ASAN error reporting had an ASAN error\r\n");
+ __asan_evil(addr, size, "ASAN Reporting", "load");
}
}
void __asan_report_store(uint8_t *addr, int size) {
if (cmpxchg(&__asan_noreentry, false, true)) {
- __asan_report_memory_fault(addr, size, "store")();
- __asan_unreachable();
+ if (!__vforked) {
+ __asan_report_memory_fault(addr, size, "store")();
+ __asan_unreachable();
+ } else {
+ __asan_evil(addr, size, "vfork()", "store");
+ }
} else {
- __printf("WARNING: ASAN error reporting had an ASAN error\r\n");
+ __asan_evil(addr, size, "ASAN reporting", "store");
}
}
@@ -1138,12 +1164,11 @@ void __asan_install_malloc_hooks(void) {
void __asan_map_shadow(uintptr_t p, size_t n) {
void *addr;
+ int i, a, b;
size_t size;
int prot, flag;
- int i, x, a, b;
struct DirectMap sm;
struct MemoryIntervals *m;
- SYSDEBUG("__asan_map_shadow(0x%p, 0x%x)", p, n);
assert(!OverlapsShadowSpace((void *)p, n));
m = weaken(_mmi);
a = (0x7fff8000 + (p >> 3)) >> 16;
@@ -1167,7 +1192,8 @@ void __asan_map_shadow(uintptr_t p, size_t n) {
weaken(TrackMemoryInterval)(
m, a, a + i - 1, sm.maphandle, PROT_READ | PROT_WRITE,
MAP_PRIVATE | *weaken(MAP_ANONYMOUS) | MAP_FIXED) == -1) {
- __asan_die("error: could not map asan shadow memory\n")();
+ kprintf("error: could not map asan shadow memory%n");
+ __asan_die()();
__asan_unreachable();
}
__repstosb((void *)(intptr_t)((int64_t)((uint64_t)a << 32) >> 16),
@@ -1202,20 +1228,21 @@ static textstartup void __asan_shadow_string_list(char **list) {
__asan_map_shadow((uintptr_t)list, (i + 1) * sizeof(char *));
}
-static textstartup void __asan_shadow_existing_mappings(void) {
- size_t i;
- struct MemoryIntervals m;
- __asan_memcpy(&m, weaken(_mmi), sizeof(m));
- for (i = 0; i < m.i; ++i) {
- __asan_map_shadow((uintptr_t)m.p[i].x << 16,
- (uintptr_t)(m.p[i].y - m.p[i].x + 1) << 16);
+static textstartup void __asan_shadow_mapping(struct MemoryIntervals *m,
+ size_t i) {
+ uintptr_t x, y;
+ if (i < m->i) {
+ x = m->p[i].x;
+ y = m->p[i].y;
+ __asan_shadow_mapping(m, i + 1);
+ __asan_map_shadow(x << 16, (y - x + 1) << 16);
}
- __asan_poison(GetStackAddr(0), PAGESIZE, kAsanStackOverflow);
}
-static textstartup bool IsMemoryManagementRuntimeLinked(void) {
- return weaken(_mmi) && weaken(sys_mmap) && weaken(MAP_ANONYMOUS) &&
- weaken(TrackMemoryInterval);
+static textstartup void __asan_shadow_existing_mappings(void) {
+ __asan_shadow_mapping(&_mmi, 0);
+ __asan_map_shadow(GetStackAddr(0), GetStackSize());
+ __asan_poison(GetStackAddr(0), PAGESIZE, kAsanStackOverflow);
}
textstartup void __asan_init(int argc, char **argv, char **envp,
@@ -1223,7 +1250,7 @@ textstartup void __asan_init(int argc, char **argv, char **envp,
static bool once;
if (!cmpxchg(&once, false, true)) return;
if (IsWindows() && NtGetVersion() < kNtVersionWindows10) {
- __write_str("error: asan binaries require windows10\n");
+ __write_str("error: asan binaries require windows10\r\n");
_Exit(0); /* So `make MODE=dbg test` passes w/ Windows7 */
}
REQUIRE(_mmi);
@@ -1241,7 +1268,7 @@ textstartup void __asan_init(int argc, char **argv, char **envp,
__asan_map_shadow(0, 4096);
__asan_poison(0, PAGESIZE, kAsanNullPage);
if (!IsWindows()) {
- __sysv_mprotect((void *)0x00007fff8000, 0x10000, PROT_READ);
+ __sysv_mprotect((void *)0x7fff8000, 0x10000, PROT_READ);
}
__asan_shadow_string_list(argv);
__asan_shadow_string_list(envp);
diff --git a/libc/intrin/asan.internal.h b/libc/intrin/asan.internal.h
index 393c7205a..6bcbb2700 100644
--- a/libc/intrin/asan.internal.h
+++ b/libc/intrin/asan.internal.h
@@ -1,29 +1,10 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_ASAN_H_
#define COSMOPOLITAN_LIBC_INTRIN_ASAN_H_
#include "libc/calls/struct/iovec.h"
+#include "libc/intrin/asancodes.h"
#include "libc/macros.internal.h"
-
-#define kAsanScale 3
-#define kAsanMagic 0x7fff8000
-#define kAsanNullPage -1 /* ∅ 0xff */
-#define kAsanProtected -2 /* P 0xfe */
-#define kAsanHeapFree -3 /* F 0xfd */
-#define kAsanHeapRelocated -4 /* R 0xfc */
-#define kAsanAllocaOverrun -5 /* 𝑂 0xfb */
-#define kAsanHeapUnderrun -6 /* U 0xfa */
-#define kAsanHeapOverrun -7 /* O 0xf9 */
-#define kAsanStackUnscoped -8 /* s 0xf8 */
-#define kAsanStackOverflow -9 /* ! 0xf7 */
-#define kAsanGlobalOrder -10 /* I 0xf6 */
-#define kAsanStackFree -11 /* r 0xf5 */
-#define kAsanStackPartial -12 /* p 0xf4 */
-#define kAsanStackOverrun -13 /* o 0xf3 */
-#define kAsanStackMiddle -14 /* m 0xf2 */
-#define kAsanStackUnderrun -15 /* u 0xf1 */
-#define kAsanAllocaUnderrun -16 /* 𝑈 0xf0 */
-#define kAsanUnmapped -17 /* M 0xef */
-#define kAsanGlobalRedzone -18 /* G 0xee */
-#define kAsanGlobalGone -19 /* 𝐺 0xed */
+#if !(__ASSEMBLER__ + __LINKER__ + 0)
+COSMOPOLITAN_C_START_
#define SHADOW(x) ((signed char *)(((intptr_t)(x) >> kAsanScale) + kAsanMagic))
#define UNSHADOW(x) ((void *)(MAX(0, (intptr_t)(x)-kAsanMagic) << kAsanScale))
@@ -32,7 +13,7 @@ typedef void __asan_die_f(void);
struct AsanFault {
signed char kind;
- signed char *shadow;
+ const signed char *shadow;
};
extern bool __asan_noreentry;
@@ -58,4 +39,6 @@ void *__asan_memalign(size_t, size_t);
size_t __asan_get_heap_size(const void *);
void *__asan_realloc_in_place(void *, size_t);
+COSMOPOLITAN_C_END_
+#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_ASAN_H_ */
diff --git a/libc/intrin/asancodes.h b/libc/intrin/asancodes.h
new file mode 100644
index 000000000..d2320950c
--- /dev/null
+++ b/libc/intrin/asancodes.h
@@ -0,0 +1,28 @@
+#ifndef COSMOPOLITAN_LIBC_INTRIN_ASANCODES_H_
+#define COSMOPOLITAN_LIBC_INTRIN_ASANCODES_H_
+
+#define kAsanScale 3
+#define kAsanMagic 0x7fff8000
+#define kAsanNullPage -1 /* ∅ 0xff */
+#define kAsanProtected -2 /* P 0xfe */
+#define kAsanHeapFree -3 /* F 0xfd */
+#define kAsanHeapRelocated -4 /* R 0xfc */
+#define kAsanAllocaOverrun -5 /* 𝑂 0xfb */
+#define kAsanHeapUnderrun -6 /* U 0xfa */
+#define kAsanHeapOverrun -7 /* O 0xf9 */
+#define kAsanStackUnscoped -8 /* s 0xf8 */
+#define kAsanStackOverflow -9 /* ! 0xf7 */
+#define kAsanGlobalOrder -10 /* I 0xf6 */
+#define kAsanStackFree -11 /* r 0xf5 */
+#define kAsanStackPartial -12 /* p 0xf4 */
+#define kAsanStackOverrun -13 /* o 0xf3 */
+#define kAsanStackMiddle -14 /* m 0xf2 */
+#define kAsanStackUnderrun -15 /* u 0xf1 */
+#define kAsanAllocaUnderrun -16 /* 𝑈 0xf0 */
+#define kAsanUnmapped -17 /* M 0xef */
+#define kAsanGlobalRedzone -18 /* G 0xee */
+#define kAsanGlobalGone -19 /* 𝐺 0xed */
+#define kAsanGlobalUnderrun -20 /* μ 0xec */
+#define kAsanGlobalOverrun -21 /* Ω 0xeb */
+
+#endif /* COSMOPOLITAN_LIBC_INTRIN_ASANCODES_H_ */
diff --git a/libc/runtime/assertfail.c b/libc/intrin/assertfail.c
similarity index 93%
rename from libc/runtime/assertfail.c
rename to libc/intrin/assertfail.c
index ab06ff276..0f912db6d 100644
--- a/libc/runtime/assertfail.c
+++ b/libc/intrin/assertfail.c
@@ -19,7 +19,7 @@
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/bits/weaken.h"
-#include "libc/log/libfatal.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
@@ -29,12 +29,12 @@
relegated wontreturn void __assert_fail(const char *expr, const char *file,
int line) {
static bool noreentry;
- __printf("%s:%d: assert(%s) failed\r\n", file, line, expr);
+ kprintf("%s:%d: assert(%s) failed%n", file, line, expr);
if (cmpxchg(&noreentry, false, true)) {
if (weaken(__die)) {
weaken(__die)();
} else {
- __printf("can't backtrace b/c `__die` not linked\r\n");
+ kprintf("can't backtrace b/c `__die` not linked%n");
}
quick_exit(23);
}
diff --git a/libc/intrin/exit.c b/libc/intrin/exit.greg.c
similarity index 97%
rename from libc/intrin/exit.c
rename to libc/intrin/exit.greg.c
index 9183d7487..a0a770238 100644
--- a/libc/intrin/exit.c
+++ b/libc/intrin/exit.greg.c
@@ -16,15 +16,15 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
+#define ShouldUseMsabiAttribute() 1
#include "libc/calls/internal.h"
#include "libc/dce.h"
+#include "libc/intrin/kprintf.h"
#include "libc/nexgen32e/vendor.internal.h"
#include "libc/nt/runtime.h"
#include "libc/nt/thunk/msabi.h"
#include "libc/sysv/consts/nr.h"
-extern void(__msabi* __imp_ExitProcess)(uint32_t);
-
/**
* Terminates process, ignoring destructors and atexit() handlers.
*
diff --git a/libc/intrin/intrin.mk b/libc/intrin/intrin.mk
index 2686b4db4..fb75552bc 100644
--- a/libc/intrin/intrin.mk
+++ b/libc/intrin/intrin.mk
@@ -57,6 +57,12 @@ o/$(MODE)/libc/intrin/asan.o: \
-finline \
-finline-functions
+o/$(MODE)/libc/intrin/kstarttsc.o \
+o/$(MODE)/libc/intrin/nomultics.o \
+o/$(MODE)/libc/intrin/ntconsolemode.o: \
+ OVERRIDE_CFLAGS += \
+ -fno-sanitize=all
+
o/$(MODE)/libc/intrin/asan.o \
o/$(MODE)/libc/intrin/ubsan.o: \
OVERRIDE_CFLAGS += \
diff --git a/libc/intrin/kprintf.greg.c b/libc/intrin/kprintf.greg.c
new file mode 100644
index 000000000..bf483fa9c
--- /dev/null
+++ b/libc/intrin/kprintf.greg.c
@@ -0,0 +1,798 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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. │
+╚─────────────────────────────────────────────────────────────────────────────*/
+#define ShouldUseMsabiAttribute() 1
+#include "libc/bits/bits.h"
+#include "libc/bits/likely.h"
+#include "libc/bits/safemacros.internal.h"
+#include "libc/bits/weaken.h"
+#include "libc/calls/calls.h"
+#include "libc/calls/internal.h"
+#include "libc/dce.h"
+#include "libc/errno.h"
+#include "libc/fmt/divmod10.internal.h"
+#include "libc/fmt/fmt.h"
+#include "libc/intrin/kprintf.h"
+#include "libc/limits.h"
+#include "libc/macros.internal.h"
+#include "libc/nexgen32e/rdtsc.h"
+#include "libc/nexgen32e/uart.internal.h"
+#include "libc/nt/process.h"
+#include "libc/nt/runtime.h"
+#include "libc/nt/thunk/msabi.h"
+#include "libc/runtime/memtrack.internal.h"
+#include "libc/runtime/runtime.h"
+#include "libc/str/str.h"
+#include "libc/str/tpenc.h"
+#include "libc/str/utf16.h"
+#include "libc/sysv/consts/nr.h"
+#include "libc/sysv/consts/prot.h"
+
+#define MAXT (24 * 60 * 60 * 1000000000ull)
+#define WRAP ((MAXT + 1) / 10 * 33)
+
+struct Timestamps {
+ unsigned long long birth;
+ unsigned long long start;
+};
+
+extern int __pid;
+extern bool __replmode;
+extern bool __nomultics;
+static volatile unsigned long long kbirth;
+
+privileged static struct Timestamps kenter(void) {
+ struct Timestamps ts;
+ ts.start = rdtsc();
+ ts.birth = kbirth;
+ if (!ts.birth) {
+ ts.birth = kStartTsc;
+ if (!ts.birth) ts.birth = 1;
+ cmpxchg(&kbirth, 0, ts.birth);
+ }
+ return ts;
+}
+
+privileged static void kleave(struct Timestamps ts) {
+ uint64_t finish, elapse, adjust;
+ finish = rdtsc();
+ elapse = unsignedsubtract(finish, ts.start);
+ adjust = ts.birth + elapse;
+ if (!adjust) adjust = 1;
+ cmpxchg(&kbirth, ts.birth, adjust); /* ignore overlapping time intervals */
+}
+
+privileged static inline char *kadvance(char *p, char *e, long n) {
+ intptr_t t = (intptr_t)p;
+ if (__builtin_add_overflow(t, n, &t)) t = (intptr_t)e;
+ return (char *)t;
+}
+
+privileged static char *kemitquote(char *p, char *e, signed char t,
+ unsigned c) {
+ if (t) {
+ if (p < e) {
+ *p = t < 0 ? 'u' : 'L';
+ }
+ ++p;
+ }
+ if (p < e) {
+ *p = c;
+ }
+ ++p;
+ return p;
+}
+
+privileged static unsigned long long kgetint(va_list va, signed char t,
+ bool s) {
+#ifdef __LP64__
+ int bits;
+ unsigned long long x;
+ x = va_arg(va, unsigned long);
+ if (t <= 0) {
+ bits = 64 - (32 >> MIN(5, -t));
+ x <<= bits;
+ if (s) {
+ x = (signed long)x >> bits;
+ } else {
+ x >>= bits;
+ }
+ }
+ return x;
+#else
+ if (s) {
+ switch (t) {
+ case -2:
+ return (signed char)va_arg(va, int);
+ case -1:
+ return (signed short)va_arg(va, int);
+ default:
+ return va_arg(va, signed int);
+ case 1:
+ return va_arg(va, signed long);
+ case 2:
+ return va_arg(va, signed long long);
+ }
+ } else {
+ switch (t) {
+ case -2:
+ return (unsigned char)va_arg(va, int);
+ case -1:
+ return (unsigned short)va_arg(va, int);
+ default:
+ return va_arg(va, unsigned int);
+ case 1:
+ return va_arg(va, unsigned long);
+ case 2:
+ return va_arg(va, unsigned long long);
+ }
+ }
+#endif
+}
+
+privileged static inline bool kiskernelpointer(const void *p) {
+ return 0x7f0000000000 <= (intptr_t)p && (intptr_t)p < 0x800000000000;
+}
+
+privileged static inline bool kistextpointer(const void *p) {
+ return _base <= (const unsigned char *)p && (const unsigned char *)p < _etext;
+}
+
+privileged static inline bool kisimagepointer(const void *p) {
+ return _base <= (const unsigned char *)p && (const unsigned char *)p < _end;
+}
+
+privileged static inline bool kischarmisaligned(const char *p, signed char t) {
+ if (t == -1) return (intptr_t)p & 1;
+ if (t >= 1) return !!((intptr_t)p & 3);
+ return false;
+}
+
+privileged static inline bool kismemtrackhosed(void) {
+ return !((weaken(_mmi)->i <= weaken(_mmi)->n) &&
+ (weaken(_mmi)->p == weaken(_mmi)->s ||
+ weaken(_mmi)->p == (struct MemoryInterval *)kMemtrackStart));
+}
+
+privileged static bool kismapped(int x) {
+ size_t m, r, l = 0;
+ if (!weaken(_mmi)) return true;
+ if (kismemtrackhosed()) return false;
+ r = weaken(_mmi)->i;
+ while (l < r) {
+ m = (l + r) >> 1;
+ if (weaken(_mmi)->p[m].y < x) {
+ l = m + 1;
+ } else {
+ r = m;
+ }
+ }
+ if (l < weaken(_mmi)->i && x >= weaken(_mmi)->p[l].x) {
+ return !!(weaken(_mmi)->p[l].prot & PROT_READ);
+ } else {
+ return false;
+ }
+}
+
+privileged bool kisdangerous(const void *p) {
+ int frame;
+ if (kisimagepointer(p)) return false;
+ if (kiskernelpointer(p)) return false;
+ if (IsLegalPointer(p)) {
+ frame = (intptr_t)p >> 16;
+ if (IsStackFrame(frame)) return false;
+ if (IsOldStackFrame(frame)) return false;
+ if (kismapped(frame)) return false;
+ }
+ return true;
+}
+
+privileged static void klog(const char *b, size_t n) {
+ int e;
+ size_t i;
+ uint16_t dx;
+ uint32_t wrote;
+ unsigned char al;
+ long rax, rdi, rsi, rdx;
+ if (IsWindows()) {
+ e = __imp_GetLastError();
+ __imp_WriteFile(__imp_GetStdHandle(kNtStdErrorHandle), b, n, &wrote, 0);
+ __imp_SetLastError(e);
+ } else if (IsMetal()) {
+ for (i = 0; i < n; ++i) {
+ for (;;) {
+ dx = 0x3F8 + UART_LSR;
+ asm("inb\t%1,%0" : "=a"(al) : "dN"(dx));
+ if (al & UART_TTYTXR) break;
+ asm("pause");
+ }
+ dx = 0x3F8;
+ asm volatile("outb\t%0,%1"
+ : /* no inputs */
+ : "a"(b[i]), "dN"(dx));
+ }
+ } else {
+ asm volatile("syscall"
+ : "=a"(rax), "=D"(rdi), "=S"(rsi), "=d"(rdx)
+ : "0"(__NR_write), "1"(2), "2"(b), "3"(n)
+ : "rcx", "r8", "r9", "r10", "r11", "memory", "cc");
+ }
+}
+
+privileged static size_t kformat(char *b, size_t n, const char *fmt, va_list va,
+ struct Timestamps ts) {
+ int si;
+ wint_t t, u;
+ const char *abet;
+ signed char type;
+ const char *s, *f;
+ unsigned long long x;
+ unsigned i, j, m, rem, sign, hash, cols, prec;
+ char c, *p, *e, pdot, zero, flip, dang, base, quot, z[128];
+ if (kistextpointer(b) || kisdangerous(b)) n = 0;
+ if (!kistextpointer(fmt)) fmt = "!!WONTFMT";
+ p = b;
+ f = fmt;
+ e = p + n;
+ for (;;) {
+ for (;;) {
+ if (!(c = *f++) || c == '%') break;
+ EmitFormatByte:
+ if (p < e) *p = c;
+ ++p;
+ }
+ if (!c) break;
+ pdot = 0;
+ flip = 0;
+ dang = 0;
+ hash = 0;
+ sign = 0;
+ prec = 0;
+ quot = 0;
+ type = 0;
+ cols = 0;
+ zero = 0;
+ abet = "0123456789abcdef";
+ for (;;) {
+ switch ((c = *f++)) {
+ default:
+ goto EmitFormatByte;
+ case '\0':
+ break;
+ case '.':
+ pdot = 1;
+ continue;
+ case '-':
+ flip = 1;
+ continue;
+ case '#':
+ hash = '0';
+ continue;
+ case '_':
+ case ',':
+ case '\'':
+ quot = c;
+ continue;
+ case ' ':
+ case '+':
+ sign = c;
+ continue;
+ case 'h':
+ --type;
+ continue;
+ case 'j':
+ case 'l':
+ case 'z':
+ ++type;
+ continue;
+ case '!':
+ dang = 1;
+ continue;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ si = pdot ? prec : cols;
+ si *= 10;
+ si += c - '0';
+ goto UpdateCols;
+ case '*':
+ si = va_arg(va, int);
+ UpdateCols:
+ if (pdot) {
+ if (si >= 0) {
+ prec = si;
+ }
+ } else {
+ if (si < 0) {
+ flip = 1;
+ si = -si;
+ }
+ cols = si;
+ if (!cols) {
+ zero = 1;
+ }
+ }
+ continue;
+ case 'T':
+ x = unsignedsubtract(ts.start, ts.birth) % WRAP * 10 / 33;
+ goto FormatUnsigned;
+ case 'P':
+ if (!__vforked) {
+ x = __pid;
+ } else {
+ asm volatile("syscall"
+ : "=a"(x)
+ : "0"(__NR_getpid)
+ : "rcx", "rdx", "r11", "memory", "cc");
+ }
+ goto FormatUnsigned;
+ case 'u':
+ case 'd':
+ if (UNLIKELY(type <= -3)) {
+ s = va_arg(va, int) ? "true" : "false";
+ goto FormatString;
+ }
+ x = kgetint(va, type, c == 'd');
+ FormatDecimal:
+ if ((long long)x < 0 && c != 'u') {
+ x = -x;
+ sign = '-';
+ }
+ FormatUnsigned:
+ if (x && hash) sign = hash;
+ for (i = j = 0;;) {
+ x = DivMod10(x, &rem);
+ z[i++ & 127] = '0' + rem;
+ if (pdot ? i >= prec : !x) break;
+ if (quot && ++j == 3) {
+ z[i++ & 127] = quot;
+ j = 0;
+ }
+ }
+ EmitNumber:
+ if (flip || pdot) zero = 0;
+ while (zero && sign) {
+ if (p < e) *p = sign;
+ if (cols) --cols;
+ sign >>= 8;
+ ++p;
+ }
+ t = !!sign + !!(sign >> 8);
+ if (!flip && cols >= t) {
+ for (j = i; j < cols - t; ++j) {
+ if (p < e) {
+ *p++ = zero ? '0' : ' ';
+ } else {
+ p = kadvance(p, e, cols - t - j);
+ break;
+ }
+ }
+ }
+ while (sign) {
+ if (p < e) *p = sign;
+ sign >>= 8;
+ ++p;
+ }
+ for (j = i; j; ++p) {
+ --j;
+ if (p < e) {
+ *p = z[j & 127];
+ }
+ }
+ if (flip && cols >= t) {
+ for (j = i; j < cols - t; ++j) {
+ if (p < e) {
+ *p++ = ' ';
+ } else {
+ p = kadvance(p, e, cols - t - j);
+ break;
+ }
+ }
+ }
+ break;
+ case 'b':
+ base = 1;
+ if (hash) hash = '0' | 'b' << 8;
+ BinaryNumber:
+ x = kgetint(va, type, false);
+ FormatNumber:
+ i = 0;
+ m = (1 << base) - 1;
+ if (hash && x) sign = hash;
+ do z[i++ & 127] = abet[x & m];
+ while ((x >>= base) || (pdot && i < prec));
+ goto EmitNumber;
+ case 'X':
+ abet = "0123456789ABCDEF";
+ /* fallthrough */
+ case 'x':
+ base = 4;
+ if (hash) hash = '0' | 'x' << 8;
+ goto BinaryNumber;
+ case 'o':
+ base = 3;
+ goto BinaryNumber;
+ case 'p':
+ x = va_arg(va, intptr_t);
+ if (!x && pdot) pdot = 0;
+ if ((long)x == -1) {
+ pdot = 0;
+ goto FormatDecimal;
+ }
+ hash = '0' | 'x' << 8;
+ base = 4;
+ goto FormatNumber;
+ case 'C':
+ c = 'c';
+ type = 1;
+ /* fallthrough */
+ case 'c':
+ i = 1;
+ j = 0;
+ x = 0;
+ s = (const char *)&x;
+ t = va_arg(va, int);
+ if (!type) t &= 255;
+ if (hash) {
+ quot = 1;
+ hash = '\'';
+ p = kemitquote(p, e, type, hash);
+ if (cols && type) --cols; /* u/L */
+ if (cols) --cols; /* start quote */
+ if (cols) --cols; /* end quote */
+ }
+ goto EmitChar;
+ case 'm':
+ if (!(x = errno) && sign == ' ') {
+ break;
+ } else if (weaken(strerror_r) &&
+ !weaken(strerror_r)(x, z, sizeof(z))) {
+ s = z;
+ goto FormatString;
+ } else {
+ goto FormatDecimal;
+ }
+ case 'n':
+ if (__nomultics) {
+ if (p < e) *p = '\r';
+ ++p;
+ }
+ if (p < e) *p = '\n';
+ ++p;
+ break;
+ case 'r':
+ if (!__replmode) {
+ break;
+ } else {
+ s = "\r\033[K";
+ goto FormatString;
+ }
+ case 'S':
+ c = 's';
+ type = 1;
+ /* fallthrough */
+ case 's':
+ if (!(s = va_arg(va, const void *))) {
+ s = sign != ' ' ? "NULL" : "";
+ FormatString:
+ type = 0;
+ hash = 0;
+ } else if (!dang && (kisdangerous(s) || kischarmisaligned(s, type))) {
+ if (sign == ' ') {
+ if (p < e) *p = ' ';
+ ++p;
+ }
+ x = (intptr_t)s;
+ base = 4;
+ hash = '!' | '!' << 8;
+ goto FormatNumber;
+ } else if (hash) {
+ quot = 1;
+ hash = '"';
+ if (cols && type) --cols; /* u/L */
+ if (cols) --cols; /* start quote */
+ if (cols) --cols; /* end quote */
+ p = kemitquote(p, e, type, hash);
+ }
+ if (sign == ' ' && (!pdot || prec) && *s) {
+ if (p < e) *p = ' ';
+ ++p;
+ }
+ for (i = j = 0; !pdot || j < prec; ++j) {
+ if (UNLIKELY(!((intptr_t)s & (PAGESIZE - 1)))) {
+ if (!dang && kisdangerous(s)) break;
+ }
+ if (!type) {
+ if (!(t = *s++ & 255)) break;
+ if ((t & 0300) == 0200) goto ActuallyEmitByte;
+ ++i;
+ EmitByte:
+ if (UNLIKELY(quot) && (t == '\\' || ((t == '"' && c == 's') ||
+ (t == '\'' && c == 'c')))) {
+ if (p + 2 <= e) {
+ p[0] = '\\';
+ p[1] = t;
+ }
+ p += 2;
+ i += 1;
+ continue;
+ }
+ if (pdot ||
+ (t != 0x7F && (t >= 0x20 || (t == '\n' || t == '\t' ||
+ t == '\r' || t == '\e')))) {
+ ActuallyEmitByte:
+ if (p < e) *p = t;
+ p += 1;
+ continue;
+ } else if (quot) {
+ if (p + 4 <= e) {
+ p[0] = '\\';
+ p[1] = '0' + ((t & 0300) >> 6);
+ p[2] = '0' + ((t & 0070) >> 3);
+ p[3] = '0' + ((t & 0007) >> 0);
+ }
+ p += 4;
+ i += 3;
+ continue;
+ } else {
+ /* Control Pictures
+ ═══════════════════════════════════════════════════════
+ 2400 │ 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ ───────────────────────────────────────────────────────
+ 2400 │ ␀ ␁ ␂ ␃ ␄ ␅ ␆ ␇ ␈ ␉ ␊ ␋ ␌ ␍ ␎ ␏
+ 2410 │ ␐ ␑ ␒ ␓ ␔ ␕ ␖ ␗ ␘ ␙ ␚ ␛ ␜ ␝ ␞ ␟
+ 2420 │ ␠ ␡ ␢ ␣  ␥ ␦ */
+ if (t != 0x7F) {
+ t += 0x2400;
+ } else {
+ t = 0x2421;
+ }
+ goto EmitChar;
+ }
+ } else if (type < -1) {
+ if ((t = *s++ & 255)) {
+ t = kCp437[t];
+ }
+ } else if (type < 0) {
+ t = *(const char16_t *)s;
+ s += sizeof(char16_t);
+ if (IsHighSurrogate(t)) {
+ if (!pdot || j + 1 < prec) {
+ if (UNLIKELY(!((intptr_t)s & (PAGESIZE - 1)))) {
+ if (!dang && kisdangerous(s)) break;
+ }
+ u = *(const char16_t *)s;
+ if (IsLowSurrogate(u)) {
+ t = MergeUtf16(t, u);
+ s += sizeof(char16_t);
+ j += 1;
+ }
+ } else {
+ break;
+ }
+ } else if (!t) {
+ break;
+ }
+ } else {
+ t = *(const wchar_t *)s;
+ s += sizeof(wchar_t);
+ }
+ if (!t) break;
+ ++i;
+ EmitChar:
+ if (t <= 0x7f) {
+ goto EmitByte;
+ } else if (t <= 0x7ff) {
+ if (p + 2 <= e) {
+ p[0] = 0300 | (t >> 6);
+ p[1] = 0200 | (t & 077);
+ }
+ p += 2;
+ } else if (t <= 0xffff) {
+ if (UNLIKELY(IsSurrogate(t))) {
+ EncodeReplacementCharacter:
+ t = 0xfffd;
+ }
+ if (p + 3 <= e) {
+ p[0] = 0340 | (t >> 12);
+ p[1] = 0200 | ((t >> 6) & 077);
+ p[2] = 0200 | (t & 077);
+ }
+ p += 3;
+ } else if (~(t >> 18) & 007) {
+ if (p + 4 <= e) {
+ p[0] = 0360 | (t >> 18);
+ p[1] = 0200 | ((t >> 12) & 077);
+ p[2] = 0200 | ((t >> 6) & 077);
+ p[3] = 0200 | (t & 077);
+ }
+ p += 4;
+ } else {
+ goto EncodeReplacementCharacter;
+ }
+ }
+ if (hash) {
+ if (p < e) *p = hash;
+ ++p;
+ }
+ for (; cols > i; --cols) {
+ if (p < e) {
+ *p++ = ' ';
+ } else {
+ p = kadvance(p, e, cols - i);
+ break;
+ }
+ }
+ break;
+ }
+ break;
+ }
+ }
+ if (p < e) {
+ *p = 0;
+ } else if (e > b) {
+ u = 0;
+ *--e = 0;
+ s = "\n...";
+ if (!(((f - fmt) >= 2 && f[-2] == '\n') ||
+ ((f - fmt) >= 3 && f[-3] == '%' && f[-2] == 'n'))) {
+ ++s;
+ }
+ while ((t = *s++) && e > b) {
+ u = *--e;
+ *e = t;
+ }
+ if ((u & 0300) == 0200) {
+ while (e > b) {
+ u = *--e;
+ *e = '.';
+ if ((u & 0300) != 0200) {
+ break;
+ }
+ }
+ }
+ }
+ return p - b;
+}
+
+/**
+ * Privileged snprintf().
+ *
+ * @param b is buffer, and guaranteed a NUL-terminator if `n>0`
+ * @param n is number of bytes available in buffer
+ * @return length of output excluding NUL, which may exceed `n`
+ * @see kprintf() for documentation
+ * @asyncsignalsafe
+ * @vforksafe
+ */
+privileged size_t ksnprintf(char *b, size_t n, const char *fmt, ...) {
+ size_t m;
+ va_list v;
+ struct Timestamps t = {0};
+ va_start(v, fmt);
+ m = kformat(b, n, fmt, v, t);
+ va_end(v);
+ return m;
+}
+
+/**
+ * Privileged vsnprintf().
+ *
+ * @param b is buffer, and guaranteed a NUL-terminator if `n>0`
+ * @param n is number of bytes available in buffer
+ * @return length of output excluding NUL, which may exceed `n`
+ * @see kprintf() for documentation
+ * @asyncsignalsafe
+ * @vforksafe
+ */
+privileged size_t kvsnprintf(char *b, size_t n, const char *fmt, va_list v) {
+ struct Timestamps t = {0};
+ return kformat(b, n, fmt, v, t);
+}
+
+/**
+ * Privileged vprintf.
+ *
+ * @see kprintf() for documentation
+ * @asyncsignalsafe
+ * @vforksafe
+ */
+privileged void kvprintf(const char *fmt, va_list v) {
+ size_t n;
+ char b[2048];
+ struct Timestamps t;
+ if (!v) return;
+ t = kenter();
+ n = kformat(b, sizeof(b), fmt, v, t);
+ klog(b, MIN(n, sizeof(b)));
+ kleave(t);
+}
+
+/**
+ * Privileged printf().
+ *
+ * This function is intended for crash reporting. It's designed to be as
+ * unbreakable as possible, so that error messages can always be printed
+ * even when the rest of the runtime is broken. As such, it has continue
+ * on error semantics, doesn't support buffering between invocations and
+ * floating point is not supported. Output is also truncated if the line
+ * gets too long, but care is taken to preserve your newline characters.
+ * Your errno and GetLastError() state will not be clobbered, and ftrace
+ * and other runtime magic won't be invoked, since all the runtime magic
+ * depends on this function.
+ *
+ * Directives:
+ *
+ * %[FLAGS][WIDTH|*][.[PRECISION|*]][TYPE]SPECIFIER
+ *
+ * Specifiers:
+ *
+ * - `P` pid
+ * - `c` char
+ * - `o` octal
+ * - `b` binary
+ * - `s` string
+ * - `p` pointer
+ * - `d` decimal
+ * - `n` newline
+ * - `u` unsigned
+ * - `r` carriage
+ * - `m` strerror
+ * - `X` uppercase
+ * - `T` timestamp
+ * - `x` hexadecimal
+ *
+ * Types:
+ *
+ * - `hhh` bool
+ * - `hh` char or cp437
+ * - `h` short or char16_t
+ * - `l` long or wchar_t
+ * - `ll` long long
+ *
+ * Flags:
+ *
+ * - `0` zero padding
+ * - `-` flip alignment
+ * - `!` bypass memory safety
+ * - `,` thousands grouping w/ comma
+ * - `'` thousands grouping w/ apostrophe
+ * - `_` thousands grouping w/ underscore
+ * - `+` plus leftpad if positive (aligns w/ negatives)
+ * - ` ` space leftpad if positive (aligns w/ negatives)
+ * - `#` represent value with literal syntax, e.g. 0x, 0b, quotes
+ *
+ * @asyncsignalsafe
+ * @vforksafe
+ */
+privileged void kprintf(const char *fmt, ...) {
+ /* system call support runtime depends on this function */
+ /* function tracing runtime depends on this function */
+ /* asan runtime depends on this function */
+ va_list v;
+ va_start(v, fmt);
+ kvprintf(fmt, v);
+ va_end(v);
+}
diff --git a/libc/intrin/kprintf.h b/libc/intrin/kprintf.h
new file mode 100644
index 000000000..5bc910675
--- /dev/null
+++ b/libc/intrin/kprintf.h
@@ -0,0 +1,14 @@
+#ifndef COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
+#define COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
+#if !(__ASSEMBLER__ + __LINKER__ + 0)
+COSMOPOLITAN_C_START_
+
+void kprintf(const char *, ...);
+size_t ksnprintf(char *, size_t, const char *, ...);
+void kvprintf(const char *, va_list);
+size_t kvsnprintf(char *, size_t, const char *, va_list);
+bool kisdangerous(const void *);
+
+COSMOPOLITAN_C_END_
+#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
+#endif /* COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ */
diff --git a/libc/nexgen32e/kstarttsc.S b/libc/intrin/kstarttsc.c
similarity index 72%
rename from libc/nexgen32e/kstarttsc.S
rename to libc/intrin/kstarttsc.c
index 8822ae9cb..598fd54db 100644
--- a/libc/nexgen32e/kstarttsc.S
+++ b/libc/intrin/kstarttsc.c
@@ -1,7 +1,7 @@
-/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
-│vi: set et ft=asm ts=8 sw=8 fenc=utf-8 :vi│
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
-│ Copyright 2020 Justine Alexandra Roberts Tunney │
+│ Copyright 2021 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 │
@@ -16,24 +16,11 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
-#include "libc/macros.internal.h"
-// Stores CPU Timestamp Counter at startup.
-//
-// It can be useful as an added source of seeding information.
-//
-// @note rdtsc is a 25 cycle instruction
- .initbss 200,_init_kStartTsc
-kStartTsc:
- .quad 0
- .endobj kStartTsc,globl
- .previous
-
- .init.start 200,_init_kStartTsc
- rdtsc
- stosl
- xchg %edx,%eax
- stosl
- .init.end 200,_init_kStartTsc
-
- .source __FILE__
+/**
+ * Timestamp of process start.
+ *
+ * @see libc/runtime/winmain.greg.h
+ * @see libc/crt/crt.S
+ */
+uint64_t kStartTsc;
diff --git a/libc/intrin/nomultics.c b/libc/intrin/nomultics.c
new file mode 100644
index 000000000..036f89f49
--- /dev/null
+++ b/libc/intrin/nomultics.c
@@ -0,0 +1,30 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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. │
+╚─────────────────────────────────────────────────────────────────────────────*/
+
+/**
+ * Controls disablement of MULTICS newlines.
+ *
+ * Normally we use `\n` for newlines. If this is `true` then we'll try
+ * our best to use `\r\n`. This is toggled automatically on Windows or
+ * when `ioctl(TCSETS)` disables `OPOST`.
+ *
+ * @see kprintf()
+ */
+bool __nomultics;
+bool __replmode;
diff --git a/libc/intrin/ntconsolemode.c b/libc/intrin/ntconsolemode.c
new file mode 100644
index 000000000..f25cb4a99
--- /dev/null
+++ b/libc/intrin/ntconsolemode.c
@@ -0,0 +1,21 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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/runtime/internal.h"
+
+uint32_t __ntconsolemode[2];
diff --git a/libc/intrin/printf.c b/libc/intrin/printf.c
deleted file mode 100644
index 1ad0b9a2b..000000000
--- a/libc/intrin/printf.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
-│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
-╞══════════════════════════════════════════════════════════════════════════════╡
-│ Copyright 2021 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/limits.h"
-#include "libc/log/libfatal.internal.h"
-#include "libc/nexgen32e/uart.internal.h"
-#include "libc/nt/runtime.h"
-#include "libc/runtime/runtime.h"
-#include "libc/str/tpenc.h"
-#include "libc/sysv/consts/nr.h"
-
-/**
- * Privileged vprintf.
- *
- * This will work without any cosmopolitan runtime support once the
- * executable has been loaded into memory.
- */
-privileged noasan noubsan noinstrument void __vprintf(const char *fmt,
- va_list va) {
- short w[2];
- uint16_t dx;
- const void *s;
- uint32_t wrote;
- unsigned long x;
- unsigned char al;
- int i, j, t, cstr;
- long d, rax, rdi, rsi, rdx, dot;
- char c, *p, *e, pad, bits, base, sign, thou, z[28], b[2048];
- p = b;
- e = p + sizeof(b);
- do {
- switch ((c = *fmt++)) {
- default:
- if (p < e) {
- *p++ = c;
- }
- break;
- case '\0':
- break;
- case '%':
- dot = 0;
- pad = ' ';
- sign = 0;
- bits = 0;
- thou = 0;
- w[0] = 0;
- w[1] = SHRT_MAX;
- NeedMoar:
- switch ((c = *fmt++)) {
- case '\0':
- break;
- case 'l':
- case 'z':
- goto NeedMoar;
- case ' ':
- case '+':
- sign = c;
- goto NeedMoar;
- case 'e':
- dot = 1;
- goto NeedMoar;
- case ',':
- thou = c;
- goto NeedMoar;
- case 'h':
- bits = 16;
- goto NeedMoar;
- case '0':
- pad = c;
- /* fallthrough */
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- w[dot] *= 10;
- w[dot] += c - '0';
- goto NeedMoar;
- case '*':
- w[dot] = va_arg(va, int);
- goto NeedMoar;
- case 'd':
- d = va_arg(va, long);
- ApiAbuse:
- x = d;
- if (d < 0) {
- x = -x;
- sign = '-';
- }
- for (i = j = 0;;) {
- z[i++] = x % 10 + '0';
- if (!(x /= 10)) break;
- if (thou && !(++j % 3)) {
- z[i++] = thou;
- }
- }
- if (sign) {
- z[i++] = sign;
- }
- EmitNumber:
- while (w[0]-- > i) {
- if (p < e) *p++ = pad;
- }
- do {
- if (p < e) *p++ = z[--i];
- } while (i);
- break;
- case 'b':
- base = 1;
- BinaryNumber:
- i = 0;
- x = va_arg(va, unsigned long);
- do z[i++] = "0123456789abcdef"[x & ((1 << base) - 1)];
- while ((x >>= base) && i < w[1]);
- goto EmitNumber;
- case 'p':
- pad = '0';
- w[0] = 12;
- w[1] = 12;
- /* fallthrough */
- case 'x':
- base = 4;
- goto BinaryNumber;
- case 'o':
- base = 3;
- goto BinaryNumber;
- case 'c':
- cstr = va_arg(va, int);
- s = &cstr;
- goto EmitString;
- case 's':
- s = va_arg(va, const void *);
- EmitString:
- if (!s) {
- s = "NULL";
- bits = 0;
- } else if ((uintptr_t)s < PAGESIZE) {
- d = (intptr_t)s;
- goto ApiAbuse;
- }
- for (i = 0; i < w[1]; ++i) {
- if (!bits) {
- t = ((const char *)s)[i];
- EmitByte:
- if (t) {
- if (p < e) {
- *p++ = t;
- }
- } else {
- break;
- }
- } else {
- t = ((const char16_t *)s)[i];
- if (t <= 0x7f) {
- goto EmitByte;
- } else if (t <= 0x7ff) {
- if (p + 1 < e) {
- p[0] = 0300 | t >> 6;
- p[1] = 0200 | x << 8 | t & 077;
- p += 2;
- }
- } else if (p + 2 < e) {
- p[0] = 0340 | t >> 12;
- p[1] = 0200 | x << 8 | (t >> 6) & 077;
- p[2] = 0200 | x << 8 | t & 077;
- p += 3;
- }
- }
- }
- while (w[0]-- > i) {
- if (p < e) *p++ = pad;
- }
- break;
- default:
- break;
- }
- break;
- }
- } while (c);
- if (p == e) {
- e[-4] = '.';
- e[-3] = '.';
- e[-2] = '.';
- e[-1] = '\n';
- }
- if (IsWindows()) {
- WriteFile(GetStdHandle(kNtStdErrorHandle), b, p - b, &wrote, 0);
- } else if (IsMetal()) {
- for (e = p, p = b; p < e; ++p) {
- for (;;) {
- dx = 0x3F8 + UART_LSR;
- asm("inb\t%1,%0" : "=a"(al) : "dN"(dx));
- if (al & UART_TTYTXR) break;
- asm("pause");
- }
- dx = 0x3F8;
- asm volatile("outb\t%0,%1"
- : /* no inputs */
- : "a"(*p), "dN"(dx));
- }
- } else {
- asm volatile("syscall"
- : "=a"(rax), "=D"(rdi), "=S"(rsi), "=d"(rdx)
- : "0"(__NR_write), "1"(2L), "2"(b), "3"(p - b)
- : "rcx", "r8", "r9", "r10", "r11", "memory", "cc");
- }
-}
-
-/**
- * Privileged printf.
- *
- * This will work without any cosmopolitan runtime support once the
- * executable has been loaded into memory.
- */
-privileged noasan noubsan noinstrument void __printf(const char *fmt, ...) {
- /* system call support runtime depends on this function */
- /* function tracing runtime depends on this function */
- /* asan runtime depends on this function */
- va_list va;
- va_start(va, fmt);
- __vprintf(fmt, va);
- va_end(va);
-}
diff --git a/libc/runtime/quick_exit.c b/libc/intrin/quick_exit.c
similarity index 85%
rename from libc/runtime/quick_exit.c
rename to libc/intrin/quick_exit.c
index aea08672c..54e37e172 100644
--- a/libc/runtime/quick_exit.c
+++ b/libc/intrin/quick_exit.c
@@ -16,15 +16,16 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
-#include "libc/bits/pushpop.h"
#include "libc/bits/weaken.h"
+#include "libc/dce.h"
#include "libc/nt/console.h"
-#include "libc/nt/enum/consolemodeflags.h"
#include "libc/nt/runtime.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
+const char kConsoleHandles[2] = {kNtStdInputHandle, kNtStdOutputHandle};
+
/**
* Exits process faster.
*
@@ -32,18 +33,18 @@
* @noreturn
*/
wontreturn void quick_exit(int exitcode) {
+ int i;
const uintptr_t *p;
if (weaken(fflush)) {
weaken(fflush)(0);
}
+ if (SupportsWindows() && __ntconsolemode[0]) {
+ for (i = 0; i < 2; ++i) {
+ SetConsoleMode(GetStdHandle(kConsoleHandles[i]), __ntconsolemode[i]);
+ }
+ }
for (p = __fini_array_end; p > __fini_array_start;) {
((void (*)(void))(*--p))();
}
- if (SupportsWindows() && __ntconsolemode) {
- SetConsoleMode(GetStdHandle(pushpop(kNtStdInputHandle)), __ntconsolemode);
- SetConsoleMode(GetStdHandle(pushpop(kNtStdOutputHandle)),
- kNtEnableProcessedOutput | kNtEnableWrapAtEolOutput |
- kNtEnableVirtualTerminalProcessing);
- }
_Exit(exitcode);
}
diff --git a/libc/intrin/ubsan.c b/libc/intrin/ubsan.c
index ae95fede5..2b0458ff1 100644
--- a/libc/intrin/ubsan.c
+++ b/libc/intrin/ubsan.c
@@ -21,6 +21,7 @@
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/fmt/fmt.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/internal.h"
#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
@@ -189,7 +190,7 @@ static uintptr_t __ubsan_extend(struct UbsanTypeDescriptor *t, uintptr_t x) {
void __ubsan_abort(const struct UbsanSourceLocation *loc,
const char *description) {
- __printf("\r\n%s:%d: ubsan error: %s\r\n", loc->file, loc->line, description);
+ kprintf("%n%s:%d: ubsan error: %s%n", loc->file, loc->line, description);
if (weaken(__die)) weaken(__die)();
_Exit(134);
}
@@ -258,7 +259,7 @@ void __ubsan_handle_type_mismatch(struct UbsanTypeMismatchInfo *info,
p = __stpcpy(p, " align ");
p = __intcpy(p, info->alignment);
} else {
- p = __stpcpy(p, "insufficient size\r\n\t");
+ p = __stpcpy(p, "insufficient size%n\t");
p = __stpcpy(p, kind);
p = __stpcpy(p, " address 0x");
p = __fixcpy(p, pointer, sizeof(pointer) * CHAR_BIT);
diff --git a/libc/calls/vforked.c b/libc/intrin/vforked.c
similarity index 100%
rename from libc/calls/vforked.c
rename to libc/intrin/vforked.c
diff --git a/libc/log/addr2linepath.c b/libc/log/addr2linepath.c
index b2af0c798..44b51de5a 100644
--- a/libc/log/addr2linepath.c
+++ b/libc/log/addr2linepath.c
@@ -18,6 +18,6 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/log/log.h"
-noasan const char *GetAddr2linePath(void) {
+const char *GetAddr2linePath(void) {
return commandvenv("ADDR2LINE", "addr2line");
}
diff --git a/libc/log/attachdebugger.c b/libc/log/attachdebugger.c
index 7dacf176a..e1d731268 100644
--- a/libc/log/attachdebugger.c
+++ b/libc/log/attachdebugger.c
@@ -19,6 +19,7 @@
#include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/fmt/fmt.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/color.internal.h"
#include "libc/log/gdb.h"
#include "libc/log/internal.h"
@@ -50,17 +51,17 @@
* @return gdb pid if continuing, 0 if detached, or -1 w/ errno
* @note this is called via eponymous spinlock macro wrapper
*/
-relegated int(attachdebugger)(intptr_t continuetoaddr) {
+relegated int(AttachDebugger)(intptr_t continuetoaddr) {
int pid, ttyfd;
struct StackFrame *bp;
char pidstr[11], breakcmd[40];
const char *se, *elf, *gdb, *rewind, *layout;
- if (IsGenuineCosmo() || !(gdb = GetGdbPath()) ||
+ if (IsGenuineCosmo() || !(gdb = GetGdbPath()) || !isatty(0) || !isatty(1) ||
(ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC)) == -1) {
return -1;
}
__restore_tty(ttyfd);
- snprintf(pidstr, sizeof(pidstr), "%u", getpid());
+ ksnprintf(pidstr, sizeof(pidstr), "%u", getpid());
layout = "layout asm";
if ((elf = FindDebugBinary())) {
se = "-se";
@@ -75,12 +76,12 @@ relegated int(attachdebugger)(intptr_t continuetoaddr) {
continuetoaddr = bp->addr;
}
rewind = "-ex";
- snprintf(breakcmd, sizeof(breakcmd), "%s *%#p", "break", continuetoaddr);
+ ksnprintf(breakcmd, sizeof(breakcmd), "%s *%#p", "break", continuetoaddr);
} else {
rewind = NULL;
breakcmd[0] = '\0';
}
- if (!(pid = vfork())) {
+ if (!(pid = fork())) {
dup2(ttyfd, 0);
dup2(ttyfd, 1);
execv(gdb, (char *const[]){
diff --git a/libc/log/backtrace2.c b/libc/log/backtrace2.c
index e5bb6b764..74872127f 100644
--- a/libc/log/backtrace2.c
+++ b/libc/log/backtrace2.c
@@ -27,6 +27,7 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
@@ -46,8 +47,7 @@
#define kBacktraceMaxFrames 128
#define kBacktraceBufSize ((kBacktraceMaxFrames - 1) * (18 + 1))
-static noasan int PrintBacktraceUsingAddr2line(int fd,
- const struct StackFrame *bp) {
+static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
ssize_t got;
intptr_t addr;
size_t i, j, gi;
@@ -57,10 +57,32 @@ static noasan int PrintBacktraceUsingAddr2line(int fd,
const struct StackFrame *frame;
char *debugbin, *p1, *p2, *p3, *addr2line;
char buf[kBacktraceBufSize], *argv[kBacktraceMaxFrames];
- if (IsOpenbsd()) return -1;
- if (IsWindows()) return -1;
- if (!(debugbin = FindDebugBinary())) return -1;
- if (!(addr2line = GetAddr2linePath())) return -1;
+
+ if (!(debugbin = FindDebugBinary())) {
+ if (IsLinux()) {
+ kprintf("warning: can't find debug binary try setting COMDBG%n");
+ }
+ return -1;
+ }
+
+ if (!(addr2line = GetAddr2linePath())) {
+ if (IsLinux()) {
+ kprintf("warning: can't find addr2line try setting ADDR2LINE%n");
+ }
+ return -1;
+ }
+
+ /*
+ * DWARF is a weak standard. If we build on Linux then only the
+ * precice same version of the same tools on Linux can be counted upon
+ * to work reliably. So if it's not Linux, we fall back to our builtin
+ * tooling which can be counted upon.
+ */
+ if (!IsLinux()) {
+ kprintf("note: won't print addr2line backtrace on non-linux%n");
+ return -1;
+ }
+
i = 0;
j = 0;
argv[i++] = "addr2line";
@@ -92,8 +114,8 @@ static noasan int PrintBacktraceUsingAddr2line(int fd,
if (!(pid = vfork())) {
sigprocmask(SIG_SETMASK, &savemask, NULL);
dup2(pipefds[1], 1);
- close(pipefds[0]);
- close(pipefds[1]);
+ if (pipefds[0] != 1) close(pipefds[0]);
+ if (pipefds[1] != 1) close(pipefds[1]);
execvp(addr2line, argv);
_exit(127);
}
@@ -101,36 +123,6 @@ static noasan int PrintBacktraceUsingAddr2line(int fd,
while ((got = read(pipefds[0], buf, kBacktraceBufSize)) > 0) {
p1 = buf;
p3 = p1 + got;
-
- /*
- * Remove deep libc error reporting facilities from backtraces.
- *
- * For example, if the following shows up in Emacs:
- *
- * 40d097: __die at libc/log/die.c:33
- * 434daa: __asan_die at libc/intrin/asan.c:483
- * 435146: __asan_report_memory_fault at libc/intrin/asan.c:524
- * 435b32: __asan_report_store at libc/intrin/asan.c:719
- * 43472e: __asan_report_store1 at libc/intrin/somanyasan.S:118
- * 40c3a9: GetCipherSuite at net/https/getciphersuite.c:80
- * 4383a5: GetCipherSuite_test at test/net/https/getciphersuite.c:23
- * ...
- *
- * Then it's unpleasant to need to press C-x C-n six times.
- */
-#if 0
- while ((p2 = memchr(p1, '\n', p3 - p1))) {
- if (memmem(p1, p2 - p1, ": __asan_", 9) ||
- memmem(p1, p2 - p1, ": __die", 7)) {
- memmove(p1, p2 + 1, p3 - (p2 + 1));
- p3 -= p2 + 1 - p1;
- } else {
- p1 = p2 + 1;
- break;
- }
- }
-#endif
-
/*
* remove racist output from gnu tooling, that can't be disabled
* otherwise, since it breaks other tools like emacs that aren't
@@ -165,7 +157,7 @@ static noasan int PrintBacktraceUsingAddr2line(int fd,
}
}
-static noasan int PrintBacktrace(int fd, const struct StackFrame *bp) {
+static int PrintBacktrace(int fd, const struct StackFrame *bp) {
if (!IsTiny()) {
if (PrintBacktraceUsingAddr2line(fd, bp) != -1) {
return 0;
@@ -174,21 +166,23 @@ static noasan int PrintBacktrace(int fd, const struct StackFrame *bp) {
return PrintBacktraceUsingSymbols(fd, bp, GetSymbolTable());
}
-noasan void ShowBacktrace(int fd, const struct StackFrame *bp) {
+void ShowBacktrace(int fd, const struct StackFrame *bp) {
#ifdef __FNO_OMIT_FRAME_POINTER__
/* asan runtime depends on this function */
static bool noreentry;
- ++g_ftrace;
+ --g_ftrace;
if (!bp) bp = __builtin_frame_address(0);
if (!noreentry) {
noreentry = true;
PrintBacktrace(fd, bp);
noreentry = false;
+ } else {
+ kprintf("warning: re-entered ShowBackTrace()%n");
}
- --g_ftrace;
+ ++g_ftrace;
#else
- __printf("ShowBacktrace() needs these flags to show C backtrace:\n"
- "\t-D__FNO_OMIT_FRAME_POINTER__\n"
- "\t-fno-omit-frame-pointer\n");
+ kprintf("ShowBacktrace() needs these flags to show C backtrace:%n"
+ "\t-D__FNO_OMIT_FRAME_POINTER__%n"
+ "\t-fno-omit-frame-pointer%n");
#endif
}
diff --git a/libc/log/backtrace3.c b/libc/log/backtrace3.c
index ed2fc87d4..24f8d15d1 100644
--- a/libc/log/backtrace3.c
+++ b/libc/log/backtrace3.c
@@ -22,8 +22,8 @@
#include "libc/calls/calls.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h"
-#include "libc/log/libfatal.internal.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/gc.internal.h"
#include "libc/nexgen32e/stackframe.h"
@@ -51,17 +51,16 @@ noinstrument noasan int PrintBacktraceUsingSymbols(int fd,
int i, symbol, addend;
struct Garbages *garbage;
const struct StackFrame *frame;
- ++g_ftrace;
if (!bp) bp = __builtin_frame_address(0);
garbage = weaken(__garbage);
gi = garbage ? garbage->i : 0;
for (i = 0, frame = bp; frame; frame = frame->next) {
if (!IsValidStackFramePointer(frame)) {
- __printf("%p corrupt frame pointer\n", frame);
+ kprintf("%p corrupt frame pointer%n", frame);
break;
}
if (++i == LIMIT) {
- __printf("\n");
+ kprintf("%n");
break;
}
addr = frame->addr;
@@ -85,9 +84,8 @@ noinstrument noasan int PrintBacktraceUsingSymbols(int fd,
} else {
addend = 0;
}
- __printf("%p %p %s%+d\r\n", frame, addr, __get_symbol_name(st, symbol),
- addend);
+ kprintf("%012lx %012lx %s%+d\r%n", frame, addr,
+ __get_symbol_name(st, symbol), addend);
}
- --g_ftrace;
return 0;
}
diff --git a/libc/log/checkfail_ndebug.c b/libc/log/checkfail_ndebug.c
index 7217e487d..e1f655883 100644
--- a/libc/log/checkfail_ndebug.c
+++ b/libc/log/checkfail_ndebug.c
@@ -17,8 +17,8 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/errno.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/internal.h"
-#include "libc/log/libfatal.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
@@ -35,8 +35,8 @@
relegated void ___check_fail_ndebug(uint64_t want, uint64_t got,
const char *opchar) {
__restore_tty(1);
- __printf("\n%serror: %s: check failed: 0x%x %s 0x%x (%s)\n",
- !g_isterminalinarticulate ? "\e[J" : "", program_invocation_name,
- want, opchar, got, strerror(errno));
+ kprintf("%n%serror: %s: check failed: 0x%x %s 0x%x (%s)%n",
+ !g_isterminalinarticulate ? "\e[J" : "", program_invocation_name,
+ want, opchar, got, strerror(errno));
exit(1);
}
diff --git a/libc/log/gdb.h b/libc/log/gdb.h
index 0eccb440e..0444a8f45 100644
--- a/libc/log/gdb.h
+++ b/libc/log/gdb.h
@@ -18,10 +18,10 @@ COSMOPOLITAN_C_START_
extern volatile int g_gdbsync;
int gdbexec(const char *);
-int attachdebugger(intptr_t);
+int AttachDebugger(intptr_t);
-#define attachdebugger(CONTINUE_TO_ADDR) /* shorten backtraces */ \
- SYNCHRONIZE_DEBUGGER((attachdebugger)(CONTINUE_TO_ADDR))
+#define AttachDebugger(CONTINUE_TO_ADDR) /* shorten backtraces */ \
+ SYNCHRONIZE_DEBUGGER((AttachDebugger)(CONTINUE_TO_ADDR))
#define SYNCHRONIZE_DEBUGGER(PID) \
({ \
@@ -40,20 +40,20 @@ int attachdebugger(intptr_t);
Pid; \
})
-#define __inline_wait4(PID, OPT_OUT_WSTATUS, OPTIONS, OPT_OUT_RUSAGE) \
- ({ \
- int64_t WaAx; \
- if (!IsWindows()) { \
- asm volatile("mov\t%5,%%r10\n\t" \
- "syscall" \
- : "=a"(WaAx) \
- : "0"(__NR_wait4), "D"(PID), "S"(OPT_OUT_WSTATUS), \
- "d"(OPTIONS), "g"(OPT_OUT_RUSAGE) \
- : "rcx", "r10", "r11", "cc", "memory"); \
- } else { \
+#define __inline_wait4(PID, OPT_OUT_WSTATUS, OPTIONS, OPT_OUT_RUSAGE) \
+ ({ \
+ int64_t WaAx; \
+ if (!IsWindows()) { \
+ asm volatile("mov\t%5,%%r10\n\t" \
+ "syscall" \
+ : "=a"(WaAx) \
+ : "0"(__NR_wait4), "D"(PID), "S"(OPT_OUT_WSTATUS), \
+ "d"(OPTIONS), "g"(OPT_OUT_RUSAGE) \
+ : "rcx", "r8", "r9", "r10", "r11", "memory", "cc"); \
+ } else { \
WaAx = sys_wait4_nt(PID, OPT_OUT_WSTATUS, OPTIONS, OPT_OUT_RUSAGE); \
- } \
- WaAx; \
+ } \
+ WaAx; \
})
COSMOPOLITAN_C_END_
diff --git a/libc/log/internal.h b/libc/log/internal.h
index 298911be3..866579a1d 100644
--- a/libc/log/internal.h
+++ b/libc/log/internal.h
@@ -7,11 +7,11 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
-extern hidden int kCrashSigs[8];
+extern hidden int kCrashSigs[7];
extern hidden bool g_isrunningundermake;
extern hidden bool g_isterminalinarticulate;
extern hidden struct termios g_oldtermios;
-extern hidden struct sigaction g_oldcrashacts[8];
+extern hidden struct sigaction g_oldcrashacts[7];
void __start_fatal(const char *, int) hidden;
void __oncrash(int, struct siginfo *, struct ucontext *) relegated;
diff --git a/libc/log/libfatal.internal.h b/libc/log/libfatal.internal.h
index 264c43a8f..63dd53c0f 100644
--- a/libc/log/libfatal.internal.h
+++ b/libc/log/libfatal.internal.h
@@ -13,9 +13,6 @@ COSMOPOLITAN_C_START_
extern char __fatalbuf[];
-void __printf(const char *, ...);
-void __vprintf(const char *, va_list);
-
forceinline long __sysv_exit(long rc) {
long ax;
#if defined(__MNO_RED_ZONE__) && defined(__GNUC__) && !defined(__STRICT_ANSI__)
diff --git a/libc/log/oncrash.c b/libc/log/oncrash.c
index 81b32fec7..aa166d28a 100644
--- a/libc/log/oncrash.c
+++ b/libc/log/oncrash.c
@@ -19,6 +19,7 @@
#include "libc/bits/bits.h"
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
+#include "libc/calls/internal.h"
#include "libc/calls/sigbits.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h"
@@ -30,6 +31,7 @@
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/asan.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/color.internal.h"
#include "libc/log/gdb.h"
@@ -59,6 +61,8 @@
* @see libc/onkill.c
*/
+STATIC_YOINK("strerror_r");
+
static const char kGregOrder[17] forcealign(1) = {
13, 11, 8, 14, 12, 9, 10, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7,
};
@@ -72,9 +76,9 @@ static const char kCpuFlags[12] forcealign(1) = "CVPRAKZSTIDO";
static const char kFpuExceptions[6] forcealign(1) = "IDZOUP";
/* : showcrashreports.c, oncrashthunks.S, oncrash.c */
-int kCrashSigs[8];
-struct sigaction g_oldcrashacts[8];
-static const char kCrashSigNames[8][5] forcealign(1) = {
+int kCrashSigs[7];
+struct sigaction g_oldcrashacts[7];
+static const char kCrashSigNames[7][5] forcealign(1) = {
"QUIT", //
"FPE", //
"ILL", //
@@ -82,11 +86,10 @@ static const char kCrashSigNames[8][5] forcealign(1) = {
"TRAP", //
"ABRT", //
"BUS", //
- "PIPE", //
};
/* : showcrashreports.c, oncrashthunks.S, oncrash.c */
-relegated static const char *TinyStrSignal(int sig) {
+static relegated noasan noinstrument const char *TinyStrSignal(int sig) {
size_t i;
for (i = 0; i < ARRAYLEN(kCrashSigs); ++i) {
if (kCrashSigs[i] && sig == kCrashSigs[i]) {
@@ -100,14 +103,15 @@ relegated static void ShowFunctionCalls(ucontext_t *ctx) {
struct StackFrame *bp;
struct StackFrame goodframe;
if (!ctx->uc_mcontext.rip) {
- __printf("%s is NULL can't show backtrace\n", "RIP");
+ kprintf("%s is NULL can't show backtrace%n", "RIP");
} else if (!ctx->uc_mcontext.rbp) {
- __printf("%s is NULL can't show backtrace\n", "RBP");
+ kprintf("%s is NULL can't show backtrace%n", "RBP");
} else {
goodframe.next = (struct StackFrame *)ctx->uc_mcontext.rbp;
goodframe.addr = ctx->uc_mcontext.rip;
bp = &goodframe;
ShowBacktrace(2, bp);
+ kprintf("%n");
}
}
@@ -153,7 +157,7 @@ relegated static void ShowGeneralRegisters(ucontext_t *ctx) {
long double st;
char *p, buf[128];
p = buf;
- *p++ = '\n';
+ printf("%n");
for (i = 0, j = 0, k = 0; i < ARRAYLEN(kGregNames); ++i) {
if (j > 0) *p++ = ' ';
if (!(s = kGregNames[(unsigned)kGregOrder[i]])[2]) *p++ = ' ';
@@ -172,9 +176,9 @@ relegated static void ShowGeneralRegisters(ucontext_t *ctx) {
x = st * 1000;
if (x < 0) x = -x, *p++ = '-';
p = __uintcpy(p, x / 1000), *p++ = '.';
- p = __uintcpy(p, x % 1000), *p++ = '\n';
+ p = __uintcpy(p, x % 1000);
*p = 0;
- __printf("%s", buf);
+ kprintf("%s%n", buf);
p = buf;
}
}
@@ -182,14 +186,14 @@ relegated static void ShowGeneralRegisters(ucontext_t *ctx) {
p, ctx->uc_mcontext.gregs[REG_EFL],
ctx->uc_mcontext.fpregs ? ctx->uc_mcontext.fpregs->swd : 0,
ctx->uc_mcontext.fpregs ? ctx->uc_mcontext.fpregs->mxcsr : 0);
- __printf("%s\n", buf);
+ kprintf("%s%n", buf);
}
relegated static void ShowSseRegisters(ucontext_t *ctx) {
size_t i;
char *p, buf[128];
if (ctx->uc_mcontext.fpregs) {
- __printf("\n");
+ kprintf("%n");
for (i = 0; i < 8; ++i) {
p = buf;
if (i >= 10) {
@@ -214,7 +218,7 @@ relegated static void ShowSseRegisters(ucontext_t *ctx) {
p = __fixcpy(p, ctx->uc_mcontext.fpregs->xmm[i + 8].u64[1], 64);
p = __fixcpy(p, ctx->uc_mcontext.fpregs->xmm[i + 8].u64[0], 64);
*p = 0;
- __printf("XMM%s\n", buf);
+ kprintf("XMM%s%n", buf);
}
}
}
@@ -226,48 +230,49 @@ relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
int i;
char *p;
char host[64];
- intptr_t stackaddr;
struct utsname names;
static char buf[4096];
if (weaken(ShowCrashReportHook)) {
ShowCrashReportHook(2, err, sig, si, ctx);
}
+ names.sysname[0] = 0;
+ names.release[0] = 0;
+ names.version[0] = 0;
+ names.nodename[0] = 0;
__stpcpy(host, "unknown");
gethostname(host, sizeof(host));
+ uname(&names);
p = buf;
- __printf("\n%serror%s: Uncaught SIG%s",
- !g_isterminalinarticulate ? "\e[30;101m" : "",
- !g_isterminalinarticulate ? "\e[0m" : "", TinyStrSignal(sig));
- stackaddr = GetStackAddr(0);
- if (ctx && (ctx->uc_mcontext.rsp >= GetStaticStackAddr(0) &&
- ctx->uc_mcontext.rsp <= GetStaticStackAddr(0) + PAGESIZE)) {
- __printf(" (Stack Overflow)");
- } else if (si) {
- __printf(" (%s)", GetSiCodeName(sig, si->si_code));
- }
- __printf(" on %s pid %d\n %s\n %s\n", host, __getpid(),
- program_invocation_name, strerror(err));
- if (uname(&names) != -1) {
- __printf(" %s %s %s %s\n", names.sysname, names.nodename, names.release,
- names.version);
- }
+ errno = err;
+ kprintf("%n%serror%s: Uncaught SIG%s (%s) on %s pid %d%n"
+ " %s%n"
+ " %m%n"
+ " %s %s %s %s%n",
+ !g_isterminalinarticulate ? "\e[30;101m" : "",
+ !g_isterminalinarticulate ? "\e[0m" : "", TinyStrSignal(sig),
+ (ctx && (ctx->uc_mcontext.rsp >= GetStaticStackAddr(0) &&
+ ctx->uc_mcontext.rsp <= GetStaticStackAddr(0) + PAGESIZE))
+ ? "Stack Overflow"
+ : GetSiCodeName(sig, si->si_code),
+ host, __getpid(), program_invocation_name, names.sysname,
+ names.nodename, names.release, names.version);
if (ctx) {
- __printf("\n");
+ kprintf("%n");
ShowFunctionCalls(ctx);
ShowGeneralRegisters(ctx);
ShowSseRegisters(ctx);
}
- __printf("\n");
+ kprintf("%n");
PrintMemoryIntervals(2, &_mmi);
/* PrintSystemMappings(2); */
if (__argv) {
for (i = 0; i < __argc; ++i) {
if (!__argv[i]) continue;
if (IsAsan() && !__asan_is_valid(__argv[i], 1)) continue;
- __printf("%s ", __argv[i]);
+ kprintf("%s ", __argv[i]);
}
}
- __printf("\n");
+ kprintf("%n");
}
relegated static void RestoreDefaultCrashSignalHandlers(void) {
@@ -280,6 +285,21 @@ relegated static void RestoreDefaultCrashSignalHandlers(void) {
}
}
+static wontreturn noasan relegated noinstrument void __minicrash(
+ int sig, struct siginfo *si, ucontext_t *ctx, const char *kind) {
+ kprintf("%n"
+ "%n"
+ "CRASHED %s WITH SIG%s%n"
+ "%s%n"
+ "RIP %x%n"
+ "RSP %x%n"
+ "RBP %x%n"
+ "%n",
+ kind, TinyStrSignal(sig), __argv[0], ctx ? ctx->uc_mcontext.rip : 0,
+ ctx ? ctx->uc_mcontext.rsp : 0, ctx ? ctx->uc_mcontext.rbp : 0);
+ quick_exit(119);
+}
+
/**
* Crashes in a developer-friendly human-centric way.
*
@@ -293,48 +313,47 @@ relegated static void RestoreDefaultCrashSignalHandlers(void) {
*
* This function never returns, except for traps w/ human supervision.
*/
-noasan relegated void __oncrash(int sig, struct siginfo *si, ucontext_t *ctx) {
+noasan relegated noinstrument void __oncrash(int sig, struct siginfo *si,
+ ucontext_t *ctx) {
intptr_t rip;
int gdbpid, err;
static bool noreentry, notpossible;
- ++g_ftrace;
- rip = ctx ? ctx->uc_mcontext.rip : 0;
+ --g_ftrace;
if (cmpxchg(&noreentry, false, true)) {
- err = errno;
- if ((gdbpid = IsDebuggerPresent(true))) {
- DebugBreak();
- } else if (g_isterminalinarticulate || g_isrunningundermake) {
- gdbpid = -1;
- } else if (FindDebugBinary()) {
- RestoreDefaultCrashSignalHandlers();
- gdbpid =
- attachdebugger(((sig == SIGTRAP || sig == SIGQUIT) &&
- (rip >= (intptr_t)&_base && rip < (intptr_t)&_etext))
- ? rip
- : 0);
- }
- if (!(gdbpid > 0 && (sig == SIGTRAP || sig == SIGQUIT))) {
- __restore_tty(1);
- ShowCrashReport(err, sig, si, ctx);
- _Exit(128 + sig);
+ if (!__vforked) {
+ rip = ctx ? ctx->uc_mcontext.rip : 0;
+ err = errno;
+ if ((gdbpid = IsDebuggerPresent(true))) {
+ DebugBreak();
+ } else if (g_isterminalinarticulate || g_isrunningundermake) {
+ gdbpid = -1;
+ } else if (IsLinux() && FindDebugBinary()) {
+ RestoreDefaultCrashSignalHandlers();
+ gdbpid = AttachDebugger(
+ ((sig == SIGTRAP || sig == SIGQUIT) &&
+ (rip >= (intptr_t)&_base && rip < (intptr_t)&_etext))
+ ? rip
+ : 0);
+ }
+ if (!(gdbpid > 0 && (sig == SIGTRAP || sig == SIGQUIT))) {
+ __restore_tty(1);
+ ShowCrashReport(err, sig, si, ctx);
+ quick_exit(128 + sig);
+ }
+ } else {
+ __minicrash(sig, si, ctx, "WHILE VFORKED");
}
+ } else if (sig == SIGTRAP) {
+ /* chances are IsDebuggerPresent() confused strace w/ gdb */
+ ++g_ftrace;
+ return;
} else if (cmpxchg(¬possible, false, true)) {
- __printf("\n"
- "\n"
- "CRASHED WHILE CRASHING WITH SIG%s\n"
- "%s\n"
- "RIP %x\n"
- "RSP %x\n"
- "RBP %x\n"
- "\n",
- TinyStrSignal(sig), __argv[0], rip, ctx ? ctx->uc_mcontext.rsp : 0,
- ctx ? ctx->uc_mcontext.rbp : 0);
- _Exit(119);
+ __minicrash(sig, si, ctx, "WHILE CRASHING");
} else {
for (;;) {
asm("ud2");
}
}
noreentry = false;
- --g_ftrace;
+ ++g_ftrace;
}
diff --git a/libc/log/oncrashthunks.S b/libc/log/oncrashthunks.S
index ef70cb9e8..c3ed2d2b9 100644
--- a/libc/log/oncrashthunks.S
+++ b/libc/log/oncrashthunks.S
@@ -90,15 +90,6 @@ __oncrash_sigbus:
ret
.endfn __oncrash_sigbus,globl
- .org 11*7
-__oncrash_sigpipe:
- push %rbp
- mov %rsp,%rbp
- call __oncrash
- pop %rbp
- ret
- .endfn __oncrash_sigpipe,globl
-
// : showcrashreports.c, oncrashthunks.S, oncrash.c
.endobj __oncrash_thunks,globl
diff --git a/libc/log/printgarbage.c b/libc/log/printgarbage.c
index 7c8d8bd49..ac0afdb00 100644
--- a/libc/log/printgarbage.c
+++ b/libc/log/printgarbage.c
@@ -17,7 +17,7 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/fmt/fmt.h"
-#include "libc/log/libfatal.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/log.h"
#include "libc/nexgen32e/gc.internal.h"
#include "libc/stdio/stdio.h"
@@ -30,27 +30,27 @@ void PrintGarbage(void) {
size_t i;
char name[19];
const char *symbol;
- __printf("\n");
- __printf(" SHADOW STACK @ 0x%p\n", __builtin_frame_address(0));
- __printf("garbage entry parent frame original ret callback arg \n");
- __printf("-------------- -------------- ------------------ ------------------ ------------------\n");
+ kprintf("%n");
+ kprintf(" SHADOW STACK @ %p%n", __builtin_frame_address(0));
+ kprintf("garbage ent. parent frame original ret callback arg %n");
+ kprintf("------------ ------------ ------------------ ------------------ ------------------%n");
if (__garbage.i) {
for (i = __garbage.i; i--;) {
symbol = __get_symbol_by_addr(__garbage.p[i].ret);
if (symbol) {
- snprintf(name, sizeof(name), "%s", symbol);
+ ksnprintf(name, sizeof(name), "%s", symbol);
} else {
- snprintf(name, sizeof(name), "0x%012lx", __garbage.p[i].ret);
+ ksnprintf(name, sizeof(name), "%#014lx", __garbage.p[i].ret);
}
- __printf("0x%p 0x%p %18s %18s 0x%016lx\n",
- __garbage.p + i,
- __garbage.p[i].frame,
- name,
- __get_symbol_by_addr(__garbage.p[i].fn),
- __garbage.p[i].arg);
+ kprintf("%12lx %12lx %18s %18s %#18lx%n",
+ __garbage.p + i,
+ __garbage.p[i].frame,
+ name,
+ __get_symbol_by_addr(__garbage.p[i].fn),
+ __garbage.p[i].arg);
}
} else {
- __printf("%14s %14s %18s %18s %18s\n","empty","-","-","-","-");
+ kprintf("%12s %12s %18s %18s %18s%n","empty","-","-","-","-");
}
- __printf("\n");
+ kprintf("%n");
}
diff --git a/libc/log/showcrashreports.c b/libc/log/showcrashreports.c
index cfca95610..6eec13085 100644
--- a/libc/log/showcrashreports.c
+++ b/libc/log/showcrashreports.c
@@ -59,7 +59,6 @@ void ShowCrashReports(void) {
kCrashSigs[4] = SIGTRAP; /* bad system call */
kCrashSigs[5] = SIGABRT; /* abort() called */
kCrashSigs[6] = SIGBUS; /* misaligned, noncanonical ptr, etc. */
- kCrashSigs[7] = SIGPIPE; /* write to closed thing */
/* : showcrashreports.c, oncrashthunks.S, oncrash.c */
bzero(&sa, sizeof(sa));
ss.ss_flags = 0;
diff --git a/libc/macros.internal.inc b/libc/macros.internal.inc
index e7f5201cb..8fe4feb43 100644
--- a/libc/macros.internal.inc
+++ b/libc/macros.internal.inc
@@ -189,10 +189,8 @@
.endm
// LOOP Instruction Replacement.
-// With its mop-Fusion Mexican equivalent.
-// Thus avoiding 3x legacy pipeline slowdown.
.macro .loop label:req
- .byte 0x83,0xe9,0x01 # sub $1,%ecx
+ .byte 0x83,0xe9,0x01 # sub §1,%ecx
jnz \label
.endm
diff --git a/libc/nt/synchronization.h b/libc/nt/synchronization.h
index ef11d095e..cdf052d95 100644
--- a/libc/nt/synchronization.h
+++ b/libc/nt/synchronization.h
@@ -5,6 +5,7 @@
#include "libc/nt/struct/linkedlist.h"
#include "libc/nt/struct/securityattributes.h"
#include "libc/nt/struct/systemtime.h"
+#include "libc/nt/thunk/msabi.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/* ░░░░
@@ -115,6 +116,9 @@ bool32 GetSystemTimeAdjustment(uint32_t *lpTimeAdjustment,
uint32_t *lpTimeIncrement,
bool32 *lpTimeAdjustmentDisabled);
+#if ShouldUseMsabiAttribute()
+#include "libc/nt/thunk/synchronization.inc"
+#endif /* ShouldUseMsabiAttribute() */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_SYNCHRONIZATION_H_ */
diff --git a/libc/nt/thunk/memory.inc b/libc/nt/thunk/memory.inc
index fe36ff37b..cf2941299 100644
--- a/libc/nt/thunk/memory.inc
+++ b/libc/nt/thunk/memory.inc
@@ -3,6 +3,8 @@
#define FlushViewOfFile(...) __imp_FlushViewOfFile(__VA_ARGS__)
#define UnmapViewOfFile(...) __imp_UnmapViewOfFile(__VA_ARGS__)
+extern typeof(LocalFree) *const __imp_LocalFree __msabi;
+extern typeof(VirtualProtect) *const __imp_VirtualProtect __msabi;
extern typeof(UnmapViewOfFile) *const __imp_UnmapViewOfFile __msabi;
extern typeof(FlushViewOfFile) *const __imp_FlushViewOfFile __msabi;
extern typeof(MapViewOfFileExNuma) *const __imp_MapViewOfFileExNuma __msabi;
diff --git a/libc/nt/thunk/process.inc b/libc/nt/thunk/process.inc
index e483b043e..63cdb8e9f 100644
--- a/libc/nt/thunk/process.inc
+++ b/libc/nt/thunk/process.inc
@@ -17,3 +17,6 @@ extern typeof(GetCurrentProcessId) *const __imp_GetCurrentProcessId __msabi;
#define CreateProcess(...) __imp_CreateProcessW(__VA_ARGS__)
extern typeof(CreateProcess) *const __imp_CreateProcessW __msabi;
+
+extern typeof(FormatMessage) *const __imp_FormatMessageW __msabi;
+extern typeof(SetLastError) *const __imp_SetLastError __msabi;
diff --git a/libc/nt/thunk/runtime.inc b/libc/nt/thunk/runtime.inc
index dae9cc513..a389fa8d2 100644
--- a/libc/nt/thunk/runtime.inc
+++ b/libc/nt/thunk/runtime.inc
@@ -31,3 +31,6 @@ extern typeof(GetCurrentProcess) *const __imp_GetCurrentProcess __msabi;
#define GetModuleFileName(...) __imp_GetModuleFileNameW(__VA_ARGS__)
extern typeof(GetModuleFileName) *const __imp_GetModuleFileNameW __msabi;
+
+extern typeof(GetLastError) *const __imp_GetLastError __msabi;
+extern typeof(ExitProcess) *const __imp_ExitProcess __msabi;
diff --git a/libc/nt/thunk/synchronization.inc b/libc/nt/thunk/synchronization.inc
new file mode 100644
index 000000000..fa73a16cd
--- /dev/null
+++ b/libc/nt/thunk/synchronization.inc
@@ -0,0 +1 @@
+extern typeof(SleepEx) *const __imp_SleepEx __msabi;
diff --git a/libc/nt/version.h b/libc/nt/version.h
index 7acf9f290..f7ade11de 100644
--- a/libc/nt/version.h
+++ b/libc/nt/version.h
@@ -4,8 +4,22 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
+bool IsAtLeastWindows10(void) pureconst;
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
+#if defined(__GCC_ASM_FLAG_OUTPUTS__) && !defined(__STRICT_ANSI__)
+#define IsAtLeastWindows10() \
+ ({ \
+ long ReG; \
+ bool NoTbelow; \
+ asm("mov\t%%gs:96,%1\r\n" \
+ "cmpb\t%2,280(%1)" \
+ : "=@ccnb"(NoTbelow), "=l"(ReG) \
+ : "i"(10)); \
+ NoTbelow; \
+ })
+#endif
+
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_VERSION_H_ */
diff --git a/libc/runtime/exit.c b/libc/runtime/exit.c
index e2a177998..6818ff1fc 100644
--- a/libc/runtime/exit.c
+++ b/libc/runtime/exit.c
@@ -16,13 +16,7 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
-#include "libc/bits/pushpop.h"
#include "libc/bits/weaken.h"
-#include "libc/dce.h"
-#include "libc/nt/console.h"
-#include "libc/nt/enum/consolemodeflags.h"
-#include "libc/nt/pedef.internal.h"
-#include "libc/nt/runtime.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
@@ -38,18 +32,8 @@
* @noreturn
*/
wontreturn void exit(int exitcode) {
- const uintptr_t *p;
if (weaken(__cxa_finalize)) {
weaken(__cxa_finalize)(NULL);
}
- for (p = __fini_array_end; p > __fini_array_start;) {
- ((void (*)(void))(*--p))();
- }
- if (SupportsWindows() && __ntconsolemode) {
- SetConsoleMode(GetStdHandle(pushpop(kNtStdInputHandle)), __ntconsolemode);
- SetConsoleMode(GetStdHandle(pushpop(kNtStdOutputHandle)),
- kNtEnableProcessedOutput | kNtEnableWrapAtEolOutput |
- kNtEnableVirtualTerminalProcessing);
- }
- _Exit(exitcode);
+ quick_exit(exitcode);
}
diff --git a/libc/runtime/fork.c b/libc/runtime/fork.c
index 2c86fd8d6..5d47e474a 100644
--- a/libc/runtime/fork.c
+++ b/libc/runtime/fork.c
@@ -17,9 +17,14 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/bits/bits.h"
+#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
+#include "libc/calls/sysdebug.internal.h"
#include "libc/dce.h"
+#include "libc/nt/process.h"
+
+extern int __pid;
/**
* Creates new process.
@@ -29,7 +34,7 @@
*/
int fork(void) {
axdx_t ad;
- int ax, dx;
+ int ax, dx, parent;
if (!IsWindows()) {
ad = sys_fork();
ax = ad.ax;
@@ -43,7 +48,19 @@ int fork(void) {
ax = sys_fork_nt();
}
if (!ax) {
- __onfork();
+ if (!IsWindows()) {
+ dx = sys_getpid().ax;
+ } else {
+ dx = GetCurrentProcessId();
+ }
+ parent = __pid;
+ __pid = dx;
+ SYSDEBUG("fork() → 0 (child of %d)", parent);
+ if (weaken(__onfork)) {
+ weaken(__onfork)();
+ }
+ } else {
+ SYSDEBUG("fork() → %d% m", ax);
}
return ax;
}
diff --git a/libc/runtime/ftracer.c b/libc/runtime/ftracer.c
index 013b724b2..b78567eeb 100644
--- a/libc/runtime/ftracer.c
+++ b/libc/runtime/ftracer.c
@@ -18,6 +18,7 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/bits/bits.h"
#include "libc/bits/safemacros.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/rdtsc.h"
@@ -91,9 +92,9 @@ privileged noinstrument noasan noubsan void ftracer(void) {
if ((symbol = __get_symbol(g_symbols, frame->addr)) != -1 &&
symbol != g_lastsymbol) {
g_lastsymbol = symbol;
- __printf("+ %*s%s %d\r\n", GetNestingLevel(frame) * 2, "",
- __get_symbol_name(g_symbols, symbol),
- (long)(unsignedsubtract(stamp, laststamp) / 3.3));
+ kprintf("+ %*s%s %d\r\n", GetNestingLevel(frame) * 2, "",
+ __get_symbol_name(g_symbols, symbol),
+ (long)(unsignedsubtract(stamp, laststamp) / 3.3));
laststamp = X86_HAVE(RDTSCP) ? rdtscp(0) : rdtsc();
}
}
@@ -110,9 +111,9 @@ textstartup void ftrace_install(void) {
ftrace_enabled = 1;
__hook(ftrace_hook, g_symbols);
} else {
- __printf("error: --ftrace failed to open symbol table\r\n");
+ kprintf("error: --ftrace failed to open symbol table\r\n");
}
} else {
- __printf("error: --ftrace needs concomitant .com.dbg binary\r\n");
+ kprintf("error: --ftrace needs concomitant .com.dbg binary\r\n");
}
}
diff --git a/libc/runtime/getdosargv.c b/libc/runtime/getdosargv.c
index d21113715..2c747a5ed 100644
--- a/libc/runtime/getdosargv.c
+++ b/libc/runtime/getdosargv.c
@@ -16,9 +16,7 @@
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
-#include "libc/assert.h"
#include "libc/bits/bits.h"
-#include "libc/bits/pushpop.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/runtime/internal.h"
#include "libc/str/str.h"
@@ -32,25 +30,23 @@ struct DosArgv {
wint_t wc;
};
-static textwindows noasan wint_t DecodeDosArgv(const char16_t **s) {
+textwindows noasan void DecodeDosArgv(int ignore, struct DosArgv *st) {
wint_t x, y;
for (;;) {
- if (!(x = *(*s)++)) break;
- if (IsUtf16Cont(x)) continue;
- if (IsUcs2(x)) {
- return x;
- } else {
- if ((y = *(*s)++)) {
- return MergeUtf16(x, y);
+ if (!(x = *st->s++)) break;
+ if (!IsUcs2(x)) {
+ if ((y = *st->s++)) {
+ x = MergeUtf16(x, y);
} else {
- return 0;
+ x = 0;
}
}
+ break;
}
- return x;
+ st->wc = x;
}
-static textwindows noasan void AppendDosArgv(struct DosArgv *st, wint_t wc) {
+static textwindows noasan void AppendDosArgv(wint_t wc, struct DosArgv *st) {
uint64_t w;
w = tpenc(wc);
do {
@@ -59,6 +55,16 @@ static textwindows noasan void AppendDosArgv(struct DosArgv *st, wint_t wc) {
} while (w >>= 8);
}
+static textwindows noasan int Count(int c, struct DosArgv *st) {
+ int ignore, n = 0;
+ asm("" : "=g"(ignore));
+ while (st->wc == c) {
+ DecodeDosArgv(ignore, st);
+ n++;
+ }
+ return n;
+}
+
/**
* Tokenizes and transcodes Windows NT CLI args, thus avoiding
* CommandLineToArgv() schlepping in forty megs of dependencies.
@@ -81,49 +87,60 @@ static textwindows noasan void AppendDosArgv(struct DosArgv *st, wint_t wc) {
textwindows noasan int GetDosArgv(const char16_t *cmdline, char *buf,
size_t size, char **argv, size_t max) {
bool inquote;
- size_t i, argc, slashes, quotes;
- struct DosArgv st;
- st.s = cmdline;
- st.p = buf;
- st.pe = buf + size;
+ int i, argc, slashes, quotes, ignore;
+ static struct DosArgv st_;
+ struct DosArgv *st = &st_;
+ asm("" : "=g"(ignore));
+ asm("" : "+r"(st));
+ st->s = cmdline;
+ st->p = buf;
+ st->pe = buf + size;
argc = 0;
- st.wc = DecodeDosArgv(&st.s);
- while (st.wc) {
- while (st.wc && (st.wc == ' ' || st.wc == '\t')) {
- st.wc = DecodeDosArgv(&st.s);
+ DecodeDosArgv(ignore, st);
+ while (st->wc) {
+ while (st->wc && (st->wc == ' ' || st->wc == '\t')) {
+ DecodeDosArgv(ignore, st);
}
- if (!st.wc) break;
+ if (!st->wc) break;
if (++argc < max) {
- argv[argc - 1] = st.p < st.pe ? st.p : NULL;
+ argv[argc - 1] = st->p < st->pe ? st->p : NULL;
}
inquote = false;
- while (st.wc) {
- if (!inquote && (st.wc == ' ' || st.wc == '\t')) break;
- if (st.wc == '"' || st.wc == '\\') {
- slashes = 0;
- quotes = 0;
- while (st.wc == '\\') st.wc = DecodeDosArgv(&st.s), slashes++;
- while (st.wc == '"') st.wc = DecodeDosArgv(&st.s), quotes++;
+ while (st->wc) {
+ if (!inquote && (st->wc == ' ' || st->wc == '\t')) break;
+ if (st->wc == '"' || st->wc == '\\') {
+ slashes = Count('\\', st);
+ quotes = Count('"', st);
if (!quotes) {
- while (slashes--) AppendDosArgv(&st, '\\');
+ while (slashes--) {
+ AppendDosArgv('\\', st);
+ }
} else {
- while (slashes >= 2) AppendDosArgv(&st, '\\'), slashes -= 2;
- if (slashes) AppendDosArgv(&st, '"'), quotes--;
+ while (slashes >= 2) {
+ AppendDosArgv('\\', st);
+ slashes -= 2;
+ }
+ if (slashes) {
+ AppendDosArgv('"', st);
+ quotes--;
+ }
if (quotes > 0) {
if (!inquote) quotes--;
- for (i = 3; i <= quotes + 1; i += 3) AppendDosArgv(&st, '"');
+ for (i = 3; i <= quotes + 1; i += 3) {
+ AppendDosArgv('"', st);
+ }
inquote = (quotes % 3 == 0);
}
}
} else {
- AppendDosArgv(&st, st.wc);
- st.wc = DecodeDosArgv(&st.s);
+ AppendDosArgv(st->wc, st);
+ DecodeDosArgv(ignore, st);
}
}
- AppendDosArgv(&st, '\0');
+ AppendDosArgv('\0', st);
}
- AppendDosArgv(&st, '\0');
- if (size) buf[min(st.p - buf, size - 1)] = '\0';
+ AppendDosArgv('\0', st);
+ if (size) buf[min(st->p - buf, size - 1)] = '\0';
if (max) argv[min(argc, max - 1)] = NULL;
return argc;
}
diff --git a/libc/runtime/getdosenviron.c b/libc/runtime/getdosenviron.c
index f1a4117d9..58f3e3bf1 100644
--- a/libc/runtime/getdosenviron.c
+++ b/libc/runtime/getdosenviron.c
@@ -32,7 +32,6 @@ static textwindows noasan noinstrument axdx_t Recode16to8(char *dst,
wint_t x, y;
for (v = r.ax = 0, r.dx = 0;;) {
if (!(x = src[r.dx++])) break;
- if (IsUtf16Cont(x)) continue;
if (!IsUcs2(x)) {
y = src[r.dx++];
x = MergeUtf16(x, y);
diff --git a/libc/runtime/getinterpreterexecutablename.c b/libc/runtime/getinterpreterexecutablename.c
new file mode 100644
index 000000000..d75fb29b7
--- /dev/null
+++ b/libc/runtime/getinterpreterexecutablename.c
@@ -0,0 +1,83 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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/calls/internal.h"
+#include "libc/dce.h"
+#include "libc/intrin/kprintf.h"
+#include "libc/macros.internal.h"
+#include "libc/runtime/runtime.h"
+#include "libc/sysv/consts/at.h"
+#include "libc/sysv/errfuns.h"
+
+/**
+ * Returns path of executable interperter.
+ *
+ * Unlike `program_executable_name` which is designed to figure out the
+ * absolute path of the first argument passed to `execve()`, what we do
+ * here is probe things like `/proc` and `sysctl()` to figure out if we
+ * were launched by something like `ape-loader`, and then we return its
+ * path. If we can't determine that path, possibly because we're on XNU
+ * or OpenBSD, then we return -1 with an error code.
+ *
+ * @param p receives utf8 output
+ * @param n is byte size of res buffer
+ * @return p on success or null w/ errno if out of buf or error
+ * @see program_invocation_short_name
+ * @see program_invocation_name
+ * @see program_executable_name
+ */
+char *GetInterpreterExecutableName(char *p, size_t n) {
+ int e;
+ size_t m;
+ int cmd[4];
+ ssize_t rc;
+ char *r, *t;
+ e = errno;
+ if (n < 2) {
+ errno = ENAMETOOLONG;
+ } else if (IsWindows()) {
+ if (strlen(program_executable_name) < n) {
+ strcpy(p, program_executable_name);
+ return p;
+ }
+ errno = ENAMETOOLONG;
+ } else if ((rc = sys_readlinkat(AT_FDCWD, "/proc/self/exe", p, n - 1)) > 0) {
+ p[rc] = 0;
+ return p;
+ } else if ((rc = sys_readlinkat(AT_FDCWD, "/proc/curproc/file", p, n - 1)) >
+ 0) {
+ errno = e;
+ p[n] = 0;
+ return p;
+ } else if (IsFreebsd() || IsNetbsd()) {
+ cmd[0] = 1 /* CTL_KERN */;
+ cmd[1] = 14 /* KERN_PROC */;
+ if (IsFreebsd()) {
+ cmd[2] = 12 /* KERN_PROC_PATHNAME */;
+ } else {
+ cmd[2] = 5 /* KERN_PROC_PATHNAME */;
+ }
+ cmd[3] = -1; /* current process */
+ if (sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) {
+ errno = e;
+ return p;
+ }
+ }
+ return 0;
+}
diff --git a/libc/runtime/internal.h b/libc/runtime/internal.h
index 32aaa564e..3b0e05e97 100644
--- a/libc/runtime/internal.h
+++ b/libc/runtime/internal.h
@@ -12,7 +12,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
-extern uint32_t __ntconsolemode;
+extern uint32_t __ntconsolemode[2];
extern const char v_ntsubsystem[] __attribute__((__weak__));
extern const uintptr_t __fini_array_end[] __attribute__((__weak__));
extern const uintptr_t __fini_array_start[] __attribute__((__weak__));
diff --git a/libc/runtime/memtrack.internal.h b/libc/runtime/memtrack.internal.h
index ae844bda0..1fb01f238 100644
--- a/libc/runtime/memtrack.internal.h
+++ b/libc/runtime/memtrack.internal.h
@@ -21,8 +21,9 @@ COSMOPOLITAN_C_START_
#define kFixedmapStart _kMem(0x300000000000, 0x000040000000)
#define kFixedmapSize \
_kMem(0x400000000000 - 0x300000000000, 0x000070000000 - 0x000040000000)
-#define _kMmi(VSPACE) \
- ROUNDUP(VSPACE / FRAMESIZE * sizeof(struct MemoryInterval), FRAMESIZE)
+#define _kMmi(VSPACE) \
+ ROUNDUP(VSPACE / FRAMESIZE * (intptr_t)sizeof(struct MemoryInterval), \
+ FRAMESIZE)
#define _kMem(NORMAL, WIN7) \
(!(IsWindows() && NtGetVersion() < kNtVersionWindows10) ? NORMAL : WIN7)
@@ -35,7 +36,7 @@ struct MemoryInterval {
};
struct MemoryIntervals {
- long i, n;
+ size_t i, n;
struct MemoryInterval *p;
struct MemoryInterval s[OPEN_MAX];
};
@@ -57,6 +58,10 @@ int UntrackMemoryIntervals(void *, size_t) hidden;
#define IsLegalPointer(p) \
(-0x800000000000 <= (intptr_t)(p) && (intptr_t)(p) <= 0x7fffffffffff)
+forceinline pureconst bool IsLegalSize(size_t n) {
+ return n <= 0xffffffffffff;
+}
+
forceinline pureconst bool IsAutoFrame(int x) {
return (kAutomapStart >> 16) <= x &&
x <= ((kAutomapStart + (kAutomapSize - 1)) >> 16);
@@ -75,14 +80,26 @@ forceinline pureconst bool IsShadowFrame(int x) {
return 0x7fff <= x && x < 0x10008000;
}
+forceinline pureconst bool IsKernelFrame(int x) {
+ return (int)(GetStaticStackAddr(0) >> 16) <= x &&
+ x <= (int)((GetStaticStackAddr(0) + (GetStackSize() - FRAMESIZE)) >>
+ 16);
+}
+
forceinline pureconst bool IsStaticStackFrame(int x) {
- return (GetStaticStackAddr(0) >> 16) <= x &&
- x <= ((GetStaticStackAddr(0) + (GetStackSize() - FRAMESIZE)) >> 16);
+ return (int)(GetStaticStackAddr(0) >> 16) <= x &&
+ x <= (int)((GetStaticStackAddr(0) + (GetStackSize() - FRAMESIZE)) >>
+ 16);
+}
+
+forceinline pureconst bool IsStackFrame(int x) {
+ return (int)(GetStackAddr(0) >> 16) <= x &&
+ x <= (int)((GetStackAddr(0) + (GetStackSize() - FRAMESIZE)) >> 16);
}
forceinline pureconst bool IsSigAltStackFrame(int x) {
- return (GetStackAddr(0) >> 16) <= x &&
- x <= ((GetStackAddr(0) + (SIGSTKSZ - FRAMESIZE)) >> 16);
+ return (int)(GetStackAddr(0) >> 16) <= x &&
+ x <= (int)((GetStackAddr(0) + (SIGSTKSZ - FRAMESIZE)) >> 16);
}
forceinline pureconst bool IsOldStackFrame(int x) {
diff --git a/libc/runtime/printmemoryintervals.c b/libc/runtime/printmemoryintervals.c
index 3569334b9..d3b5ae1db 100644
--- a/libc/runtime/printmemoryintervals.c
+++ b/libc/runtime/printmemoryintervals.c
@@ -17,7 +17,7 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/fmt/itoa.h"
-#include "libc/log/libfatal.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/macros.internal.h"
#include "libc/runtime/memtrack.internal.h"
@@ -41,20 +41,20 @@ void PrintMemoryIntervals(int fd, const struct MemoryIntervals *mm) {
for (i = 0; i < mm->i; ++i) {
frames = mm->p[i].y + 1 - mm->p[i].x;
maptally += frames;
- __printf("%012x-%012x %s %,*dx%s", ADDR(mm->p[i].x), ADDR(mm->p[i].y + 1),
- DescribeMapping(mm->p[i].prot, mm->p[i].flags, mode), w, frames,
- DescribeFrame(mm->p[i].x));
+ kprintf("%012lx-%012lx %s %'*ldx%s", ADDR(mm->p[i].x), ADDR(mm->p[i].y + 1),
+ DescribeMapping(mm->p[i].prot, mm->p[i].flags, mode), w, frames,
+ DescribeFrame(mm->p[i].x));
if (i + 1 < _mmi.i) {
frames = mm->p[i + 1].x - mm->p[i].y - 1;
if (frames && IsNoteworthyHole(i, mm)) {
gaptally += frames;
- __printf(" w/ %,d frame hole", frames);
+ kprintf(" w/ %'ld frame hole", frames);
}
}
if (mm->p[i].h != -1) {
- __printf(" h=%d", mm->p[i].h);
+ kprintf(" h=%ld", mm->p[i].h);
}
- __printf("\r\n");
+ kprintf("%n");
}
- __printf("# %d frames mapped w/ %,d frames gapped\r\n", maptally, gaptally);
+ kprintf("# %ld frames mapped w/ %'ld frames gapped%n", maptally, gaptally);
}
diff --git a/libc/runtime/runtime.h b/libc/runtime/runtime.h
index c46add19e..d1ad71ead 100644
--- a/libc/runtime/runtime.h
+++ b/libc/runtime/runtime.h
@@ -97,6 +97,7 @@ int OpenExecutable(void);
void ftrace_install(void);
long GetResourceLimit(int);
long GetMaxFd(void);
+char *GetInterpreterExecutableName(char *, size_t);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
diff --git a/libc/runtime/stack.h b/libc/runtime/stack.h
index a5d580fcf..60b5bf157 100644
--- a/libc/runtime/stack.h
+++ b/libc/runtime/stack.h
@@ -2,6 +2,7 @@
#define COSMOPOLITAN_LIBC_RUNTIME_STACK_H_
#include "ape/config.h"
#include "libc/dce.h"
+#include "libc/nt/version.h"
#include "libc/runtime/runtime.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
@@ -27,7 +28,7 @@
/**
* Tunes APE stack virtual address.
*
- * This defaults to `0x700000000000 - STACKSIZE`. The value defined by
+ * This defaults to `0x7e0000000000 - STACKSIZE`. The value defined by
* this macro will be respected, with two exceptions: (1) in MODE=tiny
* the operating system provided stack is used instead and (2) Windows
* Seven doesn't support 64-bit addresses so 0x10000000 - GetStackSize
@@ -48,7 +49,7 @@
#define _STACK_EXTRA ""
#endif
-#if defined(__GNUC__) && defined(__ELF__)
+#if defined(__GNUC__) && defined(__ELF__) && !defined(__STRICT_ANSI__)
COSMOPOLITAN_C_START_
extern char ape_stack_memsz[] __attribute__((__weak__));
@@ -64,18 +65,18 @@ extern char ape_stack_memsz[] __attribute__((__weak__));
/**
* Returns preferred bottom address of stack.
*/
-#define GetStaticStackAddr(ADDEND) \
- ({ \
- intptr_t vAddr; \
- if (!IsWindows() || NtGetVersion() >= kNtVersionWindows10) { \
- asm(".weak\tape_stack_vaddr\n\t" \
- "movabs\t%1+ape_stack_vaddr,%0" \
- : "=r"(vAddr) \
- : "i"(ADDEND)); \
- } else { \
- vAddr = 0x10000000; \
- } \
- vAddr; \
+#define GetStaticStackAddr(ADDEND) \
+ ({ \
+ intptr_t vAddr; \
+ if (!IsWindows() || IsAtLeastWindows10()) { \
+ __asm__(".weak\tape_stack_vaddr\n\t" \
+ "movabs\t%1+ape_stack_vaddr,%0" \
+ : "=r"(vAddr) \
+ : "i"(ADDEND)); \
+ } else { \
+ vAddr = 0x10000000; \
+ } \
+ vAddr; \
})
COSMOPOLITAN_C_END_
diff --git a/libc/runtime/winmain.greg.c b/libc/runtime/winmain.greg.c
index 8f0498b4c..35ffb0810 100644
--- a/libc/runtime/winmain.greg.c
+++ b/libc/runtime/winmain.greg.c
@@ -22,9 +22,11 @@
#include "libc/calls/internal.h"
#include "libc/dce.h"
#include "libc/fmt/fmt.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/bsr.h"
+#include "libc/nexgen32e/rdtsc.h"
#include "libc/nt/console.h"
#include "libc/nt/enum/consolemodeflags.h"
#include "libc/nt/enum/filemapflags.h"
@@ -66,9 +68,20 @@ struct WinArgs {
char envblock[ARG_MAX];
};
-uint32_t __ntconsolemode;
+extern int __pid;
+extern bool __nomultics;
+extern const char kConsoleHandles[2];
-static noasan textwindows noinstrument void MakeLongDoubleLongAgain(void) {
+static const short kConsoleModes[2] = {
+ kNtEnableProcessedInput | kNtEnableLineInput | kNtEnableEchoInput |
+ kNtEnableMouseInput | kNtEnableQuickEditMode | kNtEnableExtendedFlags |
+ kNtEnableAutoPosition | kNtEnableInsertMode |
+ kNtEnableVirtualTerminalInput,
+ kNtEnableProcessedOutput | kNtEnableWrapAtEolOutput |
+ kNtEnableVirtualTerminalProcessing,
+};
+
+forceinline void MakeLongDoubleLongAgain(void) {
/* 8087 FPU Control Word
IM: Invalid Operation ───────────────┐
DM: Denormal Operand ───────────────┐│
@@ -90,29 +103,22 @@ static noasan textwindows wontreturn noinstrument void WinMainNew(void) {
int64_t h;
int version;
int i, count;
- int64_t inhand;
+ int64_t hand;
struct WinArgs *wa;
const char16_t *env16;
intptr_t stackaddr, allocaddr;
size_t allocsize, argsize, stacksize;
- extern char os asm("__hostos");
- os = WINDOWS; /* madness https://news.ycombinator.com/item?id=21019722 */
version = NtGetPeb()->OSMajorVersion;
__oldstack = (intptr_t)__builtin_frame_address(0);
if ((intptr_t)v_ntsubsystem == kNtImageSubsystemWindowsCui && version >= 10) {
SetConsoleCP(kNtCpUtf8);
SetConsoleOutputCP(kNtCpUtf8);
- inhand = GetStdHandle(pushpop(kNtStdInputHandle));
SetEnvironmentVariable(u"TERM", u"xterm-truecolor");
- GetConsoleMode(inhand, &__ntconsolemode);
- SetConsoleMode(inhand, kNtEnableProcessedInput | kNtEnableLineInput |
- kNtEnableEchoInput | kNtEnableMouseInput |
- kNtEnableQuickEditMode | kNtEnableExtendedFlags |
- kNtEnableAutoPosition |
- kNtEnableVirtualTerminalInput);
- SetConsoleMode(GetStdHandle(pushpop(kNtStdOutputHandle)),
- kNtEnableProcessedOutput | kNtEnableWrapAtEolOutput |
- kNtEnableVirtualTerminalProcessing);
+ for (i = 0; i < 2; ++i) {
+ hand = GetStdHandle(kConsoleHandles[i]);
+ GetConsoleMode(hand, __ntconsolemode + i);
+ SetConsoleMode(hand, kConsoleModes[i]);
+ }
}
_mmi.p = _mmi.s;
_mmi.n = ARRAYLEN(_mmi.s);
@@ -186,6 +192,12 @@ noasan textwindows noinstrument int64_t WinMain(int64_t hInstance,
int64_t hPrevInstance,
const char *lpCmdLine,
int nCmdShow) {
+ extern char os asm("__hostos");
+ extern uint64_t ts asm("kStartTsc");
+ os = WINDOWS; /* madness https://news.ycombinator.com/item?id=21019722 */
+ ts = rdtsc();
+ __nomultics = true;
+ __pid = GetCurrentProcessId();
MakeLongDoubleLongAgain();
if (weaken(WinSockInit)) weaken(WinSockInit)();
if (weaken(WinMainForked)) weaken(WinMainForked)();
diff --git a/libc/sock/poll-nt.c b/libc/sock/poll-nt.c
index 94f73e197..47ebdb80d 100644
--- a/libc/sock/poll-nt.c
+++ b/libc/sock/poll-nt.c
@@ -17,7 +17,9 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/bits/bits.h"
+#include "libc/bits/weaken.h"
#include "libc/calls/internal.h"
+#include "libc/calls/struct/sigaction.h"
#include "libc/macros.internal.h"
#include "libc/nt/struct/pollfd.h"
#include "libc/nt/winsock.h"
@@ -42,6 +44,9 @@ textwindows int sys_poll_nt(struct pollfd *fds, uint64_t nfds, uint64_t ms) {
}
for (;;) {
if (cmpxchg(&__interrupted, true, false)) return eintr();
+ if (weaken(_check_sigwinch) && weaken(_check_sigwinch)(g_fds.p + 0)) {
+ return eintr();
+ }
waitfor = MIN(1000, ms); /* for ctrl+c */
if ((got = WSAPoll(ntfds, nfds, waitfor)) != -1) {
if (!got && (ms -= waitfor) > 0) continue;
diff --git a/libc/str/utf16.h b/libc/str/utf16.h
index 0e8e391d7..a0a87854e 100644
--- a/libc/str/utf16.h
+++ b/libc/str/utf16.h
@@ -1,20 +1,23 @@
#ifndef COSMOPOLITAN_LIBC_STR_UTF16_H_
#define COSMOPOLITAN_LIBC_STR_UTF16_H_
+#include "libc/bits/likely.h"
#define UTF16_MASK 0xfc00
#define UTF16_MOAR 0xd800 /* 0xD800..0xDBFF */
-#define UTF16_CONT 0xdc00 /* 0xDC00..0xDBFF */
+#define UTF16_CONT 0xdc00 /* 0xDC00..0xDFFF */
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
-#define IsUcs2(wc) (((wc)&UTF16_MASK) != UTF16_MOAR)
-#define IsUtf16Cont(wc) (((wc)&UTF16_MASK) == UTF16_CONT)
-#define MergeUtf16(lo, hi) ((((lo)-0xD800) << 10) + ((hi)-0xDC00) + 0x10000)
+#define IsSurrogate(wc) ((0xf800 & (wc)) == 0xd800)
+#define IsHighSurrogate(wc) ((UTF16_MASK & (wc)) == UTF16_MOAR)
+#define IsLowSurrogate(wc) ((UTF16_MASK & (wc)) == UTF16_CONT)
+#define IsUcs2(wc) (((65535 & (wc)) >> 11) != 27)
+#define IsUtf16Cont(wc) IsLowSurrogate(wc) /* TODO: DELETE */
+#define MergeUtf16(hi, lo) ((((hi)-0xD800) << 10) + ((lo)-0xDC00) + 0x10000)
#define EncodeUtf16(wc) \
- (__builtin_expect(((0x0000 <= (wc) && (wc) <= 0xFFFF) || \
- (0xE000 <= (wc) && (wc) <= 0xFFFF)), \
- 1) \
+ (LIKELY((0x0000 <= (wc) && (wc) <= 0xFFFF) || \
+ (0xE000 <= (wc) && (wc) <= 0xFFFF)) \
? (wc) \
: 0x10000 <= (wc) && (wc) <= 0x10FFFF \
? (((((wc)-0x10000) >> 10) + 0xD800) | \
diff --git a/libc/sysv/calls/__syscall.s b/libc/sysv/calls/__syscall.s
deleted file mode 100644
index afb98875d..000000000
--- a/libc/sysv/calls/__syscall.s
+++ /dev/null
@@ -1,2 +0,0 @@
-.include "o/libc/sysv/macros.internal.inc"
-.scall __syscall,0xfff0c6ffffffffff,globl
diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh
index 1855299a7..f9782ce88 100755
--- a/libc/sysv/consts.sh
+++ b/libc/sysv/consts.sh
@@ -224,11 +224,11 @@ syscon compat MAP_FILE 0 0 0 0 0 0 # consensus
syscon mmap MAP_SHARED 1 1 1 1 1 1 # forced consensus & faked nt
syscon mmap MAP_PRIVATE 2 2 2 2 2 2 # forced consensus & faked nt
syscon mmap MAP_TYPE 15 15 15 15 15 15 # mask for type of mapping
-syscon mmap MAP_FIXED 0x10 0x10 0x10 0x10 0x10 0x10 # unix consensus; openbsd appears to forbid; faked nt
+syscon mmap MAP_FIXED 0x0000010 0x0000010 0x0000010 0x0000010 0x0000010 0x0000010 # unix consensus; openbsd appears to forbid; faked nt
syscon mmap MAP_FIXED_NOREPLACE 0x8000000 0x8000000 0x8000000 0x8000000 0x8000000 0x8000000 # handled and defined by cosmo runtime; 0x100000 on linux 4.7+
-syscon mmap MAP_ANONYMOUS 0x20 0x1000 0x1000 0x1000 0x1000 0x20 # bsd consensus; faked nt
-syscon mmap MAP_GROWSDOWN 0x0100 0 0x0400 0x4000 0x4000 0x100000 # mandatory for OpenBSD stacks; MAP_STACK on Free/OpenBSD; MEM_TOP_DOWN on NT
-syscon mmap MAP_CONCEAL 0 0 0x20000 0x8000 0x8000 0 # omit from core dumps; MAP_NOCORE on FreeBSD
+syscon mmap MAP_ANONYMOUS 0x20 0x1000 0x0001000 0x1000 0x1000 0x20 # bsd consensus; faked nt
+syscon mmap MAP_GROWSDOWN 0x0100 0 0x0000400 0x4000 0x4000 0x100000 # mandatory for OpenBSD stacks; MAP_STACK on Free/OpenBSD; MEM_TOP_DOWN on NT
+syscon mmap MAP_CONCEAL 0 0 0x0020000 0x8000 0x8000 0 # omit from core dumps; MAP_NOCORE on FreeBSD
syscon mmap MAP_NORESERVE 0x4000 0x40 0 0 64 0 # Linux calls it "reserve"; NT calls it "commit"? which is default?
syscon mmap MAP_HUGETLB 0x040000 0 0 0 0 0x80000000 # kNtSecLargePages
syscon mmap MAP_HUGE_MASK 63 0 0 0 0 0
@@ -237,44 +237,43 @@ syscon mmap MAP_LOCKED 0x2000 0 0 0 0 0
syscon mmap MAP_NONBLOCK 0x10000 0 0 0 0 0
syscon mmap MAP_POPULATE 0x8000 0 0 0 0 0 # can avoid madvise(MADV_WILLNEED) on private file mapping
syscon mmap MAP_CONCEAL 0 0 0 0x8000 0 0 # omit from dumps
-syscon compat MAP_STACK 0x0100 0 0x0400 0x4000 0x2000 0x100000 # use MAP_GROWSDOWN
-syscon compat MAP_NOCORE 0 0 0x20000 0x8000 0x8000 0 # use MAP_CONCEAL
-syscon compat MAP_ANON 0x20 0x1000 0x1000 0x1000 0x1000 0x20 # bsd consensus; faked nt
+syscon mmap MAP_STACK 0x0100 0 0x0000400 0x4000 0x2000 0x100000 # use MAP_GROWSDOWN
+syscon compat MAP_NOCORE 0 0 0x0020000 0x8000 0x8000 0 # use MAP_CONCEAL
+syscon compat MAP_ANON 0x20 0x1000 0x0001000 0x1000 0x1000 0x20 # bsd consensus; faked nt
syscon compat MAP_EXECUTABLE 0x1000 0 0 0 0 0 # ignored
syscon compat MAP_DENYWRITE 0x0800 0 0 0 0 0
syscon compat MAP_32BIT 0x40 0 0x080000 0 0 0 # iffy
# madvise() flags
-# beneath the iceberg memory management
#
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary
syscon madv MADV_NORMAL 0 0 0 0 0 0x00000080 # consensus & kNtFileAttributeNormal
syscon compat POSIX_FADV_NORMAL 0 0 0 0 0 0x00000080 # consensus & kNtFileAttributeNormal
syscon compat POSIX_MADV_NORMAL 0 0 0 0 0 0x00000080 # consensus & kNtFileAttributeNormal
-syscon madv MADV_DONTNEED 4 4 4 4 4 0 # TODO(jart): weird nt decommit thing?
-syscon compat POSIX_MADV_DONTNEED 4 4 4 4 4 0 # unix consensus
-syscon compat POSIX_FADV_DONTNEED 4 0 4 4 4 0 # unix consensus
+syscon madv MADV_DONTNEED 4 4 4 4 4 127 # TODO(jart): weird nt decommit thing?
+syscon compat POSIX_MADV_DONTNEED 4 4 4 4 4 127 # unix consensus
+syscon compat POSIX_FADV_DONTNEED 4 127 4 4 4 127 # unix consensus
syscon madv MADV_RANDOM 1 1 1 1 1 0x10000000 # unix consensus & kNtFileFlagRandomAccess
syscon compat POSIX_MADV_RANDOM 1 1 1 1 1 0x10000000 # unix consensus & kNtFileFlagRandomAccess
-syscon compat POSIX_FADV_RANDOM 1 0 1 1 1 0x10000000 # unix consensus & kNtFileFlagRandomAccess
+syscon compat POSIX_FADV_RANDOM 1 127 1 1 1 0x10000000 # unix consensus & kNtFileFlagRandomAccess
syscon madv MADV_SEQUENTIAL 2 2 2 2 2 0x8000000 # unix consensus & kNtFileFlagSequentialScan
syscon compat POSIX_MADV_SEQUENTIAL 2 2 2 2 2 0x8000000 # unix consensus
-syscon compat POSIX_FADV_SEQUENTIAL 2 0 2 2 2 0x8000000 # TODO(jart): double check xnu
+syscon compat POSIX_FADV_SEQUENTIAL 2 127 2 2 2 0x8000000 # TODO(jart): double check xnu
syscon madv MADV_WILLNEED 3 3 3 3 3 3 # unix consensus (faked on NT)
syscon compat POSIX_MADV_WILLNEED 3 3 3 3 3 3 # unix consensus
-syscon compat POSIX_FADV_WILLNEED 3 0 3 3 3 3 # TODO(jart): double check xnu
-syscon madv MADV_MERGEABLE 12 0 0 0 0 0 # turns on (private anon range) page scanning and merging service (linux only)
-syscon madv MADV_UNMERGEABLE 13 0 0 0 0 0 # turns off mergeable (linux only)
+syscon compat POSIX_FADV_WILLNEED 3 127 3 3 3 3 # TODO(jart): double check xnu
+syscon madv MADV_MERGEABLE 12 127 127 127 127 127 # turns on (private anon range) page scanning and merging service (linux only)
+syscon madv MADV_UNMERGEABLE 13 127 127 127 127 127 # turns off mergeable (linux only)
syscon madv MADV_FREE 8 5 5 6 6 8 # Linux 4.5+ (c. 2016) / NT Faked → VMOfferPriorityNormal (Win8+)
-syscon madv MADV_HUGEPAGE 14 0 0 0 0 0 # TODO(jart): why would we need it?
-syscon madv MADV_NOHUGEPAGE 15 0 0 0 0 0 # TODO(jart): why would we need it?
-syscon madv MADV_DODUMP 17 0 0 0 0 0 # TODO(jart): what is it?
-syscon madv MADV_DOFORK 11 0 0 0 0 0 # TODO(jart): what is it?
-syscon madv MADV_DONTDUMP 16 0 0 0 0 0 # see MAP_CONCEAL in OpenBSD; TODO(jart): what is it?
-syscon madv MADV_DONTFORK 10 0 0 0 0 0 # TODO(jart): what is it?
-syscon madv MADV_HWPOISON 100 0 0 0 0 0 # TODO(jart): what is it?
-syscon madv MADV_REMOVE 9 0 0 0 0 0 # TODO(jart): what is it?
-syscon fadv POSIX_FADV_NOREUSE 5 0 5 0 5 0 # wut
+syscon madv MADV_HUGEPAGE 14 127 127 127 127 127 # TODO(jart): why would we need it?
+syscon madv MADV_NOHUGEPAGE 15 127 127 127 127 127 # TODO(jart): why would we need it?
+syscon madv MADV_DODUMP 17 127 127 127 127 127 # TODO(jart): what is it?
+syscon madv MADV_DOFORK 11 127 127 127 127 127 # TODO(jart): what is it?
+syscon madv MADV_DONTDUMP 16 127 127 127 127 127 # see MAP_CONCEAL in OpenBSD; TODO(jart): what is it?
+syscon madv MADV_DONTFORK 10 127 127 127 127 127 # TODO(jart): what is it?
+syscon madv MADV_HWPOISON 100 127 127 127 127 127 # TODO(jart): what is it?
+syscon madv MADV_REMOVE 9 127 127 127 127 127 # TODO(jart): what is it?
+syscon fadv POSIX_FADV_NOREUSE 5 127 5 127 5 127 # wut
# mmap(), mprotect(), etc.
# digital restrictions management for the people
@@ -471,7 +470,7 @@ syscon auxv AT_PHENT 4 0 4 0 4 0
syscon auxv AT_PHNUM 5 0 5 0 5 0
syscon auxv AT_PAGESZ 6 0 6 0 6 0
syscon auxv AT_BASE 7 0 7 0 7 0 # address of program interpreter
-syscon auxv AT_FLAGS 8 0 0 0 0 0
+syscon auxv AT_FLAGS 8 0 8 0 8 0
syscon auxv AT_ENTRY 9 0 9 0 9 0 # entry address of executable
syscon auxv AT_NOTELF 10 0 10 0 0 0
syscon auxv AT_OSRELDATE 0 0 18 0 0 0
@@ -487,10 +486,20 @@ syscon auxv AT_ICACHEBSIZE 20 0 0 0 0 0
syscon auxv AT_UCACHEBSIZE 21 0 0 0 0 0
syscon auxv AT_SECURE 23 0 0 0 0 0
syscon auxv AT_BASE_PLATFORM 24 0 0 0 0 0
-syscon auxv AT_RANDOM 25 0 0 0 0 0 # address of sixteen bytes of random data
+syscon auxv AT_RANDOM 25 0 16 0 0 0 # address of sixteen bytes of random data; AT_CANARY on FreeBSD whose AT_CANARYLEN should be 64
syscon auxv AT_HWCAP2 26 0 0 0 0 0
-syscon auxv AT_EXECFN 31 31 999 999 2014 31 # address of string containing first argument passed to execve() used when running program [faked on non-linux]
+syscon auxv AT_EXECFN 31 31 15 999 2014 31 # address of string containing first argument passed to execve() used when running program; AT_EXECPATH on FreeBSD
syscon auxv AT_SYSINFO_EHDR 33 0 0 0 0 0
+syscon auxv AT_STACKBASE 0 0 0 0 13 0
+syscon auxv AT_EXECPATH 31 31 15 999 2014 31 # FreeBSD name for AT_EXECFN
+syscon auxv AT_CANARY 0 0 16 0 0 0
+syscon auxv AT_CANARYLEN 0 0 17 0 0 0
+syscon auxv AT_NCPUS 0 0 19 0 0 0
+syscon auxv AT_PAGESIZES 0 0 20 0 0 0
+syscon auxv AT_PAGESIZESLEN 0 0 21 0 0 0
+syscon auxv AT_TIMEKEEP 0 0 22 0 0 0
+syscon auxv AT_STACKPROT 0 0 23 0 0 0
+syscon auxv AT_EHDRFLAGS 0 0 24 0 0 0
syscon auxv AT_NO_AUTOMOUNT 0x0800 0 0 0 0 0
# getrlimit() / setrlimit() resource parameter
@@ -1477,13 +1486,13 @@ syscon termios IGNCR 0b0000000010000000 0b0000000010000000 0b000000001000000
syscon termios ICRNL 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 0b0000000100000000 # termios.c_iflag|=ICRNL maps \r → \n input UNIXCONSENSUS
syscon termios IUCLC 0b0000001000000000 0 0 0b0001000000000000 0 0b0000001000000000 # termios.c_iflag|=IUCLC maps A-Z → a-z input
syscon termios IXON 0b0000010000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000001000000000 0b0000010000000000 # termios.c_iflag|=IXON enables flow rida
-syscon termios IXANY 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 # termios.c_iflag|=IXANY tying will un-stuck teletype UNIXCONSENSUS
+syscon termios IXANY 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 0b0000100000000000 # termios.c_iflag|=IXANY typing will un-stuck teletype UNIXCONSENSUS
syscon termios IXOFF 0b0001000000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0000010000000000 0b0001000000000000 # termios.c_iflag|=IXOFF disables annoying display freeze keys
syscon termios IMAXBEL 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 0b0010000000000000 # termios.c_iflag|=IMAXBEL rings when queue full UNIXCONSENSUS
syscon termios IUTF8 0b0100000000000000 0b0100000000000000 0 0 0 0b0100000000000000 # termios.c_iflag|=IUTF8 helps w/ rubout on UTF-8 input
-syscon termios OPOST 0b0000000000000001 0b000000000000000001 0b000000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_oflag&=~OPOST disables output processing magic
+syscon termios OPOST 0b0000000000000001 0b000000000000000001 0b000000000000000001 0b0000000000000001 0b0000000000000001 0b0000000000000001 # termios.c_oflag&=~OPOST disables output processing magic, e.g. MULTICS newlines
syscon termios OLCUC 0b0000000000000010 0 0 0b0000000000100000 0 0b0000000000000010 # termios.c_oflag|=OLCUC maps a-z → A-Z output
-syscon termios ONLCR 0b0000000000000100 0b000000000000000010 0b000000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000100 # termios.c_oflag|=ONLCR maps \n → \r\n output
+syscon termios ONLCR 0b0000000000000100 0b000000000000000010 0b000000000000000010 0b0000000000000010 0b0000000000000010 0b0000000000000100 # termios.c_oflag|=ONLCR claims to map \n → \r\n output
syscon termios OCRNL 0b0000000000001000 0b000000000000010000 0b000000000000010000 0b0000000000010000 0b0000000000010000 0b0000000000001000 # termios.c_oflag|=OCRNL maps \r → \n output
syscon termios ONOCR 0b0000000000010000 0b000000000000100000 0b000000000000100000 0b0000000001000000 0b0000000001000000 0b0000000000010000 # termios.c_oflag|=ONOCR maps \r → ∅ output iff column 0
syscon termios ONLRET 0b0000000000100000 0b000000000001000000 0b000000000001000000 0b0000000010000000 0b0000000010000000 0b0000000000100000 # termios.c_oflag|=ONLRET maps \r → ∅ output
diff --git a/libc/sysv/consts/AT_CANARY.S b/libc/sysv/consts/AT_CANARY.S
new file mode 100644
index 000000000..9a0fda0b6
--- /dev/null
+++ b/libc/sysv/consts/AT_CANARY.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_CANARY,0,0,16,0,0,0
diff --git a/libc/sysv/consts/AT_CANARYLEN.S b/libc/sysv/consts/AT_CANARYLEN.S
new file mode 100644
index 000000000..ee5e819d9
--- /dev/null
+++ b/libc/sysv/consts/AT_CANARYLEN.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_CANARYLEN,0,0,17,0,0,0
diff --git a/libc/sysv/consts/AT_EHDRFLAGS.S b/libc/sysv/consts/AT_EHDRFLAGS.S
new file mode 100644
index 000000000..47b678e3b
--- /dev/null
+++ b/libc/sysv/consts/AT_EHDRFLAGS.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_EHDRFLAGS,0,0,24,0,0,0
diff --git a/libc/sysv/consts/AT_EXECFN.S b/libc/sysv/consts/AT_EXECFN.S
index ec03740c2..0fa809424 100644
--- a/libc/sysv/consts/AT_EXECFN.S
+++ b/libc/sysv/consts/AT_EXECFN.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon auxv,AT_EXECFN,31,31,999,999,2014,31
+.syscon auxv,AT_EXECFN,31,31,15,999,2014,31
diff --git a/libc/sysv/consts/AT_EXECPATH.S b/libc/sysv/consts/AT_EXECPATH.S
new file mode 100644
index 000000000..119cf8b4f
--- /dev/null
+++ b/libc/sysv/consts/AT_EXECPATH.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_EXECPATH,31,31,15,999,2014,31
diff --git a/libc/sysv/consts/AT_FLAGS.S b/libc/sysv/consts/AT_FLAGS.S
index 79b4bc1e7..b5bf0d555 100644
--- a/libc/sysv/consts/AT_FLAGS.S
+++ b/libc/sysv/consts/AT_FLAGS.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon auxv,AT_FLAGS,8,0,0,0,0,0
+.syscon auxv,AT_FLAGS,8,0,8,0,8,0
diff --git a/libc/sysv/consts/AT_NCPUS.S b/libc/sysv/consts/AT_NCPUS.S
new file mode 100644
index 000000000..a79325514
--- /dev/null
+++ b/libc/sysv/consts/AT_NCPUS.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_NCPUS,0,0,19,0,0,0
diff --git a/libc/sysv/consts/AT_PAGESIZES.S b/libc/sysv/consts/AT_PAGESIZES.S
new file mode 100644
index 000000000..7ecb5f2cd
--- /dev/null
+++ b/libc/sysv/consts/AT_PAGESIZES.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_PAGESIZES,0,0,20,0,0,0
diff --git a/libc/sysv/consts/AT_PAGESIZESLEN.S b/libc/sysv/consts/AT_PAGESIZESLEN.S
new file mode 100644
index 000000000..1c2509346
--- /dev/null
+++ b/libc/sysv/consts/AT_PAGESIZESLEN.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_PAGESIZESLEN,0,0,21,0,0,0
diff --git a/libc/sysv/consts/AT_RANDOM.S b/libc/sysv/consts/AT_RANDOM.S
index 28cce6500..9badd07c8 100644
--- a/libc/sysv/consts/AT_RANDOM.S
+++ b/libc/sysv/consts/AT_RANDOM.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon auxv,AT_RANDOM,25,0,0,0,0,0
+.syscon auxv,AT_RANDOM,25,0,16,0,0,0
diff --git a/libc/sysv/consts/AT_STACKBASE.S b/libc/sysv/consts/AT_STACKBASE.S
new file mode 100644
index 000000000..a7689a9b0
--- /dev/null
+++ b/libc/sysv/consts/AT_STACKBASE.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_STACKBASE,0,0,0,0,13,0
diff --git a/libc/sysv/consts/AT_STACKPROT.S b/libc/sysv/consts/AT_STACKPROT.S
new file mode 100644
index 000000000..3e45d2737
--- /dev/null
+++ b/libc/sysv/consts/AT_STACKPROT.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_STACKPROT,0,0,23,0,0,0
diff --git a/libc/sysv/consts/AT_TIMEKEEP.S b/libc/sysv/consts/AT_TIMEKEEP.S
new file mode 100644
index 000000000..f90ab4b4c
--- /dev/null
+++ b/libc/sysv/consts/AT_TIMEKEEP.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon auxv,AT_TIMEKEEP,0,0,22,0,0,0
diff --git a/libc/sysv/consts/MADV_DODUMP.S b/libc/sysv/consts/MADV_DODUMP.S
index 646221a86..f8e709e27 100644
--- a/libc/sysv/consts/MADV_DODUMP.S
+++ b/libc/sysv/consts/MADV_DODUMP.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_DODUMP,17,0,0,0,0,0
+.syscon madv,MADV_DODUMP,17,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_DOFORK.S b/libc/sysv/consts/MADV_DOFORK.S
index ed787cfc2..07615b18c 100644
--- a/libc/sysv/consts/MADV_DOFORK.S
+++ b/libc/sysv/consts/MADV_DOFORK.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_DOFORK,11,0,0,0,0,0
+.syscon madv,MADV_DOFORK,11,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_DONTDUMP.S b/libc/sysv/consts/MADV_DONTDUMP.S
index feba10977..28fcf75b1 100644
--- a/libc/sysv/consts/MADV_DONTDUMP.S
+++ b/libc/sysv/consts/MADV_DONTDUMP.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_DONTDUMP,16,0,0,0,0,0
+.syscon madv,MADV_DONTDUMP,16,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_DONTFORK.S b/libc/sysv/consts/MADV_DONTFORK.S
index ee1535ff6..28eded7f4 100644
--- a/libc/sysv/consts/MADV_DONTFORK.S
+++ b/libc/sysv/consts/MADV_DONTFORK.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_DONTFORK,10,0,0,0,0,0
+.syscon madv,MADV_DONTFORK,10,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_DONTNEED.S b/libc/sysv/consts/MADV_DONTNEED.S
index 72ce36e4d..6567e21f8 100644
--- a/libc/sysv/consts/MADV_DONTNEED.S
+++ b/libc/sysv/consts/MADV_DONTNEED.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_DONTNEED,4,4,4,4,4,0
+.syscon madv,MADV_DONTNEED,4,4,4,4,4,127
diff --git a/libc/sysv/consts/MADV_HUGEPAGE.S b/libc/sysv/consts/MADV_HUGEPAGE.S
index 7d42c5da0..0afab715f 100644
--- a/libc/sysv/consts/MADV_HUGEPAGE.S
+++ b/libc/sysv/consts/MADV_HUGEPAGE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_HUGEPAGE,14,0,0,0,0,0
+.syscon madv,MADV_HUGEPAGE,14,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_HWPOISON.S b/libc/sysv/consts/MADV_HWPOISON.S
index 85ed35846..c8f76111a 100644
--- a/libc/sysv/consts/MADV_HWPOISON.S
+++ b/libc/sysv/consts/MADV_HWPOISON.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_HWPOISON,100,0,0,0,0,0
+.syscon madv,MADV_HWPOISON,100,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_MERGEABLE.S b/libc/sysv/consts/MADV_MERGEABLE.S
index 65bf29223..172668fcc 100644
--- a/libc/sysv/consts/MADV_MERGEABLE.S
+++ b/libc/sysv/consts/MADV_MERGEABLE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_MERGEABLE,12,0,0,0,0,0
+.syscon madv,MADV_MERGEABLE,12,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_NOHUGEPAGE.S b/libc/sysv/consts/MADV_NOHUGEPAGE.S
index d56f15745..9458ebc54 100644
--- a/libc/sysv/consts/MADV_NOHUGEPAGE.S
+++ b/libc/sysv/consts/MADV_NOHUGEPAGE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_NOHUGEPAGE,15,0,0,0,0,0
+.syscon madv,MADV_NOHUGEPAGE,15,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_REMOVE.S b/libc/sysv/consts/MADV_REMOVE.S
index ea2398627..cc77e67fc 100644
--- a/libc/sysv/consts/MADV_REMOVE.S
+++ b/libc/sysv/consts/MADV_REMOVE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_REMOVE,9,0,0,0,0,0
+.syscon madv,MADV_REMOVE,9,127,127,127,127,127
diff --git a/libc/sysv/consts/MADV_UNMERGEABLE.S b/libc/sysv/consts/MADV_UNMERGEABLE.S
index 2704aabe7..d0335eb72 100644
--- a/libc/sysv/consts/MADV_UNMERGEABLE.S
+++ b/libc/sysv/consts/MADV_UNMERGEABLE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon madv,MADV_UNMERGEABLE,13,0,0,0,0,0
+.syscon madv,MADV_UNMERGEABLE,13,127,127,127,127,127
diff --git a/libc/sysv/consts/MAP_ANON.S b/libc/sysv/consts/MAP_ANON.S
index 9b6ef77dd..a1eb02bfe 100644
--- a/libc/sysv/consts/MAP_ANON.S
+++ b/libc/sysv/consts/MAP_ANON.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,MAP_ANON,0x20,0x1000,0x1000,0x1000,0x1000,0x20
+.syscon compat,MAP_ANON,0x20,0x1000,0x0001000,0x1000,0x1000,0x20
diff --git a/libc/sysv/consts/MAP_ANONYMOUS.S b/libc/sysv/consts/MAP_ANONYMOUS.S
index 6872f306a..9aa3781ea 100644
--- a/libc/sysv/consts/MAP_ANONYMOUS.S
+++ b/libc/sysv/consts/MAP_ANONYMOUS.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon mmap,MAP_ANONYMOUS,0x20,0x1000,0x1000,0x1000,0x1000,0x20
+.syscon mmap,MAP_ANONYMOUS,0x20,0x1000,0x0001000,0x1000,0x1000,0x20
diff --git a/libc/sysv/consts/MAP_FIXED.S b/libc/sysv/consts/MAP_FIXED.S
index e47ad4a5d..e9dbc0e9e 100644
--- a/libc/sysv/consts/MAP_FIXED.S
+++ b/libc/sysv/consts/MAP_FIXED.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon mmap,MAP_FIXED,0x10,0x10,0x10,0x10,0x10,0x10
+.syscon mmap,MAP_FIXED,0x0000010,0x0000010,0x0000010,0x0000010,0x0000010,0x0000010
diff --git a/libc/sysv/consts/MAP_FIXED_NOREPLACE.S b/libc/sysv/consts/MAP_FIXED_NOREPLACE.S
new file mode 100644
index 000000000..2bcb31adf
--- /dev/null
+++ b/libc/sysv/consts/MAP_FIXED_NOREPLACE.S
@@ -0,0 +1,2 @@
+#include "libc/sysv/consts/syscon.internal.h"
+.syscon mmap,MAP_FIXED_NOREPLACE,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000
diff --git a/libc/sysv/consts/MAP_GROWSDOWN.S b/libc/sysv/consts/MAP_GROWSDOWN.S
index e7fc93583..ec4438b6a 100644
--- a/libc/sysv/consts/MAP_GROWSDOWN.S
+++ b/libc/sysv/consts/MAP_GROWSDOWN.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon mmap,MAP_GROWSDOWN,0x0100,0,0x0400,0x4000,0x4000,0x100000
+.syscon mmap,MAP_GROWSDOWN,0x0100,0,0x0000400,0x4000,0x4000,0x100000
diff --git a/libc/sysv/consts/MAP_NOCORE.S b/libc/sysv/consts/MAP_NOCORE.S
index 90c2c1f44..c0e6b263f 100644
--- a/libc/sysv/consts/MAP_NOCORE.S
+++ b/libc/sysv/consts/MAP_NOCORE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,MAP_NOCORE,0,0,0x20000,0x8000,0x8000,0
+.syscon compat,MAP_NOCORE,0,0,0x0020000,0x8000,0x8000,0
diff --git a/libc/sysv/consts/MAP_STACK.S b/libc/sysv/consts/MAP_STACK.S
index 1eff99c73..ed26f8ecf 100644
--- a/libc/sysv/consts/MAP_STACK.S
+++ b/libc/sysv/consts/MAP_STACK.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,MAP_STACK,0x0100,0,0x0400,0x4000,0x2000,0x100000
+.syscon mmap,MAP_STACK,0x0100,0,0x0000400,0x4000,0x2000,0x100000
diff --git a/libc/sysv/consts/POSIX_FADV_DONTNEED.S b/libc/sysv/consts/POSIX_FADV_DONTNEED.S
index b17a2a8dc..710c85ef1 100644
--- a/libc/sysv/consts/POSIX_FADV_DONTNEED.S
+++ b/libc/sysv/consts/POSIX_FADV_DONTNEED.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,POSIX_FADV_DONTNEED,4,0,4,4,4,0
+.syscon compat,POSIX_FADV_DONTNEED,4,127,4,4,4,127
diff --git a/libc/sysv/consts/POSIX_FADV_NOREUSE.S b/libc/sysv/consts/POSIX_FADV_NOREUSE.S
index 7b1286148..ff5f39d9c 100644
--- a/libc/sysv/consts/POSIX_FADV_NOREUSE.S
+++ b/libc/sysv/consts/POSIX_FADV_NOREUSE.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon fadv,POSIX_FADV_NOREUSE,5,0,5,0,5,0
+.syscon fadv,POSIX_FADV_NOREUSE,5,127,5,127,5,127
diff --git a/libc/sysv/consts/POSIX_FADV_RANDOM.S b/libc/sysv/consts/POSIX_FADV_RANDOM.S
index 1666daa39..978a1cf76 100644
--- a/libc/sysv/consts/POSIX_FADV_RANDOM.S
+++ b/libc/sysv/consts/POSIX_FADV_RANDOM.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,POSIX_FADV_RANDOM,1,0,1,1,1,0x10000000
+.syscon compat,POSIX_FADV_RANDOM,1,127,1,1,1,0x10000000
diff --git a/libc/sysv/consts/POSIX_FADV_SEQUENTIAL.S b/libc/sysv/consts/POSIX_FADV_SEQUENTIAL.S
index 1f6b11052..5f743db4d 100644
--- a/libc/sysv/consts/POSIX_FADV_SEQUENTIAL.S
+++ b/libc/sysv/consts/POSIX_FADV_SEQUENTIAL.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,POSIX_FADV_SEQUENTIAL,2,0,2,2,2,0x8000000
+.syscon compat,POSIX_FADV_SEQUENTIAL,2,127,2,2,2,0x8000000
diff --git a/libc/sysv/consts/POSIX_FADV_WILLNEED.S b/libc/sysv/consts/POSIX_FADV_WILLNEED.S
index e8f60969d..7ae0fe7da 100644
--- a/libc/sysv/consts/POSIX_FADV_WILLNEED.S
+++ b/libc/sysv/consts/POSIX_FADV_WILLNEED.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,POSIX_FADV_WILLNEED,3,0,3,3,3,3
+.syscon compat,POSIX_FADV_WILLNEED,3,127,3,3,3,3
diff --git a/libc/sysv/consts/POSIX_MADV_DONTNEED.S b/libc/sysv/consts/POSIX_MADV_DONTNEED.S
index 52f0f9ab6..77d260f6b 100644
--- a/libc/sysv/consts/POSIX_MADV_DONTNEED.S
+++ b/libc/sysv/consts/POSIX_MADV_DONTNEED.S
@@ -1,2 +1,2 @@
#include "libc/sysv/consts/syscon.internal.h"
-.syscon compat,POSIX_MADV_DONTNEED,4,4,4,4,4,0
+.syscon compat,POSIX_MADV_DONTNEED,4,4,4,4,4,127
diff --git a/libc/sysv/consts/auxv.h b/libc/sysv/consts/auxv.h
index 69bf377f9..fb18fb88c 100644
--- a/libc/sysv/consts/auxv.h
+++ b/libc/sysv/consts/auxv.h
@@ -31,6 +31,16 @@ extern const long AT_SECURE;
extern const long AT_SYSINFO_EHDR;
extern const long AT_UCACHEBSIZE;
extern const long AT_UID;
+extern const long AT_STACKBASE;
+extern const long AT_EXECPATH;
+extern const long AT_CANARY;
+extern const long AT_CANARYLEN;
+extern const long AT_NCPUS;
+extern const long AT_PAGESIZES;
+extern const long AT_PAGESIZESLEN;
+extern const long AT_TIMEKEEP;
+extern const long AT_STACKPROT;
+extern const long AT_EHDRFLAGS;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
@@ -62,5 +72,15 @@ COSMOPOLITAN_C_END_
#define AT_SYSINFO_EHDR SYMBOLIC(AT_SYSINFO_EHDR)
#define AT_UCACHEBSIZE SYMBOLIC(AT_UCACHEBSIZE)
#define AT_UID SYMBOLIC(AT_UID)
+#define AT_STACKBASE SYMBOLIC(AT_STACKBASE)
+#define AT_EXECPATH SYMBOLIC(AT_EXECPATH)
+#define AT_CANARY SYMBOLIC(AT_CANARY)
+#define AT_CANARYLEN SYMBOLIC(AT_CANARYLEN)
+#define AT_NCPUS SYMBOLIC(AT_NCPUS)
+#define AT_PAGESIZES SYMBOLIC(AT_PAGESIZES)
+#define AT_PAGESIZESLEN SYMBOLIC(AT_PAGESIZESLEN)
+#define AT_TIMEKEEP SYMBOLIC(AT_TIMEKEEP)
+#define AT_STACKPROT SYMBOLIC(AT_STACKPROT)
+#define AT_EHDRFLAGS SYMBOLIC(AT_EHDRFLAGS)
#endif /* COSMOPOLITAN_LIBC_CALLS_AUXV_H_ */
diff --git a/libc/sysv/consts/madv.h b/libc/sysv/consts/madv.h
index 1c828ad15..cb81cb926 100644
--- a/libc/sysv/consts/madv.h
+++ b/libc/sysv/consts/madv.h
@@ -2,42 +2,42 @@
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_MADV_H_
#include "libc/runtime/symbolic.h"
-#define MADV_DODUMP SYMBOLIC(MADV_DODUMP)
-#define MADV_DOFORK SYMBOLIC(MADV_DOFORK)
-#define MADV_DONTDUMP SYMBOLIC(MADV_DONTDUMP)
-#define MADV_DONTFORK SYMBOLIC(MADV_DONTFORK)
-#define MADV_DONTNEED SYMBOLIC(MADV_DONTNEED)
-#define MADV_FREE SYMBOLIC(MADV_FREE)
-#define MADV_HUGEPAGE SYMBOLIC(MADV_HUGEPAGE)
-#define MADV_HWPOISON SYMBOLIC(MADV_HWPOISON)
-#define MADV_MERGEABLE SYMBOLIC(MADV_MERGEABLE)
-#define MADV_NOHUGEPAGE SYMBOLIC(MADV_NOHUGEPAGE)
-#define MADV_NORMAL SYMBOLIC(MADV_NORMAL)
-#define MADV_RANDOM SYMBOLIC(MADV_RANDOM)
-#define MADV_REMOVE SYMBOLIC(MADV_REMOVE)
-#define MADV_SEQUENTIAL SYMBOLIC(MADV_SEQUENTIAL)
+#define MADV_DODUMP SYMBOLIC(MADV_DODUMP)
+#define MADV_DOFORK SYMBOLIC(MADV_DOFORK)
+#define MADV_DONTDUMP SYMBOLIC(MADV_DONTDUMP)
+#define MADV_DONTFORK SYMBOLIC(MADV_DONTFORK)
+#define MADV_DONTNEED SYMBOLIC(MADV_DONTNEED)
+#define MADV_FREE SYMBOLIC(MADV_FREE)
+#define MADV_HUGEPAGE SYMBOLIC(MADV_HUGEPAGE)
+#define MADV_HWPOISON SYMBOLIC(MADV_HWPOISON)
+#define MADV_MERGEABLE SYMBOLIC(MADV_MERGEABLE)
+#define MADV_NOHUGEPAGE SYMBOLIC(MADV_NOHUGEPAGE)
+#define MADV_NORMAL SYMBOLIC(MADV_NORMAL)
+#define MADV_RANDOM SYMBOLIC(MADV_RANDOM)
+#define MADV_REMOVE SYMBOLIC(MADV_REMOVE)
+#define MADV_SEQUENTIAL SYMBOLIC(MADV_SEQUENTIAL)
#define MADV_UNMERGEABLE SYMBOLIC(MADV_UNMERGEABLE)
-#define MADV_WILLNEED SYMBOLIC(MADV_WILLNEED)
+#define MADV_WILLNEED SYMBOLIC(MADV_WILLNEED)
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
-extern const long MADV_DODUMP;
-extern const long MADV_DOFORK;
-extern const long MADV_DONTDUMP;
-extern const long MADV_DONTFORK;
-extern const long MADV_DONTNEED;
-extern const long MADV_FREE;
-extern const long MADV_HUGEPAGE;
-extern const long MADV_HWPOISON;
-extern const long MADV_MERGEABLE;
-extern const long MADV_NOHUGEPAGE;
-extern const long MADV_NORMAL;
-extern const long MADV_RANDOM;
-extern const long MADV_REMOVE;
-extern const long MADV_SEQUENTIAL;
-extern const long MADV_UNMERGEABLE;
-extern const long MADV_WILLNEED;
+extern const unsigned MADV_DODUMP;
+extern const unsigned MADV_DOFORK;
+extern const unsigned MADV_DONTDUMP;
+extern const unsigned MADV_DONTFORK;
+extern const unsigned MADV_DONTNEED;
+extern const unsigned MADV_FREE;
+extern const unsigned MADV_HUGEPAGE;
+extern const unsigned MADV_HWPOISON;
+extern const unsigned MADV_MERGEABLE;
+extern const unsigned MADV_NOHUGEPAGE;
+extern const unsigned MADV_NORMAL;
+extern const unsigned MADV_RANDOM;
+extern const unsigned MADV_REMOVE;
+extern const unsigned MADV_SEQUENTIAL;
+extern const unsigned MADV_UNMERGEABLE;
+extern const unsigned MADV_WILLNEED;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
diff --git a/libc/sysv/consts/nr.h b/libc/sysv/consts/nr.h
index 810a90746..4828240be 100644
--- a/libc/sysv/consts/nr.h
+++ b/libc/sysv/consts/nr.h
@@ -1,778 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_NR_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_NR_H_
#include "libc/runtime/symbolic.h"
-
-#define __NR_exit SYMBOLIC(__NR_exit)
-#define __NR_exit_group SYMBOLIC(__NR_exit_group)
-#define __NR_read SYMBOLIC(__NR_read)
-#define __NR_write SYMBOLIC(__NR_write)
-#define __NR_open SYMBOLIC(__NR_open)
-#define __NR_close SYMBOLIC(__NR_close)
-#define __NR_stat SYMBOLIC(__NR_stat)
-#define __NR_fstat SYMBOLIC(__NR_fstat)
-#define __NR_lstat SYMBOLIC(__NR_lstat)
-#define __NR_poll SYMBOLIC(__NR_poll)
-#define __NR_ppoll SYMBOLIC(__NR_ppoll)
-#define __NR_lseek SYMBOLIC(__NR_lseek)
-#define __NR_mmap SYMBOLIC(__NR_mmap)
-#define __NR_msync SYMBOLIC(__NR_msync)
-#define __NR_mprotect SYMBOLIC(__NR_mprotect)
-#define __NR_munmap SYMBOLIC(__NR_munmap)
-#define __NR_sigaction SYMBOLIC(__NR_sigaction)
-#define __NR_sigprocmask SYMBOLIC(__NR_sigprocmask)
-#define __NR_ioctl SYMBOLIC(__NR_ioctl)
-#define __NR_pread SYMBOLIC(__NR_pread)
-#define __NR_pwrite SYMBOLIC(__NR_pwrite)
-#define __NR_readv SYMBOLIC(__NR_readv)
-#define __NR_writev SYMBOLIC(__NR_writev)
-#define __NR_access SYMBOLIC(__NR_access)
-#define __NR_pipe SYMBOLIC(__NR_pipe)
-#define __NR_select SYMBOLIC(__NR_select)
-#define __NR_pselect SYMBOLIC(__NR_pselect)
-#define __NR_pselect6 SYMBOLIC(__NR_pselect6)
-#define __NR_sched_yield SYMBOLIC(__NR_sched_yield)
-#define __NR_mremap SYMBOLIC(__NR_mremap)
-#define __NR_mincore SYMBOLIC(__NR_mincore)
-#define __NR_madvise SYMBOLIC(__NR_madvise)
-#define __NR_shmget SYMBOLIC(__NR_shmget)
-#define __NR_shmat SYMBOLIC(__NR_shmat)
-#define __NR_shmctl SYMBOLIC(__NR_shmctl)
-#define __NR_dup SYMBOLIC(__NR_dup)
-#define __NR_dup2 SYMBOLIC(__NR_dup2)
-#define __NR_pause SYMBOLIC(__NR_pause)
-#define __NR_nanosleep SYMBOLIC(__NR_nanosleep)
-#define __NR_getitimer SYMBOLIC(__NR_getitimer)
-#define __NR_setitimer SYMBOLIC(__NR_setitimer)
-#define __NR_alarm SYMBOLIC(__NR_alarm)
-#define __NR_getpid SYMBOLIC(__NR_getpid)
-#define __NR_sendfile SYMBOLIC(__NR_sendfile)
-#define __NR_socket SYMBOLIC(__NR_socket)
-#define __NR_connect SYMBOLIC(__NR_connect)
-#define __NR_accept SYMBOLIC(__NR_accept)
-#define __NR_sendto SYMBOLIC(__NR_sendto)
-#define __NR_recvfrom SYMBOLIC(__NR_recvfrom)
-#define __NR_sendmsg SYMBOLIC(__NR_sendmsg)
-#define __NR_recvmsg SYMBOLIC(__NR_recvmsg)
-#define __NR_shutdown SYMBOLIC(__NR_shutdown)
-#define __NR_bind SYMBOLIC(__NR_bind)
-#define __NR_listen SYMBOLIC(__NR_listen)
-#define __NR_getsockname SYMBOLIC(__NR_getsockname)
-#define __NR_getpeername SYMBOLIC(__NR_getpeername)
-#define __NR_socketpair SYMBOLIC(__NR_socketpair)
-#define __NR_setsockopt SYMBOLIC(__NR_setsockopt)
-#define __NR_getsockopt SYMBOLIC(__NR_getsockopt)
-#define __NR_fork SYMBOLIC(__NR_fork)
-#define __NR_vfork SYMBOLIC(__NR_vfork)
-#define __NR_posix_spawn SYMBOLIC(__NR_posix_spawn)
-#define __NR_execve SYMBOLIC(__NR_execve)
-#define __NR_wait4 SYMBOLIC(__NR_wait4)
-#define __NR_kill SYMBOLIC(__NR_kill)
-#define __NR_killpg SYMBOLIC(__NR_killpg)
-#define __NR_clone SYMBOLIC(__NR_clone)
-#define __NR_tkill SYMBOLIC(__NR_tkill)
-#define __NR_futex SYMBOLIC(__NR_futex)
-#define __NR_set_robust_list SYMBOLIC(__NR_set_robust_list)
-#define __NR_get_robust_list SYMBOLIC(__NR_get_robust_list)
-#define __NR_uname SYMBOLIC(__NR_uname)
-#define __NR_semget SYMBOLIC(__NR_semget)
-#define __NR_semop SYMBOLIC(__NR_semop)
-#define __NR_semctl SYMBOLIC(__NR_semctl)
-#define __NR_shmdt SYMBOLIC(__NR_shmdt)
-#define __NR_msgget SYMBOLIC(__NR_msgget)
-#define __NR_msgsnd SYMBOLIC(__NR_msgsnd)
-#define __NR_msgrcv SYMBOLIC(__NR_msgrcv)
-#define __NR_msgctl SYMBOLIC(__NR_msgctl)
-#define __NR_fcntl SYMBOLIC(__NR_fcntl)
-#define __NR_flock SYMBOLIC(__NR_flock)
-#define __NR_fsync SYMBOLIC(__NR_fsync)
-#define __NR_fdatasync SYMBOLIC(__NR_fdatasync)
-#define __NR_truncate SYMBOLIC(__NR_truncate)
-#define __NR_ftruncate SYMBOLIC(__NR_ftruncate)
-#define __NR_getcwd SYMBOLIC(__NR_getcwd)
-#define __NR_chdir SYMBOLIC(__NR_chdir)
-#define __NR_fchdir SYMBOLIC(__NR_fchdir)
-#define __NR_rename SYMBOLIC(__NR_rename)
-#define __NR_mkdir SYMBOLIC(__NR_mkdir)
-#define __NR_rmdir SYMBOLIC(__NR_rmdir)
-#define __NR_creat SYMBOLIC(__NR_creat)
-#define __NR_link SYMBOLIC(__NR_link)
-#define __NR_unlink SYMBOLIC(__NR_unlink)
-#define __NR_symlink SYMBOLIC(__NR_symlink)
-#define __NR_readlink SYMBOLIC(__NR_readlink)
-#define __NR_chmod SYMBOLIC(__NR_chmod)
-#define __NR_fchmod SYMBOLIC(__NR_fchmod)
-#define __NR_chown SYMBOLIC(__NR_chown)
-#define __NR_fchown SYMBOLIC(__NR_fchown)
-#define __NR_lchown SYMBOLIC(__NR_lchown)
-#define __NR_umask SYMBOLIC(__NR_umask)
-#define __NR_gettimeofday SYMBOLIC(__NR_gettimeofday)
-#define __NR_getrlimit SYMBOLIC(__NR_getrlimit)
-#define __NR_getrusage SYMBOLIC(__NR_getrusage)
-#define __NR_sysinfo SYMBOLIC(__NR_sysinfo)
-#define __NR_times SYMBOLIC(__NR_times)
-#define __NR_ptrace SYMBOLIC(__NR_ptrace)
-#define __NR_syslog SYMBOLIC(__NR_syslog)
-#define __NR_getuid SYMBOLIC(__NR_getuid)
-#define __NR_getgid SYMBOLIC(__NR_getgid)
-#define __NR_getppid SYMBOLIC(__NR_getppid)
-#define __NR_getpgrp SYMBOLIC(__NR_getpgrp)
-#define __NR_setsid SYMBOLIC(__NR_setsid)
-#define __NR_getsid SYMBOLIC(__NR_getsid)
-#define __NR_getpgid SYMBOLIC(__NR_getpgid)
-#define __NR_setpgid SYMBOLIC(__NR_setpgid)
-#define __NR_geteuid SYMBOLIC(__NR_geteuid)
-#define __NR_getegid SYMBOLIC(__NR_getegid)
-#define __NR_getgroups SYMBOLIC(__NR_getgroups)
-#define __NR_setgroups SYMBOLIC(__NR_setgroups)
-#define __NR_setreuid SYMBOLIC(__NR_setreuid)
-#define __NR_setregid SYMBOLIC(__NR_setregid)
-#define __NR_setuid SYMBOLIC(__NR_setuid)
-#define __NR_setgid SYMBOLIC(__NR_setgid)
-#define __NR_setresuid SYMBOLIC(__NR_setresuid)
-#define __NR_setresgid SYMBOLIC(__NR_setresgid)
-#define __NR_getresuid SYMBOLIC(__NR_getresuid)
-#define __NR_getresgid SYMBOLIC(__NR_getresgid)
-#define __NR_sigpending SYMBOLIC(__NR_sigpending)
-#define __NR_sigsuspend SYMBOLIC(__NR_sigsuspend)
-#define __NR_sigaltstack SYMBOLIC(__NR_sigaltstack)
-#define __NR_mknod SYMBOLIC(__NR_mknod)
-#define __NR_mknodat SYMBOLIC(__NR_mknodat)
-#define __NR_mkfifo SYMBOLIC(__NR_mkfifo)
-#define __NR_mkfifoat SYMBOLIC(__NR_mkfifoat)
-#define __NR_statfs SYMBOLIC(__NR_statfs)
-#define __NR_fstatfs SYMBOLIC(__NR_fstatfs)
-#define __NR_getpriority SYMBOLIC(__NR_getpriority)
-#define __NR_setpriority SYMBOLIC(__NR_setpriority)
-#define __NR_mlock SYMBOLIC(__NR_mlock)
-#define __NR_munlock SYMBOLIC(__NR_munlock)
-#define __NR_mlockall SYMBOLIC(__NR_mlockall)
-#define __NR_munlockall SYMBOLIC(__NR_munlockall)
-#define __NR_setrlimit SYMBOLIC(__NR_setrlimit)
-#define __NR_chroot SYMBOLIC(__NR_chroot)
-#define __NR_sync SYMBOLIC(__NR_sync)
-#define __NR_acct SYMBOLIC(__NR_acct)
-#define __NR_settimeofday SYMBOLIC(__NR_settimeofday)
-#define __NR_mount SYMBOLIC(__NR_mount)
-#define __NR_reboot SYMBOLIC(__NR_reboot)
-#define __NR_quotactl SYMBOLIC(__NR_quotactl)
-#define __NR_setfsuid SYMBOLIC(__NR_setfsuid)
-#define __NR_setfsgid SYMBOLIC(__NR_setfsgid)
-#define __NR_capget SYMBOLIC(__NR_capget)
-#define __NR_capset SYMBOLIC(__NR_capset)
-#define __NR_sigtimedwait SYMBOLIC(__NR_sigtimedwait)
-#define __NR_rt_sigqueueinfo SYMBOLIC(__NR_rt_sigqueueinfo)
-#define __NR_personality SYMBOLIC(__NR_personality)
-#define __NR_ustat SYMBOLIC(__NR_ustat)
-#define __NR_sysfs SYMBOLIC(__NR_sysfs)
-#define __NR_sched_setparam SYMBOLIC(__NR_sched_setparam)
-#define __NR_sched_getparam SYMBOLIC(__NR_sched_getparam)
-#define __NR_sched_setscheduler SYMBOLIC(__NR_sched_setscheduler)
-#define __NR_sched_getscheduler SYMBOLIC(__NR_sched_getscheduler)
-#define __NR_sched_get_priority_max SYMBOLIC(__NR_sched_get_priority_max)
-#define __NR_sched_get_priority_min SYMBOLIC(__NR_sched_get_priority_min)
-#define __NR_sched_rr_get_interval SYMBOLIC(__NR_sched_rr_get_interval)
-#define __NR_vhangup SYMBOLIC(__NR_vhangup)
-#define __NR_modify_ldt SYMBOLIC(__NR_modify_ldt)
-#define __NR_pivot_root SYMBOLIC(__NR_pivot_root)
-#define __NR__sysctl SYMBOLIC(__NR__sysctl)
-#define __NR_prctl SYMBOLIC(__NR_prctl)
-#define __NR_arch_prctl SYMBOLIC(__NR_arch_prctl)
-#define __NR_adjtimex SYMBOLIC(__NR_adjtimex)
-#define __NR_umount2 SYMBOLIC(__NR_umount2)
-#define __NR_swapon SYMBOLIC(__NR_swapon)
-#define __NR_swapoff SYMBOLIC(__NR_swapoff)
-#define __NR_sethostname SYMBOLIC(__NR_sethostname)
-#define __NR_setdomainname SYMBOLIC(__NR_setdomainname)
-#define __NR_iopl SYMBOLIC(__NR_iopl)
-#define __NR_ioperm SYMBOLIC(__NR_ioperm)
-#define __NR_init_module SYMBOLIC(__NR_init_module)
-#define __NR_delete_module SYMBOLIC(__NR_delete_module)
-#define __NR_gettid SYMBOLIC(__NR_gettid)
-#define __NR_readahead SYMBOLIC(__NR_readahead)
-#define __NR_setxattr SYMBOLIC(__NR_setxattr)
-#define __NR_fsetxattr SYMBOLIC(__NR_fsetxattr)
-#define __NR_getxattr SYMBOLIC(__NR_getxattr)
-#define __NR_fgetxattr SYMBOLIC(__NR_fgetxattr)
-#define __NR_listxattr SYMBOLIC(__NR_listxattr)
-#define __NR_flistxattr SYMBOLIC(__NR_flistxattr)
-#define __NR_removexattr SYMBOLIC(__NR_removexattr)
-#define __NR_fremovexattr SYMBOLIC(__NR_fremovexattr)
-#define __NR_lsetxattr SYMBOLIC(__NR_lsetxattr)
-#define __NR_lgetxattr SYMBOLIC(__NR_lgetxattr)
-#define __NR_llistxattr SYMBOLIC(__NR_llistxattr)
-#define __NR_lremovexattr SYMBOLIC(__NR_lremovexattr)
-#define __NR_sched_setaffinity SYMBOLIC(__NR_sched_setaffinity)
-#define __NR_sched_getaffinity SYMBOLIC(__NR_sched_getaffinity)
-#define __NR_cpuset_getaffinity SYMBOLIC(__NR_cpuset_getaffinity)
-#define __NR_cpuset_setaffinity SYMBOLIC(__NR_cpuset_setaffinity)
-#define __NR_io_setup SYMBOLIC(__NR_io_setup)
-#define __NR_io_destroy SYMBOLIC(__NR_io_destroy)
-#define __NR_io_getevents SYMBOLIC(__NR_io_getevents)
-#define __NR_io_submit SYMBOLIC(__NR_io_submit)
-#define __NR_io_cancel SYMBOLIC(__NR_io_cancel)
-#define __NR_lookup_dcookie SYMBOLIC(__NR_lookup_dcookie)
-#define __NR_epoll_create SYMBOLIC(__NR_epoll_create)
-#define __NR_epoll_wait SYMBOLIC(__NR_epoll_wait)
-#define __NR_epoll_ctl SYMBOLIC(__NR_epoll_ctl)
-#define __NR_getdents SYMBOLIC(__NR_getdents)
-#define __NR_set_tid_address SYMBOLIC(__NR_set_tid_address)
-#define __NR_restart_syscall SYMBOLIC(__NR_restart_syscall)
-#define __NR_semtimedop SYMBOLIC(__NR_semtimedop)
-#define __NR_fadvise SYMBOLIC(__NR_fadvise)
-#define __NR_timer_create SYMBOLIC(__NR_timer_create)
-#define __NR_timer_settime SYMBOLIC(__NR_timer_settime)
-#define __NR_timer_gettime SYMBOLIC(__NR_timer_gettime)
-#define __NR_timer_getoverrun SYMBOLIC(__NR_timer_getoverrun)
-#define __NR_timer_delete SYMBOLIC(__NR_timer_delete)
-#define __NR_clock_settime SYMBOLIC(__NR_clock_settime)
-#define __NR_clock_gettime SYMBOLIC(__NR_clock_gettime)
-#define __NR_clock_getres SYMBOLIC(__NR_clock_getres)
-#define __NR_clock_nanosleep SYMBOLIC(__NR_clock_nanosleep)
-#define __NR_tgkill SYMBOLIC(__NR_tgkill)
-#define __NR_mbind SYMBOLIC(__NR_mbind)
-#define __NR_set_mempolicy SYMBOLIC(__NR_set_mempolicy)
-#define __NR_get_mempolicy SYMBOLIC(__NR_get_mempolicy)
-#define __NR_mq_open SYMBOLIC(__NR_mq_open)
-#define __NR_mq_unlink SYMBOLIC(__NR_mq_unlink)
-#define __NR_mq_timedsend SYMBOLIC(__NR_mq_timedsend)
-#define __NR_mq_timedreceive SYMBOLIC(__NR_mq_timedreceive)
-#define __NR_mq_notify SYMBOLIC(__NR_mq_notify)
-#define __NR_mq_getsetattr SYMBOLIC(__NR_mq_getsetattr)
-#define __NR_kexec_load SYMBOLIC(__NR_kexec_load)
-#define __NR_waitid SYMBOLIC(__NR_waitid)
-#define __NR_add_key SYMBOLIC(__NR_add_key)
-#define __NR_request_key SYMBOLIC(__NR_request_key)
-#define __NR_keyctl SYMBOLIC(__NR_keyctl)
-#define __NR_ioprio_set SYMBOLIC(__NR_ioprio_set)
-#define __NR_ioprio_get SYMBOLIC(__NR_ioprio_get)
-#define __NR_inotify_init SYMBOLIC(__NR_inotify_init)
-#define __NR_inotify_add_watch SYMBOLIC(__NR_inotify_add_watch)
-#define __NR_inotify_rm_watch SYMBOLIC(__NR_inotify_rm_watch)
-#define __NR_openat SYMBOLIC(__NR_openat)
-#define __NR_mkdirat SYMBOLIC(__NR_mkdirat)
-#define __NR_fchownat SYMBOLIC(__NR_fchownat)
-#define __NR_utime SYMBOLIC(__NR_utime)
-#define __NR_utimes SYMBOLIC(__NR_utimes)
-#define __NR_futimesat SYMBOLIC(__NR_futimesat)
-#define __NR_futimes SYMBOLIC(__NR_futimes)
-#define __NR_futimens SYMBOLIC(__NR_futimens)
-#define __NR_fstatat SYMBOLIC(__NR_fstatat)
-#define __NR_unlinkat SYMBOLIC(__NR_unlinkat)
-#define __NR_renameat SYMBOLIC(__NR_renameat)
-#define __NR_linkat SYMBOLIC(__NR_linkat)
-#define __NR_symlinkat SYMBOLIC(__NR_symlinkat)
-#define __NR_readlinkat SYMBOLIC(__NR_readlinkat)
-#define __NR_fchmodat SYMBOLIC(__NR_fchmodat)
-#define __NR_faccessat SYMBOLIC(__NR_faccessat)
-#define __NR_unshare SYMBOLIC(__NR_unshare)
-#define __NR_splice SYMBOLIC(__NR_splice)
-#define __NR_tee SYMBOLIC(__NR_tee)
-#define __NR_sync_file_range SYMBOLIC(__NR_sync_file_range)
-#define __NR_vmsplice SYMBOLIC(__NR_vmsplice)
-#define __NR_migrate_pages SYMBOLIC(__NR_migrate_pages)
-#define __NR_move_pages SYMBOLIC(__NR_move_pages)
-#define __NR_preadv SYMBOLIC(__NR_preadv)
-#define __NR_pwritev SYMBOLIC(__NR_pwritev)
-#define __NR_utimensat SYMBOLIC(__NR_utimensat)
-#define __NR_fallocate SYMBOLIC(__NR_fallocate)
-#define __NR_posix_fallocate SYMBOLIC(__NR_posix_fallocate)
-#define __NR_accept4 SYMBOLIC(__NR_accept4)
-#define __NR_dup3 SYMBOLIC(__NR_dup3)
-#define __NR_pipe2 SYMBOLIC(__NR_pipe2)
-#define __NR_epoll_pwait SYMBOLIC(__NR_epoll_pwait)
-#define __NR_epoll_create1 SYMBOLIC(__NR_epoll_create1)
-#define __NR_perf_event_open SYMBOLIC(__NR_perf_event_open)
-#define __NR_inotify_init1 SYMBOLIC(__NR_inotify_init1)
-#define __NR_rt_tgsigqueueinfo SYMBOLIC(__NR_rt_tgsigqueueinfo)
-#define __NR_signalfd SYMBOLIC(__NR_signalfd)
-#define __NR_signalfd4 SYMBOLIC(__NR_signalfd4)
-#define __NR_eventfd SYMBOLIC(__NR_eventfd)
-#define __NR_eventfd2 SYMBOLIC(__NR_eventfd2)
-#define __NR_timerfd_create SYMBOLIC(__NR_timerfd_create)
-#define __NR_timerfd_settime SYMBOLIC(__NR_timerfd_settime)
-#define __NR_timerfd_gettime SYMBOLIC(__NR_timerfd_gettime)
-#define __NR_recvmmsg SYMBOLIC(__NR_recvmmsg)
-#define __NR_fanotify_init SYMBOLIC(__NR_fanotify_init)
-#define __NR_fanotify_mark SYMBOLIC(__NR_fanotify_mark)
-#define __NR_prlimit SYMBOLIC(__NR_prlimit)
-#define __NR_name_to_handle_at SYMBOLIC(__NR_name_to_handle_at)
-#define __NR_open_by_handle_at SYMBOLIC(__NR_open_by_handle_at)
-#define __NR_clock_adjtime SYMBOLIC(__NR_clock_adjtime)
-#define __NR_syncfs SYMBOLIC(__NR_syncfs)
-#define __NR_sendmmsg SYMBOLIC(__NR_sendmmsg)
-#define __NR_setns SYMBOLIC(__NR_setns)
-#define __NR_getcpu SYMBOLIC(__NR_getcpu)
-#define __NR_process_vm_readv SYMBOLIC(__NR_process_vm_readv)
-#define __NR_process_vm_writev SYMBOLIC(__NR_process_vm_writev)
-#define __NR_kcmp SYMBOLIC(__NR_kcmp)
-#define __NR_finit_module SYMBOLIC(__NR_finit_module)
-#define __NR_sched_setattr SYMBOLIC(__NR_sched_setattr)
-#define __NR_sched_getattr SYMBOLIC(__NR_sched_getattr)
-#define __NR_renameat2 SYMBOLIC(__NR_renameat2)
-#define __NR_seccomp SYMBOLIC(__NR_seccomp)
-#define __NR_getrandom SYMBOLIC(__NR_getrandom)
-#define __NR_memfd_create SYMBOLIC(__NR_memfd_create)
-#define __NR_kexec_file_load SYMBOLIC(__NR_kexec_file_load)
-#define __NR_bpf SYMBOLIC(__NR_bpf)
-#define __NR_execveat SYMBOLIC(__NR_execveat)
-#define __NR_userfaultfd SYMBOLIC(__NR_userfaultfd)
-#define __NR_membarrier SYMBOLIC(__NR_membarrier)
-#define __NR_mlock2 SYMBOLIC(__NR_mlock2)
-#define __NR_copy_file_range SYMBOLIC(__NR_copy_file_range)
-#define __NR_preadv2 SYMBOLIC(__NR_preadv2)
-#define __NR_pwritev2 SYMBOLIC(__NR_pwritev2)
-#define __NR_pkey_mprotect SYMBOLIC(__NR_pkey_mprotect)
-#define __NR_pkey_alloc SYMBOLIC(__NR_pkey_alloc)
-#define __NR_pkey_free SYMBOLIC(__NR_pkey_free)
-#define __NR_statx SYMBOLIC(__NR_statx)
-#define __NR_io_pgetevents SYMBOLIC(__NR_io_pgetevents)
-#define __NR_rseq SYMBOLIC(__NR_rseq)
-#define __NR_pidfd_send_signal SYMBOLIC(__NR_pidfd_send_signal)
-#define __NR_io_uring_setup SYMBOLIC(__NR_io_uring_setup)
-#define __NR_io_uring_enter SYMBOLIC(__NR_io_uring_enter)
-#define __NR_io_uring_register SYMBOLIC(__NR_io_uring_register)
-#define __NR_pledge SYMBOLIC(__NR_pledge)
-#define __NR_msyscall SYMBOLIC(__NR_msyscall)
-#define __NR_ktrace SYMBOLIC(__NR_ktrace)
-#define __NR_kqueue SYMBOLIC(__NR_kqueue)
-#define __NR_kevent SYMBOLIC(__NR_kevent)
-#define __NR_revoke SYMBOLIC(__NR_revoke)
-#define __NR_setlogin SYMBOLIC(__NR_setlogin)
-#define __NR_getfh SYMBOLIC(__NR_getfh)
-#define __NR_chflags SYMBOLIC(__NR_chflags)
-#define __NR_getfsstat SYMBOLIC(__NR_getfsstat)
-#define __NR_nfssvc SYMBOLIC(__NR_nfssvc)
-#define __NR_adjtime SYMBOLIC(__NR_adjtime)
-#define __NR_fchflags SYMBOLIC(__NR_fchflags)
-#define __NR_seteuid SYMBOLIC(__NR_seteuid)
-#define __NR_setegid SYMBOLIC(__NR_setegid)
-#define __NR_fpathconf SYMBOLIC(__NR_fpathconf)
-#define __NR_fhopen SYMBOLIC(__NR_fhopen)
-#define __NR_unmount SYMBOLIC(__NR_unmount)
-#define __NR_issetugid SYMBOLIC(__NR_issetugid)
-#define __NR_minherit SYMBOLIC(__NR_minherit)
-#define __NR_pathconf SYMBOLIC(__NR_pathconf)
-#define __NR_sysctl SYMBOLIC(__NR_sysctl)
-#define __NR_ntp_adjtime SYMBOLIC(__NR_ntp_adjtime)
-#define __NR_ntp_gettime SYMBOLIC(__NR_ntp_gettime)
-#define __NR_shm_unlink SYMBOLIC(__NR_shm_unlink)
-#define __NR_shm_open SYMBOLIC(__NR_shm_open)
-#define __NR_aio_read SYMBOLIC(__NR_aio_read)
-#define __NR_aio_suspend SYMBOLIC(__NR_aio_suspend)
-#define __NR_aio_cancel SYMBOLIC(__NR_aio_cancel)
-#define __NR_aio_fsync SYMBOLIC(__NR_aio_fsync)
-#define __NR_aio_error SYMBOLIC(__NR_aio_error)
-#define __NR_aio_return SYMBOLIC(__NR_aio_return)
-#define __NR_aio_write SYMBOLIC(__NR_aio_write)
-#define __NR_aio_waitcomplete SYMBOLIC(__NR_aio_waitcomplete)
-#define __NR_aio_suspend_nocancel SYMBOLIC(__NR_aio_suspend_nocancel)
-#define __NR_aio_mlock SYMBOLIC(__NR_aio_mlock)
-#define __NR_sigwait SYMBOLIC(__NR_sigwait)
-#define __NR_undelete SYMBOLIC(__NR_undelete)
-#define __NR_getlogin SYMBOLIC(__NR_getlogin)
-#define __NR_getdtablesize SYMBOLIC(__NR_getdtablesize)
-#define __NR_setauid SYMBOLIC(__NR_setauid)
-#define __NR_audit SYMBOLIC(__NR_audit)
-#define __NR_auditctl SYMBOLIC(__NR_auditctl)
-#define __NR_getaudit_addr SYMBOLIC(__NR_getaudit_addr)
-#define __NR_getdirentries SYMBOLIC(__NR_getdirentries)
-#define __NR_lio_listio SYMBOLIC(__NR_lio_listio)
-#define __NR_setaudit_addr SYMBOLIC(__NR_setaudit_addr)
-#define __NR_getauid SYMBOLIC(__NR_getauid)
-#define __NR_semsys SYMBOLIC(__NR_semsys)
-#define __NR_auditon SYMBOLIC(__NR_auditon)
-#define __NR_msgsys SYMBOLIC(__NR_msgsys)
-#define __NR_shmsys SYMBOLIC(__NR_shmsys)
-#define __NR_fhstat SYMBOLIC(__NR_fhstat)
-#define __NR_chflagsat SYMBOLIC(__NR_chflagsat)
-#define __NR_profil SYMBOLIC(__NR_profil)
-#define __NR_fhstatfs SYMBOLIC(__NR_fhstatfs)
-#define __NR_utrace SYMBOLIC(__NR_utrace)
-#define __NR_closefrom SYMBOLIC(__NR_closefrom)
-#define __NR_pthread_markcancel SYMBOLIC(__NR_pthread_markcancel)
-#define __NR_pthread_kill SYMBOLIC(__NR_pthread_kill)
-#define __NR_pthread_fchdir SYMBOLIC(__NR_pthread_fchdir)
-#define __NR_pthread_sigmask SYMBOLIC(__NR_pthread_sigmask)
-#define __NR_pthread_chdir SYMBOLIC(__NR_pthread_chdir)
-#define __NR_pthread_canceled SYMBOLIC(__NR_pthread_canceled)
-#define __NR_disable_threadsignal SYMBOLIC(__NR_disable_threadsignal)
-#define __NR_abort_with_payload SYMBOLIC(__NR_abort_with_payload)
-#define __NR_accept_nocancel SYMBOLIC(__NR_accept_nocancel)
-#define __NR_access_extended SYMBOLIC(__NR_access_extended)
-#define __NR_audit_session_join SYMBOLIC(__NR_audit_session_join)
-#define __NR_audit_session_port SYMBOLIC(__NR_audit_session_port)
-#define __NR_audit_session_self SYMBOLIC(__NR_audit_session_self)
-#define __NR_bsdthread_create SYMBOLIC(__NR_bsdthread_create)
-#define __NR_bsdthread_ctl SYMBOLIC(__NR_bsdthread_ctl)
-#define __NR_bsdthread_register SYMBOLIC(__NR_bsdthread_register)
-#define __NR_bsdthread_terminate SYMBOLIC(__NR_bsdthread_terminate)
-#define __NR_change_fdguard_np SYMBOLIC(__NR_change_fdguard_np)
-#define __NR_chmod_extended SYMBOLIC(__NR_chmod_extended)
-#define __NR_clonefileat SYMBOLIC(__NR_clonefileat)
-#define __NR_close_nocancel SYMBOLIC(__NR_close_nocancel)
-#define __NR_coalition SYMBOLIC(__NR_coalition)
-#define __NR_coalition_info SYMBOLIC(__NR_coalition_info)
-#define __NR_connect_nocancel SYMBOLIC(__NR_connect_nocancel)
-#define __NR_connectx SYMBOLIC(__NR_connectx)
-#define __NR_copyfile SYMBOLIC(__NR_copyfile)
-#define __NR_csops SYMBOLIC(__NR_csops)
-#define __NR_csops_audittoken SYMBOLIC(__NR_csops_audittoken)
-#define __NR_csrctl SYMBOLIC(__NR_csrctl)
-#define __NR_delete SYMBOLIC(__NR_delete)
-#define __NR_disconnectx SYMBOLIC(__NR_disconnectx)
-#define __NR_exchangedata SYMBOLIC(__NR_exchangedata)
-#define __NR_fchmod_extended SYMBOLIC(__NR_fchmod_extended)
-#define __NR_fclonefileat SYMBOLIC(__NR_fclonefileat)
-#define __NR_fcntl_nocancel SYMBOLIC(__NR_fcntl_nocancel)
-#define __NR_ffsctl SYMBOLIC(__NR_ffsctl)
-#define __NR_fgetattrlist SYMBOLIC(__NR_fgetattrlist)
-#define __NR_fileport_makefd SYMBOLIC(__NR_fileport_makefd)
-#define __NR_fileport_makeport SYMBOLIC(__NR_fileport_makeport)
-#define __NR_fmount SYMBOLIC(__NR_fmount)
-#define __NR_fs_snapshot SYMBOLIC(__NR_fs_snapshot)
-#define __NR_fsctl SYMBOLIC(__NR_fsctl)
-#define __NR_fsetattrlist SYMBOLIC(__NR_fsetattrlist)
-#define __NR_fstat_extended SYMBOLIC(__NR_fstat_extended)
-#define __NR_fsync_nocancel SYMBOLIC(__NR_fsync_nocancel)
-#define __NR_getattrlist SYMBOLIC(__NR_getattrlist)
-#define __NR_getattrlistat SYMBOLIC(__NR_getattrlistat)
-#define __NR_getattrlistbulk SYMBOLIC(__NR_getattrlistbulk)
-#define __NR_getdirentriesattr SYMBOLIC(__NR_getdirentriesattr)
-#define __NR_gethostuuid SYMBOLIC(__NR_gethostuuid)
-#define __NR_getsgroups SYMBOLIC(__NR_getsgroups)
-#define __NR_getwgroups SYMBOLIC(__NR_getwgroups)
-#define __NR_grab_pgo_data SYMBOLIC(__NR_grab_pgo_data)
-#define __NR_guarded_close_np SYMBOLIC(__NR_guarded_close_np)
-#define __NR_guarded_kqueue_np SYMBOLIC(__NR_guarded_kqueue_np)
-#define __NR_guarded_open_np SYMBOLIC(__NR_guarded_open_np)
-#define __NR_guarded_pwrite_np SYMBOLIC(__NR_guarded_pwrite_np)
-#define __NR_guarded_write_np SYMBOLIC(__NR_guarded_write_np)
-#define __NR_guarded_writev_np SYMBOLIC(__NR_guarded_writev_np)
-#define __NR_identitysvc SYMBOLIC(__NR_identitysvc)
-#define __NR_initgroups SYMBOLIC(__NR_initgroups)
-#define __NR_iopolicysys SYMBOLIC(__NR_iopolicysys)
-#define __NR_kas_info SYMBOLIC(__NR_kas_info)
-#define __NR_kdebug_trace SYMBOLIC(__NR_kdebug_trace)
-#define __NR_kdebug_trace_string SYMBOLIC(__NR_kdebug_trace_string)
-#define __NR_kdebug_typefilter SYMBOLIC(__NR_kdebug_typefilter)
-#define __NR_kevent_id SYMBOLIC(__NR_kevent_id)
-#define __NR_kevent_qos SYMBOLIC(__NR_kevent_qos)
-#define __NR_ledger SYMBOLIC(__NR_ledger)
-#define __NR_lstat_extended SYMBOLIC(__NR_lstat_extended)
-#define __NR_memorystatus_control SYMBOLIC(__NR_memorystatus_control)
-#define __NR_memorystatus_get_level SYMBOLIC(__NR_memorystatus_get_level)
-#define __NR_microstackshot SYMBOLIC(__NR_microstackshot)
-#define __NR_mkdir_extended SYMBOLIC(__NR_mkdir_extended)
-#define __NR_mkfifo_extended SYMBOLIC(__NR_mkfifo_extended)
-#define __NR_modwatch SYMBOLIC(__NR_modwatch)
-#define __NR_mremap_encrypted SYMBOLIC(__NR_mremap_encrypted)
-#define __NR_msgrcv_nocancel SYMBOLIC(__NR_msgrcv_nocancel)
-#define __NR_msgsnd_nocancel SYMBOLIC(__NR_msgsnd_nocancel)
-#define __NR_msync_nocancel SYMBOLIC(__NR_msync_nocancel)
-#define __NR_necp_client_action SYMBOLIC(__NR_necp_client_action)
-#define __NR_necp_match_policy SYMBOLIC(__NR_necp_match_policy)
-#define __NR_necp_open SYMBOLIC(__NR_necp_open)
-#define __NR_necp_session_action SYMBOLIC(__NR_necp_session_action)
-#define __NR_necp_session_open SYMBOLIC(__NR_necp_session_open)
-#define __NR_net_qos_guideline SYMBOLIC(__NR_net_qos_guideline)
-#define __NR_netagent_trigger SYMBOLIC(__NR_netagent_trigger)
-#define __NR_nfsclnt SYMBOLIC(__NR_nfsclnt)
-#define __NR_open_dprotected_np SYMBOLIC(__NR_open_dprotected_np)
-#define __NR_open_extended SYMBOLIC(__NR_open_extended)
-#define __NR_open_nocancel SYMBOLIC(__NR_open_nocancel)
-#define __NR_openat_nocancel SYMBOLIC(__NR_openat_nocancel)
-#define __NR_openbyid_np SYMBOLIC(__NR_openbyid_np)
-#define __NR_os_fault_with_payload SYMBOLIC(__NR_os_fault_with_payload)
-#define __NR_peeloff SYMBOLIC(__NR_peeloff)
-#define __NR_persona SYMBOLIC(__NR_persona)
-#define __NR_pid_hibernate SYMBOLIC(__NR_pid_hibernate)
-#define __NR_pid_resume SYMBOLIC(__NR_pid_resume)
-#define __NR_pid_shutdown_sockets SYMBOLIC(__NR_pid_shutdown_sockets)
-#define __NR_pid_suspend SYMBOLIC(__NR_pid_suspend)
-#define __NR_poll_nocancel SYMBOLIC(__NR_poll_nocancel)
-#define __NR_pread_nocancel SYMBOLIC(__NR_pread_nocancel)
-#define __NR_proc_info SYMBOLIC(__NR_proc_info)
-#define __NR_proc_rlimit_control SYMBOLIC(__NR_proc_rlimit_control)
-#define __NR_proc_trace_log SYMBOLIC(__NR_proc_trace_log)
-#define __NR_proc_uuid_policy SYMBOLIC(__NR_proc_uuid_policy)
-#define __NR_process_policy SYMBOLIC(__NR_process_policy)
-#define __NR_pselect_nocancel SYMBOLIC(__NR_pselect_nocancel)
-#define __NR_psynch_cvbroad SYMBOLIC(__NR_psynch_cvbroad)
-#define __NR_psynch_cvclrprepost SYMBOLIC(__NR_psynch_cvclrprepost)
-#define __NR_psynch_cvsignal SYMBOLIC(__NR_psynch_cvsignal)
-#define __NR_psynch_mutexdrop SYMBOLIC(__NR_psynch_mutexdrop)
-#define __NR_psynch_mutexwait SYMBOLIC(__NR_psynch_mutexwait)
-#define __NR_psynch_rw_downgrade SYMBOLIC(__NR_psynch_rw_downgrade)
-#define __NR_psynch_rw_longrdlock SYMBOLIC(__NR_psynch_rw_longrdlock)
-#define __NR_psynch_rw_rdlock SYMBOLIC(__NR_psynch_rw_rdlock)
-#define __NR_psynch_rw_unlock SYMBOLIC(__NR_psynch_rw_unlock)
-#define __NR_psynch_rw_unlock2 SYMBOLIC(__NR_psynch_rw_unlock2)
-#define __NR_psynch_rw_upgrade SYMBOLIC(__NR_psynch_rw_upgrade)
-#define __NR_psynch_rw_wrlock SYMBOLIC(__NR_psynch_rw_wrlock)
-#define __NR_psynch_rw_yieldwrlock SYMBOLIC(__NR_psynch_rw_yieldwrlock)
-#define __NR_pwrite_nocancel SYMBOLIC(__NR_pwrite_nocancel)
-#define __NR_read_nocancel SYMBOLIC(__NR_read_nocancel)
-#define __NR_readv_nocancel SYMBOLIC(__NR_readv_nocancel)
-#define __NR_recvfrom_nocancel SYMBOLIC(__NR_recvfrom_nocancel)
-#define __NR_recvmsg_nocancel SYMBOLIC(__NR_recvmsg_nocancel)
-#define __NR_recvmsg_x SYMBOLIC(__NR_recvmsg_x)
-#define __NR_renameatx_np SYMBOLIC(__NR_renameatx_np)
-#define __NR_searchfs SYMBOLIC(__NR_searchfs)
-#define __NR_select_nocancel SYMBOLIC(__NR_select_nocancel)
-#define __NR_sem_close SYMBOLIC(__NR_sem_close)
-#define __NR_sem_open SYMBOLIC(__NR_sem_open)
-#define __NR_sem_post SYMBOLIC(__NR_sem_post)
-#define __NR_sem_trywait SYMBOLIC(__NR_sem_trywait)
-#define __NR_sem_unlink SYMBOLIC(__NR_sem_unlink)
-#define __NR_sem_wait SYMBOLIC(__NR_sem_wait)
-#define __NR_sem_wait_nocancel SYMBOLIC(__NR_sem_wait_nocancel)
-#define __NR_sendmsg_nocancel SYMBOLIC(__NR_sendmsg_nocancel)
-#define __NR_sendmsg_x SYMBOLIC(__NR_sendmsg_x)
-#define __NR_sendto_nocancel SYMBOLIC(__NR_sendto_nocancel)
-#define __NR_setattrlist SYMBOLIC(__NR_setattrlist)
-#define __NR_setattrlistat SYMBOLIC(__NR_setattrlistat)
-#define __NR_setprivexec SYMBOLIC(__NR_setprivexec)
-#define __NR_setsgroups SYMBOLIC(__NR_setsgroups)
-#define __NR_settid SYMBOLIC(__NR_settid)
-#define __NR_settid_with_pid SYMBOLIC(__NR_settid_with_pid)
-#define __NR_setwgroups SYMBOLIC(__NR_setwgroups)
-#define __NR_sfi_ctl SYMBOLIC(__NR_sfi_ctl)
-#define __NR_sfi_pidctl SYMBOLIC(__NR_sfi_pidctl)
-#define __NR_shared_region_check_np SYMBOLIC(__NR_shared_region_check_np)
-#define __NR_sigsuspend_nocancel SYMBOLIC(__NR_sigsuspend_nocancel)
-#define __NR_socket_delegate SYMBOLIC(__NR_socket_delegate)
-#define __NR_stat_extended SYMBOLIC(__NR_stat_extended)
-#define __NR_sysctlbyname SYMBOLIC(__NR_sysctlbyname)
-#define __NR_system_override SYMBOLIC(__NR_system_override)
-#define __NR_telemetry SYMBOLIC(__NR_telemetry)
-#define __NR_terminate_with_payload SYMBOLIC(__NR_terminate_with_payload)
-#define __NR_thread_selfcounts SYMBOLIC(__NR_thread_selfcounts)
-#define __NR_thread_selfid SYMBOLIC(__NR_thread_selfid)
-#define __NR_thread_selfusage SYMBOLIC(__NR_thread_selfusage)
-#define __NR_ulock_wait SYMBOLIC(__NR_ulock_wait)
-#define __NR_ulock_wake SYMBOLIC(__NR_ulock_wake)
-#define __NR_umask_extended SYMBOLIC(__NR_umask_extended)
-#define __NR_usrctl SYMBOLIC(__NR_usrctl)
-#define __NR_vfs_purge SYMBOLIC(__NR_vfs_purge)
-#define __NR_vm_pressure_monitor SYMBOLIC(__NR_vm_pressure_monitor)
-#define __NR_wait4_nocancel SYMBOLIC(__NR_wait4_nocancel)
-#define __NR_waitevent SYMBOLIC(__NR_waitevent)
-#define __NR_waitid_nocancel SYMBOLIC(__NR_waitid_nocancel)
-#define __NR_watchevent SYMBOLIC(__NR_watchevent)
-#define __NR_work_interval_ctl SYMBOLIC(__NR_work_interval_ctl)
-#define __NR_workq_kernreturn SYMBOLIC(__NR_workq_kernreturn)
-#define __NR_workq_open SYMBOLIC(__NR_workq_open)
-#define __NR_write_nocancel SYMBOLIC(__NR_write_nocancel)
-#define __NR_writev_nocancel SYMBOLIC(__NR_writev_nocancel)
-#define __NR_abort2 SYMBOLIC(__NR_abort2)
-#define __NR_afs3_syscall SYMBOLIC(__NR_afs3_syscall)
-#define __NR_bindat SYMBOLIC(__NR_bindat)
-#define __NR_break SYMBOLIC(__NR_break)
-#define __NR_cap_enter SYMBOLIC(__NR_cap_enter)
-#define __NR_cap_fcntls_get SYMBOLIC(__NR_cap_fcntls_get)
-#define __NR_cap_fcntls_limit SYMBOLIC(__NR_cap_fcntls_limit)
-#define __NR_cap_getmode SYMBOLIC(__NR_cap_getmode)
-#define __NR_cap_ioctls_get SYMBOLIC(__NR_cap_ioctls_get)
-#define __NR_cap_ioctls_limit SYMBOLIC(__NR_cap_ioctls_limit)
-#define __NR_cap_rights_limit SYMBOLIC(__NR_cap_rights_limit)
-#define __NR_clock_getcpuclockid2 SYMBOLIC(__NR_clock_getcpuclockid2)
-#define __NR_connectat SYMBOLIC(__NR_connectat)
-#define __NR_cpuset SYMBOLIC(__NR_cpuset)
-#define __NR_cpuset_getdomain SYMBOLIC(__NR_cpuset_getdomain)
-#define __NR_cpuset_getid SYMBOLIC(__NR_cpuset_getid)
-#define __NR_cpuset_setdomain SYMBOLIC(__NR_cpuset_setdomain)
-#define __NR_cpuset_setid SYMBOLIC(__NR_cpuset_setid)
-#define __NR_eaccess SYMBOLIC(__NR_eaccess)
-#define __NR_extattr_delete_fd SYMBOLIC(__NR_extattr_delete_fd)
-#define __NR_extattr_delete_file SYMBOLIC(__NR_extattr_delete_file)
-#define __NR_extattr_delete_link SYMBOLIC(__NR_extattr_delete_link)
-#define __NR_extattr_get_fd SYMBOLIC(__NR_extattr_get_fd)
-#define __NR_extattr_get_file SYMBOLIC(__NR_extattr_get_file)
-#define __NR_extattr_get_link SYMBOLIC(__NR_extattr_get_link)
-#define __NR_extattr_list_fd SYMBOLIC(__NR_extattr_list_fd)
-#define __NR_extattr_list_file SYMBOLIC(__NR_extattr_list_file)
-#define __NR_extattr_list_link SYMBOLIC(__NR_extattr_list_link)
-#define __NR_extattr_set_fd SYMBOLIC(__NR_extattr_set_fd)
-#define __NR_extattr_set_file SYMBOLIC(__NR_extattr_set_file)
-#define __NR_extattr_set_link SYMBOLIC(__NR_extattr_set_link)
-#define __NR_extattrctl SYMBOLIC(__NR_extattrctl)
-#define __NR_fexecve SYMBOLIC(__NR_fexecve)
-#define __NR_ffclock_getcounter SYMBOLIC(__NR_ffclock_getcounter)
-#define __NR_ffclock_getestimate SYMBOLIC(__NR_ffclock_getestimate)
-#define __NR_ffclock_setestimate SYMBOLIC(__NR_ffclock_setestimate)
-#define __NR_fhlink SYMBOLIC(__NR_fhlink)
-#define __NR_fhlinkat SYMBOLIC(__NR_fhlinkat)
-#define __NR_fhreadlink SYMBOLIC(__NR_fhreadlink)
-#define __NR_getaudit SYMBOLIC(__NR_getaudit)
-#define __NR_getcontext SYMBOLIC(__NR_getcontext)
-#define __NR_getfhat SYMBOLIC(__NR_getfhat)
-#define __NR_gethostid SYMBOLIC(__NR_gethostid)
-#define __NR_getkerninfo SYMBOLIC(__NR_getkerninfo)
-#define __NR_getloginclass SYMBOLIC(__NR_getloginclass)
-#define __NR_getpagesize SYMBOLIC(__NR_getpagesize)
-#define __NR_gssd_syscall SYMBOLIC(__NR_gssd_syscall)
-#define __NR_jail SYMBOLIC(__NR_jail)
-#define __NR_jail_attach SYMBOLIC(__NR_jail_attach)
-#define __NR_jail_get SYMBOLIC(__NR_jail_get)
-#define __NR_jail_remove SYMBOLIC(__NR_jail_remove)
-#define __NR_jail_set SYMBOLIC(__NR_jail_set)
-#define __NR_kenv SYMBOLIC(__NR_kenv)
-#define __NR_kldfind SYMBOLIC(__NR_kldfind)
-#define __NR_kldfirstmod SYMBOLIC(__NR_kldfirstmod)
-#define __NR_kldload SYMBOLIC(__NR_kldload)
-#define __NR_kldnext SYMBOLIC(__NR_kldnext)
-#define __NR_kldstat SYMBOLIC(__NR_kldstat)
-#define __NR_kldsym SYMBOLIC(__NR_kldsym)
-#define __NR_kldunload SYMBOLIC(__NR_kldunload)
-#define __NR_kldunloadf SYMBOLIC(__NR_kldunloadf)
-#define __NR_kmq_notify SYMBOLIC(__NR_kmq_notify)
-#define __NR_kmq_setattr SYMBOLIC(__NR_kmq_setattr)
-#define __NR_kmq_timedreceive SYMBOLIC(__NR_kmq_timedreceive)
-#define __NR_kmq_timedsend SYMBOLIC(__NR_kmq_timedsend)
-#define __NR_kmq_unlink SYMBOLIC(__NR_kmq_unlink)
-#define __NR_ksem_close SYMBOLIC(__NR_ksem_close)
-#define __NR_ksem_destroy SYMBOLIC(__NR_ksem_destroy)
-#define __NR_ksem_getvalue SYMBOLIC(__NR_ksem_getvalue)
-#define __NR_ksem_init SYMBOLIC(__NR_ksem_init)
-#define __NR_ksem_open SYMBOLIC(__NR_ksem_open)
-#define __NR_ksem_post SYMBOLIC(__NR_ksem_post)
-#define __NR_ksem_timedwait SYMBOLIC(__NR_ksem_timedwait)
-#define __NR_ksem_trywait SYMBOLIC(__NR_ksem_trywait)
-#define __NR_ksem_unlink SYMBOLIC(__NR_ksem_unlink)
-#define __NR_ksem_wait SYMBOLIC(__NR_ksem_wait)
-#define __NR_ktimer_create SYMBOLIC(__NR_ktimer_create)
-#define __NR_ktimer_delete SYMBOLIC(__NR_ktimer_delete)
-#define __NR_ktimer_getoverrun SYMBOLIC(__NR_ktimer_getoverrun)
-#define __NR_ktimer_gettime SYMBOLIC(__NR_ktimer_gettime)
-#define __NR_ktimer_settime SYMBOLIC(__NR_ktimer_settime)
-#define __NR_lchflags SYMBOLIC(__NR_lchflags)
-#define __NR_lchmod SYMBOLIC(__NR_lchmod)
-#define __NR_lgetfh SYMBOLIC(__NR_lgetfh)
-#define __NR_lpathconf SYMBOLIC(__NR_lpathconf)
-#define __NR_lutimes SYMBOLIC(__NR_lutimes)
-#define __NR_mac_syscall SYMBOLIC(__NR_mac_syscall)
-#define __NR_modfind SYMBOLIC(__NR_modfind)
-#define __NR_modfnext SYMBOLIC(__NR_modfnext)
-#define __NR_modnext SYMBOLIC(__NR_modnext)
-#define __NR_modstat SYMBOLIC(__NR_modstat)
-#define __NR_nfstat SYMBOLIC(__NR_nfstat)
-#define __NR_nlm_syscall SYMBOLIC(__NR_nlm_syscall)
-#define __NR_nlstat SYMBOLIC(__NR_nlstat)
-#define __NR_nmount SYMBOLIC(__NR_nmount)
-#define __NR_nnpfs_syscall SYMBOLIC(__NR_nnpfs_syscall)
-#define __NR_nstat SYMBOLIC(__NR_nstat)
-#define __NR_pdfork SYMBOLIC(__NR_pdfork)
-#define __NR_pdgetpid SYMBOLIC(__NR_pdgetpid)
-#define __NR_pdkill SYMBOLIC(__NR_pdkill)
-#define __NR_posix_openpt SYMBOLIC(__NR_posix_openpt)
-#define __NR_procctl SYMBOLIC(__NR_procctl)
-#define __NR_psynch_cvwait SYMBOLIC(__NR_psynch_cvwait)
-#define __NR_quota SYMBOLIC(__NR_quota)
-#define __NR_rctl_add_rule SYMBOLIC(__NR_rctl_add_rule)
-#define __NR_rctl_get_limits SYMBOLIC(__NR_rctl_get_limits)
-#define __NR_rctl_get_racct SYMBOLIC(__NR_rctl_get_racct)
-#define __NR_rctl_get_rules SYMBOLIC(__NR_rctl_get_rules)
-#define __NR_rctl_remove_rule SYMBOLIC(__NR_rctl_remove_rule)
-#define __NR_recv SYMBOLIC(__NR_recv)
-#define __NR_rfork SYMBOLIC(__NR_rfork)
-#define __NR_rtprio SYMBOLIC(__NR_rtprio)
-#define __NR_rtprio_thread SYMBOLIC(__NR_rtprio_thread)
-#define __NR_send SYMBOLIC(__NR_send)
-#define __NR_setaudit SYMBOLIC(__NR_setaudit)
-#define __NR_setcontext SYMBOLIC(__NR_setcontext)
-#define __NR_setfib SYMBOLIC(__NR_setfib)
-#define __NR_sethostid SYMBOLIC(__NR_sethostid)
-#define __NR_setloginclass SYMBOLIC(__NR_setloginclass)
-#define __NR_sigblock SYMBOLIC(__NR_sigblock)
-#define __NR_sigqueue SYMBOLIC(__NR_sigqueue)
-#define __NR_sigsetmask SYMBOLIC(__NR_sigsetmask)
-#define __NR_sigstack SYMBOLIC(__NR_sigstack)
-#define __NR_sigvec SYMBOLIC(__NR_sigvec)
-#define __NR_sigwaitinfo SYMBOLIC(__NR_sigwaitinfo)
-#define __NR_sstk SYMBOLIC(__NR_sstk)
-#define __NR_swapcontext SYMBOLIC(__NR_swapcontext)
-#define __NR_thr_create SYMBOLIC(__NR_thr_create)
-#define __NR_thr_exit SYMBOLIC(__NR_thr_exit)
-#define __NR_thr_kill SYMBOLIC(__NR_thr_kill)
-#define __NR_thr_kill2 SYMBOLIC(__NR_thr_kill2)
-#define __NR_thr_new SYMBOLIC(__NR_thr_new)
-#define __NR_thr_self SYMBOLIC(__NR_thr_self)
-#define __NR_thr_set_name SYMBOLIC(__NR_thr_set_name)
-#define __NR_thr_suspend SYMBOLIC(__NR_thr_suspend)
-#define __NR_thr_wake SYMBOLIC(__NR_thr_wake)
-#define __NR_uuidgen SYMBOLIC(__NR_uuidgen)
-#define __NR_vadvise SYMBOLIC(__NR_vadvise)
-#define __NR_wait SYMBOLIC(__NR_wait)
-#define __NR_wait6 SYMBOLIC(__NR_wait6)
-#define __NR_yield SYMBOLIC(__NR_yield)
-#define __NR_tfork SYMBOLIC(__NR_tfork)
-#define __NR_thrsleep SYMBOLIC(__NR_thrsleep)
-#define __NR_thrwakeup SYMBOLIC(__NR_thrwakeup)
-#define __NR_threxit SYMBOLIC(__NR_threxit)
-#define __NR_thrsigdivert SYMBOLIC(__NR_thrsigdivert)
-#define __NR_set_tcb SYMBOLIC(__NR_set_tcb)
-#define __NR_get_tcb SYMBOLIC(__NR_get_tcb)
-#define __NR_adjfreq SYMBOLIC(__NR_adjfreq)
-#define __NR_getdtablecount SYMBOLIC(__NR_getdtablecount)
-#define __NR_getlogin_r SYMBOLIC(__NR_getlogin_r)
-#define __NR_getrtable SYMBOLIC(__NR_getrtable)
-#define __NR_getthrid SYMBOLIC(__NR_getthrid)
-#define __NR_kbind SYMBOLIC(__NR_kbind)
-#define __NR_mquery SYMBOLIC(__NR_mquery)
-#define __NR_obreak SYMBOLIC(__NR_obreak)
-#define __NR_sendsyslog SYMBOLIC(__NR_sendsyslog)
-#define __NR_setrtable SYMBOLIC(__NR_setrtable)
-#define __NR_swapctl SYMBOLIC(__NR_swapctl)
-#define __NR_thrkill SYMBOLIC(__NR_thrkill)
-#define __NR_unveil SYMBOLIC(__NR_unveil)
-#define __NR_mac_get_link SYMBOLIC(__NR_mac_get_link)
-#define __NR_mac_set_link SYMBOLIC(__NR_mac_set_link)
-#define __NR_mac_get_fd SYMBOLIC(__NR_mac_get_fd)
-#define __NR_mac_get_file SYMBOLIC(__NR_mac_get_file)
-#define __NR_mac_get_proc SYMBOLIC(__NR_mac_get_proc)
-#define __NR_mac_set_fd SYMBOLIC(__NR_mac_set_fd)
-#define __NR_mac_get_pid SYMBOLIC(__NR_mac_get_pid)
-#define __NR_mac_set_proc SYMBOLIC(__NR_mac_set_proc)
-#define __NR_mac_set_file SYMBOLIC(__NR_mac_set_file)
-#define __NR_mac_execve SYMBOLIC(__NR_mac_execve)
-#define __NR_acl_get_link SYMBOLIC(__NR_acl_get_link)
-#define __NR_sigwait_nocancel SYMBOLIC(__NR_sigwait_nocancel)
-#define __NR_cap_rights_get SYMBOLIC(__NR_cap_rights_get)
-#define __NR_semwait_signal SYMBOLIC(__NR_semwait_signal)
-#define __NR_acl_set_link SYMBOLIC(__NR_acl_set_link)
-#define __NR_acl_set_fd SYMBOLIC(__NR_acl_set_fd)
-#define __NR_old_semwait_signal SYMBOLIC(__NR_old_semwait_signal)
-#define __NR_setugid SYMBOLIC(__NR_setugid)
-#define __NR_acl_aclcheck_fd SYMBOLIC(__NR_acl_aclcheck_fd)
-#define __NR_acl_get_fd SYMBOLIC(__NR_acl_get_fd)
-#define __NR___sysctl SYMBOLIC(__NR___sysctl)
-#define __NR_mac_getfsstat SYMBOLIC(__NR_mac_getfsstat)
-#define __NR_mac_get_mount SYMBOLIC(__NR_mac_get_mount)
-#define __NR_acl_delete_link SYMBOLIC(__NR_acl_delete_link)
-#define __NR_mac_mount SYMBOLIC(__NR_mac_mount)
-#define __NR_acl_get_file SYMBOLIC(__NR_acl_get_file)
-#define __NR_acl_aclcheck_file SYMBOLIC(__NR_acl_aclcheck_file)
-#define __NR_acl_delete_fd SYMBOLIC(__NR_acl_delete_fd)
-#define __NR_acl_aclcheck_link SYMBOLIC(__NR_acl_aclcheck_link)
-#define __NR___mac_syscall SYMBOLIC(__NR___mac_syscall)
-#define __NR_acl_set_file SYMBOLIC(__NR_acl_set_file)
-#define __NR_acl_delete_file SYMBOLIC(__NR_acl_delete_file)
-#define __NR_syscall SYMBOLIC(__NR_syscall)
-#define __NR__umtx_op SYMBOLIC(__NR__umtx_op)
-#define __NR_semwait_signal_nocancel SYMBOLIC(__NR_semwait_signal_nocancel)
-#define __NR_old_semwait_signal_nocancel \
- SYMBOLIC(__NR_old_semwait_signal_nocancel)
-#define __NR_sctp_peeloff SYMBOLIC(__NR_sctp_peeloff)
-#define __NR_sctp_generic_recvmsg SYMBOLIC(__NR_sctp_generic_recvmsg)
-#define __NR_sctp_generic_sendmsg SYMBOLIC(__NR_sctp_generic_sendmsg)
-#define __NR_sctp_generic_sendmsg_iov SYMBOLIC(__NR_sctp_generic_sendmsg_iov)
-#define __NR_shared_region_map_and_slide_np \
- SYMBOLIC(__NR_shared_region_map_and_slide_np)
-#define __NR_guarded_open_dprotected_np \
- SYMBOLIC(__NR_guarded_open_dprotected_np)
-#define __NR_stack_snapshot_with_config \
- SYMBOLIC(__NR_stack_snapshot_with_config)
-
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@@ -1545,4 +773,776 @@ extern const long __NR_stack_snapshot_with_config;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
+
+#define __NR_exit SYMBOLIC(__NR_exit)
+#define __NR_exit_group SYMBOLIC(__NR_exit_group)
+#define __NR_read SYMBOLIC(__NR_read)
+#define __NR_write SYMBOLIC(__NR_write)
+#define __NR_open SYMBOLIC(__NR_open)
+#define __NR_close SYMBOLIC(__NR_close)
+#define __NR_stat SYMBOLIC(__NR_stat)
+#define __NR_fstat SYMBOLIC(__NR_fstat)
+#define __NR_lstat SYMBOLIC(__NR_lstat)
+#define __NR_poll SYMBOLIC(__NR_poll)
+#define __NR_ppoll SYMBOLIC(__NR_ppoll)
+#define __NR_lseek SYMBOLIC(__NR_lseek)
+#define __NR_mmap SYMBOLIC(__NR_mmap)
+#define __NR_msync SYMBOLIC(__NR_msync)
+#define __NR_mprotect SYMBOLIC(__NR_mprotect)
+#define __NR_munmap SYMBOLIC(__NR_munmap)
+#define __NR_sigaction SYMBOLIC(__NR_sigaction)
+#define __NR_sigprocmask SYMBOLIC(__NR_sigprocmask)
+#define __NR_ioctl SYMBOLIC(__NR_ioctl)
+#define __NR_pread SYMBOLIC(__NR_pread)
+#define __NR_pwrite SYMBOLIC(__NR_pwrite)
+#define __NR_readv SYMBOLIC(__NR_readv)
+#define __NR_writev SYMBOLIC(__NR_writev)
+#define __NR_access SYMBOLIC(__NR_access)
+#define __NR_pipe SYMBOLIC(__NR_pipe)
+#define __NR_select SYMBOLIC(__NR_select)
+#define __NR_pselect SYMBOLIC(__NR_pselect)
+#define __NR_pselect6 SYMBOLIC(__NR_pselect6)
+#define __NR_sched_yield SYMBOLIC(__NR_sched_yield)
+#define __NR_mremap SYMBOLIC(__NR_mremap)
+#define __NR_mincore SYMBOLIC(__NR_mincore)
+#define __NR_madvise SYMBOLIC(__NR_madvise)
+#define __NR_shmget SYMBOLIC(__NR_shmget)
+#define __NR_shmat SYMBOLIC(__NR_shmat)
+#define __NR_shmctl SYMBOLIC(__NR_shmctl)
+#define __NR_dup SYMBOLIC(__NR_dup)
+#define __NR_dup2 SYMBOLIC(__NR_dup2)
+#define __NR_pause SYMBOLIC(__NR_pause)
+#define __NR_nanosleep SYMBOLIC(__NR_nanosleep)
+#define __NR_getitimer SYMBOLIC(__NR_getitimer)
+#define __NR_setitimer SYMBOLIC(__NR_setitimer)
+#define __NR_alarm SYMBOLIC(__NR_alarm)
+#define __NR_getpid SYMBOLIC(__NR_getpid)
+#define __NR_sendfile SYMBOLIC(__NR_sendfile)
+#define __NR_socket SYMBOLIC(__NR_socket)
+#define __NR_connect SYMBOLIC(__NR_connect)
+#define __NR_accept SYMBOLIC(__NR_accept)
+#define __NR_sendto SYMBOLIC(__NR_sendto)
+#define __NR_recvfrom SYMBOLIC(__NR_recvfrom)
+#define __NR_sendmsg SYMBOLIC(__NR_sendmsg)
+#define __NR_recvmsg SYMBOLIC(__NR_recvmsg)
+#define __NR_shutdown SYMBOLIC(__NR_shutdown)
+#define __NR_bind SYMBOLIC(__NR_bind)
+#define __NR_listen SYMBOLIC(__NR_listen)
+#define __NR_getsockname SYMBOLIC(__NR_getsockname)
+#define __NR_getpeername SYMBOLIC(__NR_getpeername)
+#define __NR_socketpair SYMBOLIC(__NR_socketpair)
+#define __NR_setsockopt SYMBOLIC(__NR_setsockopt)
+#define __NR_getsockopt SYMBOLIC(__NR_getsockopt)
+#define __NR_fork SYMBOLIC(__NR_fork)
+#define __NR_vfork SYMBOLIC(__NR_vfork)
+#define __NR_posix_spawn SYMBOLIC(__NR_posix_spawn)
+#define __NR_execve LITERALLY(0x003b)
+#define __NR_wait4 SYMBOLIC(__NR_wait4)
+#define __NR_kill SYMBOLIC(__NR_kill)
+#define __NR_killpg SYMBOLIC(__NR_killpg)
+#define __NR_clone SYMBOLIC(__NR_clone)
+#define __NR_tkill SYMBOLIC(__NR_tkill)
+#define __NR_futex SYMBOLIC(__NR_futex)
+#define __NR_set_robust_list SYMBOLIC(__NR_set_robust_list)
+#define __NR_get_robust_list SYMBOLIC(__NR_get_robust_list)
+#define __NR_uname SYMBOLIC(__NR_uname)
+#define __NR_semget SYMBOLIC(__NR_semget)
+#define __NR_semop SYMBOLIC(__NR_semop)
+#define __NR_semctl SYMBOLIC(__NR_semctl)
+#define __NR_shmdt SYMBOLIC(__NR_shmdt)
+#define __NR_msgget SYMBOLIC(__NR_msgget)
+#define __NR_msgsnd SYMBOLIC(__NR_msgsnd)
+#define __NR_msgrcv SYMBOLIC(__NR_msgrcv)
+#define __NR_msgctl SYMBOLIC(__NR_msgctl)
+#define __NR_fcntl SYMBOLIC(__NR_fcntl)
+#define __NR_flock SYMBOLIC(__NR_flock)
+#define __NR_fsync SYMBOLIC(__NR_fsync)
+#define __NR_fdatasync SYMBOLIC(__NR_fdatasync)
+#define __NR_truncate SYMBOLIC(__NR_truncate)
+#define __NR_ftruncate SYMBOLIC(__NR_ftruncate)
+#define __NR_getcwd SYMBOLIC(__NR_getcwd)
+#define __NR_chdir SYMBOLIC(__NR_chdir)
+#define __NR_fchdir SYMBOLIC(__NR_fchdir)
+#define __NR_rename SYMBOLIC(__NR_rename)
+#define __NR_mkdir SYMBOLIC(__NR_mkdir)
+#define __NR_rmdir SYMBOLIC(__NR_rmdir)
+#define __NR_creat SYMBOLIC(__NR_creat)
+#define __NR_link SYMBOLIC(__NR_link)
+#define __NR_unlink SYMBOLIC(__NR_unlink)
+#define __NR_symlink SYMBOLIC(__NR_symlink)
+#define __NR_readlink SYMBOLIC(__NR_readlink)
+#define __NR_chmod SYMBOLIC(__NR_chmod)
+#define __NR_fchmod SYMBOLIC(__NR_fchmod)
+#define __NR_chown SYMBOLIC(__NR_chown)
+#define __NR_fchown SYMBOLIC(__NR_fchown)
+#define __NR_lchown SYMBOLIC(__NR_lchown)
+#define __NR_umask SYMBOLIC(__NR_umask)
+#define __NR_gettimeofday SYMBOLIC(__NR_gettimeofday)
+#define __NR_getrlimit SYMBOLIC(__NR_getrlimit)
+#define __NR_getrusage SYMBOLIC(__NR_getrusage)
+#define __NR_sysinfo SYMBOLIC(__NR_sysinfo)
+#define __NR_times SYMBOLIC(__NR_times)
+#define __NR_ptrace SYMBOLIC(__NR_ptrace)
+#define __NR_syslog SYMBOLIC(__NR_syslog)
+#define __NR_getuid SYMBOLIC(__NR_getuid)
+#define __NR_getgid SYMBOLIC(__NR_getgid)
+#define __NR_getppid SYMBOLIC(__NR_getppid)
+#define __NR_getpgrp SYMBOLIC(__NR_getpgrp)
+#define __NR_setsid SYMBOLIC(__NR_setsid)
+#define __NR_getsid SYMBOLIC(__NR_getsid)
+#define __NR_getpgid SYMBOLIC(__NR_getpgid)
+#define __NR_setpgid SYMBOLIC(__NR_setpgid)
+#define __NR_geteuid SYMBOLIC(__NR_geteuid)
+#define __NR_getegid SYMBOLIC(__NR_getegid)
+#define __NR_getgroups SYMBOLIC(__NR_getgroups)
+#define __NR_setgroups SYMBOLIC(__NR_setgroups)
+#define __NR_setreuid SYMBOLIC(__NR_setreuid)
+#define __NR_setregid SYMBOLIC(__NR_setregid)
+#define __NR_setuid SYMBOLIC(__NR_setuid)
+#define __NR_setgid SYMBOLIC(__NR_setgid)
+#define __NR_setresuid SYMBOLIC(__NR_setresuid)
+#define __NR_setresgid SYMBOLIC(__NR_setresgid)
+#define __NR_getresuid SYMBOLIC(__NR_getresuid)
+#define __NR_getresgid SYMBOLIC(__NR_getresgid)
+#define __NR_sigpending SYMBOLIC(__NR_sigpending)
+#define __NR_sigsuspend SYMBOLIC(__NR_sigsuspend)
+#define __NR_sigaltstack SYMBOLIC(__NR_sigaltstack)
+#define __NR_mknod SYMBOLIC(__NR_mknod)
+#define __NR_mknodat SYMBOLIC(__NR_mknodat)
+#define __NR_mkfifo SYMBOLIC(__NR_mkfifo)
+#define __NR_mkfifoat SYMBOLIC(__NR_mkfifoat)
+#define __NR_statfs SYMBOLIC(__NR_statfs)
+#define __NR_fstatfs SYMBOLIC(__NR_fstatfs)
+#define __NR_getpriority SYMBOLIC(__NR_getpriority)
+#define __NR_setpriority SYMBOLIC(__NR_setpriority)
+#define __NR_mlock SYMBOLIC(__NR_mlock)
+#define __NR_munlock SYMBOLIC(__NR_munlock)
+#define __NR_mlockall SYMBOLIC(__NR_mlockall)
+#define __NR_munlockall SYMBOLIC(__NR_munlockall)
+#define __NR_setrlimit SYMBOLIC(__NR_setrlimit)
+#define __NR_chroot SYMBOLIC(__NR_chroot)
+#define __NR_sync SYMBOLIC(__NR_sync)
+#define __NR_acct SYMBOLIC(__NR_acct)
+#define __NR_settimeofday SYMBOLIC(__NR_settimeofday)
+#define __NR_mount SYMBOLIC(__NR_mount)
+#define __NR_reboot SYMBOLIC(__NR_reboot)
+#define __NR_quotactl SYMBOLIC(__NR_quotactl)
+#define __NR_setfsuid SYMBOLIC(__NR_setfsuid)
+#define __NR_setfsgid SYMBOLIC(__NR_setfsgid)
+#define __NR_capget SYMBOLIC(__NR_capget)
+#define __NR_capset SYMBOLIC(__NR_capset)
+#define __NR_sigtimedwait SYMBOLIC(__NR_sigtimedwait)
+#define __NR_rt_sigqueueinfo SYMBOLIC(__NR_rt_sigqueueinfo)
+#define __NR_personality SYMBOLIC(__NR_personality)
+#define __NR_ustat SYMBOLIC(__NR_ustat)
+#define __NR_sysfs SYMBOLIC(__NR_sysfs)
+#define __NR_sched_setparam SYMBOLIC(__NR_sched_setparam)
+#define __NR_sched_getparam SYMBOLIC(__NR_sched_getparam)
+#define __NR_sched_setscheduler SYMBOLIC(__NR_sched_setscheduler)
+#define __NR_sched_getscheduler SYMBOLIC(__NR_sched_getscheduler)
+#define __NR_sched_get_priority_max SYMBOLIC(__NR_sched_get_priority_max)
+#define __NR_sched_get_priority_min SYMBOLIC(__NR_sched_get_priority_min)
+#define __NR_sched_rr_get_interval SYMBOLIC(__NR_sched_rr_get_interval)
+#define __NR_vhangup SYMBOLIC(__NR_vhangup)
+#define __NR_modify_ldt SYMBOLIC(__NR_modify_ldt)
+#define __NR_pivot_root SYMBOLIC(__NR_pivot_root)
+#define __NR__sysctl SYMBOLIC(__NR__sysctl)
+#define __NR_prctl SYMBOLIC(__NR_prctl)
+#define __NR_arch_prctl SYMBOLIC(__NR_arch_prctl)
+#define __NR_adjtimex SYMBOLIC(__NR_adjtimex)
+#define __NR_umount2 SYMBOLIC(__NR_umount2)
+#define __NR_swapon SYMBOLIC(__NR_swapon)
+#define __NR_swapoff SYMBOLIC(__NR_swapoff)
+#define __NR_sethostname SYMBOLIC(__NR_sethostname)
+#define __NR_setdomainname SYMBOLIC(__NR_setdomainname)
+#define __NR_iopl SYMBOLIC(__NR_iopl)
+#define __NR_ioperm SYMBOLIC(__NR_ioperm)
+#define __NR_init_module SYMBOLIC(__NR_init_module)
+#define __NR_delete_module SYMBOLIC(__NR_delete_module)
+#define __NR_gettid SYMBOLIC(__NR_gettid)
+#define __NR_readahead SYMBOLIC(__NR_readahead)
+#define __NR_setxattr SYMBOLIC(__NR_setxattr)
+#define __NR_fsetxattr SYMBOLIC(__NR_fsetxattr)
+#define __NR_getxattr SYMBOLIC(__NR_getxattr)
+#define __NR_fgetxattr SYMBOLIC(__NR_fgetxattr)
+#define __NR_listxattr SYMBOLIC(__NR_listxattr)
+#define __NR_flistxattr SYMBOLIC(__NR_flistxattr)
+#define __NR_removexattr SYMBOLIC(__NR_removexattr)
+#define __NR_fremovexattr SYMBOLIC(__NR_fremovexattr)
+#define __NR_lsetxattr SYMBOLIC(__NR_lsetxattr)
+#define __NR_lgetxattr SYMBOLIC(__NR_lgetxattr)
+#define __NR_llistxattr SYMBOLIC(__NR_llistxattr)
+#define __NR_lremovexattr SYMBOLIC(__NR_lremovexattr)
+#define __NR_sched_setaffinity SYMBOLIC(__NR_sched_setaffinity)
+#define __NR_sched_getaffinity SYMBOLIC(__NR_sched_getaffinity)
+#define __NR_cpuset_getaffinity SYMBOLIC(__NR_cpuset_getaffinity)
+#define __NR_cpuset_setaffinity SYMBOLIC(__NR_cpuset_setaffinity)
+#define __NR_io_setup SYMBOLIC(__NR_io_setup)
+#define __NR_io_destroy SYMBOLIC(__NR_io_destroy)
+#define __NR_io_getevents SYMBOLIC(__NR_io_getevents)
+#define __NR_io_submit SYMBOLIC(__NR_io_submit)
+#define __NR_io_cancel SYMBOLIC(__NR_io_cancel)
+#define __NR_lookup_dcookie SYMBOLIC(__NR_lookup_dcookie)
+#define __NR_epoll_create SYMBOLIC(__NR_epoll_create)
+#define __NR_epoll_wait SYMBOLIC(__NR_epoll_wait)
+#define __NR_epoll_ctl SYMBOLIC(__NR_epoll_ctl)
+#define __NR_getdents SYMBOLIC(__NR_getdents)
+#define __NR_set_tid_address SYMBOLIC(__NR_set_tid_address)
+#define __NR_restart_syscall SYMBOLIC(__NR_restart_syscall)
+#define __NR_semtimedop SYMBOLIC(__NR_semtimedop)
+#define __NR_fadvise SYMBOLIC(__NR_fadvise)
+#define __NR_timer_create SYMBOLIC(__NR_timer_create)
+#define __NR_timer_settime SYMBOLIC(__NR_timer_settime)
+#define __NR_timer_gettime SYMBOLIC(__NR_timer_gettime)
+#define __NR_timer_getoverrun SYMBOLIC(__NR_timer_getoverrun)
+#define __NR_timer_delete SYMBOLIC(__NR_timer_delete)
+#define __NR_clock_settime SYMBOLIC(__NR_clock_settime)
+#define __NR_clock_gettime SYMBOLIC(__NR_clock_gettime)
+#define __NR_clock_getres SYMBOLIC(__NR_clock_getres)
+#define __NR_clock_nanosleep SYMBOLIC(__NR_clock_nanosleep)
+#define __NR_tgkill SYMBOLIC(__NR_tgkill)
+#define __NR_mbind SYMBOLIC(__NR_mbind)
+#define __NR_set_mempolicy SYMBOLIC(__NR_set_mempolicy)
+#define __NR_get_mempolicy SYMBOLIC(__NR_get_mempolicy)
+#define __NR_mq_open SYMBOLIC(__NR_mq_open)
+#define __NR_mq_unlink SYMBOLIC(__NR_mq_unlink)
+#define __NR_mq_timedsend SYMBOLIC(__NR_mq_timedsend)
+#define __NR_mq_timedreceive SYMBOLIC(__NR_mq_timedreceive)
+#define __NR_mq_notify SYMBOLIC(__NR_mq_notify)
+#define __NR_mq_getsetattr SYMBOLIC(__NR_mq_getsetattr)
+#define __NR_kexec_load SYMBOLIC(__NR_kexec_load)
+#define __NR_waitid SYMBOLIC(__NR_waitid)
+#define __NR_add_key SYMBOLIC(__NR_add_key)
+#define __NR_request_key SYMBOLIC(__NR_request_key)
+#define __NR_keyctl SYMBOLIC(__NR_keyctl)
+#define __NR_ioprio_set SYMBOLIC(__NR_ioprio_set)
+#define __NR_ioprio_get SYMBOLIC(__NR_ioprio_get)
+#define __NR_inotify_init SYMBOLIC(__NR_inotify_init)
+#define __NR_inotify_add_watch SYMBOLIC(__NR_inotify_add_watch)
+#define __NR_inotify_rm_watch SYMBOLIC(__NR_inotify_rm_watch)
+#define __NR_openat SYMBOLIC(__NR_openat)
+#define __NR_mkdirat SYMBOLIC(__NR_mkdirat)
+#define __NR_fchownat SYMBOLIC(__NR_fchownat)
+#define __NR_utime SYMBOLIC(__NR_utime)
+#define __NR_utimes SYMBOLIC(__NR_utimes)
+#define __NR_futimesat SYMBOLIC(__NR_futimesat)
+#define __NR_futimes SYMBOLIC(__NR_futimes)
+#define __NR_futimens SYMBOLIC(__NR_futimens)
+#define __NR_fstatat SYMBOLIC(__NR_fstatat)
+#define __NR_unlinkat SYMBOLIC(__NR_unlinkat)
+#define __NR_renameat SYMBOLIC(__NR_renameat)
+#define __NR_linkat SYMBOLIC(__NR_linkat)
+#define __NR_symlinkat SYMBOLIC(__NR_symlinkat)
+#define __NR_readlinkat SYMBOLIC(__NR_readlinkat)
+#define __NR_fchmodat SYMBOLIC(__NR_fchmodat)
+#define __NR_faccessat SYMBOLIC(__NR_faccessat)
+#define __NR_unshare SYMBOLIC(__NR_unshare)
+#define __NR_splice SYMBOLIC(__NR_splice)
+#define __NR_tee SYMBOLIC(__NR_tee)
+#define __NR_sync_file_range SYMBOLIC(__NR_sync_file_range)
+#define __NR_vmsplice SYMBOLIC(__NR_vmsplice)
+#define __NR_migrate_pages SYMBOLIC(__NR_migrate_pages)
+#define __NR_move_pages SYMBOLIC(__NR_move_pages)
+#define __NR_preadv SYMBOLIC(__NR_preadv)
+#define __NR_pwritev SYMBOLIC(__NR_pwritev)
+#define __NR_utimensat SYMBOLIC(__NR_utimensat)
+#define __NR_fallocate SYMBOLIC(__NR_fallocate)
+#define __NR_posix_fallocate SYMBOLIC(__NR_posix_fallocate)
+#define __NR_accept4 SYMBOLIC(__NR_accept4)
+#define __NR_dup3 SYMBOLIC(__NR_dup3)
+#define __NR_pipe2 SYMBOLIC(__NR_pipe2)
+#define __NR_epoll_pwait SYMBOLIC(__NR_epoll_pwait)
+#define __NR_epoll_create1 SYMBOLIC(__NR_epoll_create1)
+#define __NR_perf_event_open SYMBOLIC(__NR_perf_event_open)
+#define __NR_inotify_init1 SYMBOLIC(__NR_inotify_init1)
+#define __NR_rt_tgsigqueueinfo SYMBOLIC(__NR_rt_tgsigqueueinfo)
+#define __NR_signalfd SYMBOLIC(__NR_signalfd)
+#define __NR_signalfd4 SYMBOLIC(__NR_signalfd4)
+#define __NR_eventfd SYMBOLIC(__NR_eventfd)
+#define __NR_eventfd2 SYMBOLIC(__NR_eventfd2)
+#define __NR_timerfd_create SYMBOLIC(__NR_timerfd_create)
+#define __NR_timerfd_settime SYMBOLIC(__NR_timerfd_settime)
+#define __NR_timerfd_gettime SYMBOLIC(__NR_timerfd_gettime)
+#define __NR_recvmmsg SYMBOLIC(__NR_recvmmsg)
+#define __NR_fanotify_init SYMBOLIC(__NR_fanotify_init)
+#define __NR_fanotify_mark SYMBOLIC(__NR_fanotify_mark)
+#define __NR_prlimit SYMBOLIC(__NR_prlimit)
+#define __NR_name_to_handle_at SYMBOLIC(__NR_name_to_handle_at)
+#define __NR_open_by_handle_at SYMBOLIC(__NR_open_by_handle_at)
+#define __NR_clock_adjtime SYMBOLIC(__NR_clock_adjtime)
+#define __NR_syncfs SYMBOLIC(__NR_syncfs)
+#define __NR_sendmmsg SYMBOLIC(__NR_sendmmsg)
+#define __NR_setns SYMBOLIC(__NR_setns)
+#define __NR_getcpu SYMBOLIC(__NR_getcpu)
+#define __NR_process_vm_readv SYMBOLIC(__NR_process_vm_readv)
+#define __NR_process_vm_writev SYMBOLIC(__NR_process_vm_writev)
+#define __NR_kcmp SYMBOLIC(__NR_kcmp)
+#define __NR_finit_module SYMBOLIC(__NR_finit_module)
+#define __NR_sched_setattr SYMBOLIC(__NR_sched_setattr)
+#define __NR_sched_getattr SYMBOLIC(__NR_sched_getattr)
+#define __NR_renameat2 SYMBOLIC(__NR_renameat2)
+#define __NR_seccomp SYMBOLIC(__NR_seccomp)
+#define __NR_getrandom SYMBOLIC(__NR_getrandom)
+#define __NR_memfd_create SYMBOLIC(__NR_memfd_create)
+#define __NR_kexec_file_load SYMBOLIC(__NR_kexec_file_load)
+#define __NR_bpf SYMBOLIC(__NR_bpf)
+#define __NR_execveat SYMBOLIC(__NR_execveat)
+#define __NR_userfaultfd SYMBOLIC(__NR_userfaultfd)
+#define __NR_membarrier SYMBOLIC(__NR_membarrier)
+#define __NR_mlock2 SYMBOLIC(__NR_mlock2)
+#define __NR_copy_file_range SYMBOLIC(__NR_copy_file_range)
+#define __NR_preadv2 SYMBOLIC(__NR_preadv2)
+#define __NR_pwritev2 SYMBOLIC(__NR_pwritev2)
+#define __NR_pkey_mprotect SYMBOLIC(__NR_pkey_mprotect)
+#define __NR_pkey_alloc SYMBOLIC(__NR_pkey_alloc)
+#define __NR_pkey_free SYMBOLIC(__NR_pkey_free)
+#define __NR_statx SYMBOLIC(__NR_statx)
+#define __NR_io_pgetevents SYMBOLIC(__NR_io_pgetevents)
+#define __NR_rseq SYMBOLIC(__NR_rseq)
+#define __NR_pidfd_send_signal SYMBOLIC(__NR_pidfd_send_signal)
+#define __NR_io_uring_setup SYMBOLIC(__NR_io_uring_setup)
+#define __NR_io_uring_enter SYMBOLIC(__NR_io_uring_enter)
+#define __NR_io_uring_register SYMBOLIC(__NR_io_uring_register)
+#define __NR_pledge SYMBOLIC(__NR_pledge)
+#define __NR_msyscall SYMBOLIC(__NR_msyscall)
+#define __NR_ktrace SYMBOLIC(__NR_ktrace)
+#define __NR_kqueue SYMBOLIC(__NR_kqueue)
+#define __NR_kevent SYMBOLIC(__NR_kevent)
+#define __NR_revoke SYMBOLIC(__NR_revoke)
+#define __NR_setlogin SYMBOLIC(__NR_setlogin)
+#define __NR_getfh SYMBOLIC(__NR_getfh)
+#define __NR_chflags SYMBOLIC(__NR_chflags)
+#define __NR_getfsstat SYMBOLIC(__NR_getfsstat)
+#define __NR_nfssvc SYMBOLIC(__NR_nfssvc)
+#define __NR_adjtime SYMBOLIC(__NR_adjtime)
+#define __NR_fchflags SYMBOLIC(__NR_fchflags)
+#define __NR_seteuid SYMBOLIC(__NR_seteuid)
+#define __NR_setegid SYMBOLIC(__NR_setegid)
+#define __NR_fpathconf SYMBOLIC(__NR_fpathconf)
+#define __NR_fhopen SYMBOLIC(__NR_fhopen)
+#define __NR_unmount SYMBOLIC(__NR_unmount)
+#define __NR_issetugid SYMBOLIC(__NR_issetugid)
+#define __NR_minherit SYMBOLIC(__NR_minherit)
+#define __NR_pathconf SYMBOLIC(__NR_pathconf)
+#define __NR_sysctl SYMBOLIC(__NR_sysctl)
+#define __NR_ntp_adjtime SYMBOLIC(__NR_ntp_adjtime)
+#define __NR_ntp_gettime SYMBOLIC(__NR_ntp_gettime)
+#define __NR_shm_unlink SYMBOLIC(__NR_shm_unlink)
+#define __NR_shm_open SYMBOLIC(__NR_shm_open)
+#define __NR_aio_read SYMBOLIC(__NR_aio_read)
+#define __NR_aio_suspend SYMBOLIC(__NR_aio_suspend)
+#define __NR_aio_cancel SYMBOLIC(__NR_aio_cancel)
+#define __NR_aio_fsync SYMBOLIC(__NR_aio_fsync)
+#define __NR_aio_error SYMBOLIC(__NR_aio_error)
+#define __NR_aio_return SYMBOLIC(__NR_aio_return)
+#define __NR_aio_write SYMBOLIC(__NR_aio_write)
+#define __NR_aio_waitcomplete SYMBOLIC(__NR_aio_waitcomplete)
+#define __NR_aio_suspend_nocancel SYMBOLIC(__NR_aio_suspend_nocancel)
+#define __NR_aio_mlock SYMBOLIC(__NR_aio_mlock)
+#define __NR_sigwait SYMBOLIC(__NR_sigwait)
+#define __NR_undelete SYMBOLIC(__NR_undelete)
+#define __NR_getlogin SYMBOLIC(__NR_getlogin)
+#define __NR_getdtablesize SYMBOLIC(__NR_getdtablesize)
+#define __NR_setauid SYMBOLIC(__NR_setauid)
+#define __NR_audit SYMBOLIC(__NR_audit)
+#define __NR_auditctl SYMBOLIC(__NR_auditctl)
+#define __NR_getaudit_addr SYMBOLIC(__NR_getaudit_addr)
+#define __NR_getdirentries SYMBOLIC(__NR_getdirentries)
+#define __NR_lio_listio SYMBOLIC(__NR_lio_listio)
+#define __NR_setaudit_addr SYMBOLIC(__NR_setaudit_addr)
+#define __NR_getauid SYMBOLIC(__NR_getauid)
+#define __NR_semsys SYMBOLIC(__NR_semsys)
+#define __NR_auditon SYMBOLIC(__NR_auditon)
+#define __NR_msgsys SYMBOLIC(__NR_msgsys)
+#define __NR_shmsys SYMBOLIC(__NR_shmsys)
+#define __NR_fhstat SYMBOLIC(__NR_fhstat)
+#define __NR_chflagsat SYMBOLIC(__NR_chflagsat)
+#define __NR_profil SYMBOLIC(__NR_profil)
+#define __NR_fhstatfs SYMBOLIC(__NR_fhstatfs)
+#define __NR_utrace SYMBOLIC(__NR_utrace)
+#define __NR_closefrom SYMBOLIC(__NR_closefrom)
+#define __NR_pthread_markcancel SYMBOLIC(__NR_pthread_markcancel)
+#define __NR_pthread_kill SYMBOLIC(__NR_pthread_kill)
+#define __NR_pthread_fchdir SYMBOLIC(__NR_pthread_fchdir)
+#define __NR_pthread_sigmask SYMBOLIC(__NR_pthread_sigmask)
+#define __NR_pthread_chdir SYMBOLIC(__NR_pthread_chdir)
+#define __NR_pthread_canceled SYMBOLIC(__NR_pthread_canceled)
+#define __NR_disable_threadsignal SYMBOLIC(__NR_disable_threadsignal)
+#define __NR_abort_with_payload SYMBOLIC(__NR_abort_with_payload)
+#define __NR_accept_nocancel SYMBOLIC(__NR_accept_nocancel)
+#define __NR_access_extended SYMBOLIC(__NR_access_extended)
+#define __NR_audit_session_join SYMBOLIC(__NR_audit_session_join)
+#define __NR_audit_session_port SYMBOLIC(__NR_audit_session_port)
+#define __NR_audit_session_self SYMBOLIC(__NR_audit_session_self)
+#define __NR_bsdthread_create SYMBOLIC(__NR_bsdthread_create)
+#define __NR_bsdthread_ctl SYMBOLIC(__NR_bsdthread_ctl)
+#define __NR_bsdthread_register SYMBOLIC(__NR_bsdthread_register)
+#define __NR_bsdthread_terminate SYMBOLIC(__NR_bsdthread_terminate)
+#define __NR_change_fdguard_np SYMBOLIC(__NR_change_fdguard_np)
+#define __NR_chmod_extended SYMBOLIC(__NR_chmod_extended)
+#define __NR_clonefileat SYMBOLIC(__NR_clonefileat)
+#define __NR_close_nocancel SYMBOLIC(__NR_close_nocancel)
+#define __NR_coalition SYMBOLIC(__NR_coalition)
+#define __NR_coalition_info SYMBOLIC(__NR_coalition_info)
+#define __NR_connect_nocancel SYMBOLIC(__NR_connect_nocancel)
+#define __NR_connectx SYMBOLIC(__NR_connectx)
+#define __NR_copyfile SYMBOLIC(__NR_copyfile)
+#define __NR_csops SYMBOLIC(__NR_csops)
+#define __NR_csops_audittoken SYMBOLIC(__NR_csops_audittoken)
+#define __NR_csrctl SYMBOLIC(__NR_csrctl)
+#define __NR_delete SYMBOLIC(__NR_delete)
+#define __NR_disconnectx SYMBOLIC(__NR_disconnectx)
+#define __NR_exchangedata SYMBOLIC(__NR_exchangedata)
+#define __NR_fchmod_extended SYMBOLIC(__NR_fchmod_extended)
+#define __NR_fclonefileat SYMBOLIC(__NR_fclonefileat)
+#define __NR_fcntl_nocancel SYMBOLIC(__NR_fcntl_nocancel)
+#define __NR_ffsctl SYMBOLIC(__NR_ffsctl)
+#define __NR_fgetattrlist SYMBOLIC(__NR_fgetattrlist)
+#define __NR_fileport_makefd SYMBOLIC(__NR_fileport_makefd)
+#define __NR_fileport_makeport SYMBOLIC(__NR_fileport_makeport)
+#define __NR_fmount SYMBOLIC(__NR_fmount)
+#define __NR_fs_snapshot SYMBOLIC(__NR_fs_snapshot)
+#define __NR_fsctl SYMBOLIC(__NR_fsctl)
+#define __NR_fsetattrlist SYMBOLIC(__NR_fsetattrlist)
+#define __NR_fstat_extended SYMBOLIC(__NR_fstat_extended)
+#define __NR_fsync_nocancel SYMBOLIC(__NR_fsync_nocancel)
+#define __NR_getattrlist SYMBOLIC(__NR_getattrlist)
+#define __NR_getattrlistat SYMBOLIC(__NR_getattrlistat)
+#define __NR_getattrlistbulk SYMBOLIC(__NR_getattrlistbulk)
+#define __NR_getdirentriesattr SYMBOLIC(__NR_getdirentriesattr)
+#define __NR_gethostuuid SYMBOLIC(__NR_gethostuuid)
+#define __NR_getsgroups SYMBOLIC(__NR_getsgroups)
+#define __NR_getwgroups SYMBOLIC(__NR_getwgroups)
+#define __NR_grab_pgo_data SYMBOLIC(__NR_grab_pgo_data)
+#define __NR_guarded_close_np SYMBOLIC(__NR_guarded_close_np)
+#define __NR_guarded_kqueue_np SYMBOLIC(__NR_guarded_kqueue_np)
+#define __NR_guarded_open_np SYMBOLIC(__NR_guarded_open_np)
+#define __NR_guarded_pwrite_np SYMBOLIC(__NR_guarded_pwrite_np)
+#define __NR_guarded_write_np SYMBOLIC(__NR_guarded_write_np)
+#define __NR_guarded_writev_np SYMBOLIC(__NR_guarded_writev_np)
+#define __NR_identitysvc SYMBOLIC(__NR_identitysvc)
+#define __NR_initgroups SYMBOLIC(__NR_initgroups)
+#define __NR_iopolicysys SYMBOLIC(__NR_iopolicysys)
+#define __NR_kas_info SYMBOLIC(__NR_kas_info)
+#define __NR_kdebug_trace SYMBOLIC(__NR_kdebug_trace)
+#define __NR_kdebug_trace_string SYMBOLIC(__NR_kdebug_trace_string)
+#define __NR_kdebug_typefilter SYMBOLIC(__NR_kdebug_typefilter)
+#define __NR_kevent_id SYMBOLIC(__NR_kevent_id)
+#define __NR_kevent_qos SYMBOLIC(__NR_kevent_qos)
+#define __NR_ledger SYMBOLIC(__NR_ledger)
+#define __NR_lstat_extended SYMBOLIC(__NR_lstat_extended)
+#define __NR_memorystatus_control SYMBOLIC(__NR_memorystatus_control)
+#define __NR_memorystatus_get_level SYMBOLIC(__NR_memorystatus_get_level)
+#define __NR_microstackshot SYMBOLIC(__NR_microstackshot)
+#define __NR_mkdir_extended SYMBOLIC(__NR_mkdir_extended)
+#define __NR_mkfifo_extended SYMBOLIC(__NR_mkfifo_extended)
+#define __NR_modwatch SYMBOLIC(__NR_modwatch)
+#define __NR_mremap_encrypted SYMBOLIC(__NR_mremap_encrypted)
+#define __NR_msgrcv_nocancel SYMBOLIC(__NR_msgrcv_nocancel)
+#define __NR_msgsnd_nocancel SYMBOLIC(__NR_msgsnd_nocancel)
+#define __NR_msync_nocancel SYMBOLIC(__NR_msync_nocancel)
+#define __NR_necp_client_action SYMBOLIC(__NR_necp_client_action)
+#define __NR_necp_match_policy SYMBOLIC(__NR_necp_match_policy)
+#define __NR_necp_open SYMBOLIC(__NR_necp_open)
+#define __NR_necp_session_action SYMBOLIC(__NR_necp_session_action)
+#define __NR_necp_session_open SYMBOLIC(__NR_necp_session_open)
+#define __NR_net_qos_guideline SYMBOLIC(__NR_net_qos_guideline)
+#define __NR_netagent_trigger SYMBOLIC(__NR_netagent_trigger)
+#define __NR_nfsclnt SYMBOLIC(__NR_nfsclnt)
+#define __NR_open_dprotected_np SYMBOLIC(__NR_open_dprotected_np)
+#define __NR_open_extended SYMBOLIC(__NR_open_extended)
+#define __NR_open_nocancel SYMBOLIC(__NR_open_nocancel)
+#define __NR_openat_nocancel SYMBOLIC(__NR_openat_nocancel)
+#define __NR_openbyid_np SYMBOLIC(__NR_openbyid_np)
+#define __NR_os_fault_with_payload SYMBOLIC(__NR_os_fault_with_payload)
+#define __NR_peeloff SYMBOLIC(__NR_peeloff)
+#define __NR_persona SYMBOLIC(__NR_persona)
+#define __NR_pid_hibernate SYMBOLIC(__NR_pid_hibernate)
+#define __NR_pid_resume SYMBOLIC(__NR_pid_resume)
+#define __NR_pid_shutdown_sockets SYMBOLIC(__NR_pid_shutdown_sockets)
+#define __NR_pid_suspend SYMBOLIC(__NR_pid_suspend)
+#define __NR_poll_nocancel SYMBOLIC(__NR_poll_nocancel)
+#define __NR_pread_nocancel SYMBOLIC(__NR_pread_nocancel)
+#define __NR_proc_info SYMBOLIC(__NR_proc_info)
+#define __NR_proc_rlimit_control SYMBOLIC(__NR_proc_rlimit_control)
+#define __NR_proc_trace_log SYMBOLIC(__NR_proc_trace_log)
+#define __NR_proc_uuid_policy SYMBOLIC(__NR_proc_uuid_policy)
+#define __NR_process_policy SYMBOLIC(__NR_process_policy)
+#define __NR_pselect_nocancel SYMBOLIC(__NR_pselect_nocancel)
+#define __NR_psynch_cvbroad SYMBOLIC(__NR_psynch_cvbroad)
+#define __NR_psynch_cvclrprepost SYMBOLIC(__NR_psynch_cvclrprepost)
+#define __NR_psynch_cvsignal SYMBOLIC(__NR_psynch_cvsignal)
+#define __NR_psynch_mutexdrop SYMBOLIC(__NR_psynch_mutexdrop)
+#define __NR_psynch_mutexwait SYMBOLIC(__NR_psynch_mutexwait)
+#define __NR_psynch_rw_downgrade SYMBOLIC(__NR_psynch_rw_downgrade)
+#define __NR_psynch_rw_longrdlock SYMBOLIC(__NR_psynch_rw_longrdlock)
+#define __NR_psynch_rw_rdlock SYMBOLIC(__NR_psynch_rw_rdlock)
+#define __NR_psynch_rw_unlock SYMBOLIC(__NR_psynch_rw_unlock)
+#define __NR_psynch_rw_unlock2 SYMBOLIC(__NR_psynch_rw_unlock2)
+#define __NR_psynch_rw_upgrade SYMBOLIC(__NR_psynch_rw_upgrade)
+#define __NR_psynch_rw_wrlock SYMBOLIC(__NR_psynch_rw_wrlock)
+#define __NR_psynch_rw_yieldwrlock SYMBOLIC(__NR_psynch_rw_yieldwrlock)
+#define __NR_pwrite_nocancel SYMBOLIC(__NR_pwrite_nocancel)
+#define __NR_read_nocancel SYMBOLIC(__NR_read_nocancel)
+#define __NR_readv_nocancel SYMBOLIC(__NR_readv_nocancel)
+#define __NR_recvfrom_nocancel SYMBOLIC(__NR_recvfrom_nocancel)
+#define __NR_recvmsg_nocancel SYMBOLIC(__NR_recvmsg_nocancel)
+#define __NR_recvmsg_x SYMBOLIC(__NR_recvmsg_x)
+#define __NR_renameatx_np SYMBOLIC(__NR_renameatx_np)
+#define __NR_searchfs SYMBOLIC(__NR_searchfs)
+#define __NR_select_nocancel SYMBOLIC(__NR_select_nocancel)
+#define __NR_sem_close SYMBOLIC(__NR_sem_close)
+#define __NR_sem_open SYMBOLIC(__NR_sem_open)
+#define __NR_sem_post SYMBOLIC(__NR_sem_post)
+#define __NR_sem_trywait SYMBOLIC(__NR_sem_trywait)
+#define __NR_sem_unlink SYMBOLIC(__NR_sem_unlink)
+#define __NR_sem_wait SYMBOLIC(__NR_sem_wait)
+#define __NR_sem_wait_nocancel SYMBOLIC(__NR_sem_wait_nocancel)
+#define __NR_sendmsg_nocancel SYMBOLIC(__NR_sendmsg_nocancel)
+#define __NR_sendmsg_x SYMBOLIC(__NR_sendmsg_x)
+#define __NR_sendto_nocancel SYMBOLIC(__NR_sendto_nocancel)
+#define __NR_setattrlist SYMBOLIC(__NR_setattrlist)
+#define __NR_setattrlistat SYMBOLIC(__NR_setattrlistat)
+#define __NR_setprivexec SYMBOLIC(__NR_setprivexec)
+#define __NR_setsgroups SYMBOLIC(__NR_setsgroups)
+#define __NR_settid SYMBOLIC(__NR_settid)
+#define __NR_settid_with_pid SYMBOLIC(__NR_settid_with_pid)
+#define __NR_setwgroups SYMBOLIC(__NR_setwgroups)
+#define __NR_sfi_ctl SYMBOLIC(__NR_sfi_ctl)
+#define __NR_sfi_pidctl SYMBOLIC(__NR_sfi_pidctl)
+#define __NR_shared_region_check_np SYMBOLIC(__NR_shared_region_check_np)
+#define __NR_sigsuspend_nocancel SYMBOLIC(__NR_sigsuspend_nocancel)
+#define __NR_socket_delegate SYMBOLIC(__NR_socket_delegate)
+#define __NR_stat_extended SYMBOLIC(__NR_stat_extended)
+#define __NR_sysctlbyname SYMBOLIC(__NR_sysctlbyname)
+#define __NR_system_override SYMBOLIC(__NR_system_override)
+#define __NR_telemetry SYMBOLIC(__NR_telemetry)
+#define __NR_terminate_with_payload SYMBOLIC(__NR_terminate_with_payload)
+#define __NR_thread_selfcounts SYMBOLIC(__NR_thread_selfcounts)
+#define __NR_thread_selfid SYMBOLIC(__NR_thread_selfid)
+#define __NR_thread_selfusage SYMBOLIC(__NR_thread_selfusage)
+#define __NR_ulock_wait SYMBOLIC(__NR_ulock_wait)
+#define __NR_ulock_wake SYMBOLIC(__NR_ulock_wake)
+#define __NR_umask_extended SYMBOLIC(__NR_umask_extended)
+#define __NR_usrctl SYMBOLIC(__NR_usrctl)
+#define __NR_vfs_purge SYMBOLIC(__NR_vfs_purge)
+#define __NR_vm_pressure_monitor SYMBOLIC(__NR_vm_pressure_monitor)
+#define __NR_wait4_nocancel SYMBOLIC(__NR_wait4_nocancel)
+#define __NR_waitevent SYMBOLIC(__NR_waitevent)
+#define __NR_waitid_nocancel SYMBOLIC(__NR_waitid_nocancel)
+#define __NR_watchevent SYMBOLIC(__NR_watchevent)
+#define __NR_work_interval_ctl SYMBOLIC(__NR_work_interval_ctl)
+#define __NR_workq_kernreturn SYMBOLIC(__NR_workq_kernreturn)
+#define __NR_workq_open SYMBOLIC(__NR_workq_open)
+#define __NR_write_nocancel SYMBOLIC(__NR_write_nocancel)
+#define __NR_writev_nocancel SYMBOLIC(__NR_writev_nocancel)
+#define __NR_abort2 SYMBOLIC(__NR_abort2)
+#define __NR_afs3_syscall SYMBOLIC(__NR_afs3_syscall)
+#define __NR_bindat SYMBOLIC(__NR_bindat)
+#define __NR_break SYMBOLIC(__NR_break)
+#define __NR_cap_enter SYMBOLIC(__NR_cap_enter)
+#define __NR_cap_fcntls_get SYMBOLIC(__NR_cap_fcntls_get)
+#define __NR_cap_fcntls_limit SYMBOLIC(__NR_cap_fcntls_limit)
+#define __NR_cap_getmode SYMBOLIC(__NR_cap_getmode)
+#define __NR_cap_ioctls_get SYMBOLIC(__NR_cap_ioctls_get)
+#define __NR_cap_ioctls_limit SYMBOLIC(__NR_cap_ioctls_limit)
+#define __NR_cap_rights_limit SYMBOLIC(__NR_cap_rights_limit)
+#define __NR_clock_getcpuclockid2 SYMBOLIC(__NR_clock_getcpuclockid2)
+#define __NR_connectat SYMBOLIC(__NR_connectat)
+#define __NR_cpuset SYMBOLIC(__NR_cpuset)
+#define __NR_cpuset_getdomain SYMBOLIC(__NR_cpuset_getdomain)
+#define __NR_cpuset_getid SYMBOLIC(__NR_cpuset_getid)
+#define __NR_cpuset_setdomain SYMBOLIC(__NR_cpuset_setdomain)
+#define __NR_cpuset_setid SYMBOLIC(__NR_cpuset_setid)
+#define __NR_eaccess SYMBOLIC(__NR_eaccess)
+#define __NR_extattr_delete_fd SYMBOLIC(__NR_extattr_delete_fd)
+#define __NR_extattr_delete_file SYMBOLIC(__NR_extattr_delete_file)
+#define __NR_extattr_delete_link SYMBOLIC(__NR_extattr_delete_link)
+#define __NR_extattr_get_fd SYMBOLIC(__NR_extattr_get_fd)
+#define __NR_extattr_get_file SYMBOLIC(__NR_extattr_get_file)
+#define __NR_extattr_get_link SYMBOLIC(__NR_extattr_get_link)
+#define __NR_extattr_list_fd SYMBOLIC(__NR_extattr_list_fd)
+#define __NR_extattr_list_file SYMBOLIC(__NR_extattr_list_file)
+#define __NR_extattr_list_link SYMBOLIC(__NR_extattr_list_link)
+#define __NR_extattr_set_fd SYMBOLIC(__NR_extattr_set_fd)
+#define __NR_extattr_set_file SYMBOLIC(__NR_extattr_set_file)
+#define __NR_extattr_set_link SYMBOLIC(__NR_extattr_set_link)
+#define __NR_extattrctl SYMBOLIC(__NR_extattrctl)
+#define __NR_fexecve SYMBOLIC(__NR_fexecve)
+#define __NR_ffclock_getcounter SYMBOLIC(__NR_ffclock_getcounter)
+#define __NR_ffclock_getestimate SYMBOLIC(__NR_ffclock_getestimate)
+#define __NR_ffclock_setestimate SYMBOLIC(__NR_ffclock_setestimate)
+#define __NR_fhlink SYMBOLIC(__NR_fhlink)
+#define __NR_fhlinkat SYMBOLIC(__NR_fhlinkat)
+#define __NR_fhreadlink SYMBOLIC(__NR_fhreadlink)
+#define __NR_getaudit SYMBOLIC(__NR_getaudit)
+#define __NR_getcontext SYMBOLIC(__NR_getcontext)
+#define __NR_getfhat SYMBOLIC(__NR_getfhat)
+#define __NR_gethostid SYMBOLIC(__NR_gethostid)
+#define __NR_getkerninfo SYMBOLIC(__NR_getkerninfo)
+#define __NR_getloginclass SYMBOLIC(__NR_getloginclass)
+#define __NR_getpagesize SYMBOLIC(__NR_getpagesize)
+#define __NR_gssd_syscall SYMBOLIC(__NR_gssd_syscall)
+#define __NR_jail SYMBOLIC(__NR_jail)
+#define __NR_jail_attach SYMBOLIC(__NR_jail_attach)
+#define __NR_jail_get SYMBOLIC(__NR_jail_get)
+#define __NR_jail_remove SYMBOLIC(__NR_jail_remove)
+#define __NR_jail_set SYMBOLIC(__NR_jail_set)
+#define __NR_kenv SYMBOLIC(__NR_kenv)
+#define __NR_kldfind SYMBOLIC(__NR_kldfind)
+#define __NR_kldfirstmod SYMBOLIC(__NR_kldfirstmod)
+#define __NR_kldload SYMBOLIC(__NR_kldload)
+#define __NR_kldnext SYMBOLIC(__NR_kldnext)
+#define __NR_kldstat SYMBOLIC(__NR_kldstat)
+#define __NR_kldsym SYMBOLIC(__NR_kldsym)
+#define __NR_kldunload SYMBOLIC(__NR_kldunload)
+#define __NR_kldunloadf SYMBOLIC(__NR_kldunloadf)
+#define __NR_kmq_notify SYMBOLIC(__NR_kmq_notify)
+#define __NR_kmq_setattr SYMBOLIC(__NR_kmq_setattr)
+#define __NR_kmq_timedreceive SYMBOLIC(__NR_kmq_timedreceive)
+#define __NR_kmq_timedsend SYMBOLIC(__NR_kmq_timedsend)
+#define __NR_kmq_unlink SYMBOLIC(__NR_kmq_unlink)
+#define __NR_ksem_close SYMBOLIC(__NR_ksem_close)
+#define __NR_ksem_destroy SYMBOLIC(__NR_ksem_destroy)
+#define __NR_ksem_getvalue SYMBOLIC(__NR_ksem_getvalue)
+#define __NR_ksem_init SYMBOLIC(__NR_ksem_init)
+#define __NR_ksem_open SYMBOLIC(__NR_ksem_open)
+#define __NR_ksem_post SYMBOLIC(__NR_ksem_post)
+#define __NR_ksem_timedwait SYMBOLIC(__NR_ksem_timedwait)
+#define __NR_ksem_trywait SYMBOLIC(__NR_ksem_trywait)
+#define __NR_ksem_unlink SYMBOLIC(__NR_ksem_unlink)
+#define __NR_ksem_wait SYMBOLIC(__NR_ksem_wait)
+#define __NR_ktimer_create SYMBOLIC(__NR_ktimer_create)
+#define __NR_ktimer_delete SYMBOLIC(__NR_ktimer_delete)
+#define __NR_ktimer_getoverrun SYMBOLIC(__NR_ktimer_getoverrun)
+#define __NR_ktimer_gettime SYMBOLIC(__NR_ktimer_gettime)
+#define __NR_ktimer_settime SYMBOLIC(__NR_ktimer_settime)
+#define __NR_lchflags SYMBOLIC(__NR_lchflags)
+#define __NR_lchmod SYMBOLIC(__NR_lchmod)
+#define __NR_lgetfh SYMBOLIC(__NR_lgetfh)
+#define __NR_lpathconf SYMBOLIC(__NR_lpathconf)
+#define __NR_lutimes SYMBOLIC(__NR_lutimes)
+#define __NR_mac_syscall SYMBOLIC(__NR_mac_syscall)
+#define __NR_modfind SYMBOLIC(__NR_modfind)
+#define __NR_modfnext SYMBOLIC(__NR_modfnext)
+#define __NR_modnext SYMBOLIC(__NR_modnext)
+#define __NR_modstat SYMBOLIC(__NR_modstat)
+#define __NR_nfstat SYMBOLIC(__NR_nfstat)
+#define __NR_nlm_syscall SYMBOLIC(__NR_nlm_syscall)
+#define __NR_nlstat SYMBOLIC(__NR_nlstat)
+#define __NR_nmount SYMBOLIC(__NR_nmount)
+#define __NR_nnpfs_syscall SYMBOLIC(__NR_nnpfs_syscall)
+#define __NR_nstat SYMBOLIC(__NR_nstat)
+#define __NR_pdfork SYMBOLIC(__NR_pdfork)
+#define __NR_pdgetpid SYMBOLIC(__NR_pdgetpid)
+#define __NR_pdkill SYMBOLIC(__NR_pdkill)
+#define __NR_posix_openpt SYMBOLIC(__NR_posix_openpt)
+#define __NR_procctl SYMBOLIC(__NR_procctl)
+#define __NR_psynch_cvwait SYMBOLIC(__NR_psynch_cvwait)
+#define __NR_quota SYMBOLIC(__NR_quota)
+#define __NR_rctl_add_rule SYMBOLIC(__NR_rctl_add_rule)
+#define __NR_rctl_get_limits SYMBOLIC(__NR_rctl_get_limits)
+#define __NR_rctl_get_racct SYMBOLIC(__NR_rctl_get_racct)
+#define __NR_rctl_get_rules SYMBOLIC(__NR_rctl_get_rules)
+#define __NR_rctl_remove_rule SYMBOLIC(__NR_rctl_remove_rule)
+#define __NR_recv SYMBOLIC(__NR_recv)
+#define __NR_rfork SYMBOLIC(__NR_rfork)
+#define __NR_rtprio SYMBOLIC(__NR_rtprio)
+#define __NR_rtprio_thread SYMBOLIC(__NR_rtprio_thread)
+#define __NR_send SYMBOLIC(__NR_send)
+#define __NR_setaudit SYMBOLIC(__NR_setaudit)
+#define __NR_setcontext SYMBOLIC(__NR_setcontext)
+#define __NR_setfib SYMBOLIC(__NR_setfib)
+#define __NR_sethostid SYMBOLIC(__NR_sethostid)
+#define __NR_setloginclass SYMBOLIC(__NR_setloginclass)
+#define __NR_sigblock SYMBOLIC(__NR_sigblock)
+#define __NR_sigqueue SYMBOLIC(__NR_sigqueue)
+#define __NR_sigsetmask SYMBOLIC(__NR_sigsetmask)
+#define __NR_sigstack SYMBOLIC(__NR_sigstack)
+#define __NR_sigvec SYMBOLIC(__NR_sigvec)
+#define __NR_sigwaitinfo SYMBOLIC(__NR_sigwaitinfo)
+#define __NR_sstk SYMBOLIC(__NR_sstk)
+#define __NR_swapcontext SYMBOLIC(__NR_swapcontext)
+#define __NR_thr_create SYMBOLIC(__NR_thr_create)
+#define __NR_thr_exit SYMBOLIC(__NR_thr_exit)
+#define __NR_thr_kill SYMBOLIC(__NR_thr_kill)
+#define __NR_thr_kill2 SYMBOLIC(__NR_thr_kill2)
+#define __NR_thr_new SYMBOLIC(__NR_thr_new)
+#define __NR_thr_self SYMBOLIC(__NR_thr_self)
+#define __NR_thr_set_name SYMBOLIC(__NR_thr_set_name)
+#define __NR_thr_suspend SYMBOLIC(__NR_thr_suspend)
+#define __NR_thr_wake SYMBOLIC(__NR_thr_wake)
+#define __NR_uuidgen SYMBOLIC(__NR_uuidgen)
+#define __NR_vadvise SYMBOLIC(__NR_vadvise)
+#define __NR_wait SYMBOLIC(__NR_wait)
+#define __NR_wait6 SYMBOLIC(__NR_wait6)
+#define __NR_yield SYMBOLIC(__NR_yield)
+#define __NR_tfork SYMBOLIC(__NR_tfork)
+#define __NR_thrsleep SYMBOLIC(__NR_thrsleep)
+#define __NR_thrwakeup SYMBOLIC(__NR_thrwakeup)
+#define __NR_threxit SYMBOLIC(__NR_threxit)
+#define __NR_thrsigdivert SYMBOLIC(__NR_thrsigdivert)
+#define __NR_set_tcb SYMBOLIC(__NR_set_tcb)
+#define __NR_get_tcb SYMBOLIC(__NR_get_tcb)
+#define __NR_adjfreq SYMBOLIC(__NR_adjfreq)
+#define __NR_getdtablecount SYMBOLIC(__NR_getdtablecount)
+#define __NR_getlogin_r SYMBOLIC(__NR_getlogin_r)
+#define __NR_getrtable SYMBOLIC(__NR_getrtable)
+#define __NR_getthrid SYMBOLIC(__NR_getthrid)
+#define __NR_kbind SYMBOLIC(__NR_kbind)
+#define __NR_mquery SYMBOLIC(__NR_mquery)
+#define __NR_obreak SYMBOLIC(__NR_obreak)
+#define __NR_sendsyslog SYMBOLIC(__NR_sendsyslog)
+#define __NR_setrtable SYMBOLIC(__NR_setrtable)
+#define __NR_swapctl SYMBOLIC(__NR_swapctl)
+#define __NR_thrkill SYMBOLIC(__NR_thrkill)
+#define __NR_unveil SYMBOLIC(__NR_unveil)
+#define __NR_mac_get_link SYMBOLIC(__NR_mac_get_link)
+#define __NR_mac_set_link SYMBOLIC(__NR_mac_set_link)
+#define __NR_mac_get_fd SYMBOLIC(__NR_mac_get_fd)
+#define __NR_mac_get_file SYMBOLIC(__NR_mac_get_file)
+#define __NR_mac_get_proc SYMBOLIC(__NR_mac_get_proc)
+#define __NR_mac_set_fd SYMBOLIC(__NR_mac_set_fd)
+#define __NR_mac_get_pid SYMBOLIC(__NR_mac_get_pid)
+#define __NR_mac_set_proc SYMBOLIC(__NR_mac_set_proc)
+#define __NR_mac_set_file SYMBOLIC(__NR_mac_set_file)
+#define __NR_mac_execve SYMBOLIC(__NR_mac_execve)
+#define __NR_acl_get_link SYMBOLIC(__NR_acl_get_link)
+#define __NR_sigwait_nocancel SYMBOLIC(__NR_sigwait_nocancel)
+#define __NR_cap_rights_get SYMBOLIC(__NR_cap_rights_get)
+#define __NR_semwait_signal SYMBOLIC(__NR_semwait_signal)
+#define __NR_acl_set_link SYMBOLIC(__NR_acl_set_link)
+#define __NR_acl_set_fd SYMBOLIC(__NR_acl_set_fd)
+#define __NR_old_semwait_signal SYMBOLIC(__NR_old_semwait_signal)
+#define __NR_setugid SYMBOLIC(__NR_setugid)
+#define __NR_acl_aclcheck_fd SYMBOLIC(__NR_acl_aclcheck_fd)
+#define __NR_acl_get_fd SYMBOLIC(__NR_acl_get_fd)
+#define __NR___sysctl SYMBOLIC(__NR___sysctl)
+#define __NR_mac_getfsstat SYMBOLIC(__NR_mac_getfsstat)
+#define __NR_mac_get_mount SYMBOLIC(__NR_mac_get_mount)
+#define __NR_acl_delete_link SYMBOLIC(__NR_acl_delete_link)
+#define __NR_mac_mount SYMBOLIC(__NR_mac_mount)
+#define __NR_acl_get_file SYMBOLIC(__NR_acl_get_file)
+#define __NR_acl_aclcheck_file SYMBOLIC(__NR_acl_aclcheck_file)
+#define __NR_acl_delete_fd SYMBOLIC(__NR_acl_delete_fd)
+#define __NR_acl_aclcheck_link SYMBOLIC(__NR_acl_aclcheck_link)
+#define __NR___mac_syscall SYMBOLIC(__NR___mac_syscall)
+#define __NR_acl_set_file SYMBOLIC(__NR_acl_set_file)
+#define __NR_acl_delete_file SYMBOLIC(__NR_acl_delete_file)
+#define __NR_syscall SYMBOLIC(__NR_syscall)
+#define __NR__umtx_op SYMBOLIC(__NR__umtx_op)
+#define __NR_semwait_signal_nocancel SYMBOLIC(__NR_semwait_signal_nocancel)
+#define __NR_old_semwait_signal_nocancel \
+ SYMBOLIC(__NR_old_semwait_signal_nocancel)
+#define __NR_sctp_peeloff SYMBOLIC(__NR_sctp_peeloff)
+#define __NR_sctp_generic_recvmsg SYMBOLIC(__NR_sctp_generic_recvmsg)
+#define __NR_sctp_generic_sendmsg SYMBOLIC(__NR_sctp_generic_sendmsg)
+#define __NR_sctp_generic_sendmsg_iov SYMBOLIC(__NR_sctp_generic_sendmsg_iov)
+#define __NR_shared_region_map_and_slide_np \
+ SYMBOLIC(__NR_shared_region_map_and_slide_np)
+#define __NR_guarded_open_dprotected_np \
+ SYMBOLIC(__NR_guarded_open_dprotected_np)
+#define __NR_stack_snapshot_with_config \
+ SYMBOLIC(__NR_stack_snapshot_with_config)
+
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_NR_H_ */
diff --git a/libc/sysv/consts/o.h b/libc/sysv/consts/o.h
index fb996275f..6d5d61ebf 100644
--- a/libc/sysv/consts/o.h
+++ b/libc/sysv/consts/o.h
@@ -4,39 +4,39 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
-extern const long O_ACCMODE;
-extern const long O_APPEND;
-extern const long O_ASYNC;
-extern const long O_CLOEXEC;
-extern const long O_CREAT;
-extern const long O_DIRECT;
-extern const long O_DIRECTORY;
-extern const long O_DSYNC;
-extern const long O_EXCL;
-extern const long O_EXEC;
-extern const long O_EXLOCK;
-extern const long O_LARGEFILE;
-extern const long O_NDELAY;
-extern const long O_NOATIME;
-extern const long O_NOCTTY;
-extern const long O_NOFOLLOW;
-extern const long O_NOFOLLOW_ANY;
-extern const long O_NONBLOCK;
-extern const long O_PATH;
-extern const long O_RANDOM;
-extern const long O_RDONLY;
-extern const long O_RDWR;
-extern const long O_RSYNC;
-extern const long O_SEARCH;
-extern const long O_SEQUENTIAL;
-extern const long O_SHLOCK;
-extern const long O_SPARSE;
-extern const long O_SYNC;
-extern const long O_TMPFILE;
-extern const long O_TRUNC;
-extern const long O_TTY_INIT;
-extern const long O_VERIFY;
-extern const long O_WRONLY;
+extern const unsigned O_ACCMODE;
+extern const unsigned O_APPEND;
+extern const unsigned O_ASYNC;
+extern const unsigned O_CLOEXEC;
+extern const unsigned O_CREAT;
+extern const unsigned O_DIRECT;
+extern const unsigned O_DIRECTORY;
+extern const unsigned O_DSYNC;
+extern const unsigned O_EXCL;
+extern const unsigned O_EXEC;
+extern const unsigned O_EXLOCK;
+extern const unsigned O_LARGEFILE;
+extern const unsigned O_NDELAY;
+extern const unsigned O_NOATIME;
+extern const unsigned O_NOCTTY;
+extern const unsigned O_NOFOLLOW;
+extern const unsigned O_NOFOLLOW_ANY;
+extern const unsigned O_NONBLOCK;
+extern const unsigned O_PATH;
+extern const unsigned O_RANDOM;
+extern const unsigned O_RDONLY;
+extern const unsigned O_RDWR;
+extern const unsigned O_RSYNC;
+extern const unsigned O_SEARCH;
+extern const unsigned O_SEQUENTIAL;
+extern const unsigned O_SHLOCK;
+extern const unsigned O_SPARSE;
+extern const unsigned O_SYNC;
+extern const unsigned O_TMPFILE;
+extern const unsigned O_TRUNC;
+extern const unsigned O_TTY_INIT;
+extern const unsigned O_VERIFY;
+extern const unsigned O_WRONLY;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
diff --git a/libc/sysv/syscalls.sh b/libc/sysv/syscalls.sh
index 0b1b75675..3f637cf67 100755
--- a/libc/sysv/syscalls.sh
+++ b/libc/sysv/syscalls.sh
@@ -817,7 +817,6 @@ scall __acl_aclcheck_link 0xffffff1acfffffff globl
scall __mac_syscall 0xfffffffff217dfff globl
scall __acl_set_file 0xffffff15cfffffff globl
scall __acl_delete_file 0xffffff15ffffffff globl
-scall __syscall 0xfff0c6ffffffffff globl
scall _umtx_op 0xffffff1c6fffffff globl
scall __semwait_signal_nocancel 0xfffffffff21a7fff globl
scall __old_semwait_signal_nocancel 0xfffffffff2173fff globl
diff --git a/libc/sysv/systemfive.S b/libc/sysv/systemfive.S
index f1ddd4f68..f2b5f9bca 100644
--- a/libc/sysv/systemfive.S
+++ b/libc/sysv/systemfive.S
@@ -102,6 +102,8 @@ __hostos:
__systemfive:
.quad 0
.endobj __systemfive,globl,hidden
+__pid: .quad 0
+ .endobj __pid,globl,hidden
.previous
.privileged
@@ -310,6 +312,18 @@ _init_systemfive_magnums:
pop %rbx
// 𝑠𝑙𝑖𝑑𝑒
.endfn _init_systemfive_magnums
+#if SupportsSystemv()
+_init_systemfive_pid:
+ ezlea __hostos,cx
+ mov (%rcx),%al
+ mov (%rdi),%eax
+ testb $WINDOWS|METAL,(%rcx)
+ jnz 1f
+ mov __NR_getpid,%eax
+ syscall
+1: stosq
+ .endfn _init_systemfive_pid
+#endif
#if SupportsSystemv() && !defined(TINY)
_init_systemfive_stack: # determinism ftw!
#if SupportsWindows() || SupportsMetal()
diff --git a/libc/testlib/leaks.c b/libc/testlib/leaks.c
index 78f51b2ed..f6c87aca3 100644
--- a/libc/testlib/leaks.c
+++ b/libc/testlib/leaks.c
@@ -18,12 +18,14 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/bits/bits.h"
#include "libc/intrin/asan.internal.h"
-#include "libc/log/libfatal.internal.h"
+#include "libc/intrin/kprintf.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/testlib/testlib.h"
+STATIC_YOINK("__get_symbol_by_addr");
+
static bool once;
static bool hasleaks;
@@ -43,14 +45,14 @@ static noasan void OnMemory(void *x, void *y, size_t n, void *a) {
static int i;
if (n) {
if (++i < 20) {
- __printf("%p %,d bytes", x, n);
+ kprintf("%p %,d bytes", x, n);
if (IsAsan()) {
__asan_print_trace(x);
}
- __printf("\n");
+ kprintf("\n");
}
if (i == 20) {
- __printf("etc. etc.\n");
+ kprintf("etc. etc.\n");
}
}
}
@@ -70,7 +72,7 @@ static noasan bool HasLeaks(void) {
noasan void testlib_checkformemoryleaks(void) {
struct mallinfo mi;
if (!cmpxchg(&once, false, true)) {
- __printf("testlib_checkformemoryleaks() may only be called once\n");
+ kprintf("testlib_checkformemoryleaks() may only be called once\n");
exit(1);
}
__cxa_finalize(0);
@@ -81,23 +83,23 @@ noasan void testlib_checkformemoryleaks(void) {
malloc_trim(0);
if (HasLeaks()) {
mi = mallinfo();
- __printf("\n"
- "UNFREED MEMORY\n"
- "%s\n"
- "max allocated space %,*d\n"
- "total allocated space %,*d\n"
- "total free space %,*d\n"
- "releasable space %,*d\n"
- "mmaped space %,*d\n"
- "non-mmapped space %,*d\n"
- "\n",
- __argv[0], 16l, mi.usmblks, 16l, mi.uordblks, 16l, mi.fordblks,
- 16l, mi.hblkhd, 16l, mi.keepcost, 16l, mi.arena);
+ kprintf("\n"
+ "UNFREED MEMORY\n"
+ "%s\n"
+ "max allocated space %,*d\n"
+ "total allocated space %,*d\n"
+ "total free space %,*d\n"
+ "releasable space %,*d\n"
+ "mmaped space %,*d\n"
+ "non-mmapped space %,*d\n"
+ "\n",
+ __argv[0], 16l, mi.usmblks, 16l, mi.uordblks, 16l, mi.fordblks, 16l,
+ mi.hblkhd, 16l, mi.keepcost, 16l, mi.arena);
if (!IsAsan()) {
- __printf("# NOTE: Use `make -j8 MODE=dbg` for malloc() backtraces\n");
+ kprintf("# NOTE: Use `make -j8 MODE=dbg` for malloc() backtraces\n");
}
malloc_inspect_all(OnMemory, 0);
- __printf("\n");
+ kprintf("\n");
PrintMemoryIntervals(2, &_mmi);
/* PrintSystemMappings(2); */
/* PrintGarbage(); */
diff --git a/libc/testlib/quota.c b/libc/testlib/quota.c
index a9ff4bcbe..3386fcdd7 100644
--- a/libc/testlib/quota.c
+++ b/libc/testlib/quota.c
@@ -20,6 +20,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/sigbits.h"
#include "libc/errno.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/internal.h"
#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
@@ -45,7 +46,7 @@ static relegated void DieBecauseOfQuota(int rc, const char *message) {
char hostname[32];
__stpcpy(hostname, "unknown");
gethostname(hostname, sizeof(hostname));
- __printf("%s on %s pid %d\n", message, hostname, (long)__getpid());
+ kprintf("%s on %s pid %d\n", message, hostname, (long)__getpid());
PrintBacktraceUsingSymbols(2, 0, GetSymbolTable());
exit(rc);
}
@@ -68,32 +69,34 @@ relegated void __oom_hook(size_t request) {
e = errno;
toto = CountMappedBytes();
stats = dlmalloc_stats(g_dlmalloc);
- __printf("\n\nWE REQUIRE MORE VESPENE GAS");
- if (e != ENOMEM) __printf(" (%s)", strerror(e));
- __printf("\n"
- "mmap last request = %d\n"
- "mmapped system bytes = %d\n"
- "malloc max system bytes = %d\n"
- "malloc system bytes = %d\n"
- "malloc in use bytes = %d\n"
- "\n",
- request, toto, stats.maxfp, stats.fp, stats.used);
+ kprintf("\n\nWE REQUIRE MORE VESPENE GAS");
+ if (e != ENOMEM) kprintf(" (%s)", strerror(e));
+ kprintf("\n"
+ "mmap last request = %'ld\n"
+ "mmapped system bytes = %'ld\n"
+ "malloc max system bytes = %'ld\n"
+ "malloc system bytes = %'ld\n"
+ "malloc in use bytes = %'ld\n"
+ "\n",
+ request, toto, stats.maxfp, stats.fp, stats.used);
if (IsRunningUnderMake()) {
newlim = toto + request;
newlim += newlim >> 1;
newlim = roundup2pow(newlim);
- __printf("FIX CODE OR TUNE QUOTA += -M%dm\n", newlim / (1024 * 1024));
+ kprintf("FIX CODE OR TUNE QUOTA += -M%dm\n", newlim / (1024 * 1024));
}
- __printf("\n");
+ kprintf("\n");
PrintMemoryIntervals(2, &_mmi);
- __printf("\nTHE STRAW THAT BROKE THE CAMEL'S BACK\n");
+ kprintf("\nTHE STRAW THAT BROKE THE CAMEL'S BACK\n");
PrintBacktraceUsingSymbols(2, 0, GetSymbolTable());
PrintSystemMappings(2);
exit(42);
}
static textstartup void InstallQuotaHandlers(void) {
+ int e;
struct sigaction sa;
+ e = errno;
sa.sa_flags = 0;
sa.sa_handler = OnXcpu;
sigemptyset(&sa.sa_mask);
@@ -101,6 +104,7 @@ static textstartup void InstallQuotaHandlers(void) {
sa.sa_handler = OnXfsz;
sigaction(SIGXFSZ, &sa, 0);
GetSymbolTable(); /* for effect in case we oom */
+ errno = e;
}
const void *const testlib_quota_handlers[] initarray = {
diff --git a/libc/testlib/showerror.c b/libc/testlib/showerror.c
index 51897d05f..485da8ac6 100644
--- a/libc/testlib/showerror.c
+++ b/libc/testlib/showerror.c
@@ -18,6 +18,7 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/bits/safemacros.internal.h"
#include "libc/fmt/fmt.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/color.internal.h"
#include "libc/log/internal.h"
#include "libc/log/libfatal.internal.h"
@@ -37,15 +38,15 @@ testonly void testlib_showerror(const char *file, int line, const char *func,
/* TODO(jart): Pay off tech debt re duplication */
__getpid(); /* make strace easier to read */
__getpid();
- __printf("%serror%s%s:%s:%d%s: %s() in %s(%s)\n"
- "\t%s\n"
- "\t\tneed %s %s\n"
- "\t\t got %s\n"
- "\t%s%s\n"
- "\t%s%s\n",
- RED2, UNBOLD, BLUE1, file, (long)line, RESET, method, func,
- g_fixturename, code, v1, symbol, v2, SUBTLE, strerror(errno),
- program_executable_name, RESET);
+ kprintf("%serror%s%s:%s:%d%s: %s() in %s(%s)\n"
+ "\t%s\n"
+ "\t\tneed %s %s\n"
+ "\t\t got %s\n"
+ "\t%s%s\n"
+ "\t%s%s\n",
+ RED2, UNBOLD, BLUE1, file, (long)line, RESET, method, func,
+ g_fixturename, code, v1, symbol, v2, SUBTLE, strerror(errno),
+ program_executable_name, RESET);
free_s(&v1);
free_s(&v2);
}
@@ -60,31 +61,31 @@ testonly void testlib_showerror_(int line, const char *wantcode,
e = errno;
__getpid();
__getpid();
- __printf("%serror%s:%s%s:%d%s: %s(%s)\n"
- "\t%s(%s, %s)\n",
- RED2, UNBOLD, BLUE1, testlib_showerror_file, line, RESET,
- testlib_showerror_func, g_fixturename, testlib_showerror_macro,
- wantcode, gotcode);
+ kprintf("%serror%s:%s%s:%d%s: %s(%s)\n"
+ "\t%s(%s, %s)\n",
+ RED2, UNBOLD, BLUE1, testlib_showerror_file, line, RESET,
+ testlib_showerror_func, g_fixturename, testlib_showerror_macro,
+ wantcode, gotcode);
if (wantcode) {
- __printf("\t\tneed %s %s\n"
- "\t\t got %s\n",
- FREED_want, testlib_showerror_symbol, FREED_got);
+ kprintf("\t\tneed %s %s\n"
+ "\t\t got %s\n",
+ FREED_want, testlib_showerror_symbol, FREED_got);
} else {
- __printf("\t\t→ %s%s\n", testlib_showerror_symbol, FREED_want);
+ kprintf("\t\t→ %s%s\n", testlib_showerror_symbol, FREED_want);
}
if (!isempty(fmt)) {
- __printf("\t");
+ kprintf("\t");
va_start(va, fmt);
- __vprintf(fmt, va);
+ kvprintf(fmt, va);
va_end(va);
- __printf("\n");
+ kprintf("\n");
}
__stpcpy(hostname, "unknown");
gethostname(hostname, sizeof(hostname));
- __printf("\t%s%s%s\n"
- "\t%s%s @ %s%s\n",
- SUBTLE, strerror(e), RESET, SUBTLE, program_invocation_name,
- hostname, RESET);
+ kprintf("\t%s%s%s\n"
+ "\t%s%s @ %s%s\n",
+ SUBTLE, strerror(e), RESET, SUBTLE, program_invocation_name, hostname,
+ RESET);
free_s(&FREED_want);
free_s(&FREED_got);
++g_testlib_failed;
diff --git a/libc/zipos/zipos.internal.h b/libc/zipos/zipos.internal.h
index 89c8c8f26..e659160ba 100644
--- a/libc/zipos/zipos.internal.h
+++ b/libc/zipos/zipos.internal.h
@@ -6,7 +6,7 @@
COSMOPOLITAN_C_START_
#if DEBUGSYS
-#define ZTRACE(FMT, ...) __printf("ZIP: " FMT "\n", ##__VA_ARGS__)
+#define ZTRACE(FMT, ...) kprintf("ZIP: " FMT "\n", ##__VA_ARGS__)
#else
#define ZTRACE(FMT, ...) (void)0
#endif
diff --git a/test/libc/fmt/strerror_r_test.c b/test/libc/fmt/strerror_r_test.c
index 98e78a8d2..1f8552188 100644
--- a/test/libc/fmt/strerror_r_test.c
+++ b/test/libc/fmt/strerror_r_test.c
@@ -30,55 +30,25 @@
*/
TEST(strerror, e2big) {
- if (IsTiny()) {
- EXPECT_STARTSWITH("E2BIG", strerror(E2BIG));
- } else {
- EXPECT_STARTSWITH("E2BIG[Arg list too long]", strerror(E2BIG));
- }
+ EXPECT_STARTSWITH("E2BIG", strerror(E2BIG));
}
TEST(strerror, enosys) {
- if (IsTiny()) {
- EXPECT_STARTSWITH("ENOSYS", strerror(ENOSYS));
- } else {
- EXPECT_STARTSWITH("ENOSYS[Function not implemented]", strerror(ENOSYS));
- }
+ EXPECT_STARTSWITH("ENOSYS", strerror(ENOSYS));
}
TEST(strerror, einval) {
- if (IsTiny()) {
- EXPECT_STARTSWITH("EINVAL", strerror(EINVAL));
- } else {
- EXPECT_STARTSWITH("EINVAL[Invalid argument]", strerror(EINVAL));
- }
+ EXPECT_STARTSWITH("EINVAL", strerror(EINVAL));
}
TEST(strerror, symbolizingTheseNumbersAsErrorsIsHeresyInUnixStyle) {
- if (IsTiny()) {
- EXPECT_STARTSWITH("EUNKNOWN", strerror(0));
- } else {
- EXPECT_STARTSWITH("EUNKNOWN[No error information]", strerror(0));
- }
- if (IsTiny()) {
- EXPECT_STARTSWITH("EUNKNOWN", strerror(-1));
- } else {
- EXPECT_STARTSWITH("EUNKNOWN[No error information]", strerror(-1));
- }
+ EXPECT_STARTSWITH("EUNKNOWN", strerror(0));
}
TEST(strerror, enotconn_orLinkerIsntUsingLocaleC_orCodeIsOutOfSync) {
- if (IsTiny()) {
- EXPECT_STARTSWITH("ENOTCONN", strerror(ENOTCONN));
- } else {
- EXPECT_STARTSWITH("ENOTCONN[Transport endpoint is not connected]",
- strerror(ENOTCONN));
- }
+ EXPECT_STARTSWITH("ENOTCONN", strerror(ENOTCONN));
}
TEST(strerror, exfull_orLinkerIsntUsingLocaleC_orCodeIsOutOfSync) {
- if (IsTiny()) {
- EXPECT_STARTSWITH("ETXTBSY", strerror(ETXTBSY));
- } else {
- EXPECT_STARTSWITH("ETXTBSY[Text file busy]", strerror(ETXTBSY));
- }
+ EXPECT_STARTSWITH("ETXTBSY", strerror(ETXTBSY));
}
diff --git a/test/libc/intrin/kprintf_test.c b/test/libc/intrin/kprintf_test.c
new file mode 100644
index 000000000..389d0afb4
--- /dev/null
+++ b/test/libc/intrin/kprintf_test.c
@@ -0,0 +1,372 @@
+/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
+│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
+╞══════════════════════════════════════════════════════════════════════════════╡
+│ Copyright 2021 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/bits/bits.h"
+#include "libc/calls/calls.h"
+#include "libc/errno.h"
+#include "libc/fmt/fmt.h"
+#include "libc/intrin/kprintf.h"
+#include "libc/limits.h"
+#include "libc/log/libfatal.internal.h"
+#include "libc/macros.internal.h"
+#include "libc/rand/rand.h"
+#include "libc/runtime/memtrack.internal.h"
+#include "libc/runtime/runtime.h"
+#include "libc/str/str.h"
+#include "libc/sysv/consts/map.h"
+#include "libc/sysv/consts/prot.h"
+#include "libc/testlib/ezbench.h"
+#include "libc/testlib/testlib.h"
+
+#define S(x) ((uintptr_t)(x))
+
+/**
+ * returns random bytes that don't have exclamation mark
+ * since that would disable memory safety in the fuzzing
+ */
+static uint64_t Rando(void) {
+ uint64_t x;
+ do x = vigna();
+ while (((x ^ READ64LE("!!!!!!!!")) - 0x0101010101010101) &
+ ~(x ^ READ64LE("!!!!!!!!")) & 0x8080808080808080);
+ return x;
+}
+
+static const struct {
+ const char *want;
+ const char *fmt;
+ uintptr_t arg1;
+ uintptr_t arg2;
+} V[] = {
+ {"!!WONTFMT", (const char *)31337, 123}, //
+ {"!!31337", "%s", 0x31337}, //
+ {"!!1", "%#s", 1}, //
+ {"!!feff800000031337", "%s", 0xfeff800000031337ull}, //
+ {"!!ffff800000031337", "%s", 0xffff800000031337ull}, //
+ {"123", "%d", 123}, //
+ {"2147483647", "%d", INT_MAX}, //
+ {"-2147483648", "%d", INT_MIN}, //
+ {"9223372036854775807", "%ld", LONG_MAX}, //
+ {"-9223372036854775808", "%ld", LONG_MIN}, //
+ {"9'223'372'036'854'775'807", "%'ld", LONG_MAX}, //
+ {"-9'223'372'036'854'775'808", "%'ld", LONG_MIN}, //
+ {"9,223,372,036,854,775,807", "%,ld", LONG_MAX}, //
+ {"-9,223,372,036,854,775,808", "%,ld", LONG_MIN}, //
+ {"9_223_372_036_854_775_807", "%_ld", LONG_MAX}, //
+ {"-9_223_372_036_854_775_808", "%_ld", LONG_MIN}, //
+ {"true", "%hhhd", 0xffff}, //
+ {"true", "%hhhd", 0xff00}, //
+ {"false", "%hhhd"}, //
+ {"fa", "%hhh.2d"}, //
+ {" 0x001337", "%#010.6x", 0x1337}, //
+ {"0x001337 ", "%#-010.6x", 0x1337}, //
+ {"0x1337 ", "%#-010.2x", 0x1337}, //
+ {" 0x1337", "%#010.2x", 0x1337}, //
+ {"0000001337", "%010d", 1337}, //
+ {"+000001337", "%+010d", 1337}, //
+ {" 001337", "%010.6d", 1337}, //
+ {" +001337", "%+010.6d", 1337}, //
+ {" 001337", "%010.6x", 0x1337}, //
+ {" 1337", "%010.2x", 0x1337}, //
+ {"1337 ", "%-010d", 1337}, //
+ {"001337 ", "%-010.6d", 1337}, //
+ {"+1337 ", "%+-010d", 1337}, //
+ {"+001337 ", "%+-010.6d", 1337}, //
+ {"001337 ", "%-010.6x", 0x1337}, //
+ {"1337 ", "%-010.2x", 0x1337}, //
+ {"000001'337", "%'010d", 1337}, //
+ {" 1337", "%*d", 10, 1337}, //
+ {"1337 ", "%*d", -10, 1337}, //
+ {"0", "%#x"}, //
+ {"0", "%#o"}, //
+ {"0", "%#b"}, //
+ {"0", "%#d"}, //
+ {"0", "%p"}, //
+ {"-1", "%p", S(MAP_FAILED)}, //
+ {"00000000", "%#.8x"}, //
+ {"00000000", "%#.8b"}, //
+ {"00000000", "%#.8o"}, //
+ {" 123", "%5d", 123}, //
+ {" -123", "%5d", -123}, //
+ {" 123", "%*d", 5, 123}, //
+ {" -123", "%*d", 5, -123}, //
+ {"123 ", "%-5d", 123}, //
+ {"-123 ", "%-5d", -123}, //
+ {" +123", "%+5d", 123}, //
+ {"00123", "%05d", 123}, //
+ {"-0123", "%05d", -123}, //
+ {" 0", "%5d"}, //
+ {" +0", "%+5d"}, //
+ {"00000", "%05d"}, //
+ {" deadbeef", "%20x", 0xdeadbeef}, //
+ {" 0xdeadbeef", "%20p", 0xdeadbeef}, //
+ {"101", "%b", 0b101}, //
+ {"123", "%x", 0x123}, //
+ {"deadbeef", "%x", 0xdeadbeef}, //
+ {"DEADBEEF", "%X", 0xdeadbeef}, //
+ {"0", "%hd", INT_MIN}, //
+ {"123", "%o", 0123}, //
+ {"+0", "%+d"}, //
+ {"+123", "%+d", 123}, //
+ {"-123", "%+d", -123}, //
+ {" 0", "% d"}, //
+ {" 123", "% d", 123}, //
+ {"-123", "% d", -123}, //
+ {"x", "%c", 'x'}, //
+ {"☺", "%hc", u'☺'}, //
+ {"☺", "%lc", L'☺'}, //
+ {"☺", "%C", L'☺'}, //
+ {"0x31337", "%p", 0x31337}, //
+ {"0xffff800000031337", "%p", 0xffff800000031337ull}, //
+ {"0xfeff800000031337", "%p", 0xfeff800000031337ull}, //
+ {"65535", "%hu", 0xffffffffu}, //
+ {"0", "%hu", 0x80000000u}, //
+ {"123", "%hd", 123}, //
+ {"32767", "%hd", SHRT_MAX}, //
+ {"-32768", "%hd", SHRT_MIN}, //
+ {"-1", "%hhd", 0xffff}, //
+ {"-128", "%hhd", 0xff80}, //
+ {"255", "%hhu", 0xffffffffu}, //
+ {"'x'", "%#c", 'x'}, //
+ {"u'☺'", "%#hc", u'☺'}, //
+ {"L'☺'", "%#lc", L'☺'}, //
+ {"L'☺'", "%#C", L'☺'}, //
+ {"L'\\''", "%#C", L'\''}, //
+ {"hello world\n", "%s", S("hello world\n")}, //
+ {"☺☻♥♦♣♠!\n", "%s", S("☺☻♥♦♣♠!\n")}, //
+ {"␁", "%s", S("\1")}, //
+ {"\1", "%.*s", 1, S("\1")}, //
+ {"\\001", "%'s", S("\1")}, //
+ {"\"\\001\"", "%#s", S("\1")}, //
+ {"", "%.*s", 0}, //
+ {"☺☻♥♦♣♠!", "%hhs", S("\1\2\3\4\5\6!")}, //
+ {"", "% s", S("")}, //
+ {" a", "% s", S("a")}, //
+ {"", "% .*s", 0, S("a")}, //
+ {"", "% s"}, //
+ {"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷", "%hs", S(u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷")}, //
+ {"☺☻♥♦♣♠!", "%ls", S(L"☺☻♥♦♣♠!")}, //
+ {"☺☻♥♦♣♠!\n", "%S", S(L"☺☻♥♦♣♠!\n")}, //
+ {"eeeeeee ", "%10s", S("eeeeeee")}, //
+ {"hello", "%.*s", 5, S("hello world")}, //
+ {"þell", "%.*s", 5, S("þello world")}, //
+ {"þello", "%.*hs", 5, S(u"þello world")}, //
+ {"þeeeeee ", "%10s", S("þeeeeee")}, //
+ {"☺☻♥♦♣♠! ", "%10s", S("☺☻♥♦♣♠!")}, //
+ {"☺☻♥♦♣♠ ", "%10hs", S(u"☺☻♥♦♣♠")}, //
+ {"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷 ", "%10hs", S(u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷")}, //
+ {"☺☻♥♦♣♠! ", "%10ls", S(L"☺☻♥♦♣♠!")}, //
+ {"\"xx\"", "%#s", S("xx")}, //
+ {"u\"☺☺\"", "%#hs", S(u"☺☺")}, //
+ {"L\"☺☺\"", "%#ls", S(L"☺☺")}, //
+ {"L\"☺☺\"", "%#S", S(L"☺☺")}, //
+ {"\"\\\\\\\"\\177\"", "%#s", S("\\\"\177")}, //
+ {"%%", "%%%%"}, //
+ {"%", "%.%"}, //
+ {"=", "%="}, //
+};
+
+TEST(ksnprintf, test) {
+ char b[48], g[48];
+ size_t i, j, n, rc;
+ rngset(g, sizeof(g), 0, 0);
+ for (i = 0; i < ARRAYLEN(V); ++i) {
+ bzero(b, 48);
+ n = strlen(V[i].want);
+ rc = ksnprintf(b, 48, V[i].fmt, V[i].arg1, V[i].arg2);
+ EXPECT_EQ(n, rc, "ksnprintf(\"%s\", %#lx, %#lx) → %zu ≠ %zu", V[i].fmt,
+ V[i].arg1, V[i].arg2, rc, n);
+ EXPECT_STREQ(V[i].want, b);
+ memcpy(b, g, 48);
+ for (j = 0; j < 40; ++j) {
+ rc = ksnprintf(b, 0, V[i].fmt, V[i].arg1, V[i].arg2);
+ ASSERT_EQ(n, rc, "ksnprintf(b, %zu, \"%s\", %#lx, %#lx) → %zu ≠ %zu", j,
+ V[i].fmt, V[i].arg1, V[i].arg2, rc, n);
+ ASSERT_EQ(READ64LE(g + j), READ64LE(b + j),
+ "ksnprintf(b, %zu, \"%s\", %#lx, %#lx) → buffer overrun", j,
+ V[i].fmt, V[i].arg1, V[i].arg2);
+ }
+ }
+}
+
+TEST(ksnprintf, fuzzTheUnbreakable) {
+ int e;
+ size_t i;
+ uint64_t x;
+ char *f, b[32];
+ _Alignas(PAGESIZE) static const char weasel[PAGESIZE];
+ asm("mov\t%1,%0" : "=r"(f) : "g"(weasel));
+ EXPECT_SYS(0, 0, mprotect(f, PAGESIZE, PROT_READ | PROT_WRITE));
+ strcpy(f, "hello %s\n");
+ EXPECT_EQ(12, ksnprintf(b, sizeof(b), f, "world"));
+ EXPECT_STREQ("hello world\n", b);
+ for (i = 0; i < 30000; ++i) {
+ x = Rando();
+ memcpy(f, &x, sizeof(x));
+ x = Rando();
+ memcpy(f + 8, &x, sizeof(x));
+ f[Rando() & 15] = '%';
+ ksnprintf(b, sizeof(b), f, vigna(), vigna(), vigna());
+ }
+ EXPECT_SYS(0, 0, mprotect(f, PAGESIZE, PROT_READ));
+}
+
+TEST(kprintf, testFailure_wontClobberErrnoAndBypassesSystemCallSupport) {
+ int n;
+#if 0
+ ASSERT_EQ(0, errno); /* xxx: todo(jart) */
+#else
+ errno = 0;
+#endif
+ EXPECT_SYS(0, 3, dup(2));
+ EXPECT_SYS(0, 0, close(2));
+ n = g_syscount;
+ kprintf("hello%n");
+ EXPECT_EQ(n, g_syscount);
+ EXPECT_EQ(0, errno);
+ EXPECT_SYS(0, 2, dup2(3, 2));
+ EXPECT_SYS(0, 0, close(3));
+}
+
+TEST(ksnprintf, testy) {
+ char b[32];
+ EXPECT_EQ(3, ksnprintf(b, 32, "%#s", 1));
+ EXPECT_STREQ("!!1", b);
+}
+
+TEST(ksnprintf, testNonTextFmt_wontFormat) {
+ char b[32];
+ char variable_format_string[16] = "%s";
+ EXPECT_EQ(9, ksnprintf(b, 32, variable_format_string, NULL));
+ EXPECT_STREQ("!!WONTFMT", b);
+}
+
+TEST(ksnprintf, testMisalignedPointer_wontFormat) {
+ char b[32];
+ const char16_t *s = u"hello";
+ ksnprintf(b, 32, "%hs", (char *)s + 1);
+ EXPECT_STARTSWITH("!!", b);
+}
+
+TEST(ksnprintf, testUnterminatedOverrun_truncatesAtPageBoundary) {
+ char *m;
+ char b[32];
+ m = memset(mapanon(FRAMESIZE * 2), 1, FRAMESIZE);
+ EXPECT_SYS(0, 0, munmap(m + FRAMESIZE, FRAMESIZE));
+ EXPECT_EQ(12, ksnprintf(b, 32, "%'s", m + FRAMESIZE - 3));
+ EXPECT_STREQ("\\001\\001\\001", b);
+ EXPECT_SYS(0, 0, munmap(m, FRAMESIZE));
+}
+
+TEST(ksnprintf, testEmptyBuffer_determinesTrueLength) {
+ EXPECT_EQ(5, ksnprintf(0, 0, "hello"));
+}
+
+TEST(ksnprintf, testFormatOnly_copiesString) {
+ char b[6];
+ EXPECT_EQ(5, ksnprintf(b, 6, "hello"));
+ EXPECT_STREQ("hello", b);
+}
+
+TEST(ksnprintf, testOneChar_justNulTerminates) {
+ char b[2] = {1, 2};
+ EXPECT_EQ(3, ksnprintf(b, 1, "%d", 123));
+ EXPECT_EQ(0, b[0]);
+ EXPECT_EQ(2, b[1]);
+}
+
+TEST(kprintf, testStringUcs2) {
+ char b[32];
+ EXPECT_EQ(21, ksnprintf(b, 32, "%hs", u"þ☺☻♥♦♣♠!"));
+ EXPECT_EQ(0xc3, b[0] & 255);
+ EXPECT_EQ(0xbe, b[1] & 255);
+ EXPECT_EQ(0xe2, b[2] & 255);
+ EXPECT_EQ(0x98, b[3] & 255);
+ EXPECT_EQ(0xba, b[4] & 255);
+ EXPECT_STREQ("þ☺☻♥♦♣♠!", b);
+}
+
+TEST(kprintf, testTruncate_addsDotsAndReturnsTrueLength) {
+ char b[15];
+ EXPECT_EQ(10, ksnprintf(b, 15, "%p", 0xdeadbeef));
+ EXPECT_STREQ("0xdeadbeef", b);
+ EXPECT_EQ(10, ksnprintf(b, 10, "%p", 0xdeadbeef));
+ EXPECT_STREQ("0xdead...", b);
+}
+
+TEST(kprintf, testTruncate_preservesNewlineFromEndOfFormatString) {
+ char b[14];
+ EXPECT_EQ(11, ksnprintf(b, 10, "%p\n", 0xdeadbeef));
+ EXPECT_STREQ("0xdea...\n", b);
+}
+
+TEST(ksnprintf, testTruncate_doesntBreakApartCharacters) {
+ char b[5];
+ ASSERT_EQ(6, ksnprintf(b, 5, "☻☻"));
+ ASSERT_STREQ("....", b);
+}
+
+TEST(ksnprintf, badUtf16) {
+ size_t i;
+ char b[16];
+ static const struct {
+ const char *want;
+ const char *fmt;
+ char16_t arg[16];
+ } V[] = {
+ {"� ", "%10hs", {0xd800}},
+ {"� ", "%10hs", {0xdc00}},
+ {"�� ", "%10hs", {0xd800, 0xd800}},
+ {"�� ", "%10hs", {0xdc00, 0xdc00}},
+ };
+ for (i = 0; i < ARRAYLEN(V); ++i) {
+ EXPECT_EQ(strlen(V[i].want), ksnprintf(b, 16, V[i].fmt, V[i].arg));
+ EXPECT_STREQ(V[i].want, b);
+ }
+}
+
+BENCH(printf, bench) {
+ char b[128];
+ int snprintf_(char *, size_t, const char *, ...) asm("snprintf");
+ EZBENCH2("ksnprintf fmt", donothing,
+ ksnprintf(b, 128,
+ "hello world\nhello world\nhello world\nhello world\n"));
+ EZBENCH2("snprintf fmt", donothing,
+ snprintf_(b, 128,
+ "hello world\nhello world\nhello world\nhello world\n"));
+ EZBENCH2("ksnprintf str", donothing,
+ ksnprintf(b, 128, "%s\n", "hello world"));
+ EZBENCH2("snprintf str", donothing,
+ snprintf_(b, 128, "%s\n", "hello world"));
+ EZBENCH2("ksnprintf utf8", donothing,
+ ksnprintf(b, 128, "%s\n", "天地玄黄宇宙洪荒天地玄黄宇宙洪荒"));
+ EZBENCH2("snprintf utf8", donothing,
+ snprintf_(b, 128, "%s\n", "天地玄黄宇宙洪荒天地玄黄宇宙洪荒"));
+ EZBENCH2("ksnprintf chinese", donothing,
+ ksnprintf(b, 128, "%hs\n", u"天地玄黄宇宙洪荒"));
+ EZBENCH2("snprintf chinese", donothing,
+ snprintf_(b, 128, "%hs\n", u"天地玄黄宇宙洪荒"));
+ EZBENCH2("ksnprintf astral", donothing,
+ ksnprintf(b, 128, "%hs\n", u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷"));
+ EZBENCH2("snprintf astral", donothing,
+ snprintf_(b, 128, "%hs\n", u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷"));
+ EZBENCH2("ksnprintf long", donothing, ksnprintf(b, 128, "%ld", LONG_MAX));
+ EZBENCH2("snprintf long", donothing, snprintf_(b, 128, "%ld", LONG_MAX));
+ EZBENCH2("ksnprintf thou", donothing, ksnprintf(b, 128, "%'ld", LONG_MAX));
+ EZBENCH2("snprintf thou", donothing, snprintf_(b, 128, "%'ld", LONG_MAX));
+}
diff --git a/test/libc/intrin/test.mk b/test/libc/intrin/test.mk
index b8c23624a..c29c57784 100644
--- a/test/libc/intrin/test.mk
+++ b/test/libc/intrin/test.mk
@@ -24,7 +24,6 @@ TEST_LIBC_INTRIN_CHECKS = \
TEST_LIBC_INTRIN_DIRECTDEPS = \
LIBC_CALLS \
- LIBC_STDIO \
LIBC_FMT \
LIBC_INTRIN \
LIBC_LOG \
@@ -32,10 +31,13 @@ TEST_LIBC_INTRIN_DIRECTDEPS = \
LIBC_NEXGEN32E \
LIBC_RAND \
LIBC_RUNTIME \
+ LIBC_STDIO \
LIBC_STR \
LIBC_STUBS \
+ LIBC_SYSV \
LIBC_TESTLIB \
LIBC_TINYMATH \
+ LIBC_UNICODE \
LIBC_X \
TOOL_VIZ_LIB
diff --git a/test/libc/nexgen32e/gclongjmp_test.c b/test/libc/nexgen32e/gclongjmp_test.c
index a39227ef2..e74f05d66 100644
--- a/test/libc/nexgen32e/gclongjmp_test.c
+++ b/test/libc/nexgen32e/gclongjmp_test.c
@@ -62,7 +62,7 @@ void (*Bp)(void(void)) = B;
void (*Cp)(void) = C;
TEST(gclongjmp, test) {
- PrintGarbage();
+ if (0) PrintGarbage();
if (!setjmp(jb)) {
Ap(Cp, Bp);
abort();
diff --git a/test/libc/stdio/getdelim_test.c b/test/libc/stdio/getdelim_test.c
index 9f37d5cd1..60700469c 100644
--- a/test/libc/stdio/getdelim_test.c
+++ b/test/libc/stdio/getdelim_test.c
@@ -18,6 +18,7 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/assert.h"
#include "libc/bits/bits.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/symbols.internal.h"
@@ -98,7 +99,6 @@ void ReadHyperionLines(void) {
ASSERT_NE(NULL, (f = fopen("hyperion.txt", "r")));
int i = 0;
for (;;) {
- __printf("i=%d\n", i++);
rc = getline(&line, &linesize, f);
if (rc == -1) break;
data = xrealloc(data, size + rc);
diff --git a/third_party/linenoise/linenoise.c b/third_party/linenoise/linenoise.c
index 2d0092d5f..cdfb4789d 100644
--- a/third_party/linenoise/linenoise.c
+++ b/third_party/linenoise/linenoise.c
@@ -131,7 +131,6 @@
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/intrin/asan.internal.h"
-#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
@@ -250,6 +249,7 @@ static char maskmode;
static char ispaused;
static char iscapital;
static int historylen;
+extern bool __replmode;
static struct linenoiseRing ring;
static struct sigaction orig_int;
static struct sigaction orig_quit;
@@ -349,6 +349,51 @@ static size_t GetFdSize(int fd) {
return st.st_size;
}
+static char IsCharDev(int fd) {
+ struct stat st;
+ st.st_mode = 0;
+ fstat(fd, &st);
+ return (st.st_mode & S_IFMT) == S_IFCHR;
+}
+
+static int linenoiseIsUnsupportedTerm(void) {
+ int i;
+ char *term;
+ static char once, res;
+ if (!once) {
+ if ((term = getenv("TERM"))) {
+ for (i = 0; i < sizeof(kUnsupported) / sizeof(*kUnsupported); i++) {
+ if (!strcasecmp(term, kUnsupported[i])) {
+ res = 1;
+ break;
+ }
+ }
+ }
+ once = 1;
+ }
+ return res;
+}
+
+static int linenoiseIsTerminal(void) {
+ static int once, res;
+ if (!once) {
+ res = isatty(fileno(stdin)) && isatty(fileno(stdout)) &&
+ !linenoiseIsUnsupportedTerm();
+ once = 1;
+ }
+ return res;
+}
+
+static int linenoiseIsTeletype(void) {
+ static int once, res;
+ if (!once) {
+ res = linenoiseIsTerminal() ||
+ (IsCharDev(fileno(stdin)) && IsCharDev(fileno(stdout)));
+ once = 1;
+ }
+ return res;
+}
+
static char *GetLine(FILE *f) {
ssize_t rc;
char *p = 0;
@@ -420,6 +465,7 @@ static char *FormatUnsigned(char *p, unsigned x) {
}
static char HasPendingInput(int fd) {
+ if (IsWindows()) return 0;
return poll((struct pollfd[]){{fd, POLLIN}}, 1, 0) == 1;
}
@@ -557,24 +603,6 @@ static void abFree(struct abuf *a) {
free(a->b);
}
-static int linenoiseIsUnsupportedTerm(void) {
- int i;
- char *term;
- static char once, res;
- if (!once) {
- if ((term = getenv("TERM"))) {
- for (i = 0; i < sizeof(kUnsupported) / sizeof(*kUnsupported); i++) {
- if (!strcasecmp(term, kUnsupported[i])) {
- res = 1;
- break;
- }
- }
- }
- once = 1;
- }
- return res;
-}
-
static void linenoiseUnpause(int fd) {
if (ispaused) {
tcflow(fd, TCOON);
@@ -1162,9 +1190,11 @@ StartOver:
rune = GetUtf8(buf + i, len - i);
if (x && x + rune.n > xn) {
if (cy >= 0) ++cy;
- abAppends(&ab, "\033[K" /* clear line forward */
- "\r" /* start of line */
- "\n"); /* cursor down unclamped */
+ if (x < xn) {
+ abAppends(&ab, "\033[K"); /* clear line forward */
+ }
+ abAppends(&ab, "\r" /* start of line */
+ "\n"); /* cursor down unclamped */
++rows;
x = 0;
}
@@ -2010,6 +2040,26 @@ char *linenoiseRaw(const char *prompt, int infd, int outfd) {
}
}
+static int linenoiseFallback(const char *prompt, char **res) {
+ if (prompt && *prompt &&
+ (strchr(prompt, '\n') || strchr(prompt, '\t') ||
+ strchr(prompt + 1, '\r'))) {
+ errno = EINVAL;
+ *res = 0;
+ return 1;
+ }
+ if (!linenoiseIsTerminal()) {
+ if (prompt && *prompt && linenoiseIsTeletype()) {
+ fputs(prompt, stdout);
+ fflush(stdout);
+ }
+ *res = GetLine(stdin);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
/**
* Reads line intelligently.
*
@@ -2025,24 +2075,14 @@ char *linenoiseRaw(const char *prompt, int infd, int outfd) {
* @return chomped allocated string of read line or null on eof/error
*/
char *linenoise(const char *prompt) {
- if (prompt && *prompt &&
- (strchr(prompt, '\n') || strchr(prompt, '\t') ||
- strchr(prompt + 1, '\r'))) {
- errno = EINVAL;
- return 0;
- }
- if ((!isatty(fileno(stdin)) || !isatty(fileno(stdout)))) {
- return GetLine(stdin);
- } else if (linenoiseIsUnsupportedTerm()) {
- if (prompt && *prompt) {
- fputs(prompt, stdout);
- fflush(stdout);
- }
- return GetLine(stdin);
- } else {
- fflush(stdout);
- return linenoiseRaw(prompt, fileno(stdin), fileno(stdout));
- }
+ char *res;
+ if (linenoiseFallback(prompt, &res)) return res;
+ fflush(stdout);
+ fflush(stdout);
+ __replmode = true;
+ res = linenoiseRaw(prompt, fileno(stdin), fileno(stdout));
+ __replmode = false;
+ return res;
}
/**
@@ -2066,9 +2106,11 @@ char *linenoise(const char *prompt) {
* @return chomped allocated string of read line or null on eof/error
*/
char *linenoiseWithHistory(const char *prompt, const char *prog) {
- char *line;
+ char *line, *res;
struct abuf path;
const char *a, *b;
+ if (linenoiseFallback(prompt, &res)) return res;
+ fflush(stdout);
abInit(&path);
if (prog) {
if (strchr(prog, '/') || strchr(prog, '.')) {
diff --git a/third_party/mbedtls/sha256.c b/third_party/mbedtls/sha256.c
index ef1e3f2f9..a623517e1 100644
--- a/third_party/mbedtls/sha256.c
+++ b/third_party/mbedtls/sha256.c
@@ -175,15 +175,17 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
if( !IsTiny() || X86_NEED( SHA ) )
{
- if( X86_HAVE( SHA ) )
+ if( X86_HAVE( SHA ) &&
+ X86_HAVE( SSE2 ) &&
+ X86_HAVE( SSSE3 ) )
{
if( IsAsan() )
__asan_verify( data, 64 );
sha256_transform_ni( ctx->state, data, 1 );
return( 0 );
}
- if( X86_HAVE( BMI ) &&
- X86_HAVE( BMI2 ) &&
+ if( X86_HAVE( BMI2 ) &&
+ X86_HAVE( AVX ) &&
X86_HAVE( AVX2 ) )
{
if( IsAsan() )
@@ -310,7 +312,10 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
if( ilen >= 64 )
{
- if( ( !IsTiny() || X86_NEED( SHA ) ) && X86_HAVE( SHA ) )
+ if( !IsTiny() &&
+ X86_HAVE( SHA ) &&
+ X86_HAVE( SSE2 ) &&
+ X86_HAVE( SSSE3 ) )
{
if( IsAsan() )
__asan_verify( input, ilen );
diff --git a/third_party/python/Include/ezprint.h b/third_party/python/Include/ezprint.h
index deb349781..ca8b3e841 100644
--- a/third_party/python/Include/ezprint.h
+++ b/third_party/python/Include/ezprint.h
@@ -1,7 +1,7 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_PYTHON_INCLUDE_EZPRINT_H_
#define COSMOPOLITAN_THIRD_PARTY_PYTHON_INCLUDE_EZPRINT_H_
#include "libc/calls/calls.h"
-#include "libc/log/libfatal.internal.h"
+#include "libc/intrin/kprintf.h"
#include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/bytesobject.h"
#include "third_party/python/Include/pyerrors.h"
@@ -11,24 +11,24 @@ COSMOPOLITAN_C_START_
static void EzPrint(PyObject *x, const char *s) {
PyObject *u, *r, *t;
- __printf("%s = ", s);
+ kprintf("%s = ", s);
if (!s) {
- __printf("NULL");
+ kprintf("NULL");
} else {
t = PyObject_Type(x);
r = PyObject_Repr(t);
u = PyUnicode_AsUTF8String(r);
- __printf("%.*s ", PyBytes_GET_SIZE(u), PyBytes_AS_STRING(u));
+ kprintf("%.*s ", PyBytes_GET_SIZE(u), PyBytes_AS_STRING(u));
Py_DECREF(u);
Py_DECREF(r);
Py_DECREF(t);
r = PyObject_Repr(x);
u = PyUnicode_AsUTF8String(r);
- __printf("%.*s", PyBytes_GET_SIZE(u), PyBytes_AS_STRING(u));
+ kprintf("%.*s", PyBytes_GET_SIZE(u), PyBytes_AS_STRING(u));
Py_DECREF(u);
Py_DECREF(r);
}
- __printf("\n");
+ kprintf("\n");
}
#define EZPRINT(x) EzPrint(x, #x)
diff --git a/third_party/python/Lib/test/support/__init__.py b/third_party/python/Lib/test/support/__init__.py
index da08e991d..4a2c857f3 100644
--- a/third_party/python/Lib/test/support/__init__.py
+++ b/third_party/python/Lib/test/support/__init__.py
@@ -3,6 +3,7 @@
if __name__ != 'test.support':
raise ImportError('support must be imported from the test package')
+import cosmo
import collections.abc
import contextlib
import datetime
@@ -2043,9 +2044,10 @@ def run_unittest(*classes):
def _check_docstrings():
"""Just used to check if docstrings are enabled"""
-MISSING_C_DOCSTRINGS = (check_impl_detail() and
- sys.platform != 'win32' and
- not sysconfig.get_config_var('WITH_DOC_STRINGS'))
+MISSING_C_DOCSTRINGS = (cosmo.MODE.startswith('tiny') or
+ (check_impl_detail() and
+ sys.platform != 'win32' and
+ not sysconfig.get_config_var('WITH_DOC_STRINGS')))
HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None and
not MISSING_C_DOCSTRINGS)
diff --git a/third_party/python/Lib/test/test_bz2.py b/third_party/python/Lib/test/test_bz2.py
index 58d908499..7316317de 100644
--- a/third_party/python/Lib/test/test_bz2.py
+++ b/third_party/python/Lib/test/test_bz2.py
@@ -734,7 +734,7 @@ class BZ2DecompressorTest(BaseTest):
with self.assertRaises(TypeError):
pickle.dumps(BZ2Decompressor(), proto)
- @unittest.skipIf(cosmo.MODE == 'tiny',
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"),
"TODO(jart): what's going on here?")
def testDecompressorChunksMaxsize(self):
bzd = BZ2Decompressor()
diff --git a/third_party/python/Lib/test/test_class.py b/third_party/python/Lib/test/test_class.py
index b6a3eb4bf..b8faffd34 100644
--- a/third_party/python/Lib/test/test_class.py
+++ b/third_party/python/Lib/test/test_class.py
@@ -490,7 +490,8 @@ class ClassTests(unittest.TestCase):
self.assertRaises(TypeError, hash, C2())
- @unittest.skipIf(cosmo.MODE == 'tiny', "no stack awareness in tiny mode")
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"),
+ "no stack awareness in tiny mode")
def testSFBug532646(self):
# Test for SF bug 532646
diff --git a/third_party/python/Lib/test/test_exceptions.py b/third_party/python/Lib/test/test_exceptions.py
index d345ced3c..d8a42e644 100644
--- a/third_party/python/Lib/test/test_exceptions.py
+++ b/third_party/python/Lib/test/test_exceptions.py
@@ -1152,7 +1152,7 @@ class ExceptionTests(unittest.TestCase):
os.listdir(__file__)
self.assertEqual(cm.exception.errno, errno.ENOTDIR, cm.exception)
- @unittest.skipIf(cosmo.MODE == 'tiny',
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"),
"todo(jart): why is it broken")
def test_unraisable(self):
# Issue #22836: PyErr_WriteUnraisable() should give sensible reports
@@ -1186,7 +1186,7 @@ class ExceptionTests(unittest.TestCase):
self.assertIn("del is broken", report)
self.assertTrue(report.endswith("\n"))
- @unittest.skipIf(cosmo.MODE == 'tiny',
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"),
"todo(jart): why is it broken")
def test_unhandled(self):
# Check for sensible reporting of unhandled exceptions
diff --git a/third_party/python/Lib/test/test_fileio.py b/third_party/python/Lib/test/test_fileio.py
index 788cc8723..9f014b5c8 100644
--- a/third_party/python/Lib/test/test_fileio.py
+++ b/third_party/python/Lib/test/test_fileio.py
@@ -177,7 +177,7 @@ class AutoFileTests:
finally:
os.close(fd)
- @unittest.skipIf(cosmo.MODE == 'tiny', "no stack awareness in tiny mode")
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"), "no stack awareness in tiny mode")
def testRecursiveRepr(self):
# Issue #25455
with swap_attr(self.f, 'name', self.f):
diff --git a/third_party/python/Lib/test/test_functools.py b/third_party/python/Lib/test/test_functools.py
index eef6c72f0..3e3627402 100644
--- a/third_party/python/Lib/test/test_functools.py
+++ b/third_party/python/Lib/test/test_functools.py
@@ -619,7 +619,7 @@ class TestUpdateWrapper(unittest.TestCase):
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
- @unittest.skipIf(cosmo.MODE == 'tiny',
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"),
"No .py files available in Cosmo MODE=tiny")
def test_default_update_doc(self):
wrapper, f = self._default_update()
@@ -681,7 +681,7 @@ class TestUpdateWrapper(unittest.TestCase):
@support.requires_docstrings
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
- @unittest.skipIf(cosmo.MODE == 'tiny',
+ @unittest.skipIf(cosmo.MODE .startswith("tiny"),
"No .py files available in Cosmo MODE=tiny")
def test_builtin_update(self):
# Test for bug #1576241
@@ -715,7 +715,7 @@ class TestWraps(TestUpdateWrapper):
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
- @unittest.skipIf(cosmo.MODE == 'tiny',
+ @unittest.skipIf(cosmo.MODE .startswith("tiny"),
"No .py files available in Cosmo MODE=tiny")
def test_default_update_doc(self):
wrapper, _ = self._default_update()
diff --git a/third_party/python/Lib/test/test_plistlib.py b/third_party/python/Lib/test/test_plistlib.py
index 9655615fa..d4c1a5d30 100644
--- a/third_party/python/Lib/test/test_plistlib.py
+++ b/third_party/python/Lib/test/test_plistlib.py
@@ -814,7 +814,8 @@ class TestBinaryPlistlib(unittest.TestCase):
b = plistlib.loads(plistlib.dumps(a, fmt=plistlib.FMT_BINARY))
self.assertIs(b['x'], b)
- @unittest.skipIf(cosmo.MODE == 'tiny', "no stack awareness in tiny mode")
+ @unittest.skipIf(cosmo.MODE.startswith("tiny"),
+ "no stack awareness in tiny mode")
def test_deep_nesting(self):
for N in [300, 100000]:
chunks = [b'\xa1' + (i + 1).to_bytes(4, 'big') for i in range(N)]
diff --git a/third_party/python/Lib/test/test_unicodedata.py b/third_party/python/Lib/test/test_unicodedata.py
index 07b84ac16..9d94ba2af 100644
--- a/third_party/python/Lib/test/test_unicodedata.py
+++ b/third_party/python/Lib/test/test_unicodedata.py
@@ -131,7 +131,7 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
self.assertRaises(TypeError, self.db.numeric, 'xx')
self.assertRaises(ValueError, self.db.numeric, 'x')
- @unittest.skipIf(cosmo.MODE == 'tiny', 'astral planes arent tiny')
+ @unittest.skipIf(cosmo.MODE.startswith('tiny'), 'astral planes arent tiny')
def test_numeric_astral(self):
self.assertEqual(self.db.numeric('\U00020000', None), None)
self.assertEqual(self.db.numeric('\U0001012A'), 9000)
diff --git a/third_party/python/Modules/tlsmodule.c b/third_party/python/Modules/tlsmodule.c
index 58afc1c87..b1aa81821 100644
--- a/third_party/python/Modules/tlsmodule.c
+++ b/third_party/python/Modules/tlsmodule.c
@@ -46,7 +46,7 @@
PYTHON_PROVIDE("tls");
#if 0
-#define LOG(...) __printf(__VA_ARGS__)
+#define LOG(...) kprintf(__VA_ARGS__)
#else
#define LOG(...) (void)0
#endif
diff --git a/third_party/python/launch.c b/third_party/python/launch.c
index 3035b47b3..093d4dc94 100644
--- a/third_party/python/launch.c
+++ b/third_party/python/launch.c
@@ -6,6 +6,7 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/calls/calls.h"
#include "libc/dce.h"
+#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
@@ -94,10 +95,10 @@ ShowCrashReportHook(int err, int fd, int sig,
{
PyObject *str;
PyFrameObject *frame;
- __printf("\nCalamity Occurred w/ Python\n");
+ kprintf("\nCalamity Occurred w/ Python\n");
for (frame = PyEval_GetFrame(); frame; frame = frame->f_back) {
str = PyUnicode_AsUTF8String(frame->f_code->co_filename);
- __printf("%s:%d\n", PyBytes_AS_STRING(str), frame->f_code->co_firstlineno/* frame->f_lineno */);
+ kprintf("%s:%d\n", PyBytes_AS_STRING(str), frame->f_code->co_firstlineno/* frame->f_lineno */);
Py_DECREF(str);
}
}
diff --git a/third_party/python/python.mk b/third_party/python/python.mk
index b0036d69c..f18c15060 100644
--- a/third_party/python/python.mk
+++ b/third_party/python/python.mk
@@ -2116,1483 +2116,1483 @@ o/$(MODE)/third_party/python/pythontester.com.dbg: \
$(THIRD_PARTY_PYTHON_PYTEST_TODOS:%.py=o/$(MODE)/%.o) \
o/$(MODE)/third_party/python/repl.o \
$(CRT) \
- $(APE_NO_MODIFY_SELF)
+ $(APE)
@$(APELINK)
o/$(MODE)/third_party/python/Lib/test/test_genexps.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_genexps $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sqlite.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sqlite $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bz2.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bz2 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_zlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_zlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_opcodes.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_opcodes $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_marshal.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_marshal $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pow.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pow $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_binascii.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_binascii $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_binhex.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_binhex $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_capi.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_capi $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test__locale.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test__locale $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_binop.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_binop $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test___future__.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test___future__ $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test__opcode.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test__opcode $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_abc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_abc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bytes.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bytes $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_setcomps.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_setcomps $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_itertools.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_itertools $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_listcomps.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_listcomps $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_aifc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_aifc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_audioop.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_audioop $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bool.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bool $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_base64.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_base64 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_baseexception.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_baseexception $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_array.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_array $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_builtin.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_builtin $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_charmapcodec.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_charmapcodec $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecs.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecs $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codeop.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codeop $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cgi.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cgi $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_abstract_numbers.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_abstract_numbers $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_augassign.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_augassign $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bigaddrspace.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bigaddrspace $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_class.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_class $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_call.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_call $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_buffer.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_buffer $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bufio.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bufio $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_enum.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_enum $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_code.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_code $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cmd.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cmd $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pwd.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pwd $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cmath.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cmath $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_defaultdict.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_defaultdict $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_decorators.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_decorators $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_copy.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_copy $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_csv.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_csv $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_difflib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_difflib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_colorsys.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_colorsys $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_compare.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_compare $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_copyreg.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_copyreg $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_collections.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_collections $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_format.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_format $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fractions.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fractions $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_eof.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_eof $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fnmatch.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fnmatch $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_frame.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_frame $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dummy_threading.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dummy_threading $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dynamic.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dynamic $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dict.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dict $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_wsgiref.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_wsgiref $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_wave.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_wave $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urlparse.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urlparse $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_userdict.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_userdict $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_userlist.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_userlist $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_userstring.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_userstring $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_utf8source.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_utf8source $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_uu.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_uu $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test__encoded_words.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test__encoded_words $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test__header_value_parser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test__header_value_parser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_asian_codecs.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_asian_codecs $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_contentmanager.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_contentmanager $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_defect_handling.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_defect_handling $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_email.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_email $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_generator.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_generator $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_headerregistry.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_headerregistry $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_inversion.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_inversion $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_message.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_message $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_parser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_parser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_pickleable.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_pickleable $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_policy.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_policy $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_email/test_utils.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_email.test_utils $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_strtod.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_strtod $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_struct.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_struct $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_structmembers.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_structmembers $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_hash.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_hash $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_heapq.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_heapq $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_operator.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_operator $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_optparse.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_optparse $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_finalization.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_finalization $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_enumerate.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_enumerate $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_errno.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_errno $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_html.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_html $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_htmlparser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_htmlparser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_http_cookiejar.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_http_cookiejar $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_http_cookies.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_http_cookies $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_list.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_list $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_long.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_long $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_longexp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_longexp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_glob.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_glob $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_global.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_global $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_ipaddress.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_ipaddress $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_isinstance.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_isinstance $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_iter.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_iter $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_tarfile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_tarfile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_iterlen.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_iterlen $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_stat.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_stat $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_memoryio.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_memoryio $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_memoryview.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_memoryview $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_metaclass.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_metaclass $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_mimetypes.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_mimetypes $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_kdf.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_kdf $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cosmo.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cosmo $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_scratch.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_scratch $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_hashlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_hashlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_complex.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_complex $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_funcattrs.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_funcattrs $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_functools.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_functools $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_int.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_int $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_int_literal.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_int_literal $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bisect.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bisect $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pyexpat.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pyexpat $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_ioctl.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_ioctl $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_getopt.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_getopt $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sort.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sort $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_slice.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_slice $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_decimal.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_decimal $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_deque.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_deque $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_mmap.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_mmap $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_poll.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_poll $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_robotparser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_robotparser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_re.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_re $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_range.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_range $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sax.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sax $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_scope.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_scope $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_stringprep.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_stringprep $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_syntax.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_syntax $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unicodedata.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unicodedata $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unpack.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unpack $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unpack_ex.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unpack_ex $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_file.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_file $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_uuid.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_uuid $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_filecmp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_filecmp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fileinput.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fileinput $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fileio.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fileio $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_float.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_float $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pickle.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pickle $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pickletools.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pickletools $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_tuple.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_tuple $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_reprlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_reprlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_strftime.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_strftime $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_quopri.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_quopri $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_with.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_with $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_raise.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_raise $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_yield_from.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_yield_from $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_typechecks.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_typechecks $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_types.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_types $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_random.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_random $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_typing.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_typing $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unary.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unary $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_print.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_print $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pprint.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pprint $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_secrets.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_secrets $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_select.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_select $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_selectors.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_selectors $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_contains.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_contains $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_super.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_super $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unicode.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unicode $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unicode_file.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unicode_file $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unicode_identifiers.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unicode_identifiers $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unicode_file_functions.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unicode_file_functions $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_textwrap.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_textwrap $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pulldom.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pulldom $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_minidom.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_minidom $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_xml_dom_minicompat.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_xml_dom_minicompat $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_xml_etree_c.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_xml_etree_c $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_coroutines.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_coroutines $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_tempfile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_tempfile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_normalization.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_normalization $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_os.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_os $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_logging.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_logging $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_io.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_io $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_gzip.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_gzip $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_tracemalloc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_tracemalloc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_configparser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_configparser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_flufl.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_flufl $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_keyword.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_keyword $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_keywordonlyarg.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_keywordonlyarg $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sys.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sys $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cgitb.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cgitb $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_asyncgen.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_asyncgen $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_runpy.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_runpy $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_doctest.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_doctest $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_doctest2.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_doctest2 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_calendar.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_calendar $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_asynchat.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_asynchat $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_asdl_parser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_asdl_parser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_atexit.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_atexit $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dis.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dis $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_asyncore.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_asyncore $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_epoll.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_epoll $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cmd_line.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cmd_line $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cmd_line_script.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cmd_line_script $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_code_module.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_code_module $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codeccallbacks.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codeccallbacks $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecmaps_cn.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecmaps_cn $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecmaps_jp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecmaps_jp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecencodings_cn.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecencodings_cn $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecencodings_hk.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecencodings_hk $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecmaps_hk.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecmaps_hk $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecmaps_kr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecmaps_kr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecmaps_tw.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecmaps_tw $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecencodings_iso2022.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecencodings_iso2022 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecencodings_jp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecencodings_jp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecencodings_kr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecencodings_kr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_codecencodings_tw.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_codecencodings_tw $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_compile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_compile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_contextlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_contextlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_cprofile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_cprofile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_crashers.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_crashers $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_crypt.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_crypt $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_datetime.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_datetime $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_descrtut.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_descrtut $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_devpoll.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_devpoll $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dict_version.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dict_version $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dictcomps.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dictcomps $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dictviews.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dictviews $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dtrace.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dtrace $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_dynamicclassattribute.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_dynamicclassattribute $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_eintr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_eintr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_exception_hierarchy.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_exception_hierarchy $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_xmlrpc_net.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_xmlrpc_net $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_bigmem.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_bigmem $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_exception_variations.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_exception_variations $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_exceptions.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_exceptions $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_time.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_time $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_docxmlrpc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_docxmlrpc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_extcall.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_extcall $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_faulthandler.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_faulthandler $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fcntl.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fcntl $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_file_eintr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_file_eintr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fork1.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fork1 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_fstring.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_fstring $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_ftplib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_ftplib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_future.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_future $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_future3.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_future3 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_future4.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_future4 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_future5.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_future5 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_gc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_gc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_gdb.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_gdb $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_generator_stop.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_generator_stop $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_generators.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_generators $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_genericpath.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_genericpath $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_getargs2.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_getargs2 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_getpass.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_getpass $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_gettext.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_gettext $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_grp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_grp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_imaplib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_imaplib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_imghdr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_imghdr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_imp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_imp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_index.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_index $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_kqueue.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_kqueue $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_largefile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_largefile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_linecache.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_linecache $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_locale.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_locale $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_macpath.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_macpath $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_macurl2path.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_macurl2path $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_mailbox.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_mailbox $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_mailcap.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_mailcap $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_module.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_module $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_modulefinder.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_modulefinder $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_multibytecodec.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_multibytecodec $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_multiprocessing_fork.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_multiprocessing_fork $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_multiprocessing_forkserver.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_multiprocessing_forkserver $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_multiprocessing_main_handling.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_multiprocessing_main_handling $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_multiprocessing_spawn.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_multiprocessing_spawn $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_netrc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_netrc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_nis.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_nis $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_nntplib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_nntplib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_ntpath.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_ntpath $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_numeric_tower.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_numeric_tower $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_ossaudiodev.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_ossaudiodev $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_parser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_parser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pathlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pathlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pdb.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pdb $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_peepholer.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_peepholer $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pipes.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pipes $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pkgimport.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pkgimport $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_platform.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_platform $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_plistlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_plistlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_httplib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_httplib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_popen.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_popen $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_poplib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_poplib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_posix.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_posix $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_posixpath.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_posixpath $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_profile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_profile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_property.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_property $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pstats.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pstats $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pty.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pty $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_py_compile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_py_compile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pyclbr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pyclbr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_pydoc.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_pydoc $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_readline.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_readline $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_regrtest.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_regrtest $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_repl.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_repl $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_resource.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_resource $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_richcmp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_richcmp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sched.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sched $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_script_helper.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_script_helper $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_shlex.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_shlex $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_shutil.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_shutil $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_signal.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_signal $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_site.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_site $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_smtpd.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_smtpd $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_smtplib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_smtplib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_smtpnet.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_smtpnet $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sndhdr.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sndhdr $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_socket.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_socket $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_socketserver.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_socketserver $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_spwd.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_spwd $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_startfile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_startfile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_statistics.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_statistics $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_string.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_string $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_string_literals.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_string_literals $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_strptime.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_strptime $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_structseq.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_structseq $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_subclassinit.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_subclassinit $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_subprocess.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_subprocess $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sunau.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sunau $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_support.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_support $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_symbol.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_symbol $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_symtable.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_symtable $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_sys_setprofile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_sys_setprofile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_syslog.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_syslog $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_telnetlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_telnetlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_threadedtempfile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_threadedtempfile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_timeit.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_timeit $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_timeout.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_timeout $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_tokenize.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_tokenize $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_trace.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_trace $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_traceback.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_traceback $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_turtle.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_turtle $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_unittest.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_unittest $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_univnewlines.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_univnewlines $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urllib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urllib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urllib2.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urllib2 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urllib2_localnet.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urllib2_localnet $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urllib2net.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urllib2net $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urllib_response.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urllib_response $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_urllibnet.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_urllibnet $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_wait3.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_wait3 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_wait4.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_wait4 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_webbrowser.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_webbrowser $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_xdrlib.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_xdrlib $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_weakref.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_weakref $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_weakset.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_weakset $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_zipapp.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_zipapp $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_zipimport.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_zipimport $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_zipfile.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_zipfile $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_zipfile64.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_zipfile64 $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/mp_preload.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.mp_preload $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/bisect.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.bisect $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/signalinterproctester.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.signalinterproctester $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/pythoninfo.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.pythoninfo $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/datetimetester.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.datetimetester $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/outstanding_bugs.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.outstanding_bugs $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/sortperf.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.sortperf $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_openpty.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_openpty $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_queue.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_queue $(PYTESTARGS)
o/$(MODE)/third_party/python/Lib/test/test_ordered_dict.py.runs: \
- o/$(MODE)/third_party/python/pythontester.com
+ o/$(MODE)/third_party/python/pythontester.com.dbg
@$(COMPILE) -ACHECK -tT$@ $(PYHARNESSARGS) $< -m test.test_ordered_dict $(PYTESTARGS)
################################################################################
@@ -4113,21 +4113,20 @@ $(THIRD_PARTY_PYTHON_STAGE2_A_DATA_OBJS): ZIPOBJ_FLAGS += -P.python -C3
$(THIRD_PARTY_PYTHON_PYTEST_A_PYS_OBJS): PYFLAGS += -P.python -C3
$(THIRD_PARTY_PYTHON_PYTEST_A_DATA_OBJS): ZIPOBJ_FLAGS += -P.python -C3
-o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -M512m
-o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C16 -M512m
+o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -C32 -M1024m
+o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C32 -M1024m
o/$(MODE)/third_party/python/Parser/asdl_c.o: PYFLAGS += -m
$(THIRD_PARTY_PYTHON_PYTEST_PYMAINS_OBJS): PYFLAGS += -t -P.python -C3
$(THIRD_PARTY_PYTHON_PYTEST_TODOS:%.py=o/$(MODE)/%.o): PYFLAGS += -t -P.python -C3
o/$(MODE)/third_party/python/Lib/test/pystone.o: PYFLAGS += -m -O2 -P.python -C4
-o/$(MODE)/third_party/python/Lib/test/test_bz2.py.runs: QUOTA = -C16
o/$(MODE)/third_party/python/Lib/test/test_long.py.runs: QUOTA = -C32
o/$(MODE)/third_party/python/Lib/test/test_hash.py.runs: QUOTA = -C32
o/$(MODE)/third_party/python/Lib/test/test_exceptions.py.runs: QUOTA = -C32
o/$(MODE)/third_party/python/Lib/test/test_tuple.py.runs: QUOTA = -M512m
o/$(MODE)/third_party/python/Lib/test/test_decimal.py.runs: QUOTA = -M512m -C64
-o/$(MODE)/third_party/python/Lib/test/test_longexp.py.runs: QUOTA = -M512m
+o/$(MODE)/third_party/python/Lib/test/test_longexp.py.runs: QUOTA = -M1024m
o/$(MODE)/third_party/python/Lib/test/test_unicode.py.runs: QUOTA = -M1400m
o/$(MODE)/third_party/python/Lib/test/test_unicodedata.py.runs: QUOTA = -C32
o/$(MODE)/third_party/python/Lib/test/test_logging.py.runs: QUOTA = -M512m
@@ -4135,7 +4134,7 @@ o/$(MODE)/third_party/python/Lib/test/test_itertools.py.runs: QUOTA = -M1024m
o/$(MODE)/third_party/python/Lib/test/test_tarfile.py.runs: QUOTA = -L120 -C64
o/$(MODE)/third_party/python/Lib/test/test_sqlite.py.runs: QUOTA = -L120
o/$(MODE)/third_party/python/Lib/test/test_gzip.py.runs: QUOTA = -L120
-o/$(MODE)/third_party/python/Lib/test/test_email/test_email.py.runs: QUOTA = -M1024m
+o/$(MODE)/third_party/python/Lib/test/test_email/test_email.py.runs: QUOTA = -C16 -M1024m
THIRD_PARTY_PYTHON_LIBS = \
$(foreach x,$(THIRD_PARTY_PYTHON_ARTIFACTS),$($(x)))
diff --git a/third_party/quickjs/quickjs.mk b/third_party/quickjs/quickjs.mk
index 3347384bf..4e2f3906d 100644
--- a/third_party/quickjs/quickjs.mk
+++ b/third_party/quickjs/quickjs.mk
@@ -151,7 +151,7 @@ o/$(MODE)/third_party/quickjs/qjsc.com.dbg: \
$(THIRD_PARTY_QUICKJS) \
o/$(MODE)/third_party/quickjs/qjsc.o \
$(CRT) \
- $(APE)
+ $(APE_NO_MODIFY_SELF)
@$(APELINK)
# git clone git@github.com:tc39/test262 /opt/test262
diff --git a/third_party/sqlite3/README.cosmo b/third_party/sqlite3/README.cosmo
new file mode 100644
index 000000000..37e08f697
--- /dev/null
+++ b/third_party/sqlite3/README.cosmo
@@ -0,0 +1,12 @@
+DESCRIPTION
+
+ SQLite is an embeddable SQL relational database with a ~1mb
+ footprint and a wide variety of features.
+
+ORIGIN
+
+ https://www.sqlite.org/2021/sqlite-preprocessed-3350500.zip
+
+LICENSE
+
+ Public Domain or MIT
diff --git a/tool/build/blinkenlights.c b/tool/build/blinkenlights.c
index a063fb48d..6c4d92d30 100644
--- a/tool/build/blinkenlights.c
+++ b/tool/build/blinkenlights.c
@@ -30,6 +30,7 @@
#include "libc/calls/struct/termios.h"
#include "libc/calls/struct/winsize.h"
#include "libc/calls/termios.h"
+#include "libc/dce.h"
#include "libc/fmt/bing.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
@@ -37,15 +38,18 @@
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/pcmpeqb.h"
#include "libc/intrin/pmovmskb.h"
+#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/color.internal.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
+#include "libc/rand/rand.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
+#include "libc/stdio/append.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/thompike.h"
@@ -198,6 +202,12 @@ struct MemoryView {
int zoom;
};
+struct Keystrokes {
+ unsigned i;
+ char p[4][32];
+ long double s[4];
+};
+
struct MachineState {
uint64_t ip;
uint8_t cs[8];
@@ -296,6 +306,7 @@ static struct Pty *pty;
static struct Machine *m;
static struct Panels pan;
+static struct Keystrokes keystrokes;
static struct Breakpoints breakpoints;
static struct MemoryView codeview;
static struct MemoryView readview;
@@ -545,6 +556,10 @@ static void ShowCursor(void) {
TtyWriteString("\e[?25h");
}
+static void EnableSafePaste(void) {
+ TtyWriteString("\e[?2004h");
+}
+
static void DisableSafePaste(void) {
TtyWriteString("\e[?2004l");
}
@@ -596,7 +611,7 @@ static void TuiRejuvinate(void) {
CHECK_NE(-1, ioctl(ttyout, TCSETS, &term));
xsigaction(SIGBUS, OnSigBusted, SA_NODEFER, 0, NULL);
EnableMouseTracking();
- DisableSafePaste();
+ EnableSafePaste();
}
static void OnQ(void) {
@@ -639,12 +654,14 @@ static void TtyRestore2(void) {
DEBUGF("TtyRestore2");
ioctl(ttyout, TCSETS, &oldterm);
DisableMouseTracking();
+ DisableSafePaste();
}
static void TuiCleanup(void) {
sigaction(SIGCONT, oldsig + 2, NULL);
TtyRestore1();
DisableMouseTracking();
+ DisableSafePaste();
tuimode = false;
LeaveScreen();
}
@@ -682,12 +699,14 @@ static void LoadSyms(void) {
static int DrainInput(int fd) {
char buf[32];
struct pollfd fds[1];
- for (;;) {
- fds[0].fd = fd;
- fds[0].events = POLLIN;
- if (poll(fds, ARRAYLEN(fds), 0) == -1) return -1;
- if (!(fds[0].revents & POLLIN)) break;
- if (read(fd, buf, sizeof(buf)) == -1) return -1;
+ if (!IsWindows()) {
+ for (;;) {
+ fds[0].fd = fd;
+ fds[0].events = POLLIN;
+ if (poll(fds, ARRAYLEN(fds), 0) == -1) return -1;
+ if (!(fds[0].revents & POLLIN)) break;
+ if (read(fd, buf, sizeof(buf)) == -1) return -1;
+ }
}
return 0;
}
@@ -1602,6 +1621,34 @@ static int AppendStat(struct Buffer *b, const char *name, int64_t value,
return 1 + width;
}
+static char *GetStatus(int m) {
+ bool first;
+ char *b = 0;
+ unsigned i, n;
+ long double t;
+ if (statusmessage && nowl() < statusexpires) {
+ appends(&b, statusmessage);
+ } else {
+ appends(&b, "das blinkenlights");
+ }
+ n = ARRAYLEN(keystrokes.p);
+ for (first = true, t = nowl(), i = 1; i <= n; --i) {
+ if (!keystrokes.p[(keystrokes.i - i) % n][0]) continue;
+ if (t - keystrokes.s[(keystrokes.i - i) % n] > 1) continue;
+ if (first) {
+ first = false;
+ appends(&b, " (keystroke: ");
+ } else {
+ appendw(&b, ' ');
+ }
+ appends(&b, keystrokes.p[(keystrokes.i - i) % n]);
+ }
+ if (!first) {
+ appendw(&b, ')');
+ }
+ return b;
+}
+
static void DrawStatus(struct Panel *p) {
int yn, xn, rw;
struct Buffer *s;
@@ -1621,9 +1668,7 @@ static void DrawStatus(struct Panel *p) {
rw += AppendStat(s, "freed", a->freed, a->freed != b->freed);
rw += AppendStat(s, "tables", a->pagetables, a->pagetables != b->pagetables);
rw += AppendStat(s, "fds", m->fds.i, false);
- AppendFmt(&p->lines[0], "\e[7m%-*s%s\e[0m", xn - rw,
- statusmessage && nowl() < statusexpires ? statusmessage
- : "das blinkenlights",
+ AppendFmt(&p->lines[0], "\e[7m%-*s%s\e[0m", xn - rw, gc(GetStatus(xn - rw)),
s->p);
free(s->p);
free(s);
@@ -1700,6 +1745,29 @@ static void ReactiveDraw(void) {
}
}
+static void DescribeKeystroke(char *b, const char *p) {
+ int c;
+ do {
+ c = *p++ & 255;
+ if (c == '\e') {
+ b = stpcpy(b, "ALT-");
+ c = *p++ & 255;
+ }
+ if (c <= 32) {
+ b = stpcpy(b, "CTRL-");
+ c = CTRL(c);
+ }
+ *b++ = c;
+ *b = 0;
+ } while (*p);
+}
+
+static void RecordKeystroke(const char *k) {
+ keystrokes.s[keystrokes.i] = nowl();
+ DescribeKeystroke(keystrokes.p[keystrokes.i], k);
+ keystrokes.i = (keystrokes.i + 1) % ARRAYLEN(keystrokes.p);
+}
+
static void HandleAlarm(void) {
alarmed = false;
action &= ~ALARM;
@@ -1719,6 +1787,8 @@ static void HandleAppReadInterrupt(void) {
}
if (action & INT) {
action &= ~INT;
+ RecordKeystroke("\3");
+ ReactiveDraw();
if (action & CONTINUE) {
action &= ~CONTINUE;
} else {
@@ -1770,33 +1840,47 @@ static struct Mouse ParseMouse(char *p) {
return m;
}
-static ssize_t ReadPtyFdDirect(int fd, void *data, size_t size) {
+static ssize_t ReadAnsi(int fd, char *p, size_t n) {
ssize_t rc;
- char buf[32];
struct Mouse m;
- DEBUGF("ReadPtyFdDirect");
- pty->conf |= kPtyBlinkcursor;
for (;;) {
ReactiveDraw();
- if ((rc = readansi(fd, buf, sizeof(buf))) != -1) {
- if (tuimode && rc > 3 &&
- (buf[0] == '\e' && buf[1] == '[' && buf[2] == '<')) {
- m = ParseMouse(buf + 3);
- if (LocatePanel(m.y, m.x) != &pan.display) {
- HandleKeyboard(buf);
+ if ((rc = readansi(fd, p, n)) != -1) {
+ if (tuimode && rc > 3 && p[0] == '\e' && p[1] == '[') {
+ if (p[2] == '2' && p[3] == '0' && p[4] == '0' && p[5] == '~') {
+ belay = true;
continue;
}
+ if (p[2] == '2' && p[3] == '0' && p[4] == '1' && p[5] == '~') {
+ belay = false;
+ continue;
+ }
+ if (p[2] == '<') {
+ m = ParseMouse(p + 3);
+ if (LocatePanel(m.y, m.x) != &pan.display) {
+ HandleKeyboard(p);
+ continue;
+ }
+ }
}
- break;
+ return rc;
+ } else {
+ CHECK_EQ(EINTR, errno);
+ HandleAppReadInterrupt();
}
- CHECK_EQ(EINTR, errno);
- HandleAppReadInterrupt();
}
+}
+
+static ssize_t ReadPtyFdDirect(int fd) {
+ ssize_t rc;
+ char buf[32];
+ pty->conf |= kPtyBlinkcursor;
+ rc = ReadAnsi(fd, buf, sizeof(buf));
pty->conf &= ~kPtyBlinkcursor;
if (rc > 0) {
PtyWriteInput(pty, buf, rc);
ReactiveDraw();
- rc = PtyRead(pty, data, size);
+ rc = 0;
}
return rc;
}
@@ -1814,15 +1898,62 @@ static ssize_t OnPtyFdReadv(int fd, const struct iovec *iov, int iovlen) {
}
}
if (size) {
- if (!(rc = PtyRead(pty, data, size))) {
- rc = ReadPtyFdDirect(fd, data, size);
+ for (;;) {
+ if ((rc = PtyRead(pty, data, size))) {
+ return rc;
+ }
+ if (ReadPtyFdDirect(fd) == -1) {
+ return -1;
+ }
}
- return rc;
} else {
return 0;
}
}
+static int OnPtyFdPoll(struct pollfd *fds, size_t nfds, int ms) {
+ bool once, rem;
+ int i, t, re, rc;
+ struct pollfd p2;
+ ms &= INT_MAX;
+ for (once = t = i = 0; i < nfds; ++i) {
+ re = 0;
+ if (fds[i].fd >= 0) {
+ if (pty->input.i) {
+ re = POLLIN | POLLOUT;
+ ++t;
+ } else {
+ if (!once) {
+ ReactiveDraw();
+ once = true;
+ }
+ if (!IsWindows()) {
+ p2.fd = fds[i].fd;
+ p2.events = fds[i].events;
+ switch (poll(&p2, 1, ms)) {
+ case -1:
+ re = POLLERR;
+ ++t;
+ break;
+ case 0:
+ break;
+ case 1:
+ re = p2.revents;
+ ++t;
+ break;
+ default:
+ unreachable;
+ }
+ } else {
+ re = POLLIN | POLLOUT; /* xxx */
+ }
+ }
+ }
+ fds[i].revents = re;
+ }
+ return t;
+}
+
static void DrawDisplayOnly(struct Panel *p) {
struct Buffer b;
int i, y, yn, xn, tly, tlx, conf;
@@ -1910,6 +2041,7 @@ static const struct MachineFdCb kMachineFdCbPty = {
.readv = OnPtyFdReadv,
.writev = OnPtyFdWritev,
.ioctl = OnPtyFdIoctl,
+ .poll = OnPtyFdPoll,
};
static void LaunchDebuggerReactively(void) {
@@ -2137,11 +2269,10 @@ static void OnVidyaServiceTeletypeOutput(void) {
int n;
uint64_t w;
char buf[12];
- n = FormatCga(m->bx[0], buf);
+ n = 0 /* FormatCga(m->bx[0], buf) */;
w = tpenc(VidyaServiceXlatTeletype(m->ax[0]));
- do {
- buf[n++] = w;
- } while ((w >>= 8));
+ do buf[n++] = w;
+ while ((w >>= 8));
PtyWrite(pty, buf, n);
}
@@ -2173,64 +2304,19 @@ static void OnVidyaService(void) {
static void OnKeyboardServiceReadKeyPress(void) {
wint_t x;
uint8_t b;
- ssize_t rc;
size_t i, n;
struct Mouse mo;
static char buf[32];
static size_t pending;
- static const char *fun;
- static const char *prog /* = "(CONS (QUOTE A) (QUOTE B))" */;
pty->conf |= kPtyBlinkcursor;
- if (!fun && prog) {
- fun = prog;
- belay = 1;
- }
- if (fun && *fun) {
- b = *fun++;
- if (!*fun) {
- ReactiveDraw();
- belay = 0;
- }
- } else {
- if (!pending) {
- for (;;) {
- ReactiveDraw();
- if ((rc = readansi(0, buf, sizeof(buf))) != -1) {
- if (!rc) {
- exitcode = 0;
- action |= EXIT;
- return;
- }
- if (!memcmp(buf, "\e[200~", 6) || !memcmp(buf, "\e[201~", 6)) {
- continue;
- }
- if ((x = buf[0] & 0377) >= 0300) {
- n = ThomPikeLen(x);
- x = ThomPikeByte(x);
- for (i = 1; i < n; ++i) {
- x = ThomPikeMerge(x, buf[i] & 0377);
- }
- buf[0] = unbing(x);
- rc = 1;
- } else if (tuimode && rc > 3 &&
- (buf[0] == '\e' && buf[1] == '[' && buf[2] == '<')) {
- mo = ParseMouse(buf + 3);
- if (LocatePanel(mo.y, mo.x) != &pan.display) {
- HandleKeyboard(buf);
- continue;
- }
- }
- pending = rc;
- break;
- }
- CHECK_EQ(EINTR, errno);
- HandleAppReadInterrupt();
- }
- }
- b = buf[0];
- memmove(buf, buf + 1, pending - 1);
- --pending;
+ if (!pending && !(pending = ReadAnsi(0, buf, sizeof(buf)))) {
+ exitcode = 0;
+ action |= EXIT;
+ return;
}
+ b = buf[0];
+ memmove(buf, buf + 1, pending - 1);
+ --pending;
pty->conf &= ~kPtyBlinkcursor;
ReactiveDraw();
if (b == 0x7F) b = '\b';
@@ -2521,7 +2607,11 @@ static bool HasPendingKeyboard(void) {
}
static void Sleep(int ms) {
- poll((struct pollfd[]){{ttyin, POLLIN}}, 1, ms);
+ if (IsWindows()) {
+ usleep(ms * 1000L);
+ } else {
+ poll((struct pollfd[]){{ttyin, POLLIN}}, 1, ms);
+ }
}
static void OnMouseWheelUp(struct Panel *p, int y, int x) {
@@ -2596,7 +2686,8 @@ static void OnHelp(void) {
dialog = HELP;
}
-static void HandleKeyboard(const char *p) {
+static void HandleKeyboard(const char *k) {
+ const char *p = k;
switch (*p++) {
CASE('q', OnQ());
CASE('v', OnV());
@@ -2634,9 +2725,9 @@ static void HandleKeyboard(const char *p) {
switch (*p++) {
CASE('P', OnHelp()); /* \eOP is F1 */
default:
- break;
+ return;
}
- break;
+ return;
case '[':
switch (*p++) {
CASE('<', OnMouse(p));
@@ -2649,16 +2740,17 @@ static void HandleKeyboard(const char *p) {
CASE('5', OnPageUp()); /* \e[1~ is pgup */
CASE('6', OnPageDown()); /* \e[1~ is pgdn */
default:
- break;
+ return;
}
- break;
+ return;
default:
- break;
+ return;
}
break;
default:
- break;
+ return;
}
+ RecordKeystroke(k);
}
static void ReadKeyboard(void) {
@@ -2824,6 +2916,8 @@ static void Tui(void) {
if (action & INT) {
INFOF("TUI INT");
action &= ~INT;
+ RecordKeystroke("\3");
+ ReactiveDraw();
if (action & (CONTINUE | NEXT | FINISH)) {
action &= ~(CONTINUE | NEXT | FINISH);
} else {
@@ -3012,11 +3106,12 @@ static void OnlyRunOnFirstCpu(void) {
int main(int argc, char *argv[]) {
if (!NoDebug()) showcrashreports();
pty = NewPty();
+ pty->conf |= kPtyNocanon;
m = NewMachine();
m->mode = XED_MACHINE_MODE_LONG_64;
m->onbinbase = OnBinbase;
m->onlongbranch = OnLongBranch;
- speed = 16;
+ speed = 32;
SetXmmSize(2);
SetXmmDisp(kXmmHex);
if ((colorize = cancolor())) {
diff --git a/tool/build/compile.c b/tool/build/compile.c
index 84ba6e745..e2522a2b5 100644
--- a/tool/build/compile.c
+++ b/tool/build/compile.c
@@ -28,9 +28,11 @@
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/stat.h"
#include "libc/calls/struct/timeval.h"
+#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
+#include "libc/intrin/kprintf.h"
#include "libc/limits.h"
#include "libc/log/color.internal.h"
#include "libc/log/log.h"
@@ -43,6 +45,7 @@
#include "libc/stdio/append.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
+#include "libc/sysv/consts/auxv.h"
#include "libc/sysv/consts/clock.h"
#include "libc/sysv/consts/itimer.h"
#include "libc/sysv/consts/o.h"
@@ -95,8 +98,8 @@ FLAGS\n\
-T TARGET specifies target name for V=0 logging\n\
-A ACTION specifies short command name for V=0 logging\n\
-V NUMBER specifies compiler version\n\
- -C SECS set cpu limit [default 8]\n\
- -L SECS set lat limit [default 64]\n\
+ -C SECS set cpu limit [default 16]\n\
+ -L SECS set lat limit [default 90]\n\
-M BYTES set mem limit [default 512m]\n\
-F BYTES set fsz limit [default 100m]\n\
-O BYTES set out limit [default 1m]\n\
@@ -194,6 +197,7 @@ const char *const kSafeEnv[] = {
"MODE", // needed by test scripts
"PATH", // needed by clang
"PWD", // just seems plain needed
+ "STRACE", // useful for troubleshooting
"TERM", // needed by IsTerminalInarticulate
"TMPDIR", // needed by compiler
};
@@ -223,6 +227,7 @@ const char *const kGccOnlyFlags[] = {
"-fno-gnu-unique",
"-fno-gnu-unique",
"-fno-instrument-functions",
+ "-fno-schedule-insns2",
"-fno-whole-program",
"-fopt-info-vec",
"-fopt-info-vec-missed",
@@ -324,10 +329,14 @@ int GetTerminalWidth(void) {
}
}
-int GetLineWidth(void) {
+int GetLineWidth(bool *isineditor) {
char *s;
struct winsize ws = {0};
- if ((s = getenv("COLUMNS"))) {
+ s = getenv("COLUMNS");
+ if (isineditor) {
+ *isineditor = !!s;
+ }
+ if (s) {
return atoi(s);
} else if (ioctl(2, TIOCGWINSZ, &ws) != -1) {
if (ws.ws_col && ws.ws_row) {
@@ -398,11 +407,20 @@ bool FileExistsAndIsNewerThan(const char *filepath, const char *thanpath) {
return st1.st_mtim.tv_nsec >= st2.st_mtim.tv_nsec;
}
+static size_t TallyArgs(char **p) {
+ size_t n;
+ for (n = 0; *p; ++p) {
+ n += sizeof(*p);
+ n += strlen(*p) + 1;
+ }
+ return n;
+}
+
void AddStr(struct Strings *l, char *s) {
l->p = realloc(l->p, (++l->n + 1) * sizeof(*l->p));
l->p[l->n - 1] = s;
l->p[l->n - 0] = 0;
-};
+}
void AddEnv(char *s) {
AddStr(&env, s);
@@ -433,7 +451,15 @@ void AddArg(char *s) {
} else {
appends(&shortened, s);
}
- } else if (s[0] == '-' && (!s[1] || s[1] == 'o' || (s[1] == '-' && !s[2]) ||
+ } else if (/*
+ * a in ('-', '--') or
+ * a.startswith('-o') or
+ * c == 'ld' and a == '-T' or
+ * c == 'cc' and a.startswith('-O') or
+ * c == 'cc' and a.startswith('-x') or
+ * c == 'cc' and a in ('-c', '-E', '-S')
+ */
+ s[0] == '-' && (!s[1] || s[1] == 'o' || (s[1] == '-' && !s[2]) ||
(isbfd && (s[1] == 'T' && !s[2])) ||
(iscc && (s[1] == 'O' || s[1] == 'x' ||
(!s[2] && (s[1] == 'c' || s[1] == 'E' ||
@@ -486,6 +512,56 @@ void SetMemLimit(long n) {
setrlimit(RLIMIT_AS, &rlim);
}
+bool ArgNeedsShellQuotes(const char *s) {
+ if (*s) {
+ for (;;) {
+ switch (*s++ & 255) {
+ case 0:
+ return false;
+ case '-':
+ case '.':
+ case '/':
+ case '_':
+ case '=':
+ case ':':
+ case '0' ... '9':
+ case 'A' ... 'Z':
+ case 'a' ... 'z':
+ break;
+ default:
+ return true;
+ }
+ }
+ } else {
+ return true;
+ }
+}
+
+char *AddShellQuotes(const char *s) {
+ char *p, *q;
+ size_t i, j, n;
+ n = strlen(s);
+ p = malloc(1 + n * 5 + 1 + 1);
+ j = 0;
+ p[j++] = '\'';
+ for (i = 0; i < n; ++i) {
+ if (s[i] != '\'') {
+ p[j++] = s[i];
+ } else {
+ p[j + 0] = '\'';
+ p[j + 1] = '"';
+ p[j + 2] = '\'';
+ p[j + 3] = '"';
+ p[j + 4] = '\'';
+ j += 5;
+ }
+ }
+ p[j++] = '\'';
+ p[j] = 0;
+ if ((q = realloc(p, j + 1))) p = q;
+ return p;
+}
+
int Launch(void) {
size_t got;
ssize_t rc;
@@ -499,7 +575,19 @@ int Launch(void) {
timer.it_interval.tv_sec = timeout;
setitimer(ITIMER_REAL, &timer, 0);
}
- if ((pid = vfork()) == -1) exit(errno);
+ pid = fork();
+
+#if 0
+ int fd;
+ size_t n;
+ char b[1024], *p;
+ size_t t = strlen(cmd) + 1 + TallyArgs(args.p) + 9 + TallyArgs(env.p) + 9;
+ n = ksnprintf(b, sizeof(b), "%ld %s %s\n", t, cmd, outpath);
+ fd = open("o/argmax.txt", O_APPEND | O_CREAT | O_WRONLY, 0644);
+ write(fd, b, n);
+ close(fd);
+#endif
+
if (!pid) {
SetCpuLimit(cpuquota);
SetFszLimit(fszquota);
@@ -508,7 +596,7 @@ int Launch(void) {
dup2(pipefds[1], 2);
sigprocmask(SIG_SETMASK, &savemask, 0);
execve(cmd, args.p, env.p);
- _exit(127);
+ _Exit(127);
}
close(pipefds[1]);
for (;;) {
@@ -609,21 +697,42 @@ void ReportResources(void) {
appendw(&output, '\n');
}
+bool IsNativeExecutable(const char *path) {
+ bool res;
+ char buf[4];
+ int got, fd;
+ res = false;
+ if ((fd = open(path, O_RDONLY)) != -1) {
+ if ((got = read(fd, buf, 4)) == 4) {
+ if (IsWindows()) {
+ res = READ16LE(buf) == READ16LE("MZ");
+ } else if (IsXnu()) {
+ res = READ32LE(buf) == 0xFEEDFACEu + 1;
+ } else {
+ res = READ32LE(buf) == READ32LE("\177ELF");
+ }
+ }
+ close(fd);
+ }
+ return res;
+}
+
int main(int argc, char *argv[]) {
int columns;
uint64_t us;
+ bool isineditor;
size_t i, j, n, m;
bool isproblematic;
- char *s, *p, **envp;
int ws, opt, exitcode;
+ char *s, *p, *q, **envp;
/*
* parse prefix arguments
*/
mode = MODE;
verbose = 4;
- timeout = 64; /* secs */
- cpuquota = 8; /* secs */
+ timeout = 90; /* secs */
+ cpuquota = 16; /* secs */
fszquota = 100 * 1000 * 1000; /* bytes */
memquota = 512 * 1024 * 1024; /* bytes */
if ((s = getenv("V"))) verbose = atoi(s);
@@ -876,6 +985,8 @@ int main(int argc, char *argv[]) {
if (wantframe) {
AddArg("-fno-omit-frame-pointer");
AddArg("-D__FNO_OMIT_FRAME_POINTER__");
+ } else {
+ AddArg("-fomit-frame-pointer");
}
}
@@ -938,6 +1049,7 @@ int main(int argc, char *argv[]) {
exit(97);
}
}
+ args.p[0] = cmd;
}
/*
@@ -991,7 +1103,8 @@ int main(int argc, char *argv[]) {
* cleanup temporary copy of ape executable
*/
if (originalcmd) {
- if (cachedcmd && WIFEXITED(ws) && !WEXITSTATUS(ws)) {
+ if (cachedcmd && WIFEXITED(ws) && !WEXITSTATUS(ws) &&
+ IsNativeExecutable(cmd)) {
makedirs(xdirname(cachedcmd), 0755);
rename(cmd, cachedcmd);
} else {
@@ -1036,6 +1149,17 @@ int main(int argc, char *argv[]) {
appends(&output, strsignal(WTERMSIG(ws)));
PrintReset();
appendw(&output, READ16LE(":\n"));
+ appends(&output, "env -i ");
+ for (i = 0; i < env.n; ++i) {
+ if (ArgNeedsShellQuotes(env.p[i])) {
+ q = AddShellQuotes(env.p[i]);
+ appends(&output, q);
+ free(q);
+ } else {
+ appends(&output, env.p[i]);
+ }
+ appendw(&output, ' ');
+ }
}
} else {
exitcode = 89;
@@ -1170,10 +1294,19 @@ int main(int argc, char *argv[]) {
if (verbose < 2 || verbose == 3) {
command = shortened;
}
- m = GetLineWidth();
+ m = GetLineWidth(&isineditor);
if (m > n + 3 && appendz(command).i > m - n) {
- appendd(&output, command, m - n - 3);
- appendw(&output, READ32LE("..."));
+ if (isineditor) {
+ if (m > n + 3 && appendz(shortened).i > m - n) {
+ appendd(&output, shortened, m - n - 3);
+ appendw(&output, READ32LE("..."));
+ } else {
+ appendd(&output, shortened, appendz(shortened).i);
+ }
+ } else {
+ appendd(&output, command, m - n - 3);
+ appendw(&output, READ32LE("..."));
+ }
} else {
appendd(&output, command, appendz(command).i);
}
diff --git a/tool/build/lib/diself.c b/tool/build/lib/diself.c
index 27a65a4a7..87b78868e 100644
--- a/tool/build/lib/diself.c
+++ b/tool/build/lib/diself.c
@@ -23,6 +23,7 @@
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
+#include "libc/runtime/memtrack.internal.h"
#include "libc/str/str.h"
#include "tool/build/lib/dis.h"
@@ -86,8 +87,7 @@ static void DisLoadElfSyms(struct Dis *d, struct Elf *elf) {
ELF64_ST_TYPE(st[i].st_info) == STT_FILE || !st[i].st_name ||
startswith(d->syms.stab + st[i].st_name, "v_") ||
!(0 <= st[i].st_name && st[i].st_name < stablen) || !st[i].st_value ||
- !(-0x800000000000 <= (int64_t)st[i].st_value &&
- (int64_t)st[i].st_value < 0x800000000000)) {
+ !IsLegalPointer(st[i].st_value)) {
continue;
}
isabs = st[i].st_shndx == SHN_ABS;
diff --git a/tool/build/lib/disspec.c b/tool/build/lib/disspec.c
index a097cb264..1a9baca15 100644
--- a/tool/build/lib/disspec.c
+++ b/tool/build/lib/disspec.c
@@ -237,6 +237,8 @@ const char *DisSpecMap0(struct XedDecodedInst *x, char *p) {
RCASE(0xCB, "lret");
RCASE(0xCC, "int3");
RCASE(0xCD, "int Ib");
+ RCASE(0xCE, "into");
+ RCASE(0xCF, "iret");
RCASE(0xD0, "BIT Eb");
RCASE(0xD1, "BIT Evqp");
RCASE(0xD2, "BIT Evqp %cl");
diff --git a/tool/build/lib/eztls.c b/tool/build/lib/eztls.c
index 8815a18a1..dc6b6a35a 100644
--- a/tool/build/lib/eztls.c
+++ b/tool/build/lib/eztls.c
@@ -159,6 +159,25 @@ void EzHandshake(void) {
}
}
+int EzHandshake2(void) {
+ int rc;
+ while ((rc = mbedtls_ssl_handshake(&ezssl))) {
+ if (rc == MBEDTLS_ERR_NET_CONN_RESET) {
+ return rc;
+ } else if (rc != MBEDTLS_ERR_SSL_WANT_READ) {
+ TlsDie("handshake failed", rc);
+ }
+ }
+ while ((rc = EzTlsFlush(&ezbio, 0, 0))) {
+ if (rc == MBEDTLS_ERR_NET_CONN_RESET) {
+ return rc;
+ } else if (rc != MBEDTLS_ERR_SSL_WANT_READ) {
+ TlsDie("handshake flush failed", rc);
+ }
+ }
+ return 0;
+}
+
void EzInitialize(void) {
xsigaction(SIGPIPE, SIG_IGN, 0, 0, 0);
ezconf.disable_compression = 1; /* TODO(jart): Why does it behave weirdly? */
diff --git a/tool/build/lib/eztls.h b/tool/build/lib/eztls.h
index 5c659f227..612acb9ad 100644
--- a/tool/build/lib/eztls.h
+++ b/tool/build/lib/eztls.h
@@ -20,6 +20,7 @@ extern mbedtls_ctr_drbg_context ezrng;
void EzFd(int);
void EzHandshake(void);
+int EzHandshake2(void);
void EzSetup(char[32]);
void EzInitialize(void);
int EzTlsFlush(struct EzTlsBio *, const unsigned char *, size_t);
diff --git a/tool/build/lib/fds.h b/tool/build/lib/fds.h
index 8899893c9..ca038e6c5 100644
--- a/tool/build/lib/fds.h
+++ b/tool/build/lib/fds.h
@@ -1,6 +1,7 @@
#ifndef COSMOPOLITAN_TOOL_BUILD_LIB_FDS_H_
#define COSMOPOLITAN_TOOL_BUILD_LIB_FDS_H_
#include "libc/calls/struct/iovec.h"
+#include "libc/sock/sock.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@@ -14,17 +15,18 @@ struct MachineFdCb {
ssize_t (*readv)(int, const struct iovec *, int);
ssize_t (*writev)(int, const struct iovec *, int);
int (*ioctl)(int, uint64_t, void *);
+ int (*poll)(struct pollfd *, uint64_t, int32_t);
};
struct MachineFd {
int fd;
- struct MachineFdCb * cb;
+ struct MachineFdCb *cb;
};
struct MachineFds {
size_t i, n;
- struct MachineFd * p;
- struct MachineFdClosed * closed;
+ struct MachineFd *p;
+ struct MachineFdClosed *closed;
};
int MachineFdAdd(struct MachineFds *);
diff --git a/tool/build/lib/ioports.c b/tool/build/lib/ioports.c
index 03f5fb6f8..adc231b9a 100644
--- a/tool/build/lib/ioports.c
+++ b/tool/build/lib/ioports.c
@@ -17,8 +17,12 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/calls/struct/iovec.h"
+#include "libc/dce.h"
+#include "libc/log/log.h"
#include "libc/nexgen32e/uart.internal.h"
+#include "libc/sock/sock.h"
#include "libc/sysv/consts/fileno.h"
+#include "libc/sysv/consts/poll.h"
#include "tool/build/lib/ioports.h"
static int OpE9Read(struct Machine *m) {
@@ -42,7 +46,21 @@ static void OpE9Write(struct Machine *m, uint8_t b) {
m->fds.p[fd].cb->writev(m->fds.p[fd].fd, &(struct iovec){&b, 1}, 1);
}
+static int OpE9Poll(struct Machine *m) {
+ int fd, rc;
+ struct pollfd pf;
+ fd = STDIN_FILENO;
+ if (fd >= m->fds.i) return -1;
+ if (!m->fds.p[fd].cb) return -1;
+ pf.fd = m->fds.p[fd].fd;
+ pf.events = POLLIN | POLLOUT;
+ rc = m->fds.p[fd].cb->poll(&pf, 1, 20);
+ if (rc <= 0) return rc;
+ return pf.revents;
+}
+
static int OpSerialIn(struct Machine *m, int r) {
+ int p, s;
switch (r) {
case UART_DLL:
if (!m->dlab) {
@@ -51,7 +69,15 @@ static int OpSerialIn(struct Machine *m, int r) {
return 0x01;
}
case UART_LSR:
- return UART_TTYDA | UART_TTYTXR | UART_TTYIDL;
+ if (IsWindows()) {
+ p = POLLIN | POLLOUT; /* XXX */
+ } else {
+ if ((p = OpE9Poll(m)) == -1) return -1;
+ }
+ s = UART_TTYIDL;
+ if (p & POLLIN) s |= UART_TTYDA;
+ if (p & POLLOUT) s |= UART_TTYTXR;
+ return s;
default:
return 0;
}
diff --git a/tool/build/lib/loader.c b/tool/build/lib/loader.c
index 0b3a31a66..78e622030 100644
--- a/tool/build/lib/loader.c
+++ b/tool/build/lib/loader.c
@@ -43,7 +43,7 @@ static void LoadElfLoadSegment(struct Machine *m, void *code, size_t codesize,
int64_t align, bsssize;
int64_t felf, fstart, fend, vstart, vbss, vend;
align = MAX(phdr->p_align, PAGESIZE);
- CHECK_EQ(1, popcnt(align));
+ if (popcnt(align) != 1) align = 8;
CHECK_EQ(0, (phdr->p_vaddr - phdr->p_offset) % align);
felf = (int64_t)(intptr_t)code;
vstart = ROUNDDOWN(phdr->p_vaddr, align);
diff --git a/tool/build/lib/machine.c b/tool/build/lib/machine.c
index 8a2f28496..d3d220e96 100644
--- a/tool/build/lib/machine.c
+++ b/tool/build/lib/machine.c
@@ -288,6 +288,12 @@ static void OpJmpf(struct Machine *m, uint32_t rde) {
}
}
+static void OpInto(struct Machine *m, uint32_t rde) {
+ if (GetFlag(m->flags, FLAGS_OF)) {
+ HaltMachine(m, kMachineOverflow);
+ }
+}
+
static relegated void OpXlatAlBbb(struct Machine *m, uint32_t rde) {
uint64_t v;
v = MaskAddress(Eamode(rde), Read64(m->bx) + Read8(m->ax));
@@ -1888,7 +1894,7 @@ static const nexgen32e_f kNexgen32e[] = {
[0x0CB] = OpRetf,
[0x0CC] = OpInterrupt3,
[0x0CD] = OpInterruptImm,
- [0x0CE] = OpUd,
+ [0x0CE] = OpInto,
[0x0CF] = OpUd,
[0x0D0] = OpBsubi1,
[0x0D1] = OpBsuwi1,
diff --git a/tool/build/lib/machine.h b/tool/build/lib/machine.h
index edbd0141f..cdc63280a 100644
--- a/tool/build/lib/machine.h
+++ b/tool/build/lib/machine.h
@@ -13,6 +13,7 @@
#define kMachineFpuException -7
#define kMachineProtectionFault -8
#define kMachineSimdException -9
+#define kMachineOverflow -10
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
diff --git a/tool/build/lib/memory.c b/tool/build/lib/memory.c
index 4513356f7..f1c645519 100644
--- a/tool/build/lib/memory.c
+++ b/tool/build/lib/memory.c
@@ -21,6 +21,7 @@
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
+#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/pc.internal.h"
#include "libc/str/str.h"
#include "libc/x/x.h"
@@ -90,7 +91,7 @@ void *FindReal(struct Machine *m, int64_t virt) {
uint64_t table, entry, page;
unsigned skew, level, index, i;
if ((m->mode & 3) != XED_MODE_REAL) {
- if (-0x800000000000 <= virt && virt < 0x800000000000) {
+ if (IsLegalPointer(virt)) {
if (!(entry = FindPage(m, virt))) return NULL;
return m->real.p + (entry & PAGE_TA) + (virt & 0xfff);
} else {
diff --git a/tool/build/lib/pty.c b/tool/build/lib/pty.c
index 906344cce..30f4448fb 100644
--- a/tool/build/lib/pty.c
+++ b/tool/build/lib/pty.c
@@ -1167,10 +1167,45 @@ ssize_t PtyWrite(struct Pty *pty, const void *data, size_t n) {
}
ssize_t PtyWriteInput(struct Pty *pty, const void *data, size_t n) {
- PtyConcatInput(pty, data, n);
- if (!(pty->conf & kPtyNoecho)) {
- PtyWrite(pty, data, n);
+ int c;
+ bool cr;
+ char *p;
+ const char *q;
+ size_t i, j, m;
+ q = data;
+ p = pty->input.p;
+ i = pty->input.i;
+ m = pty->input.n;
+ if (i + n * 2 + 1 > m) {
+ m = MAX(m, 8);
+ do m += m >> 1;
+ while (i + n * 2 + 1 > m);
+ if (!(p = realloc(p, m))) {
+ return -1;
+ }
+ pty->input.p = p;
+ pty->input.n = m;
}
+ cr = i && p[i - 1] == '\r';
+ for (j = 0; j < n; ++j) {
+ c = q[j] & 255;
+ if (c == '\r') {
+ cr = true;
+ } else if (cr) {
+ if (c != '\n') {
+ p[i++] = '\n';
+ }
+ cr = false;
+ }
+ p[i++] = c;
+ }
+ if (cr) {
+ p[i++] = '\n';
+ }
+ if (!(pty->conf & kPtyNoecho)) {
+ PtyWrite(pty, p + pty->input.i, i - pty->input.i);
+ }
+ pty->input.i = i;
return n;
}
diff --git a/tool/build/lib/syscall.c b/tool/build/lib/syscall.c
index 76d9c87c7..f8e4976c6 100644
--- a/tool/build/lib/syscall.c
+++ b/tool/build/lib/syscall.c
@@ -102,6 +102,7 @@
const struct MachineFdCb kMachineFdCbHost = {
.close = close,
.readv = readv,
+ .poll = poll,
.writev = writev,
.ioctl = (void *)ioctl,
};
diff --git a/tool/build/lib/time.c b/tool/build/lib/time.c
index 30a77c834..f134ce478 100644
--- a/tool/build/lib/time.c
+++ b/tool/build/lib/time.c
@@ -18,7 +18,9 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/calls/calls.h"
#include "libc/nexgen32e/rdtsc.h"
+#include "libc/sock/sock.h"
#include "libc/sysv/consts/clock.h"
+#include "libc/sysv/consts/poll.h"
#include "libc/time/time.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/modrm.h"
@@ -29,7 +31,19 @@
*/
void OpPause(struct Machine *m, uint32_t rde) {
- sched_yield();
+ struct pollfd pf;
+ static bool once, interactive;
+ if (!once) {
+ interactive = isatty(0);
+ once = true;
+ }
+ if (!IsWindows() && interactive) {
+ pf.fd = 0;
+ pf.events = POLLIN;
+ poll(&pf, 1, 20); /* make spin loops less brutal */
+ } else {
+ sched_yield();
+ }
}
void OpRdtsc(struct Machine *m, uint32_t rde) {
diff --git a/tool/build/package.c b/tool/build/package.c
index 41e0c65a6..6e1ee212e 100644
--- a/tool/build/package.c
+++ b/tool/build/package.c
@@ -53,6 +53,7 @@
#include "third_party/xed/x86.h"
#include "third_party/zlib/zlib.h"
#include "tool/build/lib/elfwriter.h"
+#include "tool/build/lib/getargs.h"
#include "tool/build/lib/persist.h"
/**
@@ -62,14 +63,14 @@
*
* This script verifies the well-formedness of dependencies, e.g.
*
- * o/tool/build/package.com \
- * -o o/libc/stubs/stubs.pkg \
- * o/libc/stubs/{a,b,...}.o
+ * o/tool/build/package.com \
+ * -o o/libc/stubs/stubs.pkg \
+ * o/libc/stubs/{a,b,...}.o
*
- * o/tool/build/package.com \
- * -o o/libc/nexgen32e/nexgen32e.pkg \
- * -d o/libc/stubs/stubs.pkg \
- * o/libc/nexgen32e/{a,b,...}.o
+ * o/tool/build/package.com \
+ * -o o/libc/nexgen32e/nexgen32e.pkg \
+ * -d o/libc/stubs/stubs.pkg \
+ * o/libc/nexgen32e/{a,b,...}.o
*
* We want the following:
*
@@ -84,21 +85,30 @@
*
* SECOND PURPOSE
*
- * We want all storage to be thread-local storage. So we change
- * RIP-relative instructions to be RBX-relative, only when they
- * reference sections in the binary mutable after initialization.
- *
- * This is basically what the Go language does to implement its fiber
- * multiprocessing model. We can have this in C by appropriating all the
- * work folks put into enriching GNU C with WIN32 and ASLR lool.
- *
- * THIRD PURPOSE
- *
* Compress read-only data sections of particularly low entropy, using
* the most appropriate directly-linked algorithm and then inject code
* into _init() that calls it. If the data is extremely low energy, we
* will inject code for merging page table entries too. The overcommit
* here is limitless.
+ *
+ * POSSIBLE PURPOSE
+ *
+ * It might be nice to have all storage to be thread-local storage. So
+ * we change RIP-relative instructions to be RBX-relative, only when
+ * they reference sections in the binary mutable after initialization.
+ *
+ * This is basically what the Go language does to implement its fiber
+ * multiprocessing model. We can have this in C by appropriating all the
+ * work folks put into enriching GNU C with WIN32 and ASLR lool.
+ *
+ * CAVEATS
+ *
+ * This tool monkey patches `.o` files as a side-effect since we're not
+ * able to modify the GCC source code. Therefore it's VERY IMPORTANT to
+ * have Makefile rules which build `.a` or `.com.dbg` *depend* upon the
+ * `.pkg` rule. That way they happen in the right order. Otherwise they
+ * might build binaries with compromised profiling nops at the start of
+ * functions, which will almost certainly result in SIGILL.
*/
#define PACKAGE_MAGIC bswap_32(0xBEEFBEEFu)
@@ -226,6 +236,8 @@ void WritePackage(struct Package *pkg) {
void GetOpts(struct Package *pkg, struct Packages *deps, int argc,
char *argv[]) {
long i, si, opt;
+ const char *arg;
+ struct GetArgs ga;
pkg->path = -1;
while ((opt = getopt(argc, argv, "vho:d:")) != -1) {
switch (opt) {
@@ -251,10 +263,12 @@ void GetOpts(struct Package *pkg, struct Packages *deps, int argc,
CHECK_LT(optind, argc,
"no objects passed to package.com; "
"is your foo.mk $(FOO_OBJS) glob broken?");
- for (i = optind; i < argc; ++i) {
- CHECK_NE(-1, (si = concat(&pkg->strings, argv[i], strlen(argv[i]) + 1)));
+ getargs_init(&ga, argv + optind);
+ while ((arg = getargs_next(&ga))) {
+ CHECK_NE(-1, (si = concat(&pkg->strings, arg, strlen(arg) + 1)));
CHECK_NE(-1, append(&pkg->objects, (&(struct Object){si})));
}
+ getargs_destroy(&ga);
}
void IndexSections(struct Object *obj) {
@@ -671,17 +685,17 @@ void Package(int argc, char *argv[], struct Package *pkg,
}
free(pkg->objects.p[i].sections.p);
}
- free_s(&pkg->strings.p);
- free_s(&pkg->objects.p);
- free_s(&pkg->symbols.p);
- free_s(&deps->p);
+ free(pkg->strings.p);
+ free(pkg->objects.p);
+ free(pkg->symbols.p);
+ free(deps->p);
}
int main(int argc, char *argv[]) {
struct Package pkg;
struct Packages deps;
if (argc == 2 && !strcmp(argv[1], "-n")) exit(0);
- showcrashreports();
+ if (IsModeDbg()) ShowCrashReports();
bzero(&pkg, sizeof(pkg));
bzero(&deps, sizeof(deps));
Package(argc, argv, &pkg, &deps);
diff --git a/tool/build/runit.c b/tool/build/runit.c
index ff461e03b..5cb2b5198 100644
--- a/tool/build/runit.c
+++ b/tool/build/runit.c
@@ -22,18 +22,22 @@
#include "libc/calls/calls.h"
#include "libc/calls/sigbits.h"
#include "libc/calls/struct/flock.h"
+#include "libc/dce.h"
#include "libc/dns/dns.h"
#include "libc/fmt/conv.h"
+#include "libc/intrin/kprintf.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/crc32.h"
#include "libc/runtime/gc.internal.h"
+#include "libc/runtime/runtime.h"
#include "libc/sock/ipclassify.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/ex.h"
+#include "libc/sysv/consts/f.h"
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/ipproto.h"
#include "libc/sysv/consts/itimer.h"
@@ -110,6 +114,8 @@ char g_hostname[128];
uint16_t g_runitdport;
volatile bool alarmed;
+int __sys_execve(const char *, char *const[], char *const[]) hidden;
+
static void OnAlarm(int sig) {
alarmed = true;
}
@@ -166,7 +172,7 @@ void DeployEphemeralRunItDaemonRemotelyViaSsh(struct addrinfo *ai) {
mkdir("o", 0755);
CHECK_NE(-1, (lock = open(gc(xasprintf("o/lock.%s", g_hostname)),
O_RDWR | O_CREAT, 0644)));
- CHECK_NE(-1, flock(lock, LOCK_EX));
+ CHECK_NE(-1, fcntl(lock, F_SETLKW, &(struct flock){F_WRLCK}));
CHECK_NE(-1, gettimeofday(&now, 0));
if (!read(lock, &then, 16) || ((now.tv_sec * 1000 + now.tv_usec / 1000) -
(then.tv_sec * 1000 + then.tv_usec / 1000)) >=
@@ -232,6 +238,7 @@ void DeployEphemeralRunItDaemonRemotelyViaSsh(struct addrinfo *ai) {
} else {
DEBUGF("nospawn %s on %s:%hu", g_runitd, g_hostname, g_runitdport);
}
+ CHECK_NE(-1, fcntl(lock, F_SETLK, &(struct flock){F_UNLCK}));
LOGIFNEG1(close(lock));
}
@@ -376,6 +383,14 @@ drop:
return res;
}
+static inline bool IsElf(const char *p, size_t n) {
+ return n >= 4 && READ32LE(p) == READ32LE("\177ELF");
+}
+
+static inline bool IsMachO(const char *p, size_t n) {
+ return n >= 4 && READ32LE(p) == 0xFEEDFACEu + 1;
+}
+
int RunOnHost(char *spec) {
int rc;
char *p;
@@ -386,9 +401,13 @@ int RunOnHost(char *spec) {
1);
if (!strchr(g_hostname, '.')) strcat(g_hostname, ".test.");
do {
- Connect();
- EzFd(g_sock);
- EzHandshake(); /* TODO(jart): Backoff on MBEDTLS_ERR_NET_CONN_RESET */
+ for (;;) {
+ Connect();
+ EzFd(g_sock);
+ if (!EzHandshake2()) break;
+ WARNF("warning: got connection reset in handshake");
+ close(g_sock);
+ }
SendRequest();
} while ((rc = ReadResponse()) == -1);
return rc;
@@ -403,11 +422,14 @@ bool ShouldRunInParralel(void) {
return !IsWindows() && IsParallelBuild();
}
-int RunRemoteTestsInParallel(char *hosts[], int count) {
+int SpawnSubprocesses(int argc, char *argv[]) {
sigset_t chldmask, savemask;
int i, rc, ws, pid, *pids, exitcode;
struct sigaction ignore, saveint, savequit;
- pids = calloc(count, sizeof(char *));
+ char *args[5] = {argv[0], argv[1], argv[2]};
+ argc -= 3;
+ argv += 3;
+ pids = calloc(argc, sizeof(int));
ignore.sa_flags = 0;
ignore.sa_handler = SIG_IGN;
LOGIFNEG1(sigemptyset(&ignore.sa_mask));
@@ -416,13 +438,17 @@ int RunRemoteTestsInParallel(char *hosts[], int count) {
LOGIFNEG1(sigemptyset(&chldmask));
LOGIFNEG1(sigaddset(&chldmask, SIGCHLD));
LOGIFNEG1(sigprocmask(SIG_BLOCK, &chldmask, &savemask));
- for (i = 0; i < count; ++i) {
- CHECK_NE(-1, (pids[i] = fork()));
+ for (i = 0; i < argc; ++i) {
+ args[3] = argv[i];
+ fprintf(stderr, "spawning %s %s %s %s\n", args[0], args[1], args[2],
+ args[3]);
+ CHECK_NE(-1, (pids[i] = vfork()));
if (!pids[i]) {
- sigaction(SIGINT, &saveint, NULL);
- sigaction(SIGQUIT, &savequit, NULL);
- sigprocmask(SIG_SETMASK, &savemask, NULL);
- _exit(RunOnHost(hosts[i]));
+ xsigaction(SIGINT, SIG_DFL, 0, 0, 0);
+ xsigaction(SIGQUIT, SIG_DFL, 0, 0, 0);
+ sigprocmask(SIG_SETMASK, &savemask, 0);
+ execve(args[0], args, environ); /* for htop */
+ _exit(127);
}
}
for (exitcode = 0;;) {
@@ -431,13 +457,17 @@ int RunRemoteTestsInParallel(char *hosts[], int count) {
if (errno == ECHILD) break;
FATALF("wait failed");
}
- for (i = 0; i < count; ++i) {
+ for (i = 0; i < argc; ++i) {
if (pids[i] != pid) continue;
if (WIFEXITED(ws)) {
- DEBUGF("%s exited with %d", hosts[i], WEXITSTATUS(ws));
+ if (WEXITSTATUS(ws)) {
+ INFOF("%s exited with %d", argv[i], WEXITSTATUS(ws));
+ } else {
+ DEBUGF("%s exited with %d", argv[i], WEXITSTATUS(ws));
+ }
if (!exitcode) exitcode = WEXITSTATUS(ws);
} else {
- DEBUGF("%s terminated with %s", hosts[i], strsignal(WTERMSIG(ws)));
+ INFOF("%s terminated with %s", argv[i], strsignal(WTERMSIG(ws)));
if (!exitcode) exitcode = 128 + WTERMSIG(ws);
}
break;
@@ -447,24 +477,36 @@ int RunRemoteTestsInParallel(char *hosts[], int count) {
LOGIFNEG1(sigaction(SIGQUIT, &savequit, NULL));
LOGIFNEG1(sigprocmask(SIG_SETMASK, &savemask, NULL));
free(pids);
+ kprintf("nocommit%n");
return exitcode;
}
int main(int argc, char *argv[]) {
ShowCrashReports();
- SetupPresharedKeySsl(MBEDTLS_SSL_IS_CLIENT, GetRunitPsk());
- /* __log_level = kLogDebug; */
+ __log_level = kLogDebug;
if (argc > 1 &&
(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)) {
ShowUsage(stdout, 0);
unreachable;
}
- if (argc < 1 + 2) ShowUsage(stderr, EX_USAGE);
- CHECK_NOTNULL(commandv(firstnonnull(getenv("SSH"), "ssh"), g_ssh));
+ if (argc < 3) {
+ ShowUsage(stderr, EX_USAGE);
+ unreachable;
+ }
CheckExists((g_runitd = argv[1]));
CheckExists((g_prog = argv[2]));
- if (argc == 1 + 2) return 0; /* hosts list empty */
- g_sshport = 22;
- g_runitdport = RUNITD_PORT;
- return RunRemoteTestsInParallel(&argv[3], argc - 3);
+ CHECK_NOTNULL(commandv(firstnonnull(getenv("SSH"), "ssh"), g_ssh));
+ if (argc == 3) {
+ /* hosts list empty */
+ return 0;
+ } else if (argc == 4) {
+ /* single host */
+ SetupPresharedKeySsl(MBEDTLS_SSL_IS_CLIENT, GetRunitPsk());
+ g_sshport = 22;
+ g_runitdport = RUNITD_PORT;
+ return RunOnHost(argv[3]);
+ } else {
+ /* multiple hosts */
+ return SpawnSubprocesses(argc, argv);
+ }
}
diff --git a/tool/build/runitd.c b/tool/build/runitd.c
index 6e60a1797..2d2225a8b 100644
--- a/tool/build/runitd.c
+++ b/tool/build/runitd.c
@@ -87,7 +87,7 @@
* - 1 byte exit status
*/
-#define DEATH_CLOCK_SECONDS 5
+#define DEATH_CLOCK_SECONDS 16
#define kLogFile "o/runitd.log"
#define kLogMaxBytes (2 * 1000 * 1000)
@@ -339,6 +339,8 @@ void HandleClient(void) {
dup2(g_devnullfd, 0);
dup2(pipefds[1], 1);
dup2(pipefds[1], 2);
+ if (pipefds[0] > 2) close(pipefds[1]);
+ if (g_devnullfd > 2) close(g_devnullfd);
execv(g_exepath, (char *const[]){g_exepath, NULL});
_exit(127);
}
diff --git a/tool/emacs/cosmo-c-builtins.el b/tool/emacs/cosmo-c-builtins.el
index 862b8d7ba..bda245d50 100644
--- a/tool/emacs/cosmo-c-builtins.el
+++ b/tool/emacs/cosmo-c-builtins.el
@@ -134,6 +134,7 @@
"__builtin_expect"
"__builtin_trap"
"__builtin_unreachable"
+ "__builtin_assume"
"__builtin_assume_aligned"
"__builtin_LINE"
"__builtin_FUNCTION"
diff --git a/tool/emacs/cosmo-c-keywords.el b/tool/emacs/cosmo-c-keywords.el
index 85b91f18e..3323464c9 100644
--- a/tool/emacs/cosmo-c-keywords.el
+++ b/tool/emacs/cosmo-c-keywords.el
@@ -1,50 +1,6 @@
(defconst cosmo-c-keywords-regex
(let (
- ;; (kar
- ;; '("case"
- ;; "do"
- ;; "return"
- ;; "struct"
- ;; "for"
- ;; "default"
- ;; "auto"
- ;; "while"
- ;; "else"
- ;; "break"
- ;; "union"
- ;; "switch"
- ;; "continue"
- ;; "extern"
- ;; "sizeof"
- ;; "if"
- ;; "goto"))
-
- ;; (ansi
- ;; '("static"
- ;; "sizeof"
- ;; "if"
- ;; "typedef"
- ;; "const"
- ;; "struct"
- ;; "for"
- ;; "union"
- ;; "switch"
- ;; "volatile"
- ;; "do"
- ;; "return"
- ;; "goto"
- ;; "auto"
- ;; "enum"
- ;; "else"
- ;; "break"
- ;; "extern"
- ;; "case"
- ;; "default"
- ;; "register"
- ;; "while"
- ;; "continue"))
-
(c99
'("inline"
"restrict"
@@ -64,67 +20,10 @@
"_Complex_I"
"_Imaginary_I"))
- ;; (cxx17
- ;; '("this"
- ;; "thread_local"
- ;; "private"
- ;; "catch"
- ;; "export"
- ;; "operator"
- ;; "sizeof"
- ;; "dynamic_cast"
- ;; "static_assert"
- ;; "const_cast"
- ;; "const"
- ;; "for"
- ;; "static_cast"
- ;; "union"
- ;; "namespace"
- ;; "switch"
- ;; "virtual"
- ;; "class"
- ;; "alignas"
- ;; "continue"
- ;; "volatile"
- ;; "template"
- ;; "mutable"
- ;; "if"
- ;; "public"
- ;; "friend"
- ;; "do"
- ;; "inline"
- ;; "return"
- ;; "goto"
- ;; "alignof"
- ;; "auto"
- ;; "enum"
- ;; "typedef"
- ;; "else"
- ;; "break"
- ;; "constexpr"
- ;; "new"
- ;; "extern"
- ;; "using"
- ;; "throw"
- ;; "asm"
- ;; "case"
- ;; "typeid"
- ;; "decltype"
- ;; "reinterpret_cast"
- ;; "default"
- ;; "noexcept"
- ;; "register"
- ;; "nullptr"
- ;; "try"
- ;; "typename"
- ;; "while"
- ;; "protected"
- ;; "static"
- ;; "explicit"
- ;; "delete"))
-
(cosmo
'("__msabi"
+ "var"
+ "function"
"offsetof"
"microarchitecture"
"targetclones"
@@ -298,7 +197,9 @@
"__weak__"
"__vector_size__"
"__ms_abi__"
- "__mode__"))
+ "__mode__"
+ "__seg_fs"
+ "__seg_gs"))
(clang
'("__optnone__"
@@ -306,11 +207,8 @@
)
(concat "\\_<"
- (regexp-opt (append ;; kar
- ;; ansi
- ;; c99
+ (regexp-opt (append
c11
- ;; cxx17
gnu
clang
cosmo))
diff --git a/tool/emacs/cosmo-format.el b/tool/emacs/cosmo-format.el
index 446fa5a28..6135a12e6 100644
--- a/tool/emacs/cosmo-format.el
+++ b/tool/emacs/cosmo-format.el
@@ -97,19 +97,22 @@
"Beautifies source code in current buffer."
(interactive)
(when (and (memq major-mode cosmo-format-modes)
- (member (file-name-extension (buffer-file-name))
- cosmo-format-exts)
- (not (member (file-name-nondirectory (buffer-name))
- cosmo-format-blacklist)))
+ (member (file-name-extension (buffer-file-name))
+ cosmo-format-exts)
+ (not (member (file-name-nondirectory (buffer-name))
+ cosmo-format-blacklist))
+ (not (save-excursion
+ (beginning-of-buffer)
+ (looking-at "/\\* clang-format off \\*/"))))
(let ((bin (cosmo--find-clang-format-bin)))
(when bin
(let ((p (point))
(tmp (make-temp-file "cosmo-format"))
(arg (or cosmo-format-arg
- (and (locate-dominating-file
- (buffer-file-name)
- ".clang-format")
- "-style=file"))))
+ (and (locate-dominating-file
+ (buffer-file-name)
+ ".clang-format")
+ "-style=file"))))
(when arg
(message arg)
(write-region nil nil tmp)
diff --git a/tool/emacs/cosmo-stuff.el b/tool/emacs/cosmo-stuff.el
index eca89f3c7..becba0ff2 100644
--- a/tool/emacs/cosmo-stuff.el
+++ b/tool/emacs/cosmo-stuff.el
@@ -187,8 +187,9 @@
(format "m=%s; make -j8 -O MODE=$m o/$m/%s"
mode
(directory-file-name
- (file-name-directory
- (file-relative-name this root)))))
+ (or (file-name-directory
+ (file-relative-name this root))
+ ""))))
((and (equal suffix "")
(cosmo-contains "_test." (buffer-file-name)))
(format "m=%s; make -j8 -O MODE=$m %s"
@@ -468,11 +469,11 @@
;; -ffast-math -funsafe-math-optimizations -fsched2-use-superblocks -fjump-tables
(cond ((eq arg 9)
(cosmo--assembly 1
- "V=1 OVERRIDE_COPTS='-fverbose-asm -fsanitize=undefined -fno-sanitize=null -fno-sanitize=alignment -fno-sanitize=pointer-overflow'"))
+ "V=1 OVERRIDE_COPTS='-w -fverbose-asm -fsanitize=undefined -fno-sanitize=null -fno-sanitize=alignment -fno-sanitize=pointer-overflow'"))
((not (eq 0 (logand 8 arg)))
(cosmo--assembly (setq arg (logand (lognot 8)))
- "V=1 OVERRIDE_COPTS='-fverbose-asm -fsanitize=address'"))
- (t (cosmo--assembly arg "V=1 OVERRIDE_COPTS='' CPPFLAGS=''"))))
+ "V=1 OVERRIDE_COPTS='-w -fverbose-asm -fsanitize=address'"))
+ (t (cosmo--assembly arg "V=1 OVERRIDE_COPTS='-w ' CPPFLAGS=''"))))
(defun cosmo-assembly-native (arg)
(interactive "P")
@@ -607,7 +608,7 @@
(compile (format "make -j8 MODE=%s PYHARNESSARGS=-vv PYTESTARGS=-v o/%s/%s.py.runs"
mode mode (file-name-sans-extension file)))))
((eq major-mode 'python-mode)
- (compile (format "python3 %s" file)))
+ (compile (format "python.com %s" file)))
('t
(error "cosmo-run: unknown major mode")))))))
@@ -710,6 +711,7 @@
(concat dots notest ".c")
(concat dots notest ".cc")
(concat dots notest ".rl")
+ (concat dots notest ".greg.c")
(concat dots notest ".ncabi.c")
(concat dots notest ".hookabi.c")
(concat dots notest ".h"))))
diff --git a/tool/viz/printpeb.c b/tool/viz/printpeb.c
index 8c6151d02..1a31a9399 100644
--- a/tool/viz/printpeb.c
+++ b/tool/viz/printpeb.c
@@ -382,8 +382,8 @@ void PrintModulesLoadOrder(void) {
/* struct NtLinkedList InLoadOrderLinks; /\* msdn:reserved *\/ */
/* struct NtLinkedList InMemoryOrderLinks; */
/* struct NtLinkedList InInitOrderLinks; /\* msdn:reserved *\/ */
- printf("0x%p\n", ldr);
- printf("0x%p vs. 0x%p\n", dll, GetModuleHandleW(dll->FullDllName.Data));
+ printf("%p\n", ldr);
+ printf("%p vs. %p\n", dll, GetModuleHandleW(dll->FullDllName.Data));
printf("0x%04x: %-40s = 0x%lx\n",
offsetof(struct NtLdrDataTableEntry, DllBase), "DllBase",
dll->DllBase);
@@ -456,7 +456,7 @@ void PrintModulesMemoryOrder(void) {
/* struct NtLinkedList InLoadOrderLinks; /\* msdn:reserved *\/ */
/* struct NtLinkedList InMemoryOrderLinks; */
/* struct NtLinkedList InInitOrderLinks; /\* msdn:reserved *\/ */
- printf("0x%p\n", dll);
+ printf("%p\n", dll);
printf("0x%04x: %-40s = 0x%lx\n",
offsetof(struct NtLdrDataTableEntry, DllBase), "DllBase",
dll->DllBase);