summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-22 13:28:46 -0700
committerElliott Hughes <enh@google.com>2013-10-22 16:31:01 -0700
commitf8fcfbc85a3ce3e195626b90736d3a484331494b (patch)
tree5742644f2305f27b65ae7d3a4d07a7614c36af2a
parentf0ed9bf2537e861ae75e6ab71efb4b4722ad0eee (diff)
downloadbionic-f8fcfbc85a3ce3e195626b90736d3a484331494b.zip
bionic-f8fcfbc85a3ce3e195626b90736d3a484331494b.tar.gz
bionic-f8fcfbc85a3ce3e195626b90736d3a484331494b.tar.bz2
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
-rw-r--r--libc/Android.mk18
-rw-r--r--libc/SYSCALLS.TXT45
-rw-r--r--libc/arch-arm/syscalls.mk19
-rw-r--r--libc/arch-arm/syscalls/link.S16
-rw-r--r--libc/arch-arm/syscalls/linkat.S (renamed from libc/arch-arm/syscalls/lchown.S)13
-rw-r--r--libc/arch-arm/syscalls/lstat.S16
-rw-r--r--libc/arch-arm/syscalls/mkdir.S16
-rw-r--r--libc/arch-arm/syscalls/mknod.S16
-rw-r--r--libc/arch-arm/syscalls/mknodat.S (renamed from libc/arch-arm/syscalls/access.S)6
-rw-r--r--libc/arch-arm/syscalls/readlink.S16
-rw-r--r--libc/arch-arm/syscalls/readlinkat.S (renamed from libc/arch-arm/syscalls/chown.S)6
-rw-r--r--libc/arch-arm/syscalls/rename.S16
-rw-r--r--libc/arch-arm/syscalls/rmdir.S16
-rw-r--r--libc/arch-arm/syscalls/stat.S16
-rw-r--r--libc/arch-arm/syscalls/symlink.S16
-rw-r--r--libc/arch-arm/syscalls/symlinkat.S (renamed from libc/arch-arm/syscalls/chmod.S)6
-rw-r--r--libc/arch-arm/syscalls/unlink.S16
-rw-r--r--libc/arch-arm/syscalls/utimes.S16
-rw-r--r--libc/arch-mips/syscalls.mk19
-rw-r--r--libc/arch-mips/syscalls/link.S23
-rw-r--r--libc/arch-mips/syscalls/linkat.S (renamed from libc/arch-mips/syscalls/access.S)10
-rw-r--r--libc/arch-mips/syscalls/lstat.S23
-rw-r--r--libc/arch-mips/syscalls/mkdir.S23
-rw-r--r--libc/arch-mips/syscalls/mknod.S23
-rw-r--r--libc/arch-mips/syscalls/mknodat.S (renamed from libc/arch-mips/syscalls/chmod.S)10
-rw-r--r--libc/arch-mips/syscalls/readlink.S23
-rw-r--r--libc/arch-mips/syscalls/readlinkat.S (renamed from libc/arch-mips/syscalls/lchown.S)10
-rw-r--r--libc/arch-mips/syscalls/rename.S23
-rw-r--r--libc/arch-mips/syscalls/rmdir.S23
-rw-r--r--libc/arch-mips/syscalls/stat.S23
-rw-r--r--libc/arch-mips/syscalls/symlink.S23
-rw-r--r--libc/arch-mips/syscalls/symlinkat.S (renamed from libc/arch-mips/syscalls/chown.S)10
-rw-r--r--libc/arch-mips/syscalls/unlink.S23
-rw-r--r--libc/arch-mips/syscalls/utimes.S23
-rw-r--r--libc/arch-x86/syscalls.mk19
-rw-r--r--libc/arch-x86/syscalls/access.S25
-rw-r--r--libc/arch-x86/syscalls/chmod.S25
-rw-r--r--libc/arch-x86/syscalls/link.S25
-rw-r--r--libc/arch-x86/syscalls/linkat.S (renamed from libc/arch-x86/syscalls/lchown.S)18
-rw-r--r--libc/arch-x86/syscalls/lstat.S25
-rw-r--r--libc/arch-x86/syscalls/mkdir.S25
-rw-r--r--libc/arch-x86/syscalls/mknodat.S (renamed from libc/arch-x86/syscalls/readlink.S)15
-rw-r--r--libc/arch-x86/syscalls/readlinkat.S (renamed from libc/arch-x86/syscalls/chown.S)15
-rw-r--r--libc/arch-x86/syscalls/rename.S25
-rw-r--r--libc/arch-x86/syscalls/rmdir.S22
-rw-r--r--libc/arch-x86/syscalls/stat.S25
-rw-r--r--libc/arch-x86/syscalls/symlink.S25
-rw-r--r--libc/arch-x86/syscalls/symlinkat.S (renamed from libc/arch-x86/syscalls/mknod.S)6
-rw-r--r--libc/arch-x86/syscalls/unlink.S22
-rw-r--r--libc/arch-x86/syscalls/utimes.S25
-rw-r--r--libc/arch-x86_64/syscalls.mk21
-rw-r--r--libc/arch-x86_64/syscalls/fstatat.S (renamed from libc/arch-x86_64/syscalls/access.S)7
-rw-r--r--libc/arch-x86_64/syscalls/lchown.S18
-rw-r--r--libc/arch-x86_64/syscalls/link.S18
-rw-r--r--libc/arch-x86_64/syscalls/linkat.S (renamed from libc/arch-x86_64/syscalls/chmod.S)7
-rw-r--r--libc/arch-x86_64/syscalls/lstat.S18
-rw-r--r--libc/arch-x86_64/syscalls/mkdir.S18
-rw-r--r--libc/arch-x86_64/syscalls/mknod.S18
-rw-r--r--libc/arch-x86_64/syscalls/mknodat.S (renamed from libc/arch-x86_64/syscalls/chown.S)7
-rw-r--r--libc/arch-x86_64/syscalls/readlink.S18
-rw-r--r--libc/arch-x86_64/syscalls/readlinkat.S19
-rw-r--r--libc/arch-x86_64/syscalls/rename.S18
-rw-r--r--libc/arch-x86_64/syscalls/rmdir.S18
-rw-r--r--libc/arch-x86_64/syscalls/stat.S18
-rw-r--r--libc/arch-x86_64/syscalls/symlink.S18
-rw-r--r--libc/arch-x86_64/syscalls/symlinkat.S (renamed from libc/arch-x86_64/syscalls/__open.S)6
-rw-r--r--libc/arch-x86_64/syscalls/unlink.S18
-rw-r--r--libc/arch-x86_64/syscalls/utimes.S18
-rw-r--r--libc/bionic/access.cpp (renamed from libc/bionic/open.c)35
-rw-r--r--libc/bionic/chmod.cpp35
-rw-r--r--libc/bionic/chown.cpp35
-rw-r--r--libc/bionic/lchown.cpp35
-rw-r--r--libc/bionic/link.cpp34
-rw-r--r--libc/bionic/lstat.cpp36
-rw-r--r--libc/bionic/mkdir.cpp35
-rw-r--r--libc/bionic/mknod.cpp36
-rw-r--r--libc/bionic/open.cpp (renamed from libc/bionic/openat.c)31
-rw-r--r--libc/bionic/readlink.cpp35
-rw-r--r--libc/bionic/rename.cpp34
-rw-r--r--libc/bionic/rmdir.cpp34
-rw-r--r--libc/bionic/stat.cpp36
-rw-r--r--libc/bionic/symlink.cpp34
-rw-r--r--libc/bionic/unlink.cpp34
-rw-r--r--libc/bionic/utimes.cpp50
-rw-r--r--libc/include/stdio.h3
-rw-r--r--libc/include/sys/stat.h9
-rw-r--r--libc/include/unistd.h17
-rw-r--r--tests/Android.mk1
-rw-r--r--tests/sys_time_test.cpp40
89 files changed, 748 insertions, 1117 deletions
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 @@ libc_common_src_files := \
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_common_src_files += \
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 @@ libc_bionic_src_files := \
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 @@ libc_bionic_src_files := \
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 @@ libc_bionic_src_files := \
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 wait4(pid_t pid, int* status, int options, struct rusage* rusage) all
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 read(int, void*, size_t) all
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 @@ void sync(void) all
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 truncate64(const char*, off64_t) arm,mips,x86
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_settime:timer_settime(timer_t, int, const struct itimerspe
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/__waitid.S
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/inotify_rm_watch.S
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/pread64.S
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/sigaltstack.S
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/truncate64.S
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/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/lchown.S b/libc/arch-arm/syscalls/linkat.S
index 91b7cf5..e990ce1 100644
--- a/libc/arch-arm/syscalls/lchown.S
+++ b/libc/arch-arm/syscalls/linkat.S
@@ -4,13 +4,16 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(lchown)
- mov ip, r7
- ldr r7, =__NR_lchown32
+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
- mov r7, ip
+ ldmfd sp!, {r4, r5, r6, r7}
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(lchown)
+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/access.S b/libc/arch-arm/syscalls/mknodat.S
index 730be2a..4a64eea 100644
--- a/libc/arch-arm/syscalls/access.S
+++ b/libc/arch-arm/syscalls/mknodat.S
@@ -4,13 +4,13 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(access)
+ENTRY(mknodat)
mov ip, r7
- ldr r7, =__NR_access
+ ldr r7, =__NR_mknodat
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(access)
+END(mknodat)
diff --git a/libc/arch-arm/syscalls/readlink.S b/libc/arch-arm/syscalls/readlink.S
deleted file mode 100644
index 41fd457..0000000
--- a/libc/arch-arm/syscalls/readlink.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(readlink)
- mov ip, r7
- ldr r7, =__NR_readlink
- swi #0
- mov r7, ip
- cmn r0, #(MAX_ERRNO + 1)
- bxls lr
- neg r0, r0
- b __set_errno
-END(readlink)
diff --git a/libc/arch-arm/syscalls/chown.S b/libc/arch-arm/syscalls/readlinkat.S
index 1ef51b4..3d85e56 100644
--- a/libc/arch-arm/syscalls/chown.S
+++ b/libc/arch-arm/syscalls/readlinkat.S
@@ -4,13 +4,13 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chown)
+ENTRY(readlinkat)
mov ip, r7
- ldr r7, =__NR_chown32
+ ldr r7, =__NR_readlinkat
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(chown)
+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/chmod.S b/libc/arch-arm/syscalls/symlinkat.S
index 3491ff2..fb51f19 100644
--- a/libc/arch-arm/syscalls/chmod.S
+++ b/libc/arch-arm/syscalls/symlinkat.S
@@ -4,13 +4,13 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chmod)
+ENTRY(symlinkat)
mov ip, r7
- ldr r7, =__NR_chmod
+ ldr r7, =__NR_symlinkat
swi #0
mov r7, ip
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
-END(chmod)
+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/_exit_thread.S
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_get.S
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/pread64.S
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/sigaltstack.S
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/truncate64.S
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/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
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 @@ access:
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/chmod.S b/libc/arch-mips/syscalls/mknodat.S
index dd5a1f2..fc05bb3 100644
--- a/libc/arch-mips/syscalls/chmod.S
+++ b/libc/arch-mips/syscalls/mknodat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl chmod
+ .globl mknodat
.align 4
- .ent chmod
+ .ent mknodat
-chmod:
+mknodat:
.set noreorder
.cpload $t9
- li $v0, __NR_chmod
+ li $v0, __NR_mknodat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@ chmod:
j $t9
nop
.set reorder
- .end chmod
+ .end mknodat
diff --git a/libc/arch-mips/syscalls/readlink.S b/libc/arch-mips/syscalls/readlink.S
deleted file mode 100644
index adaf7fa..0000000
--- a/libc/arch-mips/syscalls/readlink.S
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <asm/unistd.h>
- .text
- .globl readlink
- .align 4
- .ent readlink
-
-readlink:
- .set noreorder
- .cpload $t9
- li $v0, __NR_readlink
- syscall
- bnez $a3, 1f
- move $a0, $v0
- j $ra
- nop
-1:
- la $t9,__set_errno
- j $t9
- nop
- .set reorder
- .end readlink
diff --git a/libc/arch-mips/syscalls/lchown.S b/libc/arch-mips/syscalls/readlinkat.S
index f23aa6a..3e5d72f 100644
--- a/libc/arch-mips/syscalls/lchown.S
+++ b/libc/arch-mips/syscalls/readlinkat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl lchown
+ .globl readlinkat
.align 4
- .ent lchown
+ .ent readlinkat
-lchown:
+readlinkat:
.set noreorder
.cpload $t9
- li $v0, __NR_lchown
+ li $v0, __NR_readlinkat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@ lchown:
j $t9
nop
.set reorder
- .end lchown
+ .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/chown.S b/libc/arch-mips/syscalls/symlinkat.S
index afe807d..9c43241 100644
--- a/libc/arch-mips/syscalls/chown.S
+++ b/libc/arch-mips/syscalls/symlinkat.S
@@ -2,14 +2,14 @@
#include <asm/unistd.h>
.text
- .globl chown
+ .globl symlinkat
.align 4
- .ent chown
+ .ent symlinkat
-chown:
+symlinkat:
.set noreorder
.cpload $t9
- li $v0, __NR_chown
+ li $v0, __NR_symlinkat
syscall
bnez $a3, 1f
move $a0, $v0
@@ -20,4 +20,4 @@ chown:
j $t9
nop
.set reorder
- .end chown
+ .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.S
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_get.S
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/pread64.S
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/sigaltstack.S
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/truncate64.S
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/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/lchown.S b/libc/arch-x86/syscalls/linkat.S
index 7f4589a..652f346 100644
--- a/libc/arch-x86/syscalls/lchown.S
+++ b/libc/arch-x86/syscalls/linkat.S
@@ -4,14 +4,18 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(lchown)
+ENTRY(linkat)
pushl %ebx
pushl %ecx
pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_lchown32, %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 @@ ENTRY(lchown)
addl $4, %esp
orl $-1, %eax
1:
+ popl %edi
+ popl %esi
popl %edx
popl %ecx
popl %ebx
ret
-END(lchown)
+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/readlink.S b/libc/arch-x86/syscalls/mknodat.S
index 4a279dc..8e53940 100644
--- a/libc/arch-x86/syscalls/readlink.S
+++ b/libc/arch-x86/syscalls/mknodat.S
@@ -4,14 +4,16 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(readlink)
+ENTRY(mknodat)
pushl %ebx
pushl %ecx
pushl %edx
- mov 16(%esp), %ebx
- mov 20(%esp), %ecx
- mov 24(%esp), %edx
- movl $__NR_readlink, %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 @@ ENTRY(readlink)
addl $4, %esp
orl $-1, %eax
1:
+ popl %esi
popl %edx
popl %ecx
popl %ebx
ret
-END(readlink)
+END(mknodat)
diff --git a/libc/arch-x86/syscalls/chown.S b/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 @@ ENTRY(chown)
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/mknod.S b/libc/arch-x86/syscalls/symlinkat.S
index e270384..7d24226 100644
--- a/libc/arch-x86/syscalls/mknod.S
+++ b/libc/arch-x86/syscalls/symlinkat.S
@@ -4,14 +4,14 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(mknod)
+ENTRY(symlinkat)
pushl %ebx
pushl %ecx
pushl %edx
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
- movl $__NR_mknod, %eax
+ movl $__NR_symlinkat, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax
jb 1f
@@ -25,4 +25,4 @@ ENTRY(mknod)
popl %ecx
popl %ebx
ret
-END(mknod)
+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/__getcpu.S
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/__waitid.S
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/flock.S
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_get.S
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/pread64.S
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/sigaltstack.S
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/truncate.S
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/access.S b/libc/arch-x86_64/syscalls/fstatat.S
index 81fd734..577660f 100644
--- a/libc/arch-x86_64/syscalls/access.S
+++ b/libc/arch-x86_64/syscalls/fstatat.S
@@ -4,8 +4,9 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(access)
- movl $__NR_access, %eax
+ENTRY(fstatat)
+ movq %rcx, %r10
+ movl $__NR_newfstatat, %eax
syscall
cmpq $-MAX_ERRNO, %rax
jb 1f
@@ -15,4 +16,4 @@ ENTRY(access)
orq $-1, %rax
1:
ret
-END(access)
+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
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 @@ ENTRY(chmod)
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/chown.S b/libc/arch-x86_64/syscalls/mknodat.S
index a587c05..92dbb5b 100644
--- a/libc/arch-x86_64/syscalls/chown.S
+++ b/libc/arch-x86_64/syscalls/mknodat.S
@@ -4,8 +4,9 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(chown)
- movl $__NR_chown, %eax
+ENTRY(mknodat)
+ movq %rcx, %r10
+ movl $__NR_mknodat, %eax
syscall
cmpq $-MAX_ERRNO, %rax
jb 1f
@@ -15,4 +16,4 @@ ENTRY(chown)
orq $-1, %rax
1:
ret
-END(chown)
+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/readlinkat.S b/libc/arch-x86_64/syscalls/readlinkat.S
new file mode 100644
index 0000000..209e4e9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readlinkat.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(readlinkat)
+ movq %rcx, %r10
+ movl $__NR_readlinkat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+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/__open.S b/libc/arch-x86_64/syscalls/symlinkat.S
index a52235a..3da76f2 100644
--- a/libc/arch-x86_64/syscalls/__open.S
+++ b/libc/arch-x86_64/syscalls/symlinkat.S
@@ -4,8 +4,8 @@
#include <linux/err.h>
#include <machine/asm.h>
-ENTRY(__open)
- movl $__NR_open, %eax
+ENTRY(symlinkat)
+ movl $__NR_symlinkat, %eax
syscall
cmpq $-MAX_ERRNO, %rax
jb 1f
@@ -15,4 +15,4 @@ ENTRY(__open)
orq $-1, %rax
1:
ret
-END(__open)
+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
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"
-
-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;
+#include <fcntl.h>
+#include <unistd.h>
- return __open(pathname, flags, 0);
+int access(const char* path, int mode) {
+ return faccessat(AT_FDCWD, path, mode, 0);
}
diff --git a/libc/bionic/chmod.cpp b/libc/bionic/chmod.cpp
new file mode 100644
index 0000000..d988f48
--- /dev/null
+++ b/libc/bionic/chmod.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int chmod(const char* path, mode_t mode) {
+ return fchmodat(AT_FDCWD, path, mode, 0);
+}
diff --git a/libc/bionic/chown.cpp b/libc/bionic/chown.cpp
new file mode 100644
index 0000000..bc2e605
--- /dev/null
+++ b/libc/bionic/chown.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int chown(const char* path, uid_t uid, gid_t gid) {
+ return fchownat(AT_FDCWD, path, uid, gid, 0);
+}
diff --git a/libc/bionic/lchown.cpp b/libc/bionic/lchown.cpp
new file mode 100644
index 0000000..95251db
--- /dev/null
+++ b/libc/bionic/lchown.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+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/link.cpp b/libc/bionic/link.cpp
new file mode 100644
index 0000000..65ad374
--- /dev/null
+++ b/libc/bionic/link.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <unistd.h>
+
+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/lstat.cpp b/libc/bionic/lstat.cpp
new file mode 100644
index 0000000..300d7fa
--- /dev/null
+++ b/libc/bionic/lstat.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+int lstat(const char* path, struct stat* sb) {
+ return fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW);
+}
diff --git a/libc/bionic/mkdir.cpp b/libc/bionic/mkdir.cpp
new file mode 100644
index 0000000..90dc761
--- /dev/null
+++ b/libc/bionic/mkdir.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int mkdir(const char* path, mode_t mode) {
+ return mkdirat(AT_FDCWD, path, mode);
+}
diff --git a/libc/bionic/mknod.cpp b/libc/bionic/mknod.cpp
new file mode 100644
index 0000000..68d4309
--- /dev/null
+++ b/libc/bionic/mknod.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+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
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/readlink.cpp b/libc/bionic/readlink.cpp
new file mode 100644
index 0000000..a2c5e91
--- /dev/null
+++ b/libc/bionic/readlink.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+ssize_t readlink(const char* path, char* buf, size_t size) {
+ return readlinkat(AT_FDCWD, path, buf, size);
+}
diff --git a/libc/bionic/rename.cpp b/libc/bionic/rename.cpp
new file mode 100644
index 0000000..8295559
--- /dev/null
+++ b/libc/bionic/rename.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <stdio.h>
+
+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/rmdir.cpp b/libc/bionic/rmdir.cpp
new file mode 100644
index 0000000..e7a9808
--- /dev/null
+++ b/libc/bionic/rmdir.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <unistd.h>
+
+int rmdir(const char* path) {
+ return unlinkat(AT_FDCWD, path, AT_REMOVEDIR);
+}
diff --git a/libc/bionic/stat.cpp b/libc/bionic/stat.cpp
new file mode 100644
index 0000000..62387c5
--- /dev/null
+++ b/libc/bionic/stat.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+int stat(const char* path, struct stat* sb) {
+ return fstatat(AT_FDCWD, path, sb, 0);
+}
diff --git a/libc/bionic/symlink.cpp b/libc/bionic/symlink.cpp
new file mode 100644
index 0000000..83cda47
--- /dev/null
+++ b/libc/bionic/symlink.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <unistd.h>
+
+int symlink(const char* old_path, const char* new_path) {
+ return symlinkat(old_path, AT_FDCWD, new_path);
+}
diff --git a/libc/bionic/unlink.cpp b/libc/bionic/unlink.cpp
new file mode 100644
index 0000000..b1ab15c
--- /dev/null
+++ b/libc/bionic/unlink.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <unistd.h>
+
+int unlink(const char* path) {
+ return unlinkat(AT_FDCWD, path, 0);
+}
diff --git a/libc/bionic/utimes.cpp b/libc/bionic/utimes.cpp
new file mode 100644
index 0000000..315765a
--- /dev/null
+++ b/libc/bionic/utimes.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+int utimes(const char* path, const timeval tv[2]) {
+ timespec ts[2];
+
+ // Whole seconds can just be copied.
+ ts[0].tv_sec = tv[0].tv_sec;
+ ts[1].tv_sec = tv[1].tv_sec;
+
+ // 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 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 @@ int vsprintf(char * __restrict, const char * __restrict,
__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 @@ mode_t umask(mode_t mode) {
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 @@ extern void endusershell(void);
#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 pipe(int *);
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);
diff --git a/tests/Android.mk b/tests/Android.mk
index 59e5129..5bcf996 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -84,6 +84,7 @@ test_src_files = \
sys_select_test.cpp \
sys_sendfile_test.cpp \
sys_stat_test.cpp \
+ sys_time_test.cpp \
system_properties_test.cpp \
time_test.cpp \
unistd_test.cpp \
diff --git a/tests/sys_time_test.cpp b/tests/sys_time_test.cpp
new file mode 100644
index 0000000..186aa16
--- /dev/null
+++ b/tests/sys_time_test.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <errno.h>
+#include <sys/time.h>
+
+TEST(sys_time, utimes) {
+ timeval tv[2];
+ memset(&tv, 0, sizeof(tv));
+
+ tv[0].tv_usec = -123;
+ ASSERT_EQ(-1, utimes("/", tv));
+ ASSERT_EQ(EINVAL, errno);
+ tv[0].tv_usec = 1234567;
+ ASSERT_EQ(-1, utimes("/", tv));
+ ASSERT_EQ(EINVAL, errno);
+ tv[0].tv_usec = 0;
+
+ tv[1].tv_usec = -123;
+ ASSERT_EQ(-1, utimes("/", tv));
+ ASSERT_EQ(EINVAL, errno);
+ tv[1].tv_usec = 1234567;
+ ASSERT_EQ(-1, utimes("/", tv));
+ ASSERT_EQ(EINVAL, errno);
+}