Add extended attribute (xattr) system call wrappers to bionic.
The xattr system calls are required for the SE Android userspace in
order to get and set file security contexts. In particular, libselinux
requires these calls.
Change-Id: I78f5eb3d8f3384aed0a5e7c6a6f001781d982017
diff --git a/libc/arch-sh/syscalls/fgetxattr.S b/libc/arch-sh/syscalls/fgetxattr.S
new file mode 100644
index 0000000..49b43de
--- /dev/null
+++ b/libc/arch-sh/syscalls/fgetxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type fgetxattr, @function
+ .globl fgetxattr
+ .align 4
+
+fgetxattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(4 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_fgetxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_fgetxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_fgetxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/flistxattr.S b/libc/arch-sh/syscalls/flistxattr.S
new file mode 100644
index 0000000..9b91424
--- /dev/null
+++ b/libc/arch-sh/syscalls/flistxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type flistxattr, @function
+ .globl flistxattr
+ .align 4
+
+flistxattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(3 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_flistxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_flistxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_flistxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fremovexattr.S b/libc/arch-sh/syscalls/fremovexattr.S
new file mode 100644
index 0000000..b6ebc8e
--- /dev/null
+++ b/libc/arch-sh/syscalls/fremovexattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type fremovexattr, @function
+ .globl fremovexattr
+ .align 4
+
+fremovexattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(2 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_fremovexattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_fremovexattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_fremovexattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fsetxattr.S b/libc/arch-sh/syscalls/fsetxattr.S
new file mode 100644
index 0000000..7e0681a
--- /dev/null
+++ b/libc/arch-sh/syscalls/fsetxattr.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type fsetxattr, @function
+ .globl fsetxattr
+ .align 4
+
+fsetxattr:
+
+ /* get ready for additonal arg */
+ mov.l @r15, r0
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(5 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_fsetxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_fsetxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_fsetxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getxattr.S b/libc/arch-sh/syscalls/getxattr.S
new file mode 100644
index 0000000..7d16c21
--- /dev/null
+++ b/libc/arch-sh/syscalls/getxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type getxattr, @function
+ .globl getxattr
+ .align 4
+
+getxattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(4 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_getxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_getxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_getxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/lgetxattr.S b/libc/arch-sh/syscalls/lgetxattr.S
new file mode 100644
index 0000000..d0c5014
--- /dev/null
+++ b/libc/arch-sh/syscalls/lgetxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type lgetxattr, @function
+ .globl lgetxattr
+ .align 4
+
+lgetxattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(4 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_lgetxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_lgetxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_lgetxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/listxattr.S b/libc/arch-sh/syscalls/listxattr.S
new file mode 100644
index 0000000..f2817a5
--- /dev/null
+++ b/libc/arch-sh/syscalls/listxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type listxattr, @function
+ .globl listxattr
+ .align 4
+
+listxattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(3 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_listxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_listxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_listxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/llistxattr.S b/libc/arch-sh/syscalls/llistxattr.S
new file mode 100644
index 0000000..877c15e
--- /dev/null
+++ b/libc/arch-sh/syscalls/llistxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type llistxattr, @function
+ .globl llistxattr
+ .align 4
+
+llistxattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(3 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_llistxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_llistxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_llistxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/lremovexattr.S b/libc/arch-sh/syscalls/lremovexattr.S
new file mode 100644
index 0000000..d7aa8b9
--- /dev/null
+++ b/libc/arch-sh/syscalls/lremovexattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type lremovexattr, @function
+ .globl lremovexattr
+ .align 4
+
+lremovexattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(2 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_lremovexattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_lremovexattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_lremovexattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/lsetxattr.S b/libc/arch-sh/syscalls/lsetxattr.S
new file mode 100644
index 0000000..0cc4c9d
--- /dev/null
+++ b/libc/arch-sh/syscalls/lsetxattr.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type lsetxattr, @function
+ .globl lsetxattr
+ .align 4
+
+lsetxattr:
+
+ /* get ready for additonal arg */
+ mov.l @r15, r0
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(5 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_lsetxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_lsetxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_lsetxattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/removexattr.S b/libc/arch-sh/syscalls/removexattr.S
new file mode 100644
index 0000000..ea71743
--- /dev/null
+++ b/libc/arch-sh/syscalls/removexattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type removexattr, @function
+ .globl removexattr
+ .align 4
+
+removexattr:
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(2 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_removexattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_removexattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_removexattr
+1: .long __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setxattr.S b/libc/arch-sh/syscalls/setxattr.S
new file mode 100644
index 0000000..abef6b6
--- /dev/null
+++ b/libc/arch-sh/syscalls/setxattr.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type setxattr, @function
+ .globl setxattr
+ .align 4
+
+setxattr:
+
+ /* get ready for additonal arg */
+ mov.l @r15, r0
+
+ /* invoke trap */
+ mov.l 0f, r3 /* trap num */
+ trapa #(5 + 0x10)
+
+ /* check return value */
+ cmp/pz r0
+ bt __NR_setxattr_end
+
+ /* keep error number */
+ sts.l pr, @-r15
+ mov.l 1f, r1
+ jsr @r1
+ mov r0, r4
+ lds.l @r15+, pr
+
+__NR_setxattr_end:
+ rts
+ nop
+
+ .align 2
+0: .long __NR_setxattr
+1: .long __set_syscall_errno