Add faccessat to syscall list
Change-Id: I427a18811089cb280769ac8da3ed8adc00a65a10
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 14b990d..a9bd4fd 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -160,6 +160,7 @@
int rename(const char *, const char *) 38
int __getcwd:getcwd(char * buf, size_t size) 183
int access(const char *, int) 33
+int faccessat(int, const char *, int, int) 334,307
int symlink(const char *, const char *) 83
int fchdir(int) 133
int truncate(const char*, off_t) 92
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index 61a37d5..e635e68 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -108,6 +108,7 @@
syscall_src += arch-arm/syscalls/rename.S
syscall_src += arch-arm/syscalls/__getcwd.S
syscall_src += arch-arm/syscalls/access.S
+syscall_src += arch-arm/syscalls/faccessat.S
syscall_src += arch-arm/syscalls/symlink.S
syscall_src += arch-arm/syscalls/fchdir.S
syscall_src += arch-arm/syscalls/truncate.S
diff --git a/libc/arch-arm/syscalls/faccessat.S b/libc/arch-arm/syscalls/faccessat.S
new file mode 100644
index 0000000..a2f176f
--- /dev/null
+++ b/libc/arch-arm/syscalls/faccessat.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(faccessat)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_faccessat
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(faccessat)
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index d7362f2..f1b7e76 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -112,6 +112,7 @@
syscall_src += arch-x86/syscalls/rename.S
syscall_src += arch-x86/syscalls/__getcwd.S
syscall_src += arch-x86/syscalls/access.S
+syscall_src += arch-x86/syscalls/faccessat.S
syscall_src += arch-x86/syscalls/symlink.S
syscall_src += arch-x86/syscalls/fchdir.S
syscall_src += arch-x86/syscalls/truncate.S
diff --git a/libc/arch-x86/syscalls/faccessat.S b/libc/arch-x86/syscalls/faccessat.S
new file mode 100644
index 0000000..2010e57
--- /dev/null
+++ b/libc/arch-x86/syscalls/faccessat.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type faccessat, @function
+ .globl faccessat
+ .align 4
+
+faccessat:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ pushl %esi
+ mov 20(%esp), %ebx
+ mov 24(%esp), %ecx
+ mov 28(%esp), %edx
+ mov 32(%esp), %esi
+ movl $__NR_faccessat, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index c2c609d..d09e955 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -166,6 +166,7 @@
#define __NR_fchmodat (__NR_SYSCALL_BASE + 333)
#define __NR_renameat (__NR_SYSCALL_BASE + 329)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 328)
+#define __NR_faccessat (__NR_SYSCALL_BASE + 334)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 266)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 263)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 262)
@@ -227,6 +228,7 @@
#define __NR_fchmodat (__NR_SYSCALL_BASE + 306)
#define __NR_renameat (__NR_SYSCALL_BASE + 302)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 301)
+#define __NR_faccessat (__NR_SYSCALL_BASE + 307)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 268)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 265)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 264)
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index d92549f..d8263fe 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -107,6 +107,7 @@
#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 chdir(const char *);