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/Android.mk b/libc/Android.mk
index 33f2362..a37c9bc 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -104,8 +104,6 @@
bionic/md5.c \
bionic/memmem.c \
bionic/memswap.c \
- bionic/openat.c \
- bionic/open.c \
bionic/pathconf.c \
bionic/perror.c \
bionic/pread.c \
@@ -211,8 +209,11 @@
libc_bionic_src_files := \
bionic/abort.cpp \
+ bionic/access.cpp \
bionic/assert.cpp \
bionic/brk.cpp \
+ bionic/chmod.cpp \
+ bionic/chown.cpp \
bionic/dirent.cpp \
bionic/__errno.cpp \
bionic/eventfd_read.cpp \
@@ -221,10 +222,16 @@
bionic/futimens.cpp \
bionic/getauxval.cpp \
bionic/getcwd.cpp \
+ bionic/lchown.cpp \
bionic/libc_init_common.cpp \
bionic/libc_logging.cpp \
bionic/libgen.cpp \
+ bionic/link.cpp \
+ bionic/lstat.cpp \
+ bionic/mkdir.cpp \
bionic/mkfifo.cpp \
+ bionic/mknod.cpp \
+ bionic/open.cpp \
bionic/pthread_attr.cpp \
bionic/pthread_detach.cpp \
bionic/pthread_equal.cpp \
@@ -238,6 +245,9 @@
bionic/pthread_setschedparam.cpp \
bionic/pthread_sigmask.cpp \
bionic/raise.cpp \
+ bionic/readlink.cpp \
+ bionic/rename.cpp \
+ bionic/rmdir.cpp \
bionic/sbrk.cpp \
bionic/scandir.cpp \
bionic/sched_getaffinity.cpp \
@@ -257,15 +267,19 @@
bionic/sigprocmask.cpp \
bionic/sigsuspend.cpp \
bionic/sigwait.cpp \
+ bionic/stat.cpp \
bionic/statvfs.cpp \
bionic/strerror.cpp \
bionic/strerror_r.cpp \
bionic/strsignal.cpp \
bionic/stubs.cpp \
+ bionic/symlink.cpp \
bionic/sysconf.cpp \
bionic/tdestroy.cpp \
bionic/__thread_entry.cpp \
bionic/tmpfile.cpp \
+ bionic/unlink.cpp \
+ bionic/utimes.cpp \
bionic/wait.cpp \
bionic/wchar.cpp \
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index d9a2506..504f190 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -34,6 +34,7 @@
pid_t __sys_clone:clone(int, void*, int*, void*, int*) all
pid_t _waitpid:waitpid(pid_t, int*, int, struct rusage*) mips,x86
int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*) all
+int __open:open(const char*, int, mode_t) arm,mips,x86
int execve(const char*, char* const*, char* const*) all
@@ -101,8 +102,6 @@
ssize_t write(int, const void*, size_t) all
ssize_t pread64(int, void*, size_t, off64_t) all
ssize_t pwrite64(int, void*, size_t, off64_t) all
-int __open:open(const char*, int, mode_t) all
-int __openat:openat(int, const char*, int, mode_t) all
int close(int) all
pid_t getpid() all
void* mmap(void*, size_t, int, int, int, long) x86_64
@@ -139,16 +138,26 @@
int __fcntl64:fcntl64(int, int, void*) arm,x86,mips
int __fstatfs64:fstatfs64(int, size_t, struct statfs*) arm,x86,mips
int fstatfs(int, struct statfs*) x86_64
-int fstatat:fstatat64(int dirfd, const char* path, struct stat* buf, int flags) arm,x86,mips
-int mkdirat(int dirfd, const char* pathname, mode_t mode) all
-int fchownat(int dirfd, const char* path, uid_t owner, gid_t group, int flags) all
-int fchmodat(int dirfd, const char* path, mode_t mode, int flags) all
-int renameat(int olddirfd, const char* oldpath, int newdirfd, const char* newpath) all
int fsetxattr(int, const char*, const void*, size_t, int) all
ssize_t fgetxattr(int, const char*, void*, size_t) all
ssize_t flistxattr(int, char*, size_t) all
int fremovexattr(int, const char*) all
+int __openat:openat(int, const char*, int, mode_t) all
+int faccessat(int, const char*, int, int) all
+int fchmodat(int, const char*, mode_t, int) all
+int fchownat(int, const char*, uid_t, gid_t, int) all
+int fstatat:fstatat64(int, const char*, struct stat*, int) arm,x86,mips
+int fstatat:newfstatat(int, const char*, struct stat*, int) x86_64
+int linkat(int, const char*, int, const char*, int) all
+int mkdirat(int, const char*, mode_t) all
+int mknodat(int, const char*, mode_t, dev_t) all
+int readlinkat(int, const char*, char*, size_t) all
+int renameat(int, const char*, int, const char*) all
+int symlinkat(const char*, int, const char*) all
+int unlinkat(int, const char*, int) all
+int utimensat(int, const char*, const struct timespec times[2], int) all
+
# Paired off_t/off64_t system calls. On 64-bit systems,
# sizeof(off_t) == sizeof(off64_t), so there we emit two symbols that are
# aliases. On 32-bit systems, we have two different system calls.
@@ -167,32 +176,12 @@
int truncate|truncate64(const char*, off_t) x86_64
# file system
-int link(const char*, const char*) all
-int unlink(const char*) all
-int unlinkat(int, const char*, int) all
int chdir(const char*) all
-int mknod(const char*, mode_t, dev_t) all
-int chmod(const char*, mode_t) all
-int chown:chown32(const char*, uid_t, gid_t) arm,x86
-int chown:chown(const char*, uid_t, gid_t) mips,x86_64
-int lchown:lchown32(const char*, uid_t, gid_t) arm,x86
-int lchown:lchown(const char*, uid_t, gid_t) mips,x86_64
int mount(const char*, const char*, const char*, unsigned long, const void*) all
int umount2(const char*, int) all
int fstat:fstat64(int, struct stat*) arm,x86,mips
int fstat(int, struct stat*) x86_64
-int stat:stat64(const char*, struct stat*) arm,x86,mips
-int stat(const char*, struct stat*) x86_64
-int lstat:lstat64(const char*, struct stat*) arm,x86,mips
-int lstat(const char*, struct stat*) x86_64
-int mkdir(const char*, mode_t) all
-int readlink(const char*, char*, size_t) all
-int rmdir(const char*) all
-int rename(const char*, const char*) all
int __getcwd:getcwd(char* buf, size_t size) all
-int access(const char*, int) all
-int faccessat(int, const char*, int, int) all
-int symlink(const char*, const char*) all
int fchdir(int) all
int setxattr(const char*, const char*, const void*, size_t, int) all
int lsetxattr(const char*, const char*, const void*, size_t, int) all
@@ -225,8 +214,6 @@
int __timer_gettime:timer_gettime(timer_t, struct itimerspec*) all
int __timer_getoverrun:timer_getoverrun(timer_t) all
int __timer_delete:timer_delete(timer_t) all
-int utimes(const char*, const struct timeval tvp[2]) all
-int utimensat(int, const char*, const struct timespec times[2], int) all
int timerfd_create(clockid_t, int) all
int timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*) all
int timerfd_gettime(int, struct itimerspec*) all
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index f9d348b..a59d064 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -35,15 +35,12 @@
syscall_src += arch-arm/syscalls/_exit.S
syscall_src += arch-arm/syscalls/_exit_thread.S
syscall_src += arch-arm/syscalls/accept.S
-syscall_src += arch-arm/syscalls/access.S
syscall_src += arch-arm/syscalls/acct.S
syscall_src += arch-arm/syscalls/bind.S
syscall_src += arch-arm/syscalls/cacheflush.S
syscall_src += arch-arm/syscalls/capget.S
syscall_src += arch-arm/syscalls/capset.S
syscall_src += arch-arm/syscalls/chdir.S
-syscall_src += arch-arm/syscalls/chmod.S
-syscall_src += arch-arm/syscalls/chown.S
syscall_src += arch-arm/syscalls/chroot.S
syscall_src += arch-arm/syscalls/clock_getres.S
syscall_src += arch-arm/syscalls/clock_gettime.S
@@ -105,21 +102,18 @@
syscall_src += arch-arm/syscalls/ioprio_get.S
syscall_src += arch-arm/syscalls/ioprio_set.S
syscall_src += arch-arm/syscalls/klogctl.S
-syscall_src += arch-arm/syscalls/lchown.S
syscall_src += arch-arm/syscalls/lgetxattr.S
-syscall_src += arch-arm/syscalls/link.S
+syscall_src += arch-arm/syscalls/linkat.S
syscall_src += arch-arm/syscalls/listen.S
syscall_src += arch-arm/syscalls/listxattr.S
syscall_src += arch-arm/syscalls/llistxattr.S
syscall_src += arch-arm/syscalls/lremovexattr.S
syscall_src += arch-arm/syscalls/lseek.S
syscall_src += arch-arm/syscalls/lsetxattr.S
-syscall_src += arch-arm/syscalls/lstat.S
syscall_src += arch-arm/syscalls/madvise.S
syscall_src += arch-arm/syscalls/mincore.S
-syscall_src += arch-arm/syscalls/mkdir.S
syscall_src += arch-arm/syscalls/mkdirat.S
-syscall_src += arch-arm/syscalls/mknod.S
+syscall_src += arch-arm/syscalls/mknodat.S
syscall_src += arch-arm/syscalls/mlock.S
syscall_src += arch-arm/syscalls/mlockall.S
syscall_src += arch-arm/syscalls/mount.S
@@ -141,14 +135,12 @@
syscall_src += arch-arm/syscalls/pwrite64.S
syscall_src += arch-arm/syscalls/read.S
syscall_src += arch-arm/syscalls/readahead.S
-syscall_src += arch-arm/syscalls/readlink.S
+syscall_src += arch-arm/syscalls/readlinkat.S
syscall_src += arch-arm/syscalls/readv.S
syscall_src += arch-arm/syscalls/recvfrom.S
syscall_src += arch-arm/syscalls/recvmsg.S
syscall_src += arch-arm/syscalls/removexattr.S
-syscall_src += arch-arm/syscalls/rename.S
syscall_src += arch-arm/syscalls/renameat.S
-syscall_src += arch-arm/syscalls/rmdir.S
syscall_src += arch-arm/syscalls/sched_get_priority_max.S
syscall_src += arch-arm/syscalls/sched_get_priority_min.S
syscall_src += arch-arm/syscalls/sched_getparam.S
@@ -183,10 +175,9 @@
syscall_src += arch-arm/syscalls/signalfd4.S
syscall_src += arch-arm/syscalls/socket.S
syscall_src += arch-arm/syscalls/socketpair.S
-syscall_src += arch-arm/syscalls/stat.S
syscall_src += arch-arm/syscalls/swapoff.S
syscall_src += arch-arm/syscalls/swapon.S
-syscall_src += arch-arm/syscalls/symlink.S
+syscall_src += arch-arm/syscalls/symlinkat.S
syscall_src += arch-arm/syscalls/sync.S
syscall_src += arch-arm/syscalls/sysinfo.S
syscall_src += arch-arm/syscalls/timerfd_create.S
@@ -198,11 +189,9 @@
syscall_src += arch-arm/syscalls/umask.S
syscall_src += arch-arm/syscalls/umount2.S
syscall_src += arch-arm/syscalls/uname.S
-syscall_src += arch-arm/syscalls/unlink.S
syscall_src += arch-arm/syscalls/unlinkat.S
syscall_src += arch-arm/syscalls/unshare.S
syscall_src += arch-arm/syscalls/utimensat.S
-syscall_src += arch-arm/syscalls/utimes.S
syscall_src += arch-arm/syscalls/vfork.S
syscall_src += arch-arm/syscalls/wait4.S
syscall_src += arch-arm/syscalls/write.S
diff --git a/libc/arch-arm/syscalls/access.S b/libc/arch-arm/syscalls/access.S
deleted file mode 100644
index 730be2a..0000000
--- a/libc/arch-arm/syscalls/access.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(access)
- mov ip, r7
- ldr r7, =__NR_access
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(access)
diff --git a/libc/arch-arm/syscalls/chmod.S b/libc/arch-arm/syscalls/chmod.S
deleted file mode 100644
index 3491ff2..0000000
--- a/libc/arch-arm/syscalls/chmod.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(chmod)
- mov ip, r7
- ldr r7, =__NR_chmod
- swi #0
- mov r7, ip
- 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
deleted file mode 100644
index 1ef51b4..0000000
--- a/libc/arch-arm/syscalls/chown.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(chown)
- mov ip, r7
- ldr r7, =__NR_chown32
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(chown)
diff --git a/libc/arch-arm/syscalls/lchown.S b/libc/arch-arm/syscalls/lchown.S
deleted file mode 100644
index 91b7cf5..0000000
--- a/libc/arch-arm/syscalls/lchown.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(lchown)
- mov ip, r7
- ldr r7, =__NR_lchown32
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(lchown)
diff --git a/libc/arch-arm/syscalls/link.S b/libc/arch-arm/syscalls/link.S
deleted file mode 100644
index cc6314e..0000000
--- a/libc/arch-arm/syscalls/link.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(link)
- mov ip, r7
- ldr r7, =__NR_link
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(link)
diff --git a/libc/arch-arm/syscalls/linkat.S b/libc/arch-arm/syscalls/linkat.S
new file mode 100644
index 0000000..e990ce1
--- /dev/null
+++ b/libc/arch-arm/syscalls/linkat.S
@@ -0,0 +1,19 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(linkat)
+ mov ip, sp
+ .save {r4, r5, r6, r7}
+ stmfd sp!, {r4, r5, r6, r7}
+ ldmfd ip, {r4, r5, r6}
+ ldr r7, =__NR_linkat
+ swi #0
+ ldmfd sp!, {r4, r5, r6, r7}
+ cmn r0, #(MAX_ERRNO + 1)
+ bxls lr
+ neg r0, r0
+ b __set_errno
+END(linkat)
diff --git a/libc/arch-arm/syscalls/lstat.S b/libc/arch-arm/syscalls/lstat.S
deleted file mode 100644
index 4e3d3f9..0000000
--- a/libc/arch-arm/syscalls/lstat.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(lstat)
- mov ip, r7
- ldr r7, =__NR_lstat64
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(lstat)
diff --git a/libc/arch-arm/syscalls/mkdir.S b/libc/arch-arm/syscalls/mkdir.S
deleted file mode 100644
index efceeaa..0000000
--- a/libc/arch-arm/syscalls/mkdir.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(mkdir)
- mov ip, r7
- ldr r7, =__NR_mkdir
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(mkdir)
diff --git a/libc/arch-arm/syscalls/mknod.S b/libc/arch-arm/syscalls/mknod.S
deleted file mode 100644
index a8aeb39..0000000
--- a/libc/arch-arm/syscalls/mknod.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(mknod)
- mov ip, r7
- ldr r7, =__NR_mknod
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(mknod)
diff --git a/libc/arch-arm/syscalls/readlink.S b/libc/arch-arm/syscalls/mknodat.S
similarity index 81%
rename from libc/arch-arm/syscalls/readlink.S
rename to libc/arch-arm/syscalls/mknodat.S
index 41fd457..4a64eea 100644
--- a/libc/arch-arm/syscalls/readlink.S
+++ b/libc/arch-arm/syscalls/mknodat.S
@@ -4,13 +4,13 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(readlink)
+ENTRY(mknodat)
mov ip, r7
- ldr r7, =__NR_readlink
+ ldr r7, =__NR_mknodat
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(readlink)
+END(mknodat)
diff --git a/libc/arch-arm/syscalls/readlink.S b/libc/arch-arm/syscalls/readlinkat.S
similarity index 79%
copy from libc/arch-arm/syscalls/readlink.S
copy to libc/arch-arm/syscalls/readlinkat.S
index 41fd457..3d85e56 100644
--- a/libc/arch-arm/syscalls/readlink.S
+++ b/libc/arch-arm/syscalls/readlinkat.S
@@ -4,13 +4,13 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(readlink)
+ENTRY(readlinkat)
mov ip, r7
- ldr r7, =__NR_readlink
+ ldr r7, =__NR_readlinkat
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(readlink)
+END(readlinkat)
diff --git a/libc/arch-arm/syscalls/rename.S b/libc/arch-arm/syscalls/rename.S
deleted file mode 100644
index 0954c51..0000000
--- a/libc/arch-arm/syscalls/rename.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(rename)
- mov ip, r7
- ldr r7, =__NR_rename
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(rename)
diff --git a/libc/arch-arm/syscalls/rmdir.S b/libc/arch-arm/syscalls/rmdir.S
deleted file mode 100644
index 3ebe9d1..0000000
--- a/libc/arch-arm/syscalls/rmdir.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(rmdir)
- mov ip, r7
- ldr r7, =__NR_rmdir
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(rmdir)
diff --git a/libc/arch-arm/syscalls/stat.S b/libc/arch-arm/syscalls/stat.S
deleted file mode 100644
index 728c170..0000000
--- a/libc/arch-arm/syscalls/stat.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(stat)
- mov ip, r7
- ldr r7, =__NR_stat64
- swi #0
- mov r7, ip
- 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
deleted file mode 100644
index 92bd669..0000000
--- a/libc/arch-arm/syscalls/symlink.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(symlink)
- mov ip, r7
- ldr r7, =__NR_symlink
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(symlink)
diff --git a/libc/arch-arm/syscalls/readlink.S b/libc/arch-arm/syscalls/symlinkat.S
similarity index 80%
copy from libc/arch-arm/syscalls/readlink.S
copy to libc/arch-arm/syscalls/symlinkat.S
index 41fd457..fb51f19 100644
--- a/libc/arch-arm/syscalls/readlink.S
+++ b/libc/arch-arm/syscalls/symlinkat.S
@@ -4,13 +4,13 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(readlink)
+ENTRY(symlinkat)
mov ip, r7
- ldr r7, =__NR_readlink
+ ldr r7, =__NR_symlinkat
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(readlink)
+END(symlinkat)
diff --git a/libc/arch-arm/syscalls/unlink.S b/libc/arch-arm/syscalls/unlink.S
deleted file mode 100644
index 80c4c77..0000000
--- a/libc/arch-arm/syscalls/unlink.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(unlink)
- mov ip, r7
- ldr r7, =__NR_unlink
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(unlink)
diff --git a/libc/arch-arm/syscalls/utimes.S b/libc/arch-arm/syscalls/utimes.S
deleted file mode 100644
index 8b70479..0000000
--- a/libc/arch-arm/syscalls/utimes.S
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(utimes)
- mov ip, r7
- ldr r7, =__NR_utimes
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(utimes)
diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk
index fc96222..621dbac 100644
--- a/libc/arch-mips/syscalls.mk
+++ b/libc/arch-mips/syscalls.mk
@@ -37,14 +37,11 @@
syscall_src += arch-mips/syscalls/_flush_cache.S
syscall_src += arch-mips/syscalls/_waitpid.S
syscall_src += arch-mips/syscalls/accept.S
-syscall_src += arch-mips/syscalls/access.S
syscall_src += arch-mips/syscalls/acct.S
syscall_src += arch-mips/syscalls/bind.S
syscall_src += arch-mips/syscalls/capget.S
syscall_src += arch-mips/syscalls/capset.S
syscall_src += arch-mips/syscalls/chdir.S
-syscall_src += arch-mips/syscalls/chmod.S
-syscall_src += arch-mips/syscalls/chown.S
syscall_src += arch-mips/syscalls/chroot.S
syscall_src += arch-mips/syscalls/clock_getres.S
syscall_src += arch-mips/syscalls/clock_gettime.S
@@ -107,21 +104,18 @@
syscall_src += arch-mips/syscalls/ioprio_set.S
syscall_src += arch-mips/syscalls/kill.S
syscall_src += arch-mips/syscalls/klogctl.S
-syscall_src += arch-mips/syscalls/lchown.S
syscall_src += arch-mips/syscalls/lgetxattr.S
-syscall_src += arch-mips/syscalls/link.S
+syscall_src += arch-mips/syscalls/linkat.S
syscall_src += arch-mips/syscalls/listen.S
syscall_src += arch-mips/syscalls/listxattr.S
syscall_src += arch-mips/syscalls/llistxattr.S
syscall_src += arch-mips/syscalls/lremovexattr.S
syscall_src += arch-mips/syscalls/lseek.S
syscall_src += arch-mips/syscalls/lsetxattr.S
-syscall_src += arch-mips/syscalls/lstat.S
syscall_src += arch-mips/syscalls/madvise.S
syscall_src += arch-mips/syscalls/mincore.S
-syscall_src += arch-mips/syscalls/mkdir.S
syscall_src += arch-mips/syscalls/mkdirat.S
-syscall_src += arch-mips/syscalls/mknod.S
+syscall_src += arch-mips/syscalls/mknodat.S
syscall_src += arch-mips/syscalls/mlock.S
syscall_src += arch-mips/syscalls/mlockall.S
syscall_src += arch-mips/syscalls/mount.S
@@ -142,14 +136,12 @@
syscall_src += arch-mips/syscalls/pwrite64.S
syscall_src += arch-mips/syscalls/read.S
syscall_src += arch-mips/syscalls/readahead.S
-syscall_src += arch-mips/syscalls/readlink.S
+syscall_src += arch-mips/syscalls/readlinkat.S
syscall_src += arch-mips/syscalls/readv.S
syscall_src += arch-mips/syscalls/recvfrom.S
syscall_src += arch-mips/syscalls/recvmsg.S
syscall_src += arch-mips/syscalls/removexattr.S
-syscall_src += arch-mips/syscalls/rename.S
syscall_src += arch-mips/syscalls/renameat.S
-syscall_src += arch-mips/syscalls/rmdir.S
syscall_src += arch-mips/syscalls/sched_get_priority_max.S
syscall_src += arch-mips/syscalls/sched_get_priority_min.S
syscall_src += arch-mips/syscalls/sched_getparam.S
@@ -184,10 +176,9 @@
syscall_src += arch-mips/syscalls/signalfd4.S
syscall_src += arch-mips/syscalls/socket.S
syscall_src += arch-mips/syscalls/socketpair.S
-syscall_src += arch-mips/syscalls/stat.S
syscall_src += arch-mips/syscalls/swapoff.S
syscall_src += arch-mips/syscalls/swapon.S
-syscall_src += arch-mips/syscalls/symlink.S
+syscall_src += arch-mips/syscalls/symlinkat.S
syscall_src += arch-mips/syscalls/sync.S
syscall_src += arch-mips/syscalls/syscall.S
syscall_src += arch-mips/syscalls/sysinfo.S
@@ -202,11 +193,9 @@
syscall_src += arch-mips/syscalls/umask.S
syscall_src += arch-mips/syscalls/umount2.S
syscall_src += arch-mips/syscalls/uname.S
-syscall_src += arch-mips/syscalls/unlink.S
syscall_src += arch-mips/syscalls/unlinkat.S
syscall_src += arch-mips/syscalls/unshare.S
syscall_src += arch-mips/syscalls/utimensat.S
-syscall_src += arch-mips/syscalls/utimes.S
syscall_src += arch-mips/syscalls/wait4.S
syscall_src += arch-mips/syscalls/write.S
syscall_src += arch-mips/syscalls/writev.S
diff --git a/libc/arch-mips/syscalls/chmod.S b/libc/arch-mips/syscalls/chmod.S
deleted file mode 100644
index dd5a1f2..0000000
--- a/libc/arch-mips/syscalls/chmod.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl chmod
- .align 4
- .ent chmod
-
-chmod:
- .set noreorder
- .cpload $t9
- li $v0, __NR_chmod
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end chmod
diff --git a/libc/arch-mips/syscalls/chown.S b/libc/arch-mips/syscalls/chown.S
deleted file mode 100644
index afe807d..0000000
--- a/libc/arch-mips/syscalls/chown.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl chown
- .align 4
- .ent chown
-
-chown:
- .set noreorder
- .cpload $t9
- li $v0, __NR_chown
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end chown
diff --git a/libc/arch-mips/syscalls/lchown.S b/libc/arch-mips/syscalls/lchown.S
deleted file mode 100644
index f23aa6a..0000000
--- a/libc/arch-mips/syscalls/lchown.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl lchown
- .align 4
- .ent lchown
-
-lchown:
- .set noreorder
- .cpload $t9
- li $v0, __NR_lchown
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end lchown
diff --git a/libc/arch-mips/syscalls/link.S b/libc/arch-mips/syscalls/link.S
deleted file mode 100644
index e197927..0000000
--- a/libc/arch-mips/syscalls/link.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl link
- .align 4
- .ent link
-
-link:
- .set noreorder
- .cpload $t9
- li $v0, __NR_link
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end link
diff --git a/libc/arch-mips/syscalls/access.S b/libc/arch-mips/syscalls/linkat.S
similarity index 75%
rename from libc/arch-mips/syscalls/access.S
rename to libc/arch-mips/syscalls/linkat.S
index 941b791..dae07dd 100644
--- a/libc/arch-mips/syscalls/access.S
+++ b/libc/arch-mips/syscalls/linkat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl access
+ .globl linkat
.align 4
- .ent access
+ .ent linkat
-access:
+linkat:
.set noreorder
.cpload $t9
- li $v0, __NR_access
+ li $v0, __NR_linkat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@
j $t9
nop
.set reorder
- .end access
+ .end linkat
diff --git a/libc/arch-mips/syscalls/lstat.S b/libc/arch-mips/syscalls/lstat.S
deleted file mode 100644
index 78e7a98..0000000
--- a/libc/arch-mips/syscalls/lstat.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl lstat
- .align 4
- .ent lstat
-
-lstat:
- .set noreorder
- .cpload $t9
- li $v0, __NR_lstat64
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end lstat
diff --git a/libc/arch-mips/syscalls/mkdir.S b/libc/arch-mips/syscalls/mkdir.S
deleted file mode 100644
index ec7412a..0000000
--- a/libc/arch-mips/syscalls/mkdir.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl mkdir
- .align 4
- .ent mkdir
-
-mkdir:
- .set noreorder
- .cpload $t9
- li $v0, __NR_mkdir
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end mkdir
diff --git a/libc/arch-mips/syscalls/mknod.S b/libc/arch-mips/syscalls/mknod.S
deleted file mode 100644
index 579acaf..0000000
--- a/libc/arch-mips/syscalls/mknod.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl mknod
- .align 4
- .ent mknod
-
-mknod:
- .set noreorder
- .cpload $t9
- li $v0, __NR_mknod
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end mknod
diff --git a/libc/arch-mips/syscalls/access.S b/libc/arch-mips/syscalls/mknodat.S
similarity index 74%
copy from libc/arch-mips/syscalls/access.S
copy to libc/arch-mips/syscalls/mknodat.S
index 941b791..fc05bb3 100644
--- a/libc/arch-mips/syscalls/access.S
+++ b/libc/arch-mips/syscalls/mknodat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl access
+ .globl mknodat
.align 4
- .ent access
+ .ent mknodat
-access:
+mknodat:
.set noreorder
.cpload $t9
- li $v0, __NR_access
+ li $v0, __NR_mknodat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@
j $t9
nop
.set reorder
- .end access
+ .end mknodat
diff --git a/libc/arch-mips/syscalls/readlink.S b/libc/arch-mips/syscalls/readlinkat.S
similarity index 71%
copy from libc/arch-mips/syscalls/readlink.S
copy to libc/arch-mips/syscalls/readlinkat.S
index adaf7fa..3e5d72f 100644
--- a/libc/arch-mips/syscalls/readlink.S
+++ b/libc/arch-mips/syscalls/readlinkat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl readlink
+ .globl readlinkat
.align 4
- .ent readlink
+ .ent readlinkat
-readlink:
+readlinkat:
.set noreorder
.cpload $t9
- li $v0, __NR_readlink
+ li $v0, __NR_readlinkat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@
j $t9
nop
.set reorder
- .end readlink
+ .end readlinkat
diff --git a/libc/arch-mips/syscalls/rename.S b/libc/arch-mips/syscalls/rename.S
deleted file mode 100644
index 113b910..0000000
--- a/libc/arch-mips/syscalls/rename.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl rename
- .align 4
- .ent rename
-
-rename:
- .set noreorder
- .cpload $t9
- li $v0, __NR_rename
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end rename
diff --git a/libc/arch-mips/syscalls/rmdir.S b/libc/arch-mips/syscalls/rmdir.S
deleted file mode 100644
index 97b6744..0000000
--- a/libc/arch-mips/syscalls/rmdir.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl rmdir
- .align 4
- .ent rmdir
-
-rmdir:
- .set noreorder
- .cpload $t9
- li $v0, __NR_rmdir
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end rmdir
diff --git a/libc/arch-mips/syscalls/stat.S b/libc/arch-mips/syscalls/stat.S
deleted file mode 100644
index ca1b26f..0000000
--- a/libc/arch-mips/syscalls/stat.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl stat
- .align 4
- .ent stat
-
-stat:
- .set noreorder
- .cpload $t9
- li $v0, __NR_stat64
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end stat
diff --git a/libc/arch-mips/syscalls/symlink.S b/libc/arch-mips/syscalls/symlink.S
deleted file mode 100644
index 7a49858..0000000
--- a/libc/arch-mips/syscalls/symlink.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl symlink
- .align 4
- .ent symlink
-
-symlink:
- .set noreorder
- .cpload $t9
- li $v0, __NR_symlink
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end symlink
diff --git a/libc/arch-mips/syscalls/readlink.S b/libc/arch-mips/syscalls/symlinkat.S
similarity index 72%
rename from libc/arch-mips/syscalls/readlink.S
rename to libc/arch-mips/syscalls/symlinkat.S
index adaf7fa..9c43241 100644
--- a/libc/arch-mips/syscalls/readlink.S
+++ b/libc/arch-mips/syscalls/symlinkat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl readlink
+ .globl symlinkat
.align 4
- .ent readlink
+ .ent symlinkat
-readlink:
+symlinkat:
.set noreorder
.cpload $t9
- li $v0, __NR_readlink
+ li $v0, __NR_symlinkat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@
j $t9
nop
.set reorder
- .end readlink
+ .end symlinkat
diff --git a/libc/arch-mips/syscalls/unlink.S b/libc/arch-mips/syscalls/unlink.S
deleted file mode 100644
index 2900707..0000000
--- a/libc/arch-mips/syscalls/unlink.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl unlink
- .align 4
- .ent unlink
-
-unlink:
- .set noreorder
- .cpload $t9
- li $v0, __NR_unlink
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end unlink
diff --git a/libc/arch-mips/syscalls/utimes.S b/libc/arch-mips/syscalls/utimes.S
deleted file mode 100644
index dc683e5..0000000
--- a/libc/arch-mips/syscalls/utimes.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl utimes
- .align 4
- .ent utimes
-
-utimes:
- .set noreorder
- .cpload $t9
- li $v0, __NR_utimes
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end utimes
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index 5494992..5d1edaa 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -36,14 +36,11 @@
syscall_src += arch-x86/syscalls/_exit_thread.S
syscall_src += arch-x86/syscalls/_waitpid.S
syscall_src += arch-x86/syscalls/accept.S
-syscall_src += arch-x86/syscalls/access.S
syscall_src += arch-x86/syscalls/acct.S
syscall_src += arch-x86/syscalls/bind.S
syscall_src += arch-x86/syscalls/capget.S
syscall_src += arch-x86/syscalls/capset.S
syscall_src += arch-x86/syscalls/chdir.S
-syscall_src += arch-x86/syscalls/chmod.S
-syscall_src += arch-x86/syscalls/chown.S
syscall_src += arch-x86/syscalls/chroot.S
syscall_src += arch-x86/syscalls/clock_getres.S
syscall_src += arch-x86/syscalls/clock_gettime.S
@@ -106,21 +103,18 @@
syscall_src += arch-x86/syscalls/ioprio_set.S
syscall_src += arch-x86/syscalls/kill.S
syscall_src += arch-x86/syscalls/klogctl.S
-syscall_src += arch-x86/syscalls/lchown.S
syscall_src += arch-x86/syscalls/lgetxattr.S
-syscall_src += arch-x86/syscalls/link.S
+syscall_src += arch-x86/syscalls/linkat.S
syscall_src += arch-x86/syscalls/listen.S
syscall_src += arch-x86/syscalls/listxattr.S
syscall_src += arch-x86/syscalls/llistxattr.S
syscall_src += arch-x86/syscalls/lremovexattr.S
syscall_src += arch-x86/syscalls/lseek.S
syscall_src += arch-x86/syscalls/lsetxattr.S
-syscall_src += arch-x86/syscalls/lstat.S
syscall_src += arch-x86/syscalls/madvise.S
syscall_src += arch-x86/syscalls/mincore.S
-syscall_src += arch-x86/syscalls/mkdir.S
syscall_src += arch-x86/syscalls/mkdirat.S
-syscall_src += arch-x86/syscalls/mknod.S
+syscall_src += arch-x86/syscalls/mknodat.S
syscall_src += arch-x86/syscalls/mlock.S
syscall_src += arch-x86/syscalls/mlockall.S
syscall_src += arch-x86/syscalls/mount.S
@@ -142,14 +136,12 @@
syscall_src += arch-x86/syscalls/pwrite64.S
syscall_src += arch-x86/syscalls/read.S
syscall_src += arch-x86/syscalls/readahead.S
-syscall_src += arch-x86/syscalls/readlink.S
+syscall_src += arch-x86/syscalls/readlinkat.S
syscall_src += arch-x86/syscalls/readv.S
syscall_src += arch-x86/syscalls/recvfrom.S
syscall_src += arch-x86/syscalls/recvmsg.S
syscall_src += arch-x86/syscalls/removexattr.S
-syscall_src += arch-x86/syscalls/rename.S
syscall_src += arch-x86/syscalls/renameat.S
-syscall_src += arch-x86/syscalls/rmdir.S
syscall_src += arch-x86/syscalls/sched_get_priority_max.S
syscall_src += arch-x86/syscalls/sched_get_priority_min.S
syscall_src += arch-x86/syscalls/sched_getparam.S
@@ -184,10 +176,9 @@
syscall_src += arch-x86/syscalls/signalfd4.S
syscall_src += arch-x86/syscalls/socket.S
syscall_src += arch-x86/syscalls/socketpair.S
-syscall_src += arch-x86/syscalls/stat.S
syscall_src += arch-x86/syscalls/swapoff.S
syscall_src += arch-x86/syscalls/swapon.S
-syscall_src += arch-x86/syscalls/symlink.S
+syscall_src += arch-x86/syscalls/symlinkat.S
syscall_src += arch-x86/syscalls/sync.S
syscall_src += arch-x86/syscalls/sysinfo.S
syscall_src += arch-x86/syscalls/tgkill.S
@@ -201,11 +192,9 @@
syscall_src += arch-x86/syscalls/umask.S
syscall_src += arch-x86/syscalls/umount2.S
syscall_src += arch-x86/syscalls/uname.S
-syscall_src += arch-x86/syscalls/unlink.S
syscall_src += arch-x86/syscalls/unlinkat.S
syscall_src += arch-x86/syscalls/unshare.S
syscall_src += arch-x86/syscalls/utimensat.S
-syscall_src += arch-x86/syscalls/utimes.S
syscall_src += arch-x86/syscalls/wait4.S
syscall_src += arch-x86/syscalls/write.S
syscall_src += arch-x86/syscalls/writev.S
diff --git a/libc/arch-x86/syscalls/access.S b/libc/arch-x86/syscalls/access.S
deleted file mode 100644
index 0a553ed..0000000
--- a/libc/arch-x86/syscalls/access.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(access)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_access, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(access)
diff --git a/libc/arch-x86/syscalls/chmod.S b/libc/arch-x86/syscalls/chmod.S
deleted file mode 100644
index 5718f8f..0000000
--- a/libc/arch-x86/syscalls/chmod.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(chmod)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_chmod, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(chmod)
diff --git a/libc/arch-x86/syscalls/lchown.S b/libc/arch-x86/syscalls/lchown.S
deleted file mode 100644
index 7f4589a..0000000
--- a/libc/arch-x86/syscalls/lchown.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(lchown)
- pushl %ebx
- pushl %ecx
- pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_lchown32, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %edx
- popl %ecx
- popl %ebx
- ret
-END(lchown)
diff --git a/libc/arch-x86/syscalls/link.S b/libc/arch-x86/syscalls/link.S
deleted file mode 100644
index 15d67c4..0000000
--- a/libc/arch-x86/syscalls/link.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(link)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_link, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(link)
diff --git a/libc/arch-x86/syscalls/chown.S b/libc/arch-x86/syscalls/linkat.S
similarity index 60%
copy from libc/arch-x86/syscalls/chown.S
copy to libc/arch-x86/syscalls/linkat.S
index 5706da1..652f346 100644
--- a/libc/arch-x86/syscalls/chown.S
+++ b/libc/arch-x86/syscalls/linkat.S
@@ -4,14 +4,18 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chown)
+ENTRY(linkat)
pushl %ebx
pushl %ecx
pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_chown32, %eax
+ pushl %esi
+ pushl %edi
+ mov 24(%esp), %ebx
+ mov 28(%esp), %ecx
+ mov 32(%esp), %edx
+ mov 36(%esp), %esi
+ mov 40(%esp), %edi
+ movl $__NR_linkat, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax
jb 1f
@@ -21,8 +25,10 @@
addl $4, %esp
orl $-1, %eax
1:
+ popl %edi
+ popl %esi
popl %edx
popl %ecx
popl %ebx
ret
-END(chown)
+END(linkat)
diff --git a/libc/arch-x86/syscalls/lstat.S b/libc/arch-x86/syscalls/lstat.S
deleted file mode 100644
index 23a0dcf..0000000
--- a/libc/arch-x86/syscalls/lstat.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(lstat)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_lstat64, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(lstat)
diff --git a/libc/arch-x86/syscalls/mkdir.S b/libc/arch-x86/syscalls/mkdir.S
deleted file mode 100644
index d242ce2..0000000
--- a/libc/arch-x86/syscalls/mkdir.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(mkdir)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_mkdir, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(mkdir)
diff --git a/libc/arch-x86/syscalls/mknod.S b/libc/arch-x86/syscalls/mknod.S
deleted file mode 100644
index e270384..0000000
--- a/libc/arch-x86/syscalls/mknod.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(mknod)
- pushl %ebx
- pushl %ecx
- pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_mknod, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %edx
- popl %ecx
- popl %ebx
- ret
-END(mknod)
diff --git a/libc/arch-x86/syscalls/chown.S b/libc/arch-x86/syscalls/mknodat.S
similarity index 66%
copy from libc/arch-x86/syscalls/chown.S
copy to libc/arch-x86/syscalls/mknodat.S
index 5706da1..8e53940 100644
--- a/libc/arch-x86/syscalls/chown.S
+++ b/libc/arch-x86/syscalls/mknodat.S
@@ -4,14 +4,16 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chown)
+ENTRY(mknodat)
pushl %ebx
pushl %ecx
pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_chown32, %eax
+ pushl %esi
+ mov 20(%esp), %ebx
+ mov 24(%esp), %ecx
+ mov 28(%esp), %edx
+ mov 32(%esp), %esi
+ movl $__NR_mknodat, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax
jb 1f
@@ -21,8 +23,9 @@
addl $4, %esp
orl $-1, %eax
1:
+ popl %esi
popl %edx
popl %ecx
popl %ebx
ret
-END(chown)
+END(mknodat)
diff --git a/libc/arch-x86/syscalls/readlink.S b/libc/arch-x86/syscalls/readlink.S
deleted file mode 100644
index 4a279dc..0000000
--- a/libc/arch-x86/syscalls/readlink.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(readlink)
- pushl %ebx
- pushl %ecx
- pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_readlink, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %edx
- popl %ecx
- popl %ebx
- ret
-END(readlink)
diff --git a/libc/arch-x86/syscalls/chown.S b/libc/arch-x86/syscalls/readlinkat.S
similarity index 65%
copy from libc/arch-x86/syscalls/chown.S
copy to libc/arch-x86/syscalls/readlinkat.S
index 5706da1..73b05af 100644
--- a/libc/arch-x86/syscalls/chown.S
+++ b/libc/arch-x86/syscalls/readlinkat.S
@@ -4,14 +4,16 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chown)
+ENTRY(readlinkat)
pushl %ebx
pushl %ecx
pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_chown32, %eax
+ pushl %esi
+ mov 20(%esp), %ebx
+ mov 24(%esp), %ecx
+ mov 28(%esp), %edx
+ mov 32(%esp), %esi
+ movl $__NR_readlinkat, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax
jb 1f
@@ -21,8 +23,9 @@
addl $4, %esp
orl $-1, %eax
1:
+ popl %esi
popl %edx
popl %ecx
popl %ebx
ret
-END(chown)
+END(readlinkat)
diff --git a/libc/arch-x86/syscalls/rename.S b/libc/arch-x86/syscalls/rename.S
deleted file mode 100644
index 8556619..0000000
--- a/libc/arch-x86/syscalls/rename.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(rename)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_rename, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(rename)
diff --git a/libc/arch-x86/syscalls/rmdir.S b/libc/arch-x86/syscalls/rmdir.S
deleted file mode 100644
index 8ec2d3c..0000000
--- a/libc/arch-x86/syscalls/rmdir.S
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(rmdir)
- pushl %ebx
- mov 8(%esp), %ebx
- movl $__NR_rmdir, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ebx
- ret
-END(rmdir)
diff --git a/libc/arch-x86/syscalls/stat.S b/libc/arch-x86/syscalls/stat.S
deleted file mode 100644
index 6f7604d..0000000
--- a/libc/arch-x86/syscalls/stat.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(stat)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_stat64, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(stat)
diff --git a/libc/arch-x86/syscalls/symlink.S b/libc/arch-x86/syscalls/symlink.S
deleted file mode 100644
index 815d833..0000000
--- a/libc/arch-x86/syscalls/symlink.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(symlink)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_symlink, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(symlink)
diff --git a/libc/arch-x86/syscalls/chown.S b/libc/arch-x86/syscalls/symlinkat.S
similarity index 87%
rename from libc/arch-x86/syscalls/chown.S
rename to libc/arch-x86/syscalls/symlinkat.S
index 5706da1..7d24226 100644
--- a/libc/arch-x86/syscalls/chown.S
+++ b/libc/arch-x86/syscalls/symlinkat.S
@@ -4,14 +4,14 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chown)
+ENTRY(symlinkat)
pushl %ebx
pushl %ecx
pushl %edx
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
- movl $__NR_chown32, %eax
+ movl $__NR_symlinkat, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax
jb 1f
@@ -25,4 +25,4 @@
popl %ecx
popl %ebx
ret
-END(chown)
+END(symlinkat)
diff --git a/libc/arch-x86/syscalls/unlink.S b/libc/arch-x86/syscalls/unlink.S
deleted file mode 100644
index 297d34b..0000000
--- a/libc/arch-x86/syscalls/unlink.S
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(unlink)
- pushl %ebx
- mov 8(%esp), %ebx
- movl $__NR_unlink, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ebx
- ret
-END(unlink)
diff --git a/libc/arch-x86/syscalls/utimes.S b/libc/arch-x86/syscalls/utimes.S
deleted file mode 100644
index bfe02b5..0000000
--- a/libc/arch-x86/syscalls/utimes.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(utimes)
- pushl %ebx
- pushl %ecx
- mov 12(%esp), %ebx
- mov 16(%esp), %ecx
- movl $__NR_utimes, %eax
- int $0x80
- cmpl $-MAX_ERRNO, %eax
- jb 1f
- negl %eax
- pushl %eax
- call __set_errno
- addl $4, %esp
- orl $-1, %eax
-1:
- popl %ecx
- popl %ebx
- ret
-END(utimes)
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)
diff --git a/libc/bionic/open.c b/libc/bionic/access.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/access.cpp
index 6441dc2..360b672 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/access.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int access(const char* path, int mode) {
+ return faccessat(AT_FDCWD, path, mode, 0);
}
diff --git a/libc/bionic/open.c b/libc/bionic/chmod.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/chmod.cpp
index 6441dc2..d988f48 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/chmod.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int chmod(const char* path, mode_t mode) {
+ return fchmodat(AT_FDCWD, path, mode, 0);
}
diff --git a/libc/bionic/open.c b/libc/bionic/chown.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/chown.cpp
index 6441dc2..bc2e605 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/chown.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int chown(const char* path, uid_t uid, gid_t gid) {
+ return fchownat(AT_FDCWD, path, uid, gid, 0);
}
diff --git a/libc/bionic/open.c b/libc/bionic/lchown.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/lchown.cpp
index 6441dc2..95251db 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/lchown.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int lchown(const char* path, uid_t uid, gid_t gid) {
+ return fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW);
}
diff --git a/libc/bionic/open.c b/libc/bionic/link.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/link.cpp
index 6441dc2..65ad374 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/link.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int link(const char* old_path, const char* new_path) {
+ return linkat(AT_FDCWD, old_path, AT_FDCWD, new_path, 0);
}
diff --git a/libc/bionic/open.c b/libc/bionic/lstat.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/lstat.cpp
index 6441dc2..300d7fa 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/lstat.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,12 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int lstat(const char* path, struct stat* sb) {
+ return fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW);
}
diff --git a/libc/bionic/open.c b/libc/bionic/mkdir.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/mkdir.cpp
index 6441dc2..90dc761 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/mkdir.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int mkdir(const char* path, mode_t mode) {
+ return mkdirat(AT_FDCWD, path, mode);
}
diff --git a/libc/bionic/open.c b/libc/bionic/mknod.cpp
similarity index 67%
rename from libc/bionic/open.c
rename to libc/bionic/mknod.cpp
index 6441dc2..68d4309 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/mknod.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,12 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int mknod(const char* path, mode_t mode, dev_t dev) {
+ return mknodat(AT_FDCWD, path, mode, dev);
}
diff --git a/libc/bionic/openat.c b/libc/bionic/open.cpp
similarity index 77%
rename from libc/bionic/openat.c
rename to libc/bionic/open.cpp
index 56bb627..e0dd181 100644
--- a/libc/bionic/openat.c
+++ b/libc/bionic/open.cpp
@@ -25,13 +25,40 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "private/libc_logging.h"
-extern int __openat(int, const char*, int, int);
+extern "C" int __openat(int, const char*, int, int);
+
+int open(const char* pathname, int flags, ...) {
+ mode_t mode = 0;
+
+ flags |= O_LARGEFILE;
+
+ if (flags & O_CREAT) {
+ va_list args;
+ va_start(args, flags);
+ mode = (mode_t) va_arg(args, int);
+ va_end(args);
+ }
+
+ return __openat(AT_FDCWD, pathname, flags, mode);
+}
+
+int __open_2(const char* pathname, int flags) {
+ if (__predict_false(flags & O_CREAT)) {
+ __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
+ }
+
+ flags |= O_LARGEFILE;
+
+ return __openat(AT_FDCWD, pathname, flags, 0);
+}
int openat(int fd, const char *pathname, int flags, ...) {
mode_t mode = 0;
diff --git a/libc/bionic/open.c b/libc/bionic/readlink.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/readlink.cpp
index 6441dc2..a2c5e91 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/readlink.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+ssize_t readlink(const char* path, char* buf, size_t size) {
+ return readlinkat(AT_FDCWD, path, buf, size);
}
diff --git a/libc/bionic/open.c b/libc/bionic/rename.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/rename.cpp
index 6441dc2..8295559 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/rename.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <stdio.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int rename(const char* old_path, const char* new_path) {
+ return renameat(AT_FDCWD, old_path, AT_FDCWD, new_path);
}
diff --git a/libc/bionic/open.c b/libc/bionic/rmdir.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/rmdir.cpp
index 6441dc2..e7a9808 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/rmdir.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int rmdir(const char* path) {
+ return unlinkat(AT_FDCWD, path, AT_REMOVEDIR);
}
diff --git a/libc/bionic/open.c b/libc/bionic/stat.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/stat.cpp
index 6441dc2..62387c5 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/stat.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,12 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int stat(const char* path, struct stat* sb) {
+ return fstatat(AT_FDCWD, path, sb, 0);
}
diff --git a/libc/bionic/open.c b/libc/bionic/symlink.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/symlink.cpp
index 6441dc2..83cda47 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/symlink.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int symlink(const char* old_path, const char* new_path) {
+ return symlinkat(old_path, AT_FDCWD, new_path);
}
diff --git a/libc/bionic/open.c b/libc/bionic/unlink.cpp
similarity index 67%
copy from libc/bionic/open.c
copy to libc/bionic/unlink.cpp
index 6441dc2..b1ab15c 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/unlink.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,10 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <unistd.h>
-extern int __open(const char*, int, int);
-
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
-
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
- }
-
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+int unlink(const char* path) {
+ return unlinkat(AT_FDCWD, path, 0);
}
diff --git a/libc/bionic/open.c b/libc/bionic/utimes.cpp
similarity index 66%
copy from libc/bionic/open.c
copy to libc/bionic/utimes.cpp
index 6441dc2..315765a 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/utimes.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,35 +25,26 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <unistd.h>
+
#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "private/libc_logging.h"
+#include <sys/stat.h>
+#include <sys/time.h>
-extern int __open(const char*, int, int);
+int utimes(const char* path, const timeval tv[2]) {
+ timespec ts[2];
-int open(const char* pathname, int flags, ...) {
- mode_t mode = 0;
+ // Whole seconds can just be copied.
+ ts[0].tv_sec = tv[0].tv_sec;
+ ts[1].tv_sec = tv[1].tv_sec;
- flags |= O_LARGEFILE;
-
- if (flags & O_CREAT) {
- va_list args;
- va_start(args, flags);
- mode = (mode_t) va_arg(args, int);
- va_end(args);
+ // But we might overflow when converting microseconds to nanoseconds.
+ if (tv[0].tv_usec >= 1000000 || tv[0].tv_usec < 0 ||
+ tv[1].tv_usec >= 1000000 || tv[1].tv_usec < 0) {
+ errno = EINVAL;
+ return -1;
}
+ ts[0].tv_nsec = tv[0].tv_usec * 1000;
+ ts[1].tv_nsec = tv[1].tv_usec * 1000;
- return __open(pathname, flags, mode);
-}
-
-int __open_2(const char* pathname, int flags) {
- if (__predict_false(flags & O_CREAT)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
- }
-
- flags |= O_LARGEFILE;
-
- return __open(pathname, flags, 0);
+ return utimensat(AT_FDCWD, path, ts, 0);
}
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index a13cfea..409afea 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -260,7 +260,8 @@
__printflike(2, 0);
#endif
-int rename (const char *, const char *);
+extern int rename(const char*, const char*);
+extern int renameat(int, const char*, int, const char*);
int fgetpos(FILE * __restrict, fpos_t * __restrict);
int fsetpos(FILE *, const fpos_t *);
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 84e367f..ece44c6 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -180,11 +180,10 @@
extern int mkfifo(const char*, mode_t);
-extern int fstatat(int dirfd, const char *path, struct stat *buf, int flags);
-extern int mkdirat(int dirfd, const char *pathname, mode_t mode);
-extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags);
-extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
-extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+extern int fchmodat(int, const char*, mode_t, int);
+extern int fstatat(int, const char*, struct stat*, int);
+extern int mkdirat(int, const char*, mode_t);
+extern int mknodat(int, const char*, mode_t, dev_t);
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index fb1f663..509ee5c 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -104,10 +104,12 @@
#define X_OK 1 /* Execute */
#define F_OK 0 /* Existence */
-extern int access(const char *, int);
-extern int faccessat(int, const char *, int, int);
-extern int link(const char *, const char *);
-extern int unlink(const char *);
+extern int access(const char*, int);
+extern int faccessat(int, const char*, int, int);
+extern int link(const char*, const char*);
+extern int linkat(int, const char*, int, const char*, int);
+extern int unlink(const char*);
+extern int unlinkat(int, const char*, int);
extern int chdir(const char *);
extern int fchdir(int);
extern int rmdir(const char *);
@@ -116,10 +118,13 @@
extern int pipe2(int *, int);
#endif
extern int chroot(const char *);
-extern int symlink(const char *, const char *);
-extern int readlink(const char *, char *, size_t);
+extern int symlink(const char*, const char*);
+extern int symlinkat(const char*, int, const char*);
+extern ssize_t readlink(const char*, char*, size_t);
+extern ssize_t readlinkat(int, const char*, char*, size_t);
extern int chown(const char *, uid_t, gid_t);
extern int fchown(int, uid_t, gid_t);
+extern int fchownat(int, const char*, uid_t, gid_t, int);
extern int lchown(const char *, uid_t, gid_t);
extern int truncate(const char *, off_t);
extern int truncate64(const char *, off64_t);