Move away from the __ARCH_WANT_SYSCALL_NO_AT system calls.

Modern architectures only get the *at(2) system calls. For example,
aarch64 doesn't have open(2), and expects userspace to use openat(2)
instead.

Change-Id: I87b4ed79790cb8a80844f5544ac1a13fda26c7b5
diff --git a/libc/arch-x86_64/syscalls.mk b/libc/arch-x86_64/syscalls.mk
index 70cc319..803b700 100644
--- a/libc/arch-x86_64/syscalls.mk
+++ b/libc/arch-x86_64/syscalls.mk
@@ -7,7 +7,6 @@
 syscall_src += arch-x86_64/syscalls/__getcwd.S
 syscall_src += arch-x86_64/syscalls/__getpriority.S
 syscall_src += arch-x86_64/syscalls/__ioctl.S
-syscall_src += arch-x86_64/syscalls/__open.S
 syscall_src += arch-x86_64/syscalls/__openat.S
 syscall_src += arch-x86_64/syscalls/__ptrace.S
 syscall_src += arch-x86_64/syscalls/__reboot.S
@@ -28,14 +27,11 @@
 syscall_src += arch-x86_64/syscalls/_exit.S
 syscall_src += arch-x86_64/syscalls/_exit_thread.S
 syscall_src += arch-x86_64/syscalls/accept.S
-syscall_src += arch-x86_64/syscalls/access.S
 syscall_src += arch-x86_64/syscalls/acct.S
 syscall_src += arch-x86_64/syscalls/bind.S
 syscall_src += arch-x86_64/syscalls/capget.S
 syscall_src += arch-x86_64/syscalls/capset.S
 syscall_src += arch-x86_64/syscalls/chdir.S
-syscall_src += arch-x86_64/syscalls/chmod.S
-syscall_src += arch-x86_64/syscalls/chown.S
 syscall_src += arch-x86_64/syscalls/chroot.S
 syscall_src += arch-x86_64/syscalls/clock_getres.S
 syscall_src += arch-x86_64/syscalls/clock_gettime.S
@@ -65,6 +61,7 @@
 syscall_src += arch-x86_64/syscalls/fremovexattr.S
 syscall_src += arch-x86_64/syscalls/fsetxattr.S
 syscall_src += arch-x86_64/syscalls/fstat.S
+syscall_src += arch-x86_64/syscalls/fstatat.S
 syscall_src += arch-x86_64/syscalls/fstatfs.S
 syscall_src += arch-x86_64/syscalls/fsync.S
 syscall_src += arch-x86_64/syscalls/ftruncate.S
@@ -98,21 +95,18 @@
 syscall_src += arch-x86_64/syscalls/ioprio_set.S
 syscall_src += arch-x86_64/syscalls/kill.S
 syscall_src += arch-x86_64/syscalls/klogctl.S
-syscall_src += arch-x86_64/syscalls/lchown.S
 syscall_src += arch-x86_64/syscalls/lgetxattr.S
-syscall_src += arch-x86_64/syscalls/link.S
+syscall_src += arch-x86_64/syscalls/linkat.S
 syscall_src += arch-x86_64/syscalls/listen.S
 syscall_src += arch-x86_64/syscalls/listxattr.S
 syscall_src += arch-x86_64/syscalls/llistxattr.S
 syscall_src += arch-x86_64/syscalls/lremovexattr.S
 syscall_src += arch-x86_64/syscalls/lseek.S
 syscall_src += arch-x86_64/syscalls/lsetxattr.S
-syscall_src += arch-x86_64/syscalls/lstat.S
 syscall_src += arch-x86_64/syscalls/madvise.S
 syscall_src += arch-x86_64/syscalls/mincore.S
-syscall_src += arch-x86_64/syscalls/mkdir.S
 syscall_src += arch-x86_64/syscalls/mkdirat.S
-syscall_src += arch-x86_64/syscalls/mknod.S
+syscall_src += arch-x86_64/syscalls/mknodat.S
 syscall_src += arch-x86_64/syscalls/mlock.S
 syscall_src += arch-x86_64/syscalls/mlockall.S
 syscall_src += arch-x86_64/syscalls/mmap.S
@@ -135,14 +129,12 @@
 syscall_src += arch-x86_64/syscalls/pwrite64.S
 syscall_src += arch-x86_64/syscalls/read.S
 syscall_src += arch-x86_64/syscalls/readahead.S
-syscall_src += arch-x86_64/syscalls/readlink.S
+syscall_src += arch-x86_64/syscalls/readlinkat.S
 syscall_src += arch-x86_64/syscalls/readv.S
 syscall_src += arch-x86_64/syscalls/recvfrom.S
 syscall_src += arch-x86_64/syscalls/recvmsg.S
 syscall_src += arch-x86_64/syscalls/removexattr.S
-syscall_src += arch-x86_64/syscalls/rename.S
 syscall_src += arch-x86_64/syscalls/renameat.S
-syscall_src += arch-x86_64/syscalls/rmdir.S
 syscall_src += arch-x86_64/syscalls/sched_get_priority_max.S
 syscall_src += arch-x86_64/syscalls/sched_get_priority_min.S
 syscall_src += arch-x86_64/syscalls/sched_getparam.S
@@ -176,11 +168,10 @@
 syscall_src += arch-x86_64/syscalls/signalfd4.S
 syscall_src += arch-x86_64/syscalls/socket.S
 syscall_src += arch-x86_64/syscalls/socketpair.S
-syscall_src += arch-x86_64/syscalls/stat.S
 syscall_src += arch-x86_64/syscalls/statfs.S
 syscall_src += arch-x86_64/syscalls/swapoff.S
 syscall_src += arch-x86_64/syscalls/swapon.S
-syscall_src += arch-x86_64/syscalls/symlink.S
+syscall_src += arch-x86_64/syscalls/symlinkat.S
 syscall_src += arch-x86_64/syscalls/sync.S
 syscall_src += arch-x86_64/syscalls/sysinfo.S
 syscall_src += arch-x86_64/syscalls/tgkill.S
@@ -193,11 +184,9 @@
 syscall_src += arch-x86_64/syscalls/umask.S
 syscall_src += arch-x86_64/syscalls/umount2.S
 syscall_src += arch-x86_64/syscalls/uname.S
-syscall_src += arch-x86_64/syscalls/unlink.S
 syscall_src += arch-x86_64/syscalls/unlinkat.S
 syscall_src += arch-x86_64/syscalls/unshare.S
 syscall_src += arch-x86_64/syscalls/utimensat.S
-syscall_src += arch-x86_64/syscalls/utimes.S
 syscall_src += arch-x86_64/syscalls/wait4.S
 syscall_src += arch-x86_64/syscalls/write.S
 syscall_src += arch-x86_64/syscalls/writev.S
diff --git a/libc/arch-x86_64/syscalls/__open.S b/libc/arch-x86_64/syscalls/__open.S
deleted file mode 100644
index a52235a..0000000
--- a/libc/arch-x86_64/syscalls/__open.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(__open)
-    movl    $__NR_open, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(__open)
diff --git a/libc/arch-x86_64/syscalls/access.S b/libc/arch-x86_64/syscalls/access.S
deleted file mode 100644
index 81fd734..0000000
--- a/libc/arch-x86_64/syscalls/access.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(access)
-    movl    $__NR_access, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(access)
diff --git a/libc/arch-x86_64/syscalls/chown.S b/libc/arch-x86_64/syscalls/chown.S
deleted file mode 100644
index a587c05..0000000
--- a/libc/arch-x86_64/syscalls/chown.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(chown)
-    movl    $__NR_chown, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(chown)
diff --git a/libc/arch-x86_64/syscalls/chmod.S b/libc/arch-x86_64/syscalls/fstatat.S
similarity index 76%
copy from libc/arch-x86_64/syscalls/chmod.S
copy to libc/arch-x86_64/syscalls/fstatat.S
index 4591f11..577660f 100644
--- a/libc/arch-x86_64/syscalls/chmod.S
+++ b/libc/arch-x86_64/syscalls/fstatat.S
@@ -4,8 +4,9 @@
 #include <linux/err.h>
 #include <machine/asm.h>
 
-ENTRY(chmod)
-    movl    $__NR_chmod, %eax
+ENTRY(fstatat)
+    movq    %rcx, %r10
+    movl    $__NR_newfstatat, %eax
     syscall
     cmpq    $-MAX_ERRNO, %rax
     jb      1f
@@ -15,4 +16,4 @@
     orq     $-1, %rax
 1:
     ret
-END(chmod)
+END(fstatat)
diff --git a/libc/arch-x86_64/syscalls/lchown.S b/libc/arch-x86_64/syscalls/lchown.S
deleted file mode 100644
index 2a90044..0000000
--- a/libc/arch-x86_64/syscalls/lchown.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(lchown)
-    movl    $__NR_lchown, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(lchown)
diff --git a/libc/arch-x86_64/syscalls/link.S b/libc/arch-x86_64/syscalls/link.S
deleted file mode 100644
index 8719572..0000000
--- a/libc/arch-x86_64/syscalls/link.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(link)
-    movl    $__NR_link, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(link)
diff --git a/libc/arch-x86_64/syscalls/chmod.S b/libc/arch-x86_64/syscalls/linkat.S
similarity index 77%
copy from libc/arch-x86_64/syscalls/chmod.S
copy to libc/arch-x86_64/syscalls/linkat.S
index 4591f11..8dced7d 100644
--- a/libc/arch-x86_64/syscalls/chmod.S
+++ b/libc/arch-x86_64/syscalls/linkat.S
@@ -4,8 +4,9 @@
 #include <linux/err.h>
 #include <machine/asm.h>
 
-ENTRY(chmod)
-    movl    $__NR_chmod, %eax
+ENTRY(linkat)
+    movq    %rcx, %r10
+    movl    $__NR_linkat, %eax
     syscall
     cmpq    $-MAX_ERRNO, %rax
     jb      1f
@@ -15,4 +16,4 @@
     orq     $-1, %rax
 1:
     ret
-END(chmod)
+END(linkat)
diff --git a/libc/arch-x86_64/syscalls/lstat.S b/libc/arch-x86_64/syscalls/lstat.S
deleted file mode 100644
index e68592d..0000000
--- a/libc/arch-x86_64/syscalls/lstat.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(lstat)
-    movl    $__NR_lstat, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(lstat)
diff --git a/libc/arch-x86_64/syscalls/mkdir.S b/libc/arch-x86_64/syscalls/mkdir.S
deleted file mode 100644
index d21b2e2..0000000
--- a/libc/arch-x86_64/syscalls/mkdir.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(mkdir)
-    movl    $__NR_mkdir, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(mkdir)
diff --git a/libc/arch-x86_64/syscalls/mknod.S b/libc/arch-x86_64/syscalls/mknod.S
deleted file mode 100644
index a49bc8a..0000000
--- a/libc/arch-x86_64/syscalls/mknod.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(mknod)
-    movl    $__NR_mknod, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(mknod)
diff --git a/libc/arch-x86_64/syscalls/chmod.S b/libc/arch-x86_64/syscalls/mknodat.S
similarity index 76%
copy from libc/arch-x86_64/syscalls/chmod.S
copy to libc/arch-x86_64/syscalls/mknodat.S
index 4591f11..92dbb5b 100644
--- a/libc/arch-x86_64/syscalls/chmod.S
+++ b/libc/arch-x86_64/syscalls/mknodat.S
@@ -4,8 +4,9 @@
 #include <linux/err.h>
 #include <machine/asm.h>
 
-ENTRY(chmod)
-    movl    $__NR_chmod, %eax
+ENTRY(mknodat)
+    movq    %rcx, %r10
+    movl    $__NR_mknodat, %eax
     syscall
     cmpq    $-MAX_ERRNO, %rax
     jb      1f
@@ -15,4 +16,4 @@
     orq     $-1, %rax
 1:
     ret
-END(chmod)
+END(mknodat)
diff --git a/libc/arch-x86_64/syscalls/readlink.S b/libc/arch-x86_64/syscalls/readlink.S
deleted file mode 100644
index 7cee437..0000000
--- a/libc/arch-x86_64/syscalls/readlink.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(readlink)
-    movl    $__NR_readlink, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(readlink)
diff --git a/libc/arch-x86_64/syscalls/chmod.S b/libc/arch-x86_64/syscalls/readlinkat.S
similarity index 74%
copy from libc/arch-x86_64/syscalls/chmod.S
copy to libc/arch-x86_64/syscalls/readlinkat.S
index 4591f11..209e4e9 100644
--- a/libc/arch-x86_64/syscalls/chmod.S
+++ b/libc/arch-x86_64/syscalls/readlinkat.S
@@ -4,8 +4,9 @@
 #include <linux/err.h>
 #include <machine/asm.h>
 
-ENTRY(chmod)
-    movl    $__NR_chmod, %eax
+ENTRY(readlinkat)
+    movq    %rcx, %r10
+    movl    $__NR_readlinkat, %eax
     syscall
     cmpq    $-MAX_ERRNO, %rax
     jb      1f
@@ -15,4 +16,4 @@
     orq     $-1, %rax
 1:
     ret
-END(chmod)
+END(readlinkat)
diff --git a/libc/arch-x86_64/syscalls/rename.S b/libc/arch-x86_64/syscalls/rename.S
deleted file mode 100644
index 2134732..0000000
--- a/libc/arch-x86_64/syscalls/rename.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(rename)
-    movl    $__NR_rename, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(rename)
diff --git a/libc/arch-x86_64/syscalls/rmdir.S b/libc/arch-x86_64/syscalls/rmdir.S
deleted file mode 100644
index ecfe558..0000000
--- a/libc/arch-x86_64/syscalls/rmdir.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(rmdir)
-    movl    $__NR_rmdir, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(rmdir)
diff --git a/libc/arch-x86_64/syscalls/stat.S b/libc/arch-x86_64/syscalls/stat.S
deleted file mode 100644
index c6e2c89..0000000
--- a/libc/arch-x86_64/syscalls/stat.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(stat)
-    movl    $__NR_stat, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(stat)
diff --git a/libc/arch-x86_64/syscalls/symlink.S b/libc/arch-x86_64/syscalls/symlink.S
deleted file mode 100644
index 0edb484..0000000
--- a/libc/arch-x86_64/syscalls/symlink.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(symlink)
-    movl    $__NR_symlink, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(symlink)
diff --git a/libc/arch-x86_64/syscalls/chmod.S b/libc/arch-x86_64/syscalls/symlinkat.S
similarity index 80%
rename from libc/arch-x86_64/syscalls/chmod.S
rename to libc/arch-x86_64/syscalls/symlinkat.S
index 4591f11..3da76f2 100644
--- a/libc/arch-x86_64/syscalls/chmod.S
+++ b/libc/arch-x86_64/syscalls/symlinkat.S
@@ -4,8 +4,8 @@
 #include <linux/err.h>
 #include <machine/asm.h>
 
-ENTRY(chmod)
-    movl    $__NR_chmod, %eax
+ENTRY(symlinkat)
+    movl    $__NR_symlinkat, %eax
     syscall
     cmpq    $-MAX_ERRNO, %rax
     jb      1f
@@ -15,4 +15,4 @@
     orq     $-1, %rax
 1:
     ret
-END(chmod)
+END(symlinkat)
diff --git a/libc/arch-x86_64/syscalls/unlink.S b/libc/arch-x86_64/syscalls/unlink.S
deleted file mode 100644
index 41fdc70..0000000
--- a/libc/arch-x86_64/syscalls/unlink.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(unlink)
-    movl    $__NR_unlink, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(unlink)
diff --git a/libc/arch-x86_64/syscalls/utimes.S b/libc/arch-x86_64/syscalls/utimes.S
deleted file mode 100644
index ff1fc6e..0000000
--- a/libc/arch-x86_64/syscalls/utimes.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(utimes)
-    movl    $__NR_utimes, %eax
-    syscall
-    cmpq    $-MAX_ERRNO, %rax
-    jb      1f
-    negl    %eax
-    movl    %eax, %edi
-    call    __set_errno
-    orq     $-1, %rax
-1:
-    ret
-END(utimes)