am ec40edc9: Merge "Move away from the __ARCH_WANT_SYSCALL_NO_AT system calls."

* commit 'ec40edc9188aebe5207e47c0a66e89e1ed368bd6':
  Move away from the __ARCH_WANT_SYSCALL_NO_AT system calls.
This commit is contained in:
Elliott Hughes 2013-10-22 16:34:20 -07:00 committed by Android Git Automerger
commit 1dbf56aab5
89 changed files with 748 additions and 1117 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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);
}

35
libc/bionic/chmod.cpp Normal file
View File

@ -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);
}

35
libc/bionic/chown.cpp Normal file
View File

@ -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);
}

35
libc/bionic/lchown.cpp Normal file
View File

@ -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);
}

34
libc/bionic/link.cpp Normal file
View File

@ -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);
}

36
libc/bionic/lstat.cpp Normal file
View File

@ -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);
}

35
libc/bionic/mkdir.cpp Normal file
View File

@ -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);
}

36
libc/bionic/mknod.cpp Normal file
View File

@ -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);
}

View File

@ -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;

35
libc/bionic/readlink.cpp Normal file
View File

@ -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);
}

34
libc/bionic/rename.cpp Normal file
View File

@ -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);
}

34
libc/bionic/rmdir.cpp Normal file
View File

@ -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);
}

36
libc/bionic/stat.cpp Normal file
View File

@ -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);
}

34
libc/bionic/symlink.cpp Normal file
View File

@ -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);
}

34
libc/bionic/unlink.cpp Normal file
View File

@ -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);
}

50
libc/bionic/utimes.cpp Normal file
View File

@ -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);
}

View File

@ -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 *);

View File

@ -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)

View File

@ -107,7 +107,9 @@ extern void endusershell(void);
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 *);
@ -117,9 +119,12 @@ 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 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);

View File

@ -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 \

40
tests/sys_time_test.cpp Normal file
View File

@ -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);
}