Use the kernel's MAX_ERRNO in the syscall stubs.

Bug: http://code.google.com/p/android/issues/detail?id=53104
Change-Id: Iaabf7025b153e96dc5eca231a33a32d4cb7d8116
diff --git a/libc/arch-arm/bionic/clone.S b/libc/arch-arm/bionic/clone.S
index 13bc7d7..281230c 100644
--- a/libc/arch-arm/bionic/clone.S
+++ b/libc/arch-arm/bionic/clone.S
@@ -26,6 +26,7 @@
  * SUCH DAMAGE.
  */
 
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -45,10 +46,12 @@
     movs    r0, r0
     beq     1f
 
-    # In parent, reload saved registers then either exit or set errno.
+    # In parent, reload saved registers then either return or set errno.
     ldmfd   sp!, {r4, r7}
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 
 1:  # The child.
     # pick the function arg and call address off the stack and jump
@@ -94,10 +97,12 @@
     movs    r0, r0
     beq     1f
 
-    # In the parent, reload saved registers then either exit or set errno.
+    # In the parent, reload saved registers then either return or set errno.
     ldmfd   sp!, {r4, r5, r6, r7}
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 
 1:  # The child.
     ldr    r0, [sp, #-4]
diff --git a/libc/arch-arm/bionic/kill.S b/libc/arch-arm/bionic/kill.S
index 33dfc2b..7e030f3 100644
--- a/libc/arch-arm/bionic/kill.S
+++ b/libc/arch-arm/bionic/kill.S
@@ -32,6 +32,8 @@
    abort due to a fatal runtime error (e.g. detection
    of a corrupted malloc heap).
 */
+
+#include <linux/err.h>
 #include <sys/linux-syscalls.h>
 #include <machine/asm.h>
 
@@ -44,7 +46,8 @@
     ldr     r7, =__NR_kill
     swi     #0
     ldmfd   sp!, {r4-r7, ip, lr}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(kill)
diff --git a/libc/arch-arm/bionic/syscall.S b/libc/arch-arm/bionic/syscall.S
index 69f3bec..be9591e 100644
--- a/libc/arch-arm/bionic/syscall.S
+++ b/libc/arch-arm/bionic/syscall.S
@@ -26,6 +26,7 @@
  * SUCH DAMAGE.
  */
 
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -39,7 +40,8 @@
     ldmfd   ip, {r3, r4, r5, r6}
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(syscall)
diff --git a/libc/arch-arm/bionic/tgkill.S b/libc/arch-arm/bionic/tgkill.S
index da5c0af..60df9e6 100644
--- a/libc/arch-arm/bionic/tgkill.S
+++ b/libc/arch-arm/bionic/tgkill.S
@@ -33,6 +33,7 @@
    of a corrupted malloc heap).
 */
 
+#include <linux/err.h>
 #include <sys/linux-syscalls.h>
 #include <machine/asm.h>
 
@@ -45,7 +46,8 @@
     ldr     r7, =__NR_tgkill
     swi     #0
     ldmfd   sp!, {r4-r7, ip, lr}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(tgkill)
diff --git a/libc/arch-arm/bionic/tkill.S b/libc/arch-arm/bionic/tkill.S
index fdc5ed4..d5bb739 100644
--- a/libc/arch-arm/bionic/tkill.S
+++ b/libc/arch-arm/bionic/tkill.S
@@ -33,6 +33,7 @@
    of a corrupted malloc heap).
 */
 
+#include <linux/err.h>
 #include <sys/linux-syscalls.h>
 #include <machine/asm.h>
 
@@ -45,7 +46,8 @@
     ldr     r7, =__NR_tkill
     swi     #0
     ldmfd   sp!, {r4-r7, ip, lr}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(tkill)
diff --git a/libc/arch-arm/syscalls/__brk.S b/libc/arch-arm/syscalls/__brk.S
index e4fcab0..1cc6a17 100644
--- a/libc/arch-arm/syscalls/__brk.S
+++ b/libc/arch-arm/syscalls/__brk.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_brk
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__brk)
diff --git a/libc/arch-arm/syscalls/__fcntl.S b/libc/arch-arm/syscalls/__fcntl.S
index ee82ef1..c15ad66 100644
--- a/libc/arch-arm/syscalls/__fcntl.S
+++ b/libc/arch-arm/syscalls/__fcntl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fcntl
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__fcntl)
diff --git a/libc/arch-arm/syscalls/__fcntl64.S b/libc/arch-arm/syscalls/__fcntl64.S
index 96cc16b..ea47a60 100644
--- a/libc/arch-arm/syscalls/__fcntl64.S
+++ b/libc/arch-arm/syscalls/__fcntl64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fcntl64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__fcntl64)
diff --git a/libc/arch-arm/syscalls/__fork.S b/libc/arch-arm/syscalls/__fork.S
index 9df9702..279155a 100644
--- a/libc/arch-arm/syscalls/__fork.S
+++ b/libc/arch-arm/syscalls/__fork.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fork
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__fork)
diff --git a/libc/arch-arm/syscalls/__fstatfs64.S b/libc/arch-arm/syscalls/__fstatfs64.S
index 6e90214..e8bc408 100644
--- a/libc/arch-arm/syscalls/__fstatfs64.S
+++ b/libc/arch-arm/syscalls/__fstatfs64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fstatfs64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__fstatfs64)
diff --git a/libc/arch-arm/syscalls/__getcpu.S b/libc/arch-arm/syscalls/__getcpu.S
index 7976b06..83387d5 100644
--- a/libc/arch-arm/syscalls/__getcpu.S
+++ b/libc/arch-arm/syscalls/__getcpu.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getcpu
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__getcpu)
diff --git a/libc/arch-arm/syscalls/__getcwd.S b/libc/arch-arm/syscalls/__getcwd.S
index 6fc2d64..781f7d2 100644
--- a/libc/arch-arm/syscalls/__getcwd.S
+++ b/libc/arch-arm/syscalls/__getcwd.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getcwd
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__getcwd)
diff --git a/libc/arch-arm/syscalls/__getpriority.S b/libc/arch-arm/syscalls/__getpriority.S
index 6fb2a43..8c16fd8 100644
--- a/libc/arch-arm/syscalls/__getpriority.S
+++ b/libc/arch-arm/syscalls/__getpriority.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getpriority
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__getpriority)
diff --git a/libc/arch-arm/syscalls/__ioctl.S b/libc/arch-arm/syscalls/__ioctl.S
index 56fd607..4aef590 100644
--- a/libc/arch-arm/syscalls/__ioctl.S
+++ b/libc/arch-arm/syscalls/__ioctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ioctl
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__ioctl)
diff --git a/libc/arch-arm/syscalls/__llseek.S b/libc/arch-arm/syscalls/__llseek.S
index 9893886..5891b13 100644
--- a/libc/arch-arm/syscalls/__llseek.S
+++ b/libc/arch-arm/syscalls/__llseek.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR__llseek
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__llseek)
diff --git a/libc/arch-arm/syscalls/__mmap2.S b/libc/arch-arm/syscalls/__mmap2.S
index 542b3e0..dfaa0c4 100644
--- a/libc/arch-arm/syscalls/__mmap2.S
+++ b/libc/arch-arm/syscalls/__mmap2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_mmap2
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__mmap2)
diff --git a/libc/arch-arm/syscalls/__open.S b/libc/arch-arm/syscalls/__open.S
index 589d5ad..9622a91 100644
--- a/libc/arch-arm/syscalls/__open.S
+++ b/libc/arch-arm/syscalls/__open.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_open
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__open)
diff --git a/libc/arch-arm/syscalls/__openat.S b/libc/arch-arm/syscalls/__openat.S
index 10c30d3..2c7b472 100644
--- a/libc/arch-arm/syscalls/__openat.S
+++ b/libc/arch-arm/syscalls/__openat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_openat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__openat)
diff --git a/libc/arch-arm/syscalls/__ptrace.S b/libc/arch-arm/syscalls/__ptrace.S
index 72acd70..984d499 100644
--- a/libc/arch-arm/syscalls/__ptrace.S
+++ b/libc/arch-arm/syscalls/__ptrace.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ptrace
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__ptrace)
diff --git a/libc/arch-arm/syscalls/__reboot.S b/libc/arch-arm/syscalls/__reboot.S
index 07898a0..8dd57d6 100644
--- a/libc/arch-arm/syscalls/__reboot.S
+++ b/libc/arch-arm/syscalls/__reboot.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_reboot
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__reboot)
diff --git a/libc/arch-arm/syscalls/__rt_sigaction.S b/libc/arch-arm/syscalls/__rt_sigaction.S
index 31d4c1e..7955e13 100644
--- a/libc/arch-arm/syscalls/__rt_sigaction.S
+++ b/libc/arch-arm/syscalls/__rt_sigaction.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_rt_sigaction
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__rt_sigaction)
diff --git a/libc/arch-arm/syscalls/__rt_sigprocmask.S b/libc/arch-arm/syscalls/__rt_sigprocmask.S
index 640a7ee..c40ace8 100644
--- a/libc/arch-arm/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-arm/syscalls/__rt_sigprocmask.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_rt_sigprocmask
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__rt_sigprocmask)
diff --git a/libc/arch-arm/syscalls/__rt_sigtimedwait.S b/libc/arch-arm/syscalls/__rt_sigtimedwait.S
index ad725af..dfd23e8 100644
--- a/libc/arch-arm/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-arm/syscalls/__rt_sigtimedwait.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_rt_sigtimedwait
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__rt_sigtimedwait)
diff --git a/libc/arch-arm/syscalls/__sched_getaffinity.S b/libc/arch-arm/syscalls/__sched_getaffinity.S
index bee1674..5c241b5 100644
--- a/libc/arch-arm/syscalls/__sched_getaffinity.S
+++ b/libc/arch-arm/syscalls/__sched_getaffinity.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_getaffinity
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__sched_getaffinity)
diff --git a/libc/arch-arm/syscalls/__set_tls.S b/libc/arch-arm/syscalls/__set_tls.S
index 3039b35..909c4b3 100644
--- a/libc/arch-arm/syscalls/__set_tls.S
+++ b/libc/arch-arm/syscalls/__set_tls.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ARM_set_tls
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__set_tls)
diff --git a/libc/arch-arm/syscalls/__setresuid.S b/libc/arch-arm/syscalls/__setresuid.S
index 1877bbf..baa5f30 100644
--- a/libc/arch-arm/syscalls/__setresuid.S
+++ b/libc/arch-arm/syscalls/__setresuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setresuid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__setresuid)
diff --git a/libc/arch-arm/syscalls/__setreuid.S b/libc/arch-arm/syscalls/__setreuid.S
index 2129cb2..660bd2e 100644
--- a/libc/arch-arm/syscalls/__setreuid.S
+++ b/libc/arch-arm/syscalls/__setreuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setreuid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__setreuid)
diff --git a/libc/arch-arm/syscalls/__setuid.S b/libc/arch-arm/syscalls/__setuid.S
index 9df2f89..fa98432 100644
--- a/libc/arch-arm/syscalls/__setuid.S
+++ b/libc/arch-arm/syscalls/__setuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setuid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__setuid)
diff --git a/libc/arch-arm/syscalls/__sigsuspend.S b/libc/arch-arm/syscalls/__sigsuspend.S
index 8f1ff55..0ef0c54 100644
--- a/libc/arch-arm/syscalls/__sigsuspend.S
+++ b/libc/arch-arm/syscalls/__sigsuspend.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sigsuspend
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__sigsuspend)
diff --git a/libc/arch-arm/syscalls/__statfs64.S b/libc/arch-arm/syscalls/__statfs64.S
index f8d63a3..577700a 100644
--- a/libc/arch-arm/syscalls/__statfs64.S
+++ b/libc/arch-arm/syscalls/__statfs64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_statfs64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__statfs64)
diff --git a/libc/arch-arm/syscalls/__sys_clone.S b/libc/arch-arm/syscalls/__sys_clone.S
index 48046bc..56712e4 100644
--- a/libc/arch-arm/syscalls/__sys_clone.S
+++ b/libc/arch-arm/syscalls/__sys_clone.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_clone
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__sys_clone)
diff --git a/libc/arch-arm/syscalls/__syslog.S b/libc/arch-arm/syscalls/__syslog.S
index 8ad0271..dbd3268 100644
--- a/libc/arch-arm/syscalls/__syslog.S
+++ b/libc/arch-arm/syscalls/__syslog.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_syslog
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__syslog)
diff --git a/libc/arch-arm/syscalls/__timer_create.S b/libc/arch-arm/syscalls/__timer_create.S
index fcb4e3f..6e5e647 100644
--- a/libc/arch-arm/syscalls/__timer_create.S
+++ b/libc/arch-arm/syscalls/__timer_create.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_timer_create
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__timer_create)
diff --git a/libc/arch-arm/syscalls/__timer_delete.S b/libc/arch-arm/syscalls/__timer_delete.S
index de303fc..ff6c762 100644
--- a/libc/arch-arm/syscalls/__timer_delete.S
+++ b/libc/arch-arm/syscalls/__timer_delete.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_timer_delete
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__timer_delete)
diff --git a/libc/arch-arm/syscalls/__timer_getoverrun.S b/libc/arch-arm/syscalls/__timer_getoverrun.S
index a96b047..39b0755 100644
--- a/libc/arch-arm/syscalls/__timer_getoverrun.S
+++ b/libc/arch-arm/syscalls/__timer_getoverrun.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_timer_getoverrun
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__timer_getoverrun)
diff --git a/libc/arch-arm/syscalls/__timer_gettime.S b/libc/arch-arm/syscalls/__timer_gettime.S
index 6e6bbf5..d079ffd 100644
--- a/libc/arch-arm/syscalls/__timer_gettime.S
+++ b/libc/arch-arm/syscalls/__timer_gettime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_timer_gettime
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__timer_gettime)
diff --git a/libc/arch-arm/syscalls/__timer_settime.S b/libc/arch-arm/syscalls/__timer_settime.S
index bcbe298..663082b 100644
--- a/libc/arch-arm/syscalls/__timer_settime.S
+++ b/libc/arch-arm/syscalls/__timer_settime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_timer_settime
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__timer_settime)
diff --git a/libc/arch-arm/syscalls/__wait4.S b/libc/arch-arm/syscalls/__wait4.S
index 2a0e5c4..ac59045 100644
--- a/libc/arch-arm/syscalls/__wait4.S
+++ b/libc/arch-arm/syscalls/__wait4.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_wait4
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__wait4)
diff --git a/libc/arch-arm/syscalls/__waitid.S b/libc/arch-arm/syscalls/__waitid.S
index 9950e9c..d98d9d6 100644
--- a/libc/arch-arm/syscalls/__waitid.S
+++ b/libc/arch-arm/syscalls/__waitid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_waitid
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(__waitid)
diff --git a/libc/arch-arm/syscalls/_exit.S b/libc/arch-arm/syscalls/_exit.S
index ab444ce..9c3a9f8 100644
--- a/libc/arch-arm/syscalls/_exit.S
+++ b/libc/arch-arm/syscalls/_exit.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_exit_group
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(_exit)
diff --git a/libc/arch-arm/syscalls/_exit_thread.S b/libc/arch-arm/syscalls/_exit_thread.S
index 53a21fb..4e01700 100644
--- a/libc/arch-arm/syscalls/_exit_thread.S
+++ b/libc/arch-arm/syscalls/_exit_thread.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_exit
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(_exit_thread)
diff --git a/libc/arch-arm/syscalls/accept.S b/libc/arch-arm/syscalls/accept.S
index b1a2d72..17e17ef 100644
--- a/libc/arch-arm/syscalls/accept.S
+++ b/libc/arch-arm/syscalls/accept.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_accept
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(accept)
diff --git a/libc/arch-arm/syscalls/access.S b/libc/arch-arm/syscalls/access.S
index c0b0333..2604c0c 100644
--- a/libc/arch-arm/syscalls/access.S
+++ b/libc/arch-arm/syscalls/access.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_access
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(access)
diff --git a/libc/arch-arm/syscalls/acct.S b/libc/arch-arm/syscalls/acct.S
index 5485be1..a8f7e5c 100644
--- a/libc/arch-arm/syscalls/acct.S
+++ b/libc/arch-arm/syscalls/acct.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_acct
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(acct)
diff --git a/libc/arch-arm/syscalls/bind.S b/libc/arch-arm/syscalls/bind.S
index 1bb5843..4e071eb 100644
--- a/libc/arch-arm/syscalls/bind.S
+++ b/libc/arch-arm/syscalls/bind.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_bind
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(bind)
diff --git a/libc/arch-arm/syscalls/cacheflush.S b/libc/arch-arm/syscalls/cacheflush.S
index fd7f68d..ed233e8 100644
--- a/libc/arch-arm/syscalls/cacheflush.S
+++ b/libc/arch-arm/syscalls/cacheflush.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ARM_cacheflush
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(cacheflush)
diff --git a/libc/arch-arm/syscalls/capget.S b/libc/arch-arm/syscalls/capget.S
index 1f425a0..ac297ed 100644
--- a/libc/arch-arm/syscalls/capget.S
+++ b/libc/arch-arm/syscalls/capget.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_capget
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(capget)
diff --git a/libc/arch-arm/syscalls/capset.S b/libc/arch-arm/syscalls/capset.S
index 13ebd5a..c6b043f 100644
--- a/libc/arch-arm/syscalls/capset.S
+++ b/libc/arch-arm/syscalls/capset.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_capset
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(capset)
diff --git a/libc/arch-arm/syscalls/chdir.S b/libc/arch-arm/syscalls/chdir.S
index 4965495..e59c3a0 100644
--- a/libc/arch-arm/syscalls/chdir.S
+++ b/libc/arch-arm/syscalls/chdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_chdir
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(chdir)
diff --git a/libc/arch-arm/syscalls/chmod.S b/libc/arch-arm/syscalls/chmod.S
index ed9d52f..fb0489e 100644
--- a/libc/arch-arm/syscalls/chmod.S
+++ b/libc/arch-arm/syscalls/chmod.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_chmod
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(chmod)
diff --git a/libc/arch-arm/syscalls/chown.S b/libc/arch-arm/syscalls/chown.S
index ff1cec2..41c90a6 100644
--- a/libc/arch-arm/syscalls/chown.S
+++ b/libc/arch-arm/syscalls/chown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_chown32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(chown)
diff --git a/libc/arch-arm/syscalls/chroot.S b/libc/arch-arm/syscalls/chroot.S
index bc8e3fe..a68f513 100644
--- a/libc/arch-arm/syscalls/chroot.S
+++ b/libc/arch-arm/syscalls/chroot.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_chroot
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(chroot)
diff --git a/libc/arch-arm/syscalls/clock_getres.S b/libc/arch-arm/syscalls/clock_getres.S
index 66cf9ec..bf6226c 100644
--- a/libc/arch-arm/syscalls/clock_getres.S
+++ b/libc/arch-arm/syscalls/clock_getres.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_clock_getres
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(clock_getres)
diff --git a/libc/arch-arm/syscalls/clock_gettime.S b/libc/arch-arm/syscalls/clock_gettime.S
index 4e42c82..35bfe0a 100644
--- a/libc/arch-arm/syscalls/clock_gettime.S
+++ b/libc/arch-arm/syscalls/clock_gettime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_clock_gettime
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(clock_gettime)
diff --git a/libc/arch-arm/syscalls/clock_nanosleep.S b/libc/arch-arm/syscalls/clock_nanosleep.S
index 6d530a2..34137ab 100644
--- a/libc/arch-arm/syscalls/clock_nanosleep.S
+++ b/libc/arch-arm/syscalls/clock_nanosleep.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_clock_nanosleep
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(clock_nanosleep)
diff --git a/libc/arch-arm/syscalls/clock_settime.S b/libc/arch-arm/syscalls/clock_settime.S
index e9374b5..94c0fbe 100644
--- a/libc/arch-arm/syscalls/clock_settime.S
+++ b/libc/arch-arm/syscalls/clock_settime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_clock_settime
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(clock_settime)
diff --git a/libc/arch-arm/syscalls/close.S b/libc/arch-arm/syscalls/close.S
index eb4cb62..f595025 100644
--- a/libc/arch-arm/syscalls/close.S
+++ b/libc/arch-arm/syscalls/close.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_close
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(close)
diff --git a/libc/arch-arm/syscalls/connect.S b/libc/arch-arm/syscalls/connect.S
index b97b4fe..1e7b7f9 100644
--- a/libc/arch-arm/syscalls/connect.S
+++ b/libc/arch-arm/syscalls/connect.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_connect
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(connect)
diff --git a/libc/arch-arm/syscalls/delete_module.S b/libc/arch-arm/syscalls/delete_module.S
index 0994994..122a340 100644
--- a/libc/arch-arm/syscalls/delete_module.S
+++ b/libc/arch-arm/syscalls/delete_module.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_delete_module
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(delete_module)
diff --git a/libc/arch-arm/syscalls/dup.S b/libc/arch-arm/syscalls/dup.S
index 8854342..e8272a7 100644
--- a/libc/arch-arm/syscalls/dup.S
+++ b/libc/arch-arm/syscalls/dup.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_dup
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(dup)
diff --git a/libc/arch-arm/syscalls/dup2.S b/libc/arch-arm/syscalls/dup2.S
index 0dcc57f..b0ec007 100644
--- a/libc/arch-arm/syscalls/dup2.S
+++ b/libc/arch-arm/syscalls/dup2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_dup2
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(dup2)
diff --git a/libc/arch-arm/syscalls/epoll_create.S b/libc/arch-arm/syscalls/epoll_create.S
index 92a2781..bb8d288 100644
--- a/libc/arch-arm/syscalls/epoll_create.S
+++ b/libc/arch-arm/syscalls/epoll_create.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_epoll_create
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(epoll_create)
diff --git a/libc/arch-arm/syscalls/epoll_ctl.S b/libc/arch-arm/syscalls/epoll_ctl.S
index b3c630f..255ac6f 100644
--- a/libc/arch-arm/syscalls/epoll_ctl.S
+++ b/libc/arch-arm/syscalls/epoll_ctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_epoll_ctl
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(epoll_ctl)
diff --git a/libc/arch-arm/syscalls/epoll_wait.S b/libc/arch-arm/syscalls/epoll_wait.S
index 3ccac91..1ebeaab 100644
--- a/libc/arch-arm/syscalls/epoll_wait.S
+++ b/libc/arch-arm/syscalls/epoll_wait.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_epoll_wait
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(epoll_wait)
diff --git a/libc/arch-arm/syscalls/eventfd.S b/libc/arch-arm/syscalls/eventfd.S
index 754f019..96ead51 100644
--- a/libc/arch-arm/syscalls/eventfd.S
+++ b/libc/arch-arm/syscalls/eventfd.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_eventfd2
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(eventfd)
diff --git a/libc/arch-arm/syscalls/execve.S b/libc/arch-arm/syscalls/execve.S
index 49e5b13..5b74109 100644
--- a/libc/arch-arm/syscalls/execve.S
+++ b/libc/arch-arm/syscalls/execve.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_execve
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(execve)
diff --git a/libc/arch-arm/syscalls/faccessat.S b/libc/arch-arm/syscalls/faccessat.S
index 5ade517..abc895f 100644
--- a/libc/arch-arm/syscalls/faccessat.S
+++ b/libc/arch-arm/syscalls/faccessat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_faccessat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(faccessat)
diff --git a/libc/arch-arm/syscalls/fchdir.S b/libc/arch-arm/syscalls/fchdir.S
index 96a047d..b52627a 100644
--- a/libc/arch-arm/syscalls/fchdir.S
+++ b/libc/arch-arm/syscalls/fchdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fchdir
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fchdir)
diff --git a/libc/arch-arm/syscalls/fchmod.S b/libc/arch-arm/syscalls/fchmod.S
index b096a8c..6acd482 100644
--- a/libc/arch-arm/syscalls/fchmod.S
+++ b/libc/arch-arm/syscalls/fchmod.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fchmod
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fchmod)
diff --git a/libc/arch-arm/syscalls/fchmodat.S b/libc/arch-arm/syscalls/fchmodat.S
index 8c87598..09a3569 100644
--- a/libc/arch-arm/syscalls/fchmodat.S
+++ b/libc/arch-arm/syscalls/fchmodat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fchmodat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fchmodat)
diff --git a/libc/arch-arm/syscalls/fchown.S b/libc/arch-arm/syscalls/fchown.S
index 2f7e92b..08d996e 100644
--- a/libc/arch-arm/syscalls/fchown.S
+++ b/libc/arch-arm/syscalls/fchown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fchown32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fchown)
diff --git a/libc/arch-arm/syscalls/fchownat.S b/libc/arch-arm/syscalls/fchownat.S
index 1482832..f5061ec 100644
--- a/libc/arch-arm/syscalls/fchownat.S
+++ b/libc/arch-arm/syscalls/fchownat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_fchownat
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fchownat)
diff --git a/libc/arch-arm/syscalls/fdatasync.S b/libc/arch-arm/syscalls/fdatasync.S
index 31818c8..b456fb4 100644
--- a/libc/arch-arm/syscalls/fdatasync.S
+++ b/libc/arch-arm/syscalls/fdatasync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fdatasync
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fdatasync)
diff --git a/libc/arch-arm/syscalls/fgetxattr.S b/libc/arch-arm/syscalls/fgetxattr.S
index 6f3eb3d..6cabf9f 100644
--- a/libc/arch-arm/syscalls/fgetxattr.S
+++ b/libc/arch-arm/syscalls/fgetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fgetxattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fgetxattr)
diff --git a/libc/arch-arm/syscalls/flistxattr.S b/libc/arch-arm/syscalls/flistxattr.S
index 38e856d..e912e91 100644
--- a/libc/arch-arm/syscalls/flistxattr.S
+++ b/libc/arch-arm/syscalls/flistxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_flistxattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(flistxattr)
diff --git a/libc/arch-arm/syscalls/flock.S b/libc/arch-arm/syscalls/flock.S
index 3732bfe..572d28c 100644
--- a/libc/arch-arm/syscalls/flock.S
+++ b/libc/arch-arm/syscalls/flock.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_flock
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(flock)
diff --git a/libc/arch-arm/syscalls/fremovexattr.S b/libc/arch-arm/syscalls/fremovexattr.S
index 45cf803..485886d 100644
--- a/libc/arch-arm/syscalls/fremovexattr.S
+++ b/libc/arch-arm/syscalls/fremovexattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fremovexattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fremovexattr)
diff --git a/libc/arch-arm/syscalls/fsetxattr.S b/libc/arch-arm/syscalls/fsetxattr.S
index 176cad9..29526e7 100644
--- a/libc/arch-arm/syscalls/fsetxattr.S
+++ b/libc/arch-arm/syscalls/fsetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_fsetxattr
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fsetxattr)
diff --git a/libc/arch-arm/syscalls/fstat.S b/libc/arch-arm/syscalls/fstat.S
index d314213..903c5c2 100644
--- a/libc/arch-arm/syscalls/fstat.S
+++ b/libc/arch-arm/syscalls/fstat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fstat64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fstat)
diff --git a/libc/arch-arm/syscalls/fstatat.S b/libc/arch-arm/syscalls/fstatat.S
index 8cf1a57..030ee31 100644
--- a/libc/arch-arm/syscalls/fstatat.S
+++ b/libc/arch-arm/syscalls/fstatat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fstatat64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fstatat)
diff --git a/libc/arch-arm/syscalls/fsync.S b/libc/arch-arm/syscalls/fsync.S
index 52cfa53..144b64b 100644
--- a/libc/arch-arm/syscalls/fsync.S
+++ b/libc/arch-arm/syscalls/fsync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_fsync
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(fsync)
diff --git a/libc/arch-arm/syscalls/ftruncate.S b/libc/arch-arm/syscalls/ftruncate.S
index 14cd87d..e2c5e79 100644
--- a/libc/arch-arm/syscalls/ftruncate.S
+++ b/libc/arch-arm/syscalls/ftruncate.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ftruncate
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(ftruncate)
diff --git a/libc/arch-arm/syscalls/ftruncate64.S b/libc/arch-arm/syscalls/ftruncate64.S
index 0e1b42b..19b02b6 100644
--- a/libc/arch-arm/syscalls/ftruncate64.S
+++ b/libc/arch-arm/syscalls/ftruncate64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ftruncate64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(ftruncate64)
diff --git a/libc/arch-arm/syscalls/futex.S b/libc/arch-arm/syscalls/futex.S
index 47219e3..b012cd7 100644
--- a/libc/arch-arm/syscalls/futex.S
+++ b/libc/arch-arm/syscalls/futex.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_futex
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(futex)
diff --git a/libc/arch-arm/syscalls/getdents.S b/libc/arch-arm/syscalls/getdents.S
index e6c3028..cb240ea 100644
--- a/libc/arch-arm/syscalls/getdents.S
+++ b/libc/arch-arm/syscalls/getdents.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getdents64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getdents)
diff --git a/libc/arch-arm/syscalls/getegid.S b/libc/arch-arm/syscalls/getegid.S
index 22794d1..4386c2e 100644
--- a/libc/arch-arm/syscalls/getegid.S
+++ b/libc/arch-arm/syscalls/getegid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getegid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getegid)
diff --git a/libc/arch-arm/syscalls/geteuid.S b/libc/arch-arm/syscalls/geteuid.S
index cfb318f..afe99ee 100644
--- a/libc/arch-arm/syscalls/geteuid.S
+++ b/libc/arch-arm/syscalls/geteuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_geteuid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(geteuid)
diff --git a/libc/arch-arm/syscalls/getgid.S b/libc/arch-arm/syscalls/getgid.S
index 085061e..f9b6c9e 100644
--- a/libc/arch-arm/syscalls/getgid.S
+++ b/libc/arch-arm/syscalls/getgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getgid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getgid)
diff --git a/libc/arch-arm/syscalls/getgroups.S b/libc/arch-arm/syscalls/getgroups.S
index c426d87..ab8e8a1 100644
--- a/libc/arch-arm/syscalls/getgroups.S
+++ b/libc/arch-arm/syscalls/getgroups.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getgroups32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getgroups)
diff --git a/libc/arch-arm/syscalls/getitimer.S b/libc/arch-arm/syscalls/getitimer.S
index 5d832d9..6300cdb 100644
--- a/libc/arch-arm/syscalls/getitimer.S
+++ b/libc/arch-arm/syscalls/getitimer.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getitimer
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getitimer)
diff --git a/libc/arch-arm/syscalls/getpeername.S b/libc/arch-arm/syscalls/getpeername.S
index ced69f7..f031470 100644
--- a/libc/arch-arm/syscalls/getpeername.S
+++ b/libc/arch-arm/syscalls/getpeername.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getpeername
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getpeername)
diff --git a/libc/arch-arm/syscalls/getpgid.S b/libc/arch-arm/syscalls/getpgid.S
index d599f1e..60e4589 100644
--- a/libc/arch-arm/syscalls/getpgid.S
+++ b/libc/arch-arm/syscalls/getpgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getpgid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getpgid)
diff --git a/libc/arch-arm/syscalls/getpid.S b/libc/arch-arm/syscalls/getpid.S
index ef19d25..ff8eebb 100644
--- a/libc/arch-arm/syscalls/getpid.S
+++ b/libc/arch-arm/syscalls/getpid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getpid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getpid)
diff --git a/libc/arch-arm/syscalls/getppid.S b/libc/arch-arm/syscalls/getppid.S
index 1fe30d4..b770e8d 100644
--- a/libc/arch-arm/syscalls/getppid.S
+++ b/libc/arch-arm/syscalls/getppid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getppid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getppid)
diff --git a/libc/arch-arm/syscalls/getresgid.S b/libc/arch-arm/syscalls/getresgid.S
index e8d2129..2e7949a 100644
--- a/libc/arch-arm/syscalls/getresgid.S
+++ b/libc/arch-arm/syscalls/getresgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getresgid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getresgid)
diff --git a/libc/arch-arm/syscalls/getresuid.S b/libc/arch-arm/syscalls/getresuid.S
index cdfe0f7..e006c8b 100644
--- a/libc/arch-arm/syscalls/getresuid.S
+++ b/libc/arch-arm/syscalls/getresuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getresuid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getresuid)
diff --git a/libc/arch-arm/syscalls/getrlimit.S b/libc/arch-arm/syscalls/getrlimit.S
index 3acbf95..73efb8d 100644
--- a/libc/arch-arm/syscalls/getrlimit.S
+++ b/libc/arch-arm/syscalls/getrlimit.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ugetrlimit
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getrlimit)
diff --git a/libc/arch-arm/syscalls/getrusage.S b/libc/arch-arm/syscalls/getrusage.S
index e17fc4a..5659612 100644
--- a/libc/arch-arm/syscalls/getrusage.S
+++ b/libc/arch-arm/syscalls/getrusage.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getrusage
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getrusage)
diff --git a/libc/arch-arm/syscalls/getsid.S b/libc/arch-arm/syscalls/getsid.S
index 06e6d67..3e63e50 100644
--- a/libc/arch-arm/syscalls/getsid.S
+++ b/libc/arch-arm/syscalls/getsid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getsid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getsid)
diff --git a/libc/arch-arm/syscalls/getsockname.S b/libc/arch-arm/syscalls/getsockname.S
index 458814f..08d86a9 100644
--- a/libc/arch-arm/syscalls/getsockname.S
+++ b/libc/arch-arm/syscalls/getsockname.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getsockname
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getsockname)
diff --git a/libc/arch-arm/syscalls/getsockopt.S b/libc/arch-arm/syscalls/getsockopt.S
index d52f441..5a18c52 100644
--- a/libc/arch-arm/syscalls/getsockopt.S
+++ b/libc/arch-arm/syscalls/getsockopt.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_getsockopt
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getsockopt)
diff --git a/libc/arch-arm/syscalls/gettid.S b/libc/arch-arm/syscalls/gettid.S
index f35c7ea..36e015a 100644
--- a/libc/arch-arm/syscalls/gettid.S
+++ b/libc/arch-arm/syscalls/gettid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_gettid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(gettid)
diff --git a/libc/arch-arm/syscalls/gettimeofday.S b/libc/arch-arm/syscalls/gettimeofday.S
index 113413e..d880224 100644
--- a/libc/arch-arm/syscalls/gettimeofday.S
+++ b/libc/arch-arm/syscalls/gettimeofday.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_gettimeofday
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(gettimeofday)
diff --git a/libc/arch-arm/syscalls/getuid.S b/libc/arch-arm/syscalls/getuid.S
index 20ed7f9..27ee923 100644
--- a/libc/arch-arm/syscalls/getuid.S
+++ b/libc/arch-arm/syscalls/getuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getuid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getuid)
diff --git a/libc/arch-arm/syscalls/getxattr.S b/libc/arch-arm/syscalls/getxattr.S
index 0a7cbef..c6c7441 100644
--- a/libc/arch-arm/syscalls/getxattr.S
+++ b/libc/arch-arm/syscalls/getxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_getxattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(getxattr)
diff --git a/libc/arch-arm/syscalls/init_module.S b/libc/arch-arm/syscalls/init_module.S
index de41a7e..a187629 100644
--- a/libc/arch-arm/syscalls/init_module.S
+++ b/libc/arch-arm/syscalls/init_module.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_init_module
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(init_module)
diff --git a/libc/arch-arm/syscalls/inotify_add_watch.S b/libc/arch-arm/syscalls/inotify_add_watch.S
index aa8fcb7..48eb8d8 100644
--- a/libc/arch-arm/syscalls/inotify_add_watch.S
+++ b/libc/arch-arm/syscalls/inotify_add_watch.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_inotify_add_watch
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(inotify_add_watch)
diff --git a/libc/arch-arm/syscalls/inotify_init.S b/libc/arch-arm/syscalls/inotify_init.S
index 56d4b93..9a11610 100644
--- a/libc/arch-arm/syscalls/inotify_init.S
+++ b/libc/arch-arm/syscalls/inotify_init.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_inotify_init
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(inotify_init)
diff --git a/libc/arch-arm/syscalls/inotify_rm_watch.S b/libc/arch-arm/syscalls/inotify_rm_watch.S
index 4315061..2d96f62 100644
--- a/libc/arch-arm/syscalls/inotify_rm_watch.S
+++ b/libc/arch-arm/syscalls/inotify_rm_watch.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_inotify_rm_watch
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(inotify_rm_watch)
diff --git a/libc/arch-arm/syscalls/ioprio_get.S b/libc/arch-arm/syscalls/ioprio_get.S
index d3bd796..58c6909 100644
--- a/libc/arch-arm/syscalls/ioprio_get.S
+++ b/libc/arch-arm/syscalls/ioprio_get.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ioprio_get
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(ioprio_get)
diff --git a/libc/arch-arm/syscalls/ioprio_set.S b/libc/arch-arm/syscalls/ioprio_set.S
index c42d305..3afcfa1 100644
--- a/libc/arch-arm/syscalls/ioprio_set.S
+++ b/libc/arch-arm/syscalls/ioprio_set.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_ioprio_set
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(ioprio_set)
diff --git a/libc/arch-arm/syscalls/klogctl.S b/libc/arch-arm/syscalls/klogctl.S
index 1356815..d3db0d2 100644
--- a/libc/arch-arm/syscalls/klogctl.S
+++ b/libc/arch-arm/syscalls/klogctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_syslog
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(klogctl)
diff --git a/libc/arch-arm/syscalls/lchown.S b/libc/arch-arm/syscalls/lchown.S
index 56902a3..1b0ab53 100644
--- a/libc/arch-arm/syscalls/lchown.S
+++ b/libc/arch-arm/syscalls/lchown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_lchown32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(lchown)
diff --git a/libc/arch-arm/syscalls/lgetxattr.S b/libc/arch-arm/syscalls/lgetxattr.S
index cc30d63..a9a0427 100644
--- a/libc/arch-arm/syscalls/lgetxattr.S
+++ b/libc/arch-arm/syscalls/lgetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_lgetxattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(lgetxattr)
diff --git a/libc/arch-arm/syscalls/link.S b/libc/arch-arm/syscalls/link.S
index dab8fa6..6bcaa77 100644
--- a/libc/arch-arm/syscalls/link.S
+++ b/libc/arch-arm/syscalls/link.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_link
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(link)
diff --git a/libc/arch-arm/syscalls/listen.S b/libc/arch-arm/syscalls/listen.S
index fac3702..33da94c 100644
--- a/libc/arch-arm/syscalls/listen.S
+++ b/libc/arch-arm/syscalls/listen.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_listen
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(listen)
diff --git a/libc/arch-arm/syscalls/listxattr.S b/libc/arch-arm/syscalls/listxattr.S
index 8c7fc9b..33af17b 100644
--- a/libc/arch-arm/syscalls/listxattr.S
+++ b/libc/arch-arm/syscalls/listxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_listxattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(listxattr)
diff --git a/libc/arch-arm/syscalls/llistxattr.S b/libc/arch-arm/syscalls/llistxattr.S
index 9cade18..332af2a 100644
--- a/libc/arch-arm/syscalls/llistxattr.S
+++ b/libc/arch-arm/syscalls/llistxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_llistxattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(llistxattr)
diff --git a/libc/arch-arm/syscalls/lremovexattr.S b/libc/arch-arm/syscalls/lremovexattr.S
index d4a7b82..57ae424 100644
--- a/libc/arch-arm/syscalls/lremovexattr.S
+++ b/libc/arch-arm/syscalls/lremovexattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_lremovexattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(lremovexattr)
diff --git a/libc/arch-arm/syscalls/lseek.S b/libc/arch-arm/syscalls/lseek.S
index a452856..0b9dda2 100644
--- a/libc/arch-arm/syscalls/lseek.S
+++ b/libc/arch-arm/syscalls/lseek.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_lseek
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(lseek)
diff --git a/libc/arch-arm/syscalls/lsetxattr.S b/libc/arch-arm/syscalls/lsetxattr.S
index bde7c24..af5dce8 100644
--- a/libc/arch-arm/syscalls/lsetxattr.S
+++ b/libc/arch-arm/syscalls/lsetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_lsetxattr
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(lsetxattr)
diff --git a/libc/arch-arm/syscalls/lstat.S b/libc/arch-arm/syscalls/lstat.S
index 69f2146..f90ab73 100644
--- a/libc/arch-arm/syscalls/lstat.S
+++ b/libc/arch-arm/syscalls/lstat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_lstat64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(lstat)
diff --git a/libc/arch-arm/syscalls/madvise.S b/libc/arch-arm/syscalls/madvise.S
index 02944a2..33f1b3d 100644
--- a/libc/arch-arm/syscalls/madvise.S
+++ b/libc/arch-arm/syscalls/madvise.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_madvise
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(madvise)
diff --git a/libc/arch-arm/syscalls/mincore.S b/libc/arch-arm/syscalls/mincore.S
index 5ffdc11..921ad00 100644
--- a/libc/arch-arm/syscalls/mincore.S
+++ b/libc/arch-arm/syscalls/mincore.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mincore
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mincore)
diff --git a/libc/arch-arm/syscalls/mkdir.S b/libc/arch-arm/syscalls/mkdir.S
index c2aa080..d71f9c2 100644
--- a/libc/arch-arm/syscalls/mkdir.S
+++ b/libc/arch-arm/syscalls/mkdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mkdir
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mkdir)
diff --git a/libc/arch-arm/syscalls/mkdirat.S b/libc/arch-arm/syscalls/mkdirat.S
index 421c70a..ac12d8f 100644
--- a/libc/arch-arm/syscalls/mkdirat.S
+++ b/libc/arch-arm/syscalls/mkdirat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mkdirat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mkdirat)
diff --git a/libc/arch-arm/syscalls/mknod.S b/libc/arch-arm/syscalls/mknod.S
index 4aca2c5..077af76 100644
--- a/libc/arch-arm/syscalls/mknod.S
+++ b/libc/arch-arm/syscalls/mknod.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mknod
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mknod)
diff --git a/libc/arch-arm/syscalls/mlock.S b/libc/arch-arm/syscalls/mlock.S
index 5c8e74d..edc6077 100644
--- a/libc/arch-arm/syscalls/mlock.S
+++ b/libc/arch-arm/syscalls/mlock.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mlock
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mlock)
diff --git a/libc/arch-arm/syscalls/mlockall.S b/libc/arch-arm/syscalls/mlockall.S
index a89545a..42285bb 100644
--- a/libc/arch-arm/syscalls/mlockall.S
+++ b/libc/arch-arm/syscalls/mlockall.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mlockall
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mlockall)
diff --git a/libc/arch-arm/syscalls/mount.S b/libc/arch-arm/syscalls/mount.S
index eb1624c..b1f4100 100644
--- a/libc/arch-arm/syscalls/mount.S
+++ b/libc/arch-arm/syscalls/mount.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_mount
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mount)
diff --git a/libc/arch-arm/syscalls/mprotect.S b/libc/arch-arm/syscalls/mprotect.S
index 06238bf..47692a1 100644
--- a/libc/arch-arm/syscalls/mprotect.S
+++ b/libc/arch-arm/syscalls/mprotect.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mprotect
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mprotect)
diff --git a/libc/arch-arm/syscalls/mremap.S b/libc/arch-arm/syscalls/mremap.S
index 29b308b..3b6a755 100644
--- a/libc/arch-arm/syscalls/mremap.S
+++ b/libc/arch-arm/syscalls/mremap.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_mremap
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(mremap)
diff --git a/libc/arch-arm/syscalls/msync.S b/libc/arch-arm/syscalls/msync.S
index af8fc0c..6100d7a 100644
--- a/libc/arch-arm/syscalls/msync.S
+++ b/libc/arch-arm/syscalls/msync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_msync
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(msync)
diff --git a/libc/arch-arm/syscalls/munlock.S b/libc/arch-arm/syscalls/munlock.S
index 42df37e..52e4f93 100644
--- a/libc/arch-arm/syscalls/munlock.S
+++ b/libc/arch-arm/syscalls/munlock.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_munlock
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(munlock)
diff --git a/libc/arch-arm/syscalls/munlockall.S b/libc/arch-arm/syscalls/munlockall.S
index c0fca33..6c250e1 100644
--- a/libc/arch-arm/syscalls/munlockall.S
+++ b/libc/arch-arm/syscalls/munlockall.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_munlockall
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(munlockall)
diff --git a/libc/arch-arm/syscalls/munmap.S b/libc/arch-arm/syscalls/munmap.S
index 9d7b60f..d07a849 100644
--- a/libc/arch-arm/syscalls/munmap.S
+++ b/libc/arch-arm/syscalls/munmap.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_munmap
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(munmap)
diff --git a/libc/arch-arm/syscalls/nanosleep.S b/libc/arch-arm/syscalls/nanosleep.S
index 7f4cda6..3bd69a9 100644
--- a/libc/arch-arm/syscalls/nanosleep.S
+++ b/libc/arch-arm/syscalls/nanosleep.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_nanosleep
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(nanosleep)
diff --git a/libc/arch-arm/syscalls/pause.S b/libc/arch-arm/syscalls/pause.S
index 1238f4b..7714fd1 100644
--- a/libc/arch-arm/syscalls/pause.S
+++ b/libc/arch-arm/syscalls/pause.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_pause
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(pause)
diff --git a/libc/arch-arm/syscalls/perf_event_open.S b/libc/arch-arm/syscalls/perf_event_open.S
index 39710a5..0d05587 100644
--- a/libc/arch-arm/syscalls/perf_event_open.S
+++ b/libc/arch-arm/syscalls/perf_event_open.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_perf_event_open
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(perf_event_open)
diff --git a/libc/arch-arm/syscalls/personality.S b/libc/arch-arm/syscalls/personality.S
index f338d71..f506ed8 100644
--- a/libc/arch-arm/syscalls/personality.S
+++ b/libc/arch-arm/syscalls/personality.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_personality
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(personality)
diff --git a/libc/arch-arm/syscalls/pipe.S b/libc/arch-arm/syscalls/pipe.S
index ec0efb1..5a6034c 100644
--- a/libc/arch-arm/syscalls/pipe.S
+++ b/libc/arch-arm/syscalls/pipe.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_pipe
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(pipe)
diff --git a/libc/arch-arm/syscalls/pipe2.S b/libc/arch-arm/syscalls/pipe2.S
index f79c8f5..a586f49 100644
--- a/libc/arch-arm/syscalls/pipe2.S
+++ b/libc/arch-arm/syscalls/pipe2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_pipe2
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(pipe2)
diff --git a/libc/arch-arm/syscalls/poll.S b/libc/arch-arm/syscalls/poll.S
index d9831ab..23cb0a8 100644
--- a/libc/arch-arm/syscalls/poll.S
+++ b/libc/arch-arm/syscalls/poll.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_poll
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(poll)
diff --git a/libc/arch-arm/syscalls/prctl.S b/libc/arch-arm/syscalls/prctl.S
index 009dc54..c650752 100644
--- a/libc/arch-arm/syscalls/prctl.S
+++ b/libc/arch-arm/syscalls/prctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_prctl
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(prctl)
diff --git a/libc/arch-arm/syscalls/pread64.S b/libc/arch-arm/syscalls/pread64.S
index 0090fd3..04d36f9 100644
--- a/libc/arch-arm/syscalls/pread64.S
+++ b/libc/arch-arm/syscalls/pread64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_pread64
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(pread64)
diff --git a/libc/arch-arm/syscalls/pwrite64.S b/libc/arch-arm/syscalls/pwrite64.S
index 444d78f..8a812b3 100644
--- a/libc/arch-arm/syscalls/pwrite64.S
+++ b/libc/arch-arm/syscalls/pwrite64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_pwrite64
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(pwrite64)
diff --git a/libc/arch-arm/syscalls/read.S b/libc/arch-arm/syscalls/read.S
index ab0583a..d5e8d08 100644
--- a/libc/arch-arm/syscalls/read.S
+++ b/libc/arch-arm/syscalls/read.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_read
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(read)
diff --git a/libc/arch-arm/syscalls/readahead.S b/libc/arch-arm/syscalls/readahead.S
index 6aa8265..90603a4 100644
--- a/libc/arch-arm/syscalls/readahead.S
+++ b/libc/arch-arm/syscalls/readahead.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_readahead
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(readahead)
diff --git a/libc/arch-arm/syscalls/readlink.S b/libc/arch-arm/syscalls/readlink.S
index 90b0ea6..c223e1c 100644
--- a/libc/arch-arm/syscalls/readlink.S
+++ b/libc/arch-arm/syscalls/readlink.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_readlink
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(readlink)
diff --git a/libc/arch-arm/syscalls/readv.S b/libc/arch-arm/syscalls/readv.S
index 9f8b8db..d85c90c 100644
--- a/libc/arch-arm/syscalls/readv.S
+++ b/libc/arch-arm/syscalls/readv.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_readv
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(readv)
diff --git a/libc/arch-arm/syscalls/recvfrom.S b/libc/arch-arm/syscalls/recvfrom.S
index df6302f..c43d2c3 100644
--- a/libc/arch-arm/syscalls/recvfrom.S
+++ b/libc/arch-arm/syscalls/recvfrom.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_recvfrom
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(recvfrom)
diff --git a/libc/arch-arm/syscalls/recvmsg.S b/libc/arch-arm/syscalls/recvmsg.S
index 00746a1..393667b 100644
--- a/libc/arch-arm/syscalls/recvmsg.S
+++ b/libc/arch-arm/syscalls/recvmsg.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_recvmsg
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(recvmsg)
diff --git a/libc/arch-arm/syscalls/removexattr.S b/libc/arch-arm/syscalls/removexattr.S
index 82fb9e0..d1e9310 100644
--- a/libc/arch-arm/syscalls/removexattr.S
+++ b/libc/arch-arm/syscalls/removexattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_removexattr
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(removexattr)
diff --git a/libc/arch-arm/syscalls/rename.S b/libc/arch-arm/syscalls/rename.S
index dfe0b0e..6e5de6c 100644
--- a/libc/arch-arm/syscalls/rename.S
+++ b/libc/arch-arm/syscalls/rename.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_rename
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(rename)
diff --git a/libc/arch-arm/syscalls/renameat.S b/libc/arch-arm/syscalls/renameat.S
index aa42b78..082620c 100644
--- a/libc/arch-arm/syscalls/renameat.S
+++ b/libc/arch-arm/syscalls/renameat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_renameat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(renameat)
diff --git a/libc/arch-arm/syscalls/rmdir.S b/libc/arch-arm/syscalls/rmdir.S
index c2d5c5a..3627753 100644
--- a/libc/arch-arm/syscalls/rmdir.S
+++ b/libc/arch-arm/syscalls/rmdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_rmdir
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(rmdir)
diff --git a/libc/arch-arm/syscalls/sched_get_priority_max.S b/libc/arch-arm/syscalls/sched_get_priority_max.S
index 703ddeb..d556b1b 100644
--- a/libc/arch-arm/syscalls/sched_get_priority_max.S
+++ b/libc/arch-arm/syscalls/sched_get_priority_max.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_get_priority_max
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_get_priority_max)
diff --git a/libc/arch-arm/syscalls/sched_get_priority_min.S b/libc/arch-arm/syscalls/sched_get_priority_min.S
index deea8ae..4df227d 100644
--- a/libc/arch-arm/syscalls/sched_get_priority_min.S
+++ b/libc/arch-arm/syscalls/sched_get_priority_min.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_get_priority_min
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_get_priority_min)
diff --git a/libc/arch-arm/syscalls/sched_getparam.S b/libc/arch-arm/syscalls/sched_getparam.S
index 194d4a2..2c2a5bc 100644
--- a/libc/arch-arm/syscalls/sched_getparam.S
+++ b/libc/arch-arm/syscalls/sched_getparam.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_getparam
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_getparam)
diff --git a/libc/arch-arm/syscalls/sched_getscheduler.S b/libc/arch-arm/syscalls/sched_getscheduler.S
index fd3cec5..4dcd72e 100644
--- a/libc/arch-arm/syscalls/sched_getscheduler.S
+++ b/libc/arch-arm/syscalls/sched_getscheduler.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_getscheduler
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_getscheduler)
diff --git a/libc/arch-arm/syscalls/sched_rr_get_interval.S b/libc/arch-arm/syscalls/sched_rr_get_interval.S
index 21a5788..fda67f5 100644
--- a/libc/arch-arm/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-arm/syscalls/sched_rr_get_interval.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_rr_get_interval
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_rr_get_interval)
diff --git a/libc/arch-arm/syscalls/sched_setaffinity.S b/libc/arch-arm/syscalls/sched_setaffinity.S
index c980ed0..df29a99 100644
--- a/libc/arch-arm/syscalls/sched_setaffinity.S
+++ b/libc/arch-arm/syscalls/sched_setaffinity.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_setaffinity
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_setaffinity)
diff --git a/libc/arch-arm/syscalls/sched_setparam.S b/libc/arch-arm/syscalls/sched_setparam.S
index 993078d..f6b95a0 100644
--- a/libc/arch-arm/syscalls/sched_setparam.S
+++ b/libc/arch-arm/syscalls/sched_setparam.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_setparam
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_setparam)
diff --git a/libc/arch-arm/syscalls/sched_setscheduler.S b/libc/arch-arm/syscalls/sched_setscheduler.S
index d0ac1de..0d1ab1f 100644
--- a/libc/arch-arm/syscalls/sched_setscheduler.S
+++ b/libc/arch-arm/syscalls/sched_setscheduler.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_setscheduler
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_setscheduler)
diff --git a/libc/arch-arm/syscalls/sched_yield.S b/libc/arch-arm/syscalls/sched_yield.S
index 00bdfbd..a61dead 100644
--- a/libc/arch-arm/syscalls/sched_yield.S
+++ b/libc/arch-arm/syscalls/sched_yield.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sched_yield
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sched_yield)
diff --git a/libc/arch-arm/syscalls/select.S b/libc/arch-arm/syscalls/select.S
index edd77a3..7b956d4 100644
--- a/libc/arch-arm/syscalls/select.S
+++ b/libc/arch-arm/syscalls/select.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR__newselect
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(select)
diff --git a/libc/arch-arm/syscalls/sendfile.S b/libc/arch-arm/syscalls/sendfile.S
index 9e4c70c..02db7f7 100644
--- a/libc/arch-arm/syscalls/sendfile.S
+++ b/libc/arch-arm/syscalls/sendfile.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sendfile
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sendfile)
diff --git a/libc/arch-arm/syscalls/sendmsg.S b/libc/arch-arm/syscalls/sendmsg.S
index 1b54aee..a269e78 100644
--- a/libc/arch-arm/syscalls/sendmsg.S
+++ b/libc/arch-arm/syscalls/sendmsg.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sendmsg
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sendmsg)
diff --git a/libc/arch-arm/syscalls/sendto.S b/libc/arch-arm/syscalls/sendto.S
index 302ba8a..d8afde9 100644
--- a/libc/arch-arm/syscalls/sendto.S
+++ b/libc/arch-arm/syscalls/sendto.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_sendto
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sendto)
diff --git a/libc/arch-arm/syscalls/setgid.S b/libc/arch-arm/syscalls/setgid.S
index 09045ad..e544fd7 100644
--- a/libc/arch-arm/syscalls/setgid.S
+++ b/libc/arch-arm/syscalls/setgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setgid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setgid)
diff --git a/libc/arch-arm/syscalls/setgroups.S b/libc/arch-arm/syscalls/setgroups.S
index e4c36b5..7f73d85 100644
--- a/libc/arch-arm/syscalls/setgroups.S
+++ b/libc/arch-arm/syscalls/setgroups.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setgroups32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setgroups)
diff --git a/libc/arch-arm/syscalls/setitimer.S b/libc/arch-arm/syscalls/setitimer.S
index dfb7a46..7b835f7 100644
--- a/libc/arch-arm/syscalls/setitimer.S
+++ b/libc/arch-arm/syscalls/setitimer.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setitimer
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setitimer)
diff --git a/libc/arch-arm/syscalls/setpgid.S b/libc/arch-arm/syscalls/setpgid.S
index c558063..2fda4fe 100644
--- a/libc/arch-arm/syscalls/setpgid.S
+++ b/libc/arch-arm/syscalls/setpgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setpgid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setpgid)
diff --git a/libc/arch-arm/syscalls/setpriority.S b/libc/arch-arm/syscalls/setpriority.S
index 683da34..fe0326b 100644
--- a/libc/arch-arm/syscalls/setpriority.S
+++ b/libc/arch-arm/syscalls/setpriority.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setpriority
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setpriority)
diff --git a/libc/arch-arm/syscalls/setregid.S b/libc/arch-arm/syscalls/setregid.S
index 2062d05..48745b3 100644
--- a/libc/arch-arm/syscalls/setregid.S
+++ b/libc/arch-arm/syscalls/setregid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setregid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setregid)
diff --git a/libc/arch-arm/syscalls/setresgid.S b/libc/arch-arm/syscalls/setresgid.S
index 089c7a7..3e2d9fb 100644
--- a/libc/arch-arm/syscalls/setresgid.S
+++ b/libc/arch-arm/syscalls/setresgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setresgid32
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setresgid)
diff --git a/libc/arch-arm/syscalls/setrlimit.S b/libc/arch-arm/syscalls/setrlimit.S
index 02b8db4..4804459 100644
--- a/libc/arch-arm/syscalls/setrlimit.S
+++ b/libc/arch-arm/syscalls/setrlimit.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setrlimit
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setrlimit)
diff --git a/libc/arch-arm/syscalls/setsid.S b/libc/arch-arm/syscalls/setsid.S
index d82c347..f383a38 100644
--- a/libc/arch-arm/syscalls/setsid.S
+++ b/libc/arch-arm/syscalls/setsid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_setsid
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setsid)
diff --git a/libc/arch-arm/syscalls/setsockopt.S b/libc/arch-arm/syscalls/setsockopt.S
index 7ca91dd..ffb99f4 100644
--- a/libc/arch-arm/syscalls/setsockopt.S
+++ b/libc/arch-arm/syscalls/setsockopt.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_setsockopt
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setsockopt)
diff --git a/libc/arch-arm/syscalls/settimeofday.S b/libc/arch-arm/syscalls/settimeofday.S
index 44f5e66..abb2c01 100644
--- a/libc/arch-arm/syscalls/settimeofday.S
+++ b/libc/arch-arm/syscalls/settimeofday.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_settimeofday
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(settimeofday)
diff --git a/libc/arch-arm/syscalls/setxattr.S b/libc/arch-arm/syscalls/setxattr.S
index e86fe9f..e7422d9 100644
--- a/libc/arch-arm/syscalls/setxattr.S
+++ b/libc/arch-arm/syscalls/setxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,8 @@
     ldr     r7, =__NR_setxattr
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(setxattr)
diff --git a/libc/arch-arm/syscalls/shutdown.S b/libc/arch-arm/syscalls/shutdown.S
index cc96f56..4c82ee8 100644
--- a/libc/arch-arm/syscalls/shutdown.S
+++ b/libc/arch-arm/syscalls/shutdown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_shutdown
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(shutdown)
diff --git a/libc/arch-arm/syscalls/sigaction.S b/libc/arch-arm/syscalls/sigaction.S
index 699f55d..e5ce66a 100644
--- a/libc/arch-arm/syscalls/sigaction.S
+++ b/libc/arch-arm/syscalls/sigaction.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sigaction
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sigaction)
diff --git a/libc/arch-arm/syscalls/sigaltstack.S b/libc/arch-arm/syscalls/sigaltstack.S
index 0f34eab..13d69da 100644
--- a/libc/arch-arm/syscalls/sigaltstack.S
+++ b/libc/arch-arm/syscalls/sigaltstack.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sigaltstack
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sigaltstack)
diff --git a/libc/arch-arm/syscalls/signalfd4.S b/libc/arch-arm/syscalls/signalfd4.S
index 6f07fbe..c2d70ca 100644
--- a/libc/arch-arm/syscalls/signalfd4.S
+++ b/libc/arch-arm/syscalls/signalfd4.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_signalfd4
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(signalfd4)
diff --git a/libc/arch-arm/syscalls/sigpending.S b/libc/arch-arm/syscalls/sigpending.S
index b541288..35c37c2 100644
--- a/libc/arch-arm/syscalls/sigpending.S
+++ b/libc/arch-arm/syscalls/sigpending.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sigpending
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sigpending)
diff --git a/libc/arch-arm/syscalls/sigprocmask.S b/libc/arch-arm/syscalls/sigprocmask.S
index d169474..8f8e3dc 100644
--- a/libc/arch-arm/syscalls/sigprocmask.S
+++ b/libc/arch-arm/syscalls/sigprocmask.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sigprocmask
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sigprocmask)
diff --git a/libc/arch-arm/syscalls/socket.S b/libc/arch-arm/syscalls/socket.S
index 1003bd4..5608597 100644
--- a/libc/arch-arm/syscalls/socket.S
+++ b/libc/arch-arm/syscalls/socket.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_socket
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(socket)
diff --git a/libc/arch-arm/syscalls/socketpair.S b/libc/arch-arm/syscalls/socketpair.S
index 65bef68..da40cd6 100644
--- a/libc/arch-arm/syscalls/socketpair.S
+++ b/libc/arch-arm/syscalls/socketpair.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_socketpair
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(socketpair)
diff --git a/libc/arch-arm/syscalls/stat.S b/libc/arch-arm/syscalls/stat.S
index 17b63cc..0baade6 100644
--- a/libc/arch-arm/syscalls/stat.S
+++ b/libc/arch-arm/syscalls/stat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_stat64
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(stat)
diff --git a/libc/arch-arm/syscalls/symlink.S b/libc/arch-arm/syscalls/symlink.S
index ac569af..e72df78 100644
--- a/libc/arch-arm/syscalls/symlink.S
+++ b/libc/arch-arm/syscalls/symlink.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_symlink
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(symlink)
diff --git a/libc/arch-arm/syscalls/sync.S b/libc/arch-arm/syscalls/sync.S
index ef6cb16..cc8c7cd 100644
--- a/libc/arch-arm/syscalls/sync.S
+++ b/libc/arch-arm/syscalls/sync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sync
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sync)
diff --git a/libc/arch-arm/syscalls/sysinfo.S b/libc/arch-arm/syscalls/sysinfo.S
index a891735..b02859e 100644
--- a/libc/arch-arm/syscalls/sysinfo.S
+++ b/libc/arch-arm/syscalls/sysinfo.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_sysinfo
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(sysinfo)
diff --git a/libc/arch-arm/syscalls/times.S b/libc/arch-arm/syscalls/times.S
index 051f34d..f5305c4 100644
--- a/libc/arch-arm/syscalls/times.S
+++ b/libc/arch-arm/syscalls/times.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_times
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(times)
diff --git a/libc/arch-arm/syscalls/truncate.S b/libc/arch-arm/syscalls/truncate.S
index 3bb68cd..7885be7 100644
--- a/libc/arch-arm/syscalls/truncate.S
+++ b/libc/arch-arm/syscalls/truncate.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_truncate
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(truncate)
diff --git a/libc/arch-arm/syscalls/umask.S b/libc/arch-arm/syscalls/umask.S
index 78e43e0..4e5ab81 100644
--- a/libc/arch-arm/syscalls/umask.S
+++ b/libc/arch-arm/syscalls/umask.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_umask
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(umask)
diff --git a/libc/arch-arm/syscalls/umount2.S b/libc/arch-arm/syscalls/umount2.S
index 605359e..ba98b98 100644
--- a/libc/arch-arm/syscalls/umount2.S
+++ b/libc/arch-arm/syscalls/umount2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_umount2
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(umount2)
diff --git a/libc/arch-arm/syscalls/uname.S b/libc/arch-arm/syscalls/uname.S
index db0860b..52736f2 100644
--- a/libc/arch-arm/syscalls/uname.S
+++ b/libc/arch-arm/syscalls/uname.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_uname
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(uname)
diff --git a/libc/arch-arm/syscalls/unlink.S b/libc/arch-arm/syscalls/unlink.S
index 8ef33df..2fb111b 100644
--- a/libc/arch-arm/syscalls/unlink.S
+++ b/libc/arch-arm/syscalls/unlink.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_unlink
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(unlink)
diff --git a/libc/arch-arm/syscalls/unlinkat.S b/libc/arch-arm/syscalls/unlinkat.S
index eb822e4..888e893 100644
--- a/libc/arch-arm/syscalls/unlinkat.S
+++ b/libc/arch-arm/syscalls/unlinkat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_unlinkat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(unlinkat)
diff --git a/libc/arch-arm/syscalls/unshare.S b/libc/arch-arm/syscalls/unshare.S
index ec77f3a..682c77a 100644
--- a/libc/arch-arm/syscalls/unshare.S
+++ b/libc/arch-arm/syscalls/unshare.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_unshare
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(unshare)
diff --git a/libc/arch-arm/syscalls/utimensat.S b/libc/arch-arm/syscalls/utimensat.S
index 976a667..cc2266a 100644
--- a/libc/arch-arm/syscalls/utimensat.S
+++ b/libc/arch-arm/syscalls/utimensat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_utimensat
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(utimensat)
diff --git a/libc/arch-arm/syscalls/utimes.S b/libc/arch-arm/syscalls/utimes.S
index 8966626..4360125 100644
--- a/libc/arch-arm/syscalls/utimes.S
+++ b/libc/arch-arm/syscalls/utimes.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_utimes
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(utimes)
diff --git a/libc/arch-arm/syscalls/vfork.S b/libc/arch-arm/syscalls/vfork.S
index 89cbda2..23367f5 100644
--- a/libc/arch-arm/syscalls/vfork.S
+++ b/libc/arch-arm/syscalls/vfork.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_vfork
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(vfork)
diff --git a/libc/arch-arm/syscalls/write.S b/libc/arch-arm/syscalls/write.S
index c257915..974e28b 100644
--- a/libc/arch-arm/syscalls/write.S
+++ b/libc/arch-arm/syscalls/write.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_write
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(write)
diff --git a/libc/arch-arm/syscalls/writev.S b/libc/arch-arm/syscalls/writev.S
index 521e10c..d52fc1b 100644
--- a/libc/arch-arm/syscalls/writev.S
+++ b/libc/arch-arm/syscalls/writev.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,8 @@
     ldr     r7, =__NR_writev
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(writev)
diff --git a/libc/arch-x86/syscalls/__brk.S b/libc/arch-x86/syscalls/__brk.S
index f7a81ff..88841df 100644
--- a/libc/arch-x86/syscalls/__brk.S
+++ b/libc/arch-x86/syscalls/__brk.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_brk, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__fcntl.S b/libc/arch-x86/syscalls/__fcntl.S
index 9f74d86..087097e 100644
--- a/libc/arch-x86/syscalls/__fcntl.S
+++ b/libc/arch-x86/syscalls/__fcntl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_fcntl, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__fcntl64.S b/libc/arch-x86/syscalls/__fcntl64.S
index c59f490..5a67ee1 100644
--- a/libc/arch-x86/syscalls/__fcntl64.S
+++ b/libc/arch-x86/syscalls/__fcntl64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_fcntl64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__fork.S b/libc/arch-x86/syscalls/__fork.S
index 557714d..7c3661d 100644
--- a/libc/arch-x86/syscalls/__fork.S
+++ b/libc/arch-x86/syscalls/__fork.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_fork, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__fstatfs64.S b/libc/arch-x86/syscalls/__fstatfs64.S
index 9943362..57eb2f6 100644
--- a/libc/arch-x86/syscalls/__fstatfs64.S
+++ b/libc/arch-x86/syscalls/__fstatfs64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_fstatfs64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__getcpu.S b/libc/arch-x86/syscalls/__getcpu.S
index 152f5c8..448e012 100644
--- a/libc/arch-x86/syscalls/__getcpu.S
+++ b/libc/arch-x86/syscalls/__getcpu.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_getcpu, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__getcwd.S b/libc/arch-x86/syscalls/__getcwd.S
index 2e30d9b..29a73e3 100644
--- a/libc/arch-x86/syscalls/__getcwd.S
+++ b/libc/arch-x86/syscalls/__getcwd.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_getcwd, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__getpriority.S b/libc/arch-x86/syscalls/__getpriority.S
index a015127..c5f4751 100644
--- a/libc/arch-x86/syscalls/__getpriority.S
+++ b/libc/arch-x86/syscalls/__getpriority.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_getpriority, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__ioctl.S b/libc/arch-x86/syscalls/__ioctl.S
index db85a19..e64c3af 100644
--- a/libc/arch-x86/syscalls/__ioctl.S
+++ b/libc/arch-x86/syscalls/__ioctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_ioctl, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__llseek.S b/libc/arch-x86/syscalls/__llseek.S
index 7811f6b..9160ee7 100644
--- a/libc/arch-x86/syscalls/__llseek.S
+++ b/libc/arch-x86/syscalls/__llseek.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR__llseek, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__mmap2.S b/libc/arch-x86/syscalls/__mmap2.S
index 535a891..59c6d23 100644
--- a/libc/arch-x86/syscalls/__mmap2.S
+++ b/libc/arch-x86/syscalls/__mmap2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -17,7 +18,7 @@
     mov     48(%esp), %ebp
     movl    $__NR_mmap2, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__open.S b/libc/arch-x86/syscalls/__open.S
index b878231..02b99b7 100644
--- a/libc/arch-x86/syscalls/__open.S
+++ b/libc/arch-x86/syscalls/__open.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_open, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__openat.S b/libc/arch-x86/syscalls/__openat.S
index faf8013..8a7dafe 100644
--- a/libc/arch-x86/syscalls/__openat.S
+++ b/libc/arch-x86/syscalls/__openat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_openat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__ptrace.S b/libc/arch-x86/syscalls/__ptrace.S
index f574cf0..157bdd8 100644
--- a/libc/arch-x86/syscalls/__ptrace.S
+++ b/libc/arch-x86/syscalls/__ptrace.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_ptrace, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__reboot.S b/libc/arch-x86/syscalls/__reboot.S
index 626a955..6c6ecff 100644
--- a/libc/arch-x86/syscalls/__reboot.S
+++ b/libc/arch-x86/syscalls/__reboot.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_reboot, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__rt_sigaction.S b/libc/arch-x86/syscalls/__rt_sigaction.S
index ef9893b..b0ffaee 100644
--- a/libc/arch-x86/syscalls/__rt_sigaction.S
+++ b/libc/arch-x86/syscalls/__rt_sigaction.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_rt_sigaction, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__rt_sigprocmask.S b/libc/arch-x86/syscalls/__rt_sigprocmask.S
index 930c9b2..26b2fee 100644
--- a/libc/arch-x86/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-x86/syscalls/__rt_sigprocmask.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_rt_sigprocmask, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__rt_sigtimedwait.S b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
index ba867f5..af53f04 100644
--- a/libc/arch-x86/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_rt_sigtimedwait, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__sched_getaffinity.S b/libc/arch-x86/syscalls/__sched_getaffinity.S
index 2a40b65..21efaee 100644
--- a/libc/arch-x86/syscalls/__sched_getaffinity.S
+++ b/libc/arch-x86/syscalls/__sched_getaffinity.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_sched_getaffinity, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__set_thread_area.S b/libc/arch-x86/syscalls/__set_thread_area.S
index dc4a561..bcdbca3 100644
--- a/libc/arch-x86/syscalls/__set_thread_area.S
+++ b/libc/arch-x86/syscalls/__set_thread_area.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_set_thread_area, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__setresuid.S b/libc/arch-x86/syscalls/__setresuid.S
index c604984..d235042 100644
--- a/libc/arch-x86/syscalls/__setresuid.S
+++ b/libc/arch-x86/syscalls/__setresuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_setresuid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__setreuid.S b/libc/arch-x86/syscalls/__setreuid.S
index 5818739..61eea65 100644
--- a/libc/arch-x86/syscalls/__setreuid.S
+++ b/libc/arch-x86/syscalls/__setreuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_setreuid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__setuid.S b/libc/arch-x86/syscalls/__setuid.S
index df578b8..f5b5c72 100644
--- a/libc/arch-x86/syscalls/__setuid.S
+++ b/libc/arch-x86/syscalls/__setuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_setuid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__sigsuspend.S b/libc/arch-x86/syscalls/__sigsuspend.S
index b09f872..52bb2d8 100644
--- a/libc/arch-x86/syscalls/__sigsuspend.S
+++ b/libc/arch-x86/syscalls/__sigsuspend.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_sigsuspend, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__statfs64.S b/libc/arch-x86/syscalls/__statfs64.S
index 4f46bd7..3716cec 100644
--- a/libc/arch-x86/syscalls/__statfs64.S
+++ b/libc/arch-x86/syscalls/__statfs64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_statfs64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__sys_clone.S b/libc/arch-x86/syscalls/__sys_clone.S
index a5ce170..674797b 100644
--- a/libc/arch-x86/syscalls/__sys_clone.S
+++ b/libc/arch-x86/syscalls/__sys_clone.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_clone, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__syslog.S b/libc/arch-x86/syscalls/__syslog.S
index 9d36779..8db151a 100644
--- a/libc/arch-x86/syscalls/__syslog.S
+++ b/libc/arch-x86/syscalls/__syslog.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_syslog, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__timer_create.S b/libc/arch-x86/syscalls/__timer_create.S
index b319f1b..5b92706 100644
--- a/libc/arch-x86/syscalls/__timer_create.S
+++ b/libc/arch-x86/syscalls/__timer_create.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_timer_create, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__timer_delete.S b/libc/arch-x86/syscalls/__timer_delete.S
index 7fb5930..3ba48e4 100644
--- a/libc/arch-x86/syscalls/__timer_delete.S
+++ b/libc/arch-x86/syscalls/__timer_delete.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_timer_delete, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__timer_getoverrun.S b/libc/arch-x86/syscalls/__timer_getoverrun.S
index 477a3d8..f49e218 100644
--- a/libc/arch-x86/syscalls/__timer_getoverrun.S
+++ b/libc/arch-x86/syscalls/__timer_getoverrun.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_timer_getoverrun, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__timer_gettime.S b/libc/arch-x86/syscalls/__timer_gettime.S
index ee5604d..b1dd22c 100644
--- a/libc/arch-x86/syscalls/__timer_gettime.S
+++ b/libc/arch-x86/syscalls/__timer_gettime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_timer_gettime, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__timer_settime.S b/libc/arch-x86/syscalls/__timer_settime.S
index 9758f61..9bda7f8 100644
--- a/libc/arch-x86/syscalls/__timer_settime.S
+++ b/libc/arch-x86/syscalls/__timer_settime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_timer_settime, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__wait4.S b/libc/arch-x86/syscalls/__wait4.S
index 23165a3..57de4d9 100644
--- a/libc/arch-x86/syscalls/__wait4.S
+++ b/libc/arch-x86/syscalls/__wait4.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_wait4, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/__waitid.S b/libc/arch-x86/syscalls/__waitid.S
index 12f1ac8..9c2125a 100644
--- a/libc/arch-x86/syscalls/__waitid.S
+++ b/libc/arch-x86/syscalls/__waitid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_waitid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/_exit.S b/libc/arch-x86/syscalls/_exit.S
index e17f925..0bfb2f9 100644
--- a/libc/arch-x86/syscalls/_exit.S
+++ b/libc/arch-x86/syscalls/_exit.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_exit_group, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/_exit_thread.S b/libc/arch-x86/syscalls/_exit_thread.S
index a371350..d20caea 100644
--- a/libc/arch-x86/syscalls/_exit_thread.S
+++ b/libc/arch-x86/syscalls/_exit_thread.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_exit, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/_waitpid.S b/libc/arch-x86/syscalls/_waitpid.S
index 59bf20e..74da41a 100644
--- a/libc/arch-x86/syscalls/_waitpid.S
+++ b/libc/arch-x86/syscalls/_waitpid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_waitpid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/accept.S b/libc/arch-x86/syscalls/accept.S
index f5fcb5d..5c0df0d 100644
--- a/libc/arch-x86/syscalls/accept.S
+++ b/libc/arch-x86/syscalls/accept.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/access.S b/libc/arch-x86/syscalls/access.S
index 0f68574..cdf2a2a 100644
--- a/libc/arch-x86/syscalls/access.S
+++ b/libc/arch-x86/syscalls/access.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_access, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/acct.S b/libc/arch-x86/syscalls/acct.S
index bf991d6..0d224ee 100644
--- a/libc/arch-x86/syscalls/acct.S
+++ b/libc/arch-x86/syscalls/acct.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_acct, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/bind.S b/libc/arch-x86/syscalls/bind.S
index ff6ae9f..942aba5 100644
--- a/libc/arch-x86/syscalls/bind.S
+++ b/libc/arch-x86/syscalls/bind.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/capget.S b/libc/arch-x86/syscalls/capget.S
index 55960f1..55d230c 100644
--- a/libc/arch-x86/syscalls/capget.S
+++ b/libc/arch-x86/syscalls/capget.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_capget, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/capset.S b/libc/arch-x86/syscalls/capset.S
index c8703c7..5ce72e4 100644
--- a/libc/arch-x86/syscalls/capset.S
+++ b/libc/arch-x86/syscalls/capset.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_capset, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/chdir.S b/libc/arch-x86/syscalls/chdir.S
index d40d099..f453d94 100644
--- a/libc/arch-x86/syscalls/chdir.S
+++ b/libc/arch-x86/syscalls/chdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_chdir, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/chmod.S b/libc/arch-x86/syscalls/chmod.S
index 307e196..3202cbd 100644
--- a/libc/arch-x86/syscalls/chmod.S
+++ b/libc/arch-x86/syscalls/chmod.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_chmod, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/chown.S b/libc/arch-x86/syscalls/chown.S
index 800bf04..df3f259 100644
--- a/libc/arch-x86/syscalls/chown.S
+++ b/libc/arch-x86/syscalls/chown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_chown32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/chroot.S b/libc/arch-x86/syscalls/chroot.S
index 24d2d10..35a37a9 100644
--- a/libc/arch-x86/syscalls/chroot.S
+++ b/libc/arch-x86/syscalls/chroot.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_chroot, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/clock_getres.S b/libc/arch-x86/syscalls/clock_getres.S
index da332aa..543887b 100644
--- a/libc/arch-x86/syscalls/clock_getres.S
+++ b/libc/arch-x86/syscalls/clock_getres.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_clock_getres, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/clock_gettime.S b/libc/arch-x86/syscalls/clock_gettime.S
index 41ac5e2..38a8ec9 100644
--- a/libc/arch-x86/syscalls/clock_gettime.S
+++ b/libc/arch-x86/syscalls/clock_gettime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_clock_gettime, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/clock_nanosleep.S b/libc/arch-x86/syscalls/clock_nanosleep.S
index cd163df..94f7c39 100644
--- a/libc/arch-x86/syscalls/clock_nanosleep.S
+++ b/libc/arch-x86/syscalls/clock_nanosleep.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_clock_nanosleep, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/clock_settime.S b/libc/arch-x86/syscalls/clock_settime.S
index 18237c4..f82aa78 100644
--- a/libc/arch-x86/syscalls/clock_settime.S
+++ b/libc/arch-x86/syscalls/clock_settime.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_clock_settime, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/close.S b/libc/arch-x86/syscalls/close.S
index 76175c7..b9c7961 100644
--- a/libc/arch-x86/syscalls/close.S
+++ b/libc/arch-x86/syscalls/close.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_close, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/connect.S b/libc/arch-x86/syscalls/connect.S
index e87b123..3298e08 100644
--- a/libc/arch-x86/syscalls/connect.S
+++ b/libc/arch-x86/syscalls/connect.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/delete_module.S b/libc/arch-x86/syscalls/delete_module.S
index 10a06a3..92b6446 100644
--- a/libc/arch-x86/syscalls/delete_module.S
+++ b/libc/arch-x86/syscalls/delete_module.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_delete_module, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/dup.S b/libc/arch-x86/syscalls/dup.S
index 80259fe..b3de1fb 100644
--- a/libc/arch-x86/syscalls/dup.S
+++ b/libc/arch-x86/syscalls/dup.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_dup, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/dup2.S b/libc/arch-x86/syscalls/dup2.S
index 43def66..7558f56 100644
--- a/libc/arch-x86/syscalls/dup2.S
+++ b/libc/arch-x86/syscalls/dup2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_dup2, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/epoll_create.S b/libc/arch-x86/syscalls/epoll_create.S
index 0bdc885..010473a 100644
--- a/libc/arch-x86/syscalls/epoll_create.S
+++ b/libc/arch-x86/syscalls/epoll_create.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_epoll_create, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/epoll_ctl.S b/libc/arch-x86/syscalls/epoll_ctl.S
index 43175d2..4a87900 100644
--- a/libc/arch-x86/syscalls/epoll_ctl.S
+++ b/libc/arch-x86/syscalls/epoll_ctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_epoll_ctl, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/epoll_wait.S b/libc/arch-x86/syscalls/epoll_wait.S
index e2d61c0..616f735 100644
--- a/libc/arch-x86/syscalls/epoll_wait.S
+++ b/libc/arch-x86/syscalls/epoll_wait.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_epoll_wait, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/eventfd.S b/libc/arch-x86/syscalls/eventfd.S
index 338696f..4ad4cea 100644
--- a/libc/arch-x86/syscalls/eventfd.S
+++ b/libc/arch-x86/syscalls/eventfd.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_eventfd2, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/execve.S b/libc/arch-x86/syscalls/execve.S
index c7e3ca5..82922a3 100644
--- a/libc/arch-x86/syscalls/execve.S
+++ b/libc/arch-x86/syscalls/execve.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_execve, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/faccessat.S b/libc/arch-x86/syscalls/faccessat.S
index 6733029..2756265 100644
--- a/libc/arch-x86/syscalls/faccessat.S
+++ b/libc/arch-x86/syscalls/faccessat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_faccessat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fchdir.S b/libc/arch-x86/syscalls/fchdir.S
index 23aa6e2..9badf6f 100644
--- a/libc/arch-x86/syscalls/fchdir.S
+++ b/libc/arch-x86/syscalls/fchdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_fchdir, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fchmod.S b/libc/arch-x86/syscalls/fchmod.S
index 019eb07..4cf79cc 100644
--- a/libc/arch-x86/syscalls/fchmod.S
+++ b/libc/arch-x86/syscalls/fchmod.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_fchmod, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fchmodat.S b/libc/arch-x86/syscalls/fchmodat.S
index f7292f9..b91fdf7 100644
--- a/libc/arch-x86/syscalls/fchmodat.S
+++ b/libc/arch-x86/syscalls/fchmodat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_fchmodat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fchown.S b/libc/arch-x86/syscalls/fchown.S
index f17c0d6..f5f6849 100644
--- a/libc/arch-x86/syscalls/fchown.S
+++ b/libc/arch-x86/syscalls/fchown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_fchown32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fchownat.S b/libc/arch-x86/syscalls/fchownat.S
index 7648d79..183ae1d 100644
--- a/libc/arch-x86/syscalls/fchownat.S
+++ b/libc/arch-x86/syscalls/fchownat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_fchownat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fdatasync.S b/libc/arch-x86/syscalls/fdatasync.S
index 2808e0f..73811a5 100644
--- a/libc/arch-x86/syscalls/fdatasync.S
+++ b/libc/arch-x86/syscalls/fdatasync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_fdatasync, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fgetxattr.S b/libc/arch-x86/syscalls/fgetxattr.S
index beaab09..dc6c457 100644
--- a/libc/arch-x86/syscalls/fgetxattr.S
+++ b/libc/arch-x86/syscalls/fgetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_fgetxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/flistxattr.S b/libc/arch-x86/syscalls/flistxattr.S
index 95935c0..bcef232 100644
--- a/libc/arch-x86/syscalls/flistxattr.S
+++ b/libc/arch-x86/syscalls/flistxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_flistxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/flock.S b/libc/arch-x86/syscalls/flock.S
index 156844c..e73f1b6 100644
--- a/libc/arch-x86/syscalls/flock.S
+++ b/libc/arch-x86/syscalls/flock.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_flock, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fremovexattr.S b/libc/arch-x86/syscalls/fremovexattr.S
index 32d0bdc..0535938 100644
--- a/libc/arch-x86/syscalls/fremovexattr.S
+++ b/libc/arch-x86/syscalls/fremovexattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_fremovexattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fsetxattr.S b/libc/arch-x86/syscalls/fsetxattr.S
index c3d588e..3a88be8 100644
--- a/libc/arch-x86/syscalls/fsetxattr.S
+++ b/libc/arch-x86/syscalls/fsetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_fsetxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fstat.S b/libc/arch-x86/syscalls/fstat.S
index 95301d9..4969b00 100644
--- a/libc/arch-x86/syscalls/fstat.S
+++ b/libc/arch-x86/syscalls/fstat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_fstat64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fstatat.S b/libc/arch-x86/syscalls/fstatat.S
index 947f4da..0bae34f 100644
--- a/libc/arch-x86/syscalls/fstatat.S
+++ b/libc/arch-x86/syscalls/fstatat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_fstatat64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/fsync.S b/libc/arch-x86/syscalls/fsync.S
index 363b334..6cf6ee8 100644
--- a/libc/arch-x86/syscalls/fsync.S
+++ b/libc/arch-x86/syscalls/fsync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_fsync, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/ftruncate.S b/libc/arch-x86/syscalls/ftruncate.S
index 1ed3f96..ff3e945 100644
--- a/libc/arch-x86/syscalls/ftruncate.S
+++ b/libc/arch-x86/syscalls/ftruncate.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_ftruncate, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/ftruncate64.S b/libc/arch-x86/syscalls/ftruncate64.S
index fa6dbef..fe23a41 100644
--- a/libc/arch-x86/syscalls/ftruncate64.S
+++ b/libc/arch-x86/syscalls/ftruncate64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_ftruncate64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/futex.S b/libc/arch-x86/syscalls/futex.S
index f72be1b..b21da36 100644
--- a/libc/arch-x86/syscalls/futex.S
+++ b/libc/arch-x86/syscalls/futex.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -17,7 +18,7 @@
     mov     48(%esp), %ebp
     movl    $__NR_futex, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getdents.S b/libc/arch-x86/syscalls/getdents.S
index c5d2721..baef233 100644
--- a/libc/arch-x86/syscalls/getdents.S
+++ b/libc/arch-x86/syscalls/getdents.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_getdents64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getegid.S b/libc/arch-x86/syscalls/getegid.S
index c26ebc2..4dc0678 100644
--- a/libc/arch-x86/syscalls/getegid.S
+++ b/libc/arch-x86/syscalls/getegid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(getegid)
     movl    $__NR_getegid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/geteuid.S b/libc/arch-x86/syscalls/geteuid.S
index a7761e8..a2c4029 100644
--- a/libc/arch-x86/syscalls/geteuid.S
+++ b/libc/arch-x86/syscalls/geteuid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(geteuid)
     movl    $__NR_geteuid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getgid.S b/libc/arch-x86/syscalls/getgid.S
index 7a51200..8885cf9 100644
--- a/libc/arch-x86/syscalls/getgid.S
+++ b/libc/arch-x86/syscalls/getgid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(getgid)
     movl    $__NR_getgid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getgroups.S b/libc/arch-x86/syscalls/getgroups.S
index 35bc3f5..3e580e3 100644
--- a/libc/arch-x86/syscalls/getgroups.S
+++ b/libc/arch-x86/syscalls/getgroups.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_getgroups32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getitimer.S b/libc/arch-x86/syscalls/getitimer.S
index 79957da..40e984b 100644
--- a/libc/arch-x86/syscalls/getitimer.S
+++ b/libc/arch-x86/syscalls/getitimer.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_getitimer, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getpeername.S b/libc/arch-x86/syscalls/getpeername.S
index 3831990..854cf9f 100644
--- a/libc/arch-x86/syscalls/getpeername.S
+++ b/libc/arch-x86/syscalls/getpeername.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getpgid.S b/libc/arch-x86/syscalls/getpgid.S
index f49abbf..990af58 100644
--- a/libc/arch-x86/syscalls/getpgid.S
+++ b/libc/arch-x86/syscalls/getpgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_getpgid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getpid.S b/libc/arch-x86/syscalls/getpid.S
index 29703e8..3f4406e 100644
--- a/libc/arch-x86/syscalls/getpid.S
+++ b/libc/arch-x86/syscalls/getpid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(getpid)
     movl    $__NR_getpid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getppid.S b/libc/arch-x86/syscalls/getppid.S
index dc89d6e..f1f3f6b 100644
--- a/libc/arch-x86/syscalls/getppid.S
+++ b/libc/arch-x86/syscalls/getppid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(getppid)
     movl    $__NR_getppid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getresgid.S b/libc/arch-x86/syscalls/getresgid.S
index 08a37e7..bac8f59 100644
--- a/libc/arch-x86/syscalls/getresgid.S
+++ b/libc/arch-x86/syscalls/getresgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_getresgid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getresuid.S b/libc/arch-x86/syscalls/getresuid.S
index 435a901..e78c835 100644
--- a/libc/arch-x86/syscalls/getresuid.S
+++ b/libc/arch-x86/syscalls/getresuid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_getresuid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getrlimit.S b/libc/arch-x86/syscalls/getrlimit.S
index 8f6edd6..4c3e56e 100644
--- a/libc/arch-x86/syscalls/getrlimit.S
+++ b/libc/arch-x86/syscalls/getrlimit.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_ugetrlimit, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getrusage.S b/libc/arch-x86/syscalls/getrusage.S
index ee47f3d..90d58ba 100644
--- a/libc/arch-x86/syscalls/getrusage.S
+++ b/libc/arch-x86/syscalls/getrusage.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_getrusage, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getsid.S b/libc/arch-x86/syscalls/getsid.S
index 876bf6a..4cb8182 100644
--- a/libc/arch-x86/syscalls/getsid.S
+++ b/libc/arch-x86/syscalls/getsid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_getsid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getsockname.S b/libc/arch-x86/syscalls/getsockname.S
index b28ecb8..931bf79 100644
--- a/libc/arch-x86/syscalls/getsockname.S
+++ b/libc/arch-x86/syscalls/getsockname.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getsockopt.S b/libc/arch-x86/syscalls/getsockopt.S
index 190b6f2..ffd4730 100644
--- a/libc/arch-x86/syscalls/getsockopt.S
+++ b/libc/arch-x86/syscalls/getsockopt.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/gettid.S b/libc/arch-x86/syscalls/gettid.S
index c1e6ba0..5e6d65e 100644
--- a/libc/arch-x86/syscalls/gettid.S
+++ b/libc/arch-x86/syscalls/gettid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(gettid)
     movl    $__NR_gettid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/gettimeofday.S b/libc/arch-x86/syscalls/gettimeofday.S
index 34b9982..142faa3 100644
--- a/libc/arch-x86/syscalls/gettimeofday.S
+++ b/libc/arch-x86/syscalls/gettimeofday.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_gettimeofday, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getuid.S b/libc/arch-x86/syscalls/getuid.S
index e82b8b0..9aa8bc6 100644
--- a/libc/arch-x86/syscalls/getuid.S
+++ b/libc/arch-x86/syscalls/getuid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(getuid)
     movl    $__NR_getuid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/getxattr.S b/libc/arch-x86/syscalls/getxattr.S
index 92f7c30..e3d9edc 100644
--- a/libc/arch-x86/syscalls/getxattr.S
+++ b/libc/arch-x86/syscalls/getxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_getxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/init_module.S b/libc/arch-x86/syscalls/init_module.S
index 3ef9b36..74ebfe8 100644
--- a/libc/arch-x86/syscalls/init_module.S
+++ b/libc/arch-x86/syscalls/init_module.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_init_module, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/inotify_add_watch.S b/libc/arch-x86/syscalls/inotify_add_watch.S
index 7b57f3c..58a6fd4 100644
--- a/libc/arch-x86/syscalls/inotify_add_watch.S
+++ b/libc/arch-x86/syscalls/inotify_add_watch.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_inotify_add_watch, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/inotify_init.S b/libc/arch-x86/syscalls/inotify_init.S
index c19174b..66b3a65 100644
--- a/libc/arch-x86/syscalls/inotify_init.S
+++ b/libc/arch-x86/syscalls/inotify_init.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_inotify_init, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/inotify_rm_watch.S b/libc/arch-x86/syscalls/inotify_rm_watch.S
index 351bdc2..4db5799 100644
--- a/libc/arch-x86/syscalls/inotify_rm_watch.S
+++ b/libc/arch-x86/syscalls/inotify_rm_watch.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_inotify_rm_watch, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/ioprio_get.S b/libc/arch-x86/syscalls/ioprio_get.S
index b64662f..7c6daa3 100644
--- a/libc/arch-x86/syscalls/ioprio_get.S
+++ b/libc/arch-x86/syscalls/ioprio_get.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_ioprio_get, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/ioprio_set.S b/libc/arch-x86/syscalls/ioprio_set.S
index 6f2a4f3..4be460e 100644
--- a/libc/arch-x86/syscalls/ioprio_set.S
+++ b/libc/arch-x86/syscalls/ioprio_set.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_ioprio_set, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/kill.S b/libc/arch-x86/syscalls/kill.S
index 99fe9a9..7c7dcb9 100644
--- a/libc/arch-x86/syscalls/kill.S
+++ b/libc/arch-x86/syscalls/kill.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_kill, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/klogctl.S b/libc/arch-x86/syscalls/klogctl.S
index e9f8b79..e6cac00 100644
--- a/libc/arch-x86/syscalls/klogctl.S
+++ b/libc/arch-x86/syscalls/klogctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_syslog, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/lchown.S b/libc/arch-x86/syscalls/lchown.S
index 779f703..471c51f 100644
--- a/libc/arch-x86/syscalls/lchown.S
+++ b/libc/arch-x86/syscalls/lchown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_lchown32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/lgetxattr.S b/libc/arch-x86/syscalls/lgetxattr.S
index 3781bff..0997262 100644
--- a/libc/arch-x86/syscalls/lgetxattr.S
+++ b/libc/arch-x86/syscalls/lgetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_lgetxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/link.S b/libc/arch-x86/syscalls/link.S
index dac7d0e..96b8edc 100644
--- a/libc/arch-x86/syscalls/link.S
+++ b/libc/arch-x86/syscalls/link.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_link, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/listen.S b/libc/arch-x86/syscalls/listen.S
index 8f63945..bf1aa77 100644
--- a/libc/arch-x86/syscalls/listen.S
+++ b/libc/arch-x86/syscalls/listen.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/listxattr.S b/libc/arch-x86/syscalls/listxattr.S
index 853c47b..ae8d351 100644
--- a/libc/arch-x86/syscalls/listxattr.S
+++ b/libc/arch-x86/syscalls/listxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_listxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/llistxattr.S b/libc/arch-x86/syscalls/llistxattr.S
index cd7038b..22fb6a9 100644
--- a/libc/arch-x86/syscalls/llistxattr.S
+++ b/libc/arch-x86/syscalls/llistxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_llistxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/lremovexattr.S b/libc/arch-x86/syscalls/lremovexattr.S
index 93973d6..3deae95 100644
--- a/libc/arch-x86/syscalls/lremovexattr.S
+++ b/libc/arch-x86/syscalls/lremovexattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_lremovexattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/lseek.S b/libc/arch-x86/syscalls/lseek.S
index f6250e6..d62983f 100644
--- a/libc/arch-x86/syscalls/lseek.S
+++ b/libc/arch-x86/syscalls/lseek.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_lseek, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/lsetxattr.S b/libc/arch-x86/syscalls/lsetxattr.S
index c5dbc30..f8f50aa 100644
--- a/libc/arch-x86/syscalls/lsetxattr.S
+++ b/libc/arch-x86/syscalls/lsetxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_lsetxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/lstat.S b/libc/arch-x86/syscalls/lstat.S
index 4e25fae..dc2a36c 100644
--- a/libc/arch-x86/syscalls/lstat.S
+++ b/libc/arch-x86/syscalls/lstat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_lstat64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/madvise.S b/libc/arch-x86/syscalls/madvise.S
index bf3e5dc..a2827eb 100644
--- a/libc/arch-x86/syscalls/madvise.S
+++ b/libc/arch-x86/syscalls/madvise.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_madvise, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mincore.S b/libc/arch-x86/syscalls/mincore.S
index 37df639..0b6e129 100644
--- a/libc/arch-x86/syscalls/mincore.S
+++ b/libc/arch-x86/syscalls/mincore.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_mincore, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mkdir.S b/libc/arch-x86/syscalls/mkdir.S
index 16a5c03..3256aff 100644
--- a/libc/arch-x86/syscalls/mkdir.S
+++ b/libc/arch-x86/syscalls/mkdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_mkdir, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mkdirat.S b/libc/arch-x86/syscalls/mkdirat.S
index ece2c27..9d872b1 100644
--- a/libc/arch-x86/syscalls/mkdirat.S
+++ b/libc/arch-x86/syscalls/mkdirat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_mkdirat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mknod.S b/libc/arch-x86/syscalls/mknod.S
index 22fc390..ad06357 100644
--- a/libc/arch-x86/syscalls/mknod.S
+++ b/libc/arch-x86/syscalls/mknod.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_mknod, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mlock.S b/libc/arch-x86/syscalls/mlock.S
index 5010e00..c078138 100644
--- a/libc/arch-x86/syscalls/mlock.S
+++ b/libc/arch-x86/syscalls/mlock.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_mlock, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mlockall.S b/libc/arch-x86/syscalls/mlockall.S
index 849b44f..8251117 100644
--- a/libc/arch-x86/syscalls/mlockall.S
+++ b/libc/arch-x86/syscalls/mlockall.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_mlockall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mount.S b/libc/arch-x86/syscalls/mount.S
index 9ceeab9..e57c54d 100644
--- a/libc/arch-x86/syscalls/mount.S
+++ b/libc/arch-x86/syscalls/mount.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_mount, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mprotect.S b/libc/arch-x86/syscalls/mprotect.S
index 4438bfe..c5b414a 100644
--- a/libc/arch-x86/syscalls/mprotect.S
+++ b/libc/arch-x86/syscalls/mprotect.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_mprotect, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/mremap.S b/libc/arch-x86/syscalls/mremap.S
index d33a8dc..ca40fd3 100644
--- a/libc/arch-x86/syscalls/mremap.S
+++ b/libc/arch-x86/syscalls/mremap.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_mremap, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/msync.S b/libc/arch-x86/syscalls/msync.S
index 2da5bc7..3eb8014 100644
--- a/libc/arch-x86/syscalls/msync.S
+++ b/libc/arch-x86/syscalls/msync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_msync, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/munlock.S b/libc/arch-x86/syscalls/munlock.S
index 574d17b..20249f9 100644
--- a/libc/arch-x86/syscalls/munlock.S
+++ b/libc/arch-x86/syscalls/munlock.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_munlock, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/munlockall.S b/libc/arch-x86/syscalls/munlockall.S
index f69316a..18275ca 100644
--- a/libc/arch-x86/syscalls/munlockall.S
+++ b/libc/arch-x86/syscalls/munlockall.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(munlockall)
     movl    $__NR_munlockall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/munmap.S b/libc/arch-x86/syscalls/munmap.S
index 91c73c1..22f3549 100644
--- a/libc/arch-x86/syscalls/munmap.S
+++ b/libc/arch-x86/syscalls/munmap.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_munmap, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/nanosleep.S b/libc/arch-x86/syscalls/nanosleep.S
index 6d2df08..dc14121 100644
--- a/libc/arch-x86/syscalls/nanosleep.S
+++ b/libc/arch-x86/syscalls/nanosleep.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_nanosleep, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/pause.S b/libc/arch-x86/syscalls/pause.S
index 70be691..8bc21d1 100644
--- a/libc/arch-x86/syscalls/pause.S
+++ b/libc/arch-x86/syscalls/pause.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(pause)
     movl    $__NR_pause, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/perf_event_open.S b/libc/arch-x86/syscalls/perf_event_open.S
index 6466b45..e1ec6d8 100644
--- a/libc/arch-x86/syscalls/perf_event_open.S
+++ b/libc/arch-x86/syscalls/perf_event_open.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_perf_event_open, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/personality.S b/libc/arch-x86/syscalls/personality.S
index b23b592..7ae3dfb 100644
--- a/libc/arch-x86/syscalls/personality.S
+++ b/libc/arch-x86/syscalls/personality.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_personality, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/pipe.S b/libc/arch-x86/syscalls/pipe.S
index 1560bad..583e868 100644
--- a/libc/arch-x86/syscalls/pipe.S
+++ b/libc/arch-x86/syscalls/pipe.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_pipe, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/pipe2.S b/libc/arch-x86/syscalls/pipe2.S
index 55fe08f..12a8033 100644
--- a/libc/arch-x86/syscalls/pipe2.S
+++ b/libc/arch-x86/syscalls/pipe2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_pipe2, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/poll.S b/libc/arch-x86/syscalls/poll.S
index 541d657..7d7608a 100644
--- a/libc/arch-x86/syscalls/poll.S
+++ b/libc/arch-x86/syscalls/poll.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_poll, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/prctl.S b/libc/arch-x86/syscalls/prctl.S
index 56720fe..f8dcc28 100644
--- a/libc/arch-x86/syscalls/prctl.S
+++ b/libc/arch-x86/syscalls/prctl.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_prctl, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/pread64.S b/libc/arch-x86/syscalls/pread64.S
index 987e9b8..ff12f55 100644
--- a/libc/arch-x86/syscalls/pread64.S
+++ b/libc/arch-x86/syscalls/pread64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_pread64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/pwrite64.S b/libc/arch-x86/syscalls/pwrite64.S
index 8773a20..6c00508 100644
--- a/libc/arch-x86/syscalls/pwrite64.S
+++ b/libc/arch-x86/syscalls/pwrite64.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_pwrite64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/read.S b/libc/arch-x86/syscalls/read.S
index 98b7c12..be63487 100644
--- a/libc/arch-x86/syscalls/read.S
+++ b/libc/arch-x86/syscalls/read.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_read, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/readahead.S b/libc/arch-x86/syscalls/readahead.S
index b0c0018..78584cc 100644
--- a/libc/arch-x86/syscalls/readahead.S
+++ b/libc/arch-x86/syscalls/readahead.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_readahead, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/readlink.S b/libc/arch-x86/syscalls/readlink.S
index 393b5d4..e75a2c0 100644
--- a/libc/arch-x86/syscalls/readlink.S
+++ b/libc/arch-x86/syscalls/readlink.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_readlink, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/readv.S b/libc/arch-x86/syscalls/readv.S
index d626068..699295d 100644
--- a/libc/arch-x86/syscalls/readv.S
+++ b/libc/arch-x86/syscalls/readv.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_readv, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/recvfrom.S b/libc/arch-x86/syscalls/recvfrom.S
index 98558e1..acbc166 100644
--- a/libc/arch-x86/syscalls/recvfrom.S
+++ b/libc/arch-x86/syscalls/recvfrom.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/recvmsg.S b/libc/arch-x86/syscalls/recvmsg.S
index 8b3c7bd..b85abb5 100644
--- a/libc/arch-x86/syscalls/recvmsg.S
+++ b/libc/arch-x86/syscalls/recvmsg.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/removexattr.S b/libc/arch-x86/syscalls/removexattr.S
index e2211e8..c0af7e7 100644
--- a/libc/arch-x86/syscalls/removexattr.S
+++ b/libc/arch-x86/syscalls/removexattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_removexattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/rename.S b/libc/arch-x86/syscalls/rename.S
index 43be210..955bb74 100644
--- a/libc/arch-x86/syscalls/rename.S
+++ b/libc/arch-x86/syscalls/rename.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_rename, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/renameat.S b/libc/arch-x86/syscalls/renameat.S
index 8084045..d4b9f24 100644
--- a/libc/arch-x86/syscalls/renameat.S
+++ b/libc/arch-x86/syscalls/renameat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_renameat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/rmdir.S b/libc/arch-x86/syscalls/rmdir.S
index b16375c..a9025b0 100644
--- a/libc/arch-x86/syscalls/rmdir.S
+++ b/libc/arch-x86/syscalls/rmdir.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_rmdir, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_get_priority_max.S b/libc/arch-x86/syscalls/sched_get_priority_max.S
index 713b02d..281f4d7 100644
--- a/libc/arch-x86/syscalls/sched_get_priority_max.S
+++ b/libc/arch-x86/syscalls/sched_get_priority_max.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sched_get_priority_max, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_get_priority_min.S b/libc/arch-x86/syscalls/sched_get_priority_min.S
index de6768f..41b2e65 100644
--- a/libc/arch-x86/syscalls/sched_get_priority_min.S
+++ b/libc/arch-x86/syscalls/sched_get_priority_min.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sched_get_priority_min, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_getparam.S b/libc/arch-x86/syscalls/sched_getparam.S
index eabc562..131d919 100644
--- a/libc/arch-x86/syscalls/sched_getparam.S
+++ b/libc/arch-x86/syscalls/sched_getparam.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_sched_getparam, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_getscheduler.S b/libc/arch-x86/syscalls/sched_getscheduler.S
index 2a6c8f7..da8578b 100644
--- a/libc/arch-x86/syscalls/sched_getscheduler.S
+++ b/libc/arch-x86/syscalls/sched_getscheduler.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sched_getscheduler, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_rr_get_interval.S b/libc/arch-x86/syscalls/sched_rr_get_interval.S
index 3f032d5..3ce976a 100644
--- a/libc/arch-x86/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-x86/syscalls/sched_rr_get_interval.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_sched_rr_get_interval, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_setaffinity.S b/libc/arch-x86/syscalls/sched_setaffinity.S
index 988f6b4..89b42eb 100644
--- a/libc/arch-x86/syscalls/sched_setaffinity.S
+++ b/libc/arch-x86/syscalls/sched_setaffinity.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_sched_setaffinity, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_setparam.S b/libc/arch-x86/syscalls/sched_setparam.S
index a250783..4327d04 100644
--- a/libc/arch-x86/syscalls/sched_setparam.S
+++ b/libc/arch-x86/syscalls/sched_setparam.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_sched_setparam, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_setscheduler.S b/libc/arch-x86/syscalls/sched_setscheduler.S
index c6851ba..9fdb5e6 100644
--- a/libc/arch-x86/syscalls/sched_setscheduler.S
+++ b/libc/arch-x86/syscalls/sched_setscheduler.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_sched_setscheduler, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sched_yield.S b/libc/arch-x86/syscalls/sched_yield.S
index 3dcc7fc..774aca4 100644
--- a/libc/arch-x86/syscalls/sched_yield.S
+++ b/libc/arch-x86/syscalls/sched_yield.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sched_yield, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/select.S b/libc/arch-x86/syscalls/select.S
index b665281..9943618 100644
--- a/libc/arch-x86/syscalls/select.S
+++ b/libc/arch-x86/syscalls/select.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR__newselect, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sendfile.S b/libc/arch-x86/syscalls/sendfile.S
index b36fa1f..b2dd94b 100644
--- a/libc/arch-x86/syscalls/sendfile.S
+++ b/libc/arch-x86/syscalls/sendfile.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_sendfile, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sendmsg.S b/libc/arch-x86/syscalls/sendmsg.S
index 119d632..93b5047 100644
--- a/libc/arch-x86/syscalls/sendmsg.S
+++ b/libc/arch-x86/syscalls/sendmsg.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sendto.S b/libc/arch-x86/syscalls/sendto.S
index 82208fe..b0ecd86 100644
--- a/libc/arch-x86/syscalls/sendto.S
+++ b/libc/arch-x86/syscalls/sendto.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setgid.S b/libc/arch-x86/syscalls/setgid.S
index 37f5ffe..853fea3 100644
--- a/libc/arch-x86/syscalls/setgid.S
+++ b/libc/arch-x86/syscalls/setgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_setgid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setgroups.S b/libc/arch-x86/syscalls/setgroups.S
index 20266e0..e68a971 100644
--- a/libc/arch-x86/syscalls/setgroups.S
+++ b/libc/arch-x86/syscalls/setgroups.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_setgroups32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setitimer.S b/libc/arch-x86/syscalls/setitimer.S
index 97ee7c6..246e8da 100644
--- a/libc/arch-x86/syscalls/setitimer.S
+++ b/libc/arch-x86/syscalls/setitimer.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_setitimer, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setpgid.S b/libc/arch-x86/syscalls/setpgid.S
index 8ff9273..878662b 100644
--- a/libc/arch-x86/syscalls/setpgid.S
+++ b/libc/arch-x86/syscalls/setpgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_setpgid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setpriority.S b/libc/arch-x86/syscalls/setpriority.S
index 7358a89..65ba7d5 100644
--- a/libc/arch-x86/syscalls/setpriority.S
+++ b/libc/arch-x86/syscalls/setpriority.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_setpriority, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setregid.S b/libc/arch-x86/syscalls/setregid.S
index bbe092f..58a5afd 100644
--- a/libc/arch-x86/syscalls/setregid.S
+++ b/libc/arch-x86/syscalls/setregid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_setregid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setresgid.S b/libc/arch-x86/syscalls/setresgid.S
index c235837..efda6e6 100644
--- a/libc/arch-x86/syscalls/setresgid.S
+++ b/libc/arch-x86/syscalls/setresgid.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_setresgid32, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setrlimit.S b/libc/arch-x86/syscalls/setrlimit.S
index d7f5072..b73faaf 100644
--- a/libc/arch-x86/syscalls/setrlimit.S
+++ b/libc/arch-x86/syscalls/setrlimit.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_setrlimit, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setsid.S b/libc/arch-x86/syscalls/setsid.S
index 684b304..59b3bbb 100644
--- a/libc/arch-x86/syscalls/setsid.S
+++ b/libc/arch-x86/syscalls/setsid.S
@@ -1,11 +1,12 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
 ENTRY(setsid)
     movl    $__NR_setsid, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setsockopt.S b/libc/arch-x86/syscalls/setsockopt.S
index 9c70116..486e9eb 100644
--- a/libc/arch-x86/syscalls/setsockopt.S
+++ b/libc/arch-x86/syscalls/setsockopt.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/settimeofday.S b/libc/arch-x86/syscalls/settimeofday.S
index bc95fec..616b551 100644
--- a/libc/arch-x86/syscalls/settimeofday.S
+++ b/libc/arch-x86/syscalls/settimeofday.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_settimeofday, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/setxattr.S b/libc/arch-x86/syscalls/setxattr.S
index 9dc87e3..30752f8 100644
--- a/libc/arch-x86/syscalls/setxattr.S
+++ b/libc/arch-x86/syscalls/setxattr.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -15,7 +16,7 @@
     mov     40(%esp), %edi
     movl    $__NR_setxattr, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/shutdown.S b/libc/arch-x86/syscalls/shutdown.S
index 7fa36a1..697107c 100644
--- a/libc/arch-x86/syscalls/shutdown.S
+++ b/libc/arch-x86/syscalls/shutdown.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sigaction.S b/libc/arch-x86/syscalls/sigaction.S
index 4fd5993..7f2cfd1 100644
--- a/libc/arch-x86/syscalls/sigaction.S
+++ b/libc/arch-x86/syscalls/sigaction.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_sigaction, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sigaltstack.S b/libc/arch-x86/syscalls/sigaltstack.S
index 830c99f..6adf9a7 100644
--- a/libc/arch-x86/syscalls/sigaltstack.S
+++ b/libc/arch-x86/syscalls/sigaltstack.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_sigaltstack, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/signalfd4.S b/libc/arch-x86/syscalls/signalfd4.S
index 57e0233..a2c7527 100644
--- a/libc/arch-x86/syscalls/signalfd4.S
+++ b/libc/arch-x86/syscalls/signalfd4.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_signalfd4, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sigpending.S b/libc/arch-x86/syscalls/sigpending.S
index 2f009b2..34af79d 100644
--- a/libc/arch-x86/syscalls/sigpending.S
+++ b/libc/arch-x86/syscalls/sigpending.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sigpending, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sigprocmask.S b/libc/arch-x86/syscalls/sigprocmask.S
index 81cdfa2..12390a5 100644
--- a/libc/arch-x86/syscalls/sigprocmask.S
+++ b/libc/arch-x86/syscalls/sigprocmask.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_sigprocmask, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/socket.S b/libc/arch-x86/syscalls/socket.S
index 8cc93bd..c9f63b0 100644
--- a/libc/arch-x86/syscalls/socket.S
+++ b/libc/arch-x86/syscalls/socket.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/socketpair.S b/libc/arch-x86/syscalls/socketpair.S
index ccfc847..6ea3edc 100644
--- a/libc/arch-x86/syscalls/socketpair.S
+++ b/libc/arch-x86/syscalls/socketpair.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -10,7 +11,7 @@
     addl    $12, %ecx
     movl    $__NR_socketcall, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/stat.S b/libc/arch-x86/syscalls/stat.S
index 83d1af8..cd2d291 100644
--- a/libc/arch-x86/syscalls/stat.S
+++ b/libc/arch-x86/syscalls/stat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_stat64, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/symlink.S b/libc/arch-x86/syscalls/symlink.S
index dbc5490..86415f1 100644
--- a/libc/arch-x86/syscalls/symlink.S
+++ b/libc/arch-x86/syscalls/symlink.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_symlink, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sync.S b/libc/arch-x86/syscalls/sync.S
index f337c2c..2126a6a 100644
--- a/libc/arch-x86/syscalls/sync.S
+++ b/libc/arch-x86/syscalls/sync.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sync, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/sysinfo.S b/libc/arch-x86/syscalls/sysinfo.S
index ef9fcb0..42dcea3 100644
--- a/libc/arch-x86/syscalls/sysinfo.S
+++ b/libc/arch-x86/syscalls/sysinfo.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_sysinfo, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/tgkill.S b/libc/arch-x86/syscalls/tgkill.S
index 6d5dc88..ad7a94a 100644
--- a/libc/arch-x86/syscalls/tgkill.S
+++ b/libc/arch-x86/syscalls/tgkill.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_tgkill, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/times.S b/libc/arch-x86/syscalls/times.S
index 04991a8..b4dec25 100644
--- a/libc/arch-x86/syscalls/times.S
+++ b/libc/arch-x86/syscalls/times.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_times, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/tkill.S b/libc/arch-x86/syscalls/tkill.S
index 51eb1c8..89ece49 100644
--- a/libc/arch-x86/syscalls/tkill.S
+++ b/libc/arch-x86/syscalls/tkill.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_tkill, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/truncate.S b/libc/arch-x86/syscalls/truncate.S
index 9e9b08d..60f30eb 100644
--- a/libc/arch-x86/syscalls/truncate.S
+++ b/libc/arch-x86/syscalls/truncate.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_truncate, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/umask.S b/libc/arch-x86/syscalls/umask.S
index f2bf7b0..4942c43 100644
--- a/libc/arch-x86/syscalls/umask.S
+++ b/libc/arch-x86/syscalls/umask.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_umask, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/umount2.S b/libc/arch-x86/syscalls/umount2.S
index 1949489..3c54150 100644
--- a/libc/arch-x86/syscalls/umount2.S
+++ b/libc/arch-x86/syscalls/umount2.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_umount2, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/uname.S b/libc/arch-x86/syscalls/uname.S
index 9b2c746..310ac7f 100644
--- a/libc/arch-x86/syscalls/uname.S
+++ b/libc/arch-x86/syscalls/uname.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_uname, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/unlink.S b/libc/arch-x86/syscalls/unlink.S
index 0d9ce84..d58bfb8 100644
--- a/libc/arch-x86/syscalls/unlink.S
+++ b/libc/arch-x86/syscalls/unlink.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_unlink, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/unlinkat.S b/libc/arch-x86/syscalls/unlinkat.S
index d05b488..85499c2 100644
--- a/libc/arch-x86/syscalls/unlinkat.S
+++ b/libc/arch-x86/syscalls/unlinkat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_unlinkat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/unshare.S b/libc/arch-x86/syscalls/unshare.S
index da0f563..883ad40 100644
--- a/libc/arch-x86/syscalls/unshare.S
+++ b/libc/arch-x86/syscalls/unshare.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -7,7 +8,7 @@
     mov     8(%esp), %ebx
     movl    $__NR_unshare, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/utimensat.S b/libc/arch-x86/syscalls/utimensat.S
index fb1d630..739d486 100644
--- a/libc/arch-x86/syscalls/utimensat.S
+++ b/libc/arch-x86/syscalls/utimensat.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -13,7 +14,7 @@
     mov     32(%esp), %esi
     movl    $__NR_utimensat, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/utimes.S b/libc/arch-x86/syscalls/utimes.S
index 189f6b9..b6c6036 100644
--- a/libc/arch-x86/syscalls/utimes.S
+++ b/libc/arch-x86/syscalls/utimes.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -9,7 +10,7 @@
     mov     16(%esp), %ecx
     movl    $__NR_utimes, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/write.S b/libc/arch-x86/syscalls/write.S
index 7f0b030..8dd79a2 100644
--- a/libc/arch-x86/syscalls/write.S
+++ b/libc/arch-x86/syscalls/write.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_write, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/syscalls/writev.S b/libc/arch-x86/syscalls/writev.S
index 0757a44..c442a19 100644
--- a/libc/arch-x86/syscalls/writev.S
+++ b/libc/arch-x86/syscalls/writev.S
@@ -1,4 +1,5 @@
 /* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -11,7 +12,7 @@
     mov     24(%esp), %edx
     movl    $__NR_writev, %eax
     int     $0x80
-    cmpl    $-129, %eax
+    cmpl    $-MAX_ERRNO, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/bionic/__set_errno.cpp b/libc/bionic/__set_errno.cpp
index c69ca87..4e72093 100644
--- a/libc/bionic/__set_errno.cpp
+++ b/libc/bionic/__set_errno.cpp
@@ -27,25 +27,11 @@
  */
 
 #include <errno.h>
-#include <linux/err.h>
 
-#define unlikely(x) __builtin_expect((x), false) // Used but not defined by <linux/err.h>.
-
-// These functions are called from our assembler syscall stubs.
+// This function is called from our assembler syscall stubs.
 // C/C++ code should just assign 'errno' instead.
 
-// TODO: should be __LIBC_HIDDEN__, but already exported by NDK :-(
-// TODO: this isn't used on ARM.
-extern "C" int __set_errno(int n) {
+extern "C" __LIBC_HIDDEN__ int __set_errno(int n) {
   errno = n;
   return -1;
 }
-
-// TODO: this is only used on ARM, but is exported by NDK on all platforms :-(
-extern "C" __LIBC_HIDDEN__ int __set_syscall_errno(unsigned long n) {
-  if (IS_ERR_VALUE(n)) {
-    errno = -n;
-    return -1;
-  }
-  return n;
-}
diff --git a/libc/kernel/common/linux/err.h b/libc/kernel/common/linux/err.h
index 442a1d8..ae0cf3c 100644
--- a/libc/kernel/common/linux/err.h
+++ b/libc/kernel/common/linux/err.h
@@ -22,5 +22,8 @@
 #include <asm/errno.h>
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define MAX_ERRNO 4095
+#ifndef __ASSEMBLY__
 #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 5e519de..91e7a57 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -46,6 +46,7 @@
 #
 
 x86_header = """/* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -56,7 +57,7 @@
 
 x86_call = """    movl    $%(idname)s, %%eax
     int     $0x80
-    cmpl    $-129, %%eax
+    cmpl    $-MAX_ERRNO, %%eax
     jb      1f
     negl    %%eax
     pushl   %%eax
@@ -75,6 +76,7 @@
 #
 
 arm_header = """/* autogenerated by gensyscalls.py */
+#include <linux/err.h>
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
@@ -86,9 +88,10 @@
     ldr     r7, =%(idname)s
     swi     #0
     mov     r7, ip
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(%(fname)s)
 """
 
@@ -100,9 +103,10 @@
     ldr     r7, =%(idname)s
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
 END(%(fname)s)
 """