summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2012-01-13 07:45:16 -0500
committerStephen Smalley <sds@tycho.nsa.gov>2012-01-18 08:02:23 -0500
commit5eb686d105ebd7cea332fd1ef0bb3af9386e19f7 (patch)
tree3df9e137dcdcc8b78cb9ca78aee8c5de50316e87
parente30e909363c5c706f394050d9cd00ce222caadbf (diff)
downloadbionic-5eb686d105ebd7cea332fd1ef0bb3af9386e19f7.zip
bionic-5eb686d105ebd7cea332fd1ef0bb3af9386e19f7.tar.gz
bionic-5eb686d105ebd7cea332fd1ef0bb3af9386e19f7.tar.bz2
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
-rw-r--r--libc/SYSCALLS.TXT13
-rw-r--r--libc/arch-arm/syscalls.mk12
-rw-r--r--libc/arch-arm/syscalls/fgetxattr.S14
-rw-r--r--libc/arch-arm/syscalls/flistxattr.S14
-rw-r--r--libc/arch-arm/syscalls/fremovexattr.S14
-rw-r--r--libc/arch-arm/syscalls/fsetxattr.S16
-rw-r--r--libc/arch-arm/syscalls/getxattr.S14
-rw-r--r--libc/arch-arm/syscalls/lgetxattr.S14
-rw-r--r--libc/arch-arm/syscalls/listxattr.S14
-rw-r--r--libc/arch-arm/syscalls/llistxattr.S14
-rw-r--r--libc/arch-arm/syscalls/lremovexattr.S14
-rw-r--r--libc/arch-arm/syscalls/lsetxattr.S16
-rw-r--r--libc/arch-arm/syscalls/removexattr.S14
-rw-r--r--libc/arch-arm/syscalls/setxattr.S16
-rw-r--r--libc/arch-sh/syscalls.mk12
-rw-r--r--libc/arch-sh/syscalls/fgetxattr.S32
-rw-r--r--libc/arch-sh/syscalls/flistxattr.S32
-rw-r--r--libc/arch-sh/syscalls/fremovexattr.S32
-rw-r--r--libc/arch-sh/syscalls/fsetxattr.S35
-rw-r--r--libc/arch-sh/syscalls/getxattr.S32
-rw-r--r--libc/arch-sh/syscalls/lgetxattr.S32
-rw-r--r--libc/arch-sh/syscalls/listxattr.S32
-rw-r--r--libc/arch-sh/syscalls/llistxattr.S32
-rw-r--r--libc/arch-sh/syscalls/lremovexattr.S32
-rw-r--r--libc/arch-sh/syscalls/lsetxattr.S35
-rw-r--r--libc/arch-sh/syscalls/removexattr.S32
-rw-r--r--libc/arch-sh/syscalls/setxattr.S35
-rw-r--r--libc/arch-x86/syscalls.mk12
-rw-r--r--libc/arch-x86/syscalls/fgetxattr.S32
-rw-r--r--libc/arch-x86/syscalls/flistxattr.S29
-rw-r--r--libc/arch-x86/syscalls/fremovexattr.S26
-rw-r--r--libc/arch-x86/syscalls/fsetxattr.S35
-rw-r--r--libc/arch-x86/syscalls/getxattr.S32
-rw-r--r--libc/arch-x86/syscalls/lgetxattr.S32
-rw-r--r--libc/arch-x86/syscalls/listxattr.S29
-rw-r--r--libc/arch-x86/syscalls/llistxattr.S29
-rw-r--r--libc/arch-x86/syscalls/lremovexattr.S26
-rw-r--r--libc/arch-x86/syscalls/lsetxattr.S35
-rw-r--r--libc/arch-x86/syscalls/removexattr.S26
-rw-r--r--libc/arch-x86/syscalls/setxattr.S35
-rw-r--r--libc/include/sys/linux-syscalls.h12
-rw-r--r--libc/include/sys/linux-unistd.h12
-rw-r--r--libc/include/sys/xattr.h56
43 files changed, 1062 insertions, 0 deletions
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 5c1e36e..fc5f808 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -133,6 +133,10 @@ int mkdirat(int dirfd, const char *pathname, mode_t mode) 323,296
int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags) 325,298
int fchmodat(int dirfd, const char *path, mode_t mode, int flags) 333,306
int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) 329,302
+int fsetxattr(int, const char *, const void *, size_t, int) 228
+ssize_t fgetxattr(int, const char *, void *, size_t) 231
+ssize_t flistxattr(int, char *, size_t) 234
+int fremovexattr(int, const char *) 237
# file system
int link (const char*, const char*) 9
@@ -158,7 +162,16 @@ int access(const char *, int) 33
int symlink(const char *, const char *) 83
int fchdir(int) 133
int truncate(const char*, off_t) 92
+int setxattr(const char *, const char *, const void *, size_t, int) 226
+int lsetxattr(const char *, const char *, const void *, size_t, int) 227
+ssize_t getxattr(const char *, const char *, void *, size_t) 229
+ssize_t lgetxattr(const char *, const char *, void *, size_t) 230
+ssize_t listxattr(const char *, char *, size_t) 232
+ssize_t llistxattr(const char *, char *, size_t) 233
+int removexattr(const char *, const char *) 235
+int lremovexattr(const char *, const char *) 236
int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268
+
# time
int pause () 29
int gettimeofday(struct timeval*, struct timezone*) 78
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index 1f2a1cd..3fce36d 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -85,6 +85,10 @@ syscall_src += arch-arm/syscalls/mkdirat.S
syscall_src += arch-arm/syscalls/fchownat.S
syscall_src += arch-arm/syscalls/fchmodat.S
syscall_src += arch-arm/syscalls/renameat.S
+syscall_src += arch-arm/syscalls/fsetxattr.S
+syscall_src += arch-arm/syscalls/fgetxattr.S
+syscall_src += arch-arm/syscalls/flistxattr.S
+syscall_src += arch-arm/syscalls/fremovexattr.S
syscall_src += arch-arm/syscalls/link.S
syscall_src += arch-arm/syscalls/unlink.S
syscall_src += arch-arm/syscalls/unlinkat.S
@@ -107,6 +111,14 @@ syscall_src += arch-arm/syscalls/access.S
syscall_src += arch-arm/syscalls/symlink.S
syscall_src += arch-arm/syscalls/fchdir.S
syscall_src += arch-arm/syscalls/truncate.S
+syscall_src += arch-arm/syscalls/setxattr.S
+syscall_src += arch-arm/syscalls/lsetxattr.S
+syscall_src += arch-arm/syscalls/getxattr.S
+syscall_src += arch-arm/syscalls/lgetxattr.S
+syscall_src += arch-arm/syscalls/listxattr.S
+syscall_src += arch-arm/syscalls/llistxattr.S
+syscall_src += arch-arm/syscalls/removexattr.S
+syscall_src += arch-arm/syscalls/lremovexattr.S
syscall_src += arch-arm/syscalls/__statfs64.S
syscall_src += arch-arm/syscalls/pause.S
syscall_src += arch-arm/syscalls/gettimeofday.S
diff --git a/libc/arch-arm/syscalls/fgetxattr.S b/libc/arch-arm/syscalls/fgetxattr.S
new file mode 100644
index 0000000..32b8ef8
--- /dev/null
+++ b/libc/arch-arm/syscalls/fgetxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(fgetxattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_fgetxattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(fgetxattr)
diff --git a/libc/arch-arm/syscalls/flistxattr.S b/libc/arch-arm/syscalls/flistxattr.S
new file mode 100644
index 0000000..0785e77
--- /dev/null
+++ b/libc/arch-arm/syscalls/flistxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(flistxattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_flistxattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(flistxattr)
diff --git a/libc/arch-arm/syscalls/fremovexattr.S b/libc/arch-arm/syscalls/fremovexattr.S
new file mode 100644
index 0000000..ae97d13
--- /dev/null
+++ b/libc/arch-arm/syscalls/fremovexattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(fremovexattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_fremovexattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(fremovexattr)
diff --git a/libc/arch-arm/syscalls/fsetxattr.S b/libc/arch-arm/syscalls/fsetxattr.S
new file mode 100644
index 0000000..176cad9
--- /dev/null
+++ b/libc/arch-arm/syscalls/fsetxattr.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(fsetxattr)
+ mov ip, sp
+ .save {r4, r5, r6, r7}
+ stmfd sp!, {r4, r5, r6, r7}
+ ldmfd ip, {r4, r5, r6}
+ ldr r7, =__NR_fsetxattr
+ swi #0
+ ldmfd sp!, {r4, r5, r6, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(fsetxattr)
diff --git a/libc/arch-arm/syscalls/getxattr.S b/libc/arch-arm/syscalls/getxattr.S
new file mode 100644
index 0000000..18532ce
--- /dev/null
+++ b/libc/arch-arm/syscalls/getxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(getxattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_getxattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(getxattr)
diff --git a/libc/arch-arm/syscalls/lgetxattr.S b/libc/arch-arm/syscalls/lgetxattr.S
new file mode 100644
index 0000000..61fc098
--- /dev/null
+++ b/libc/arch-arm/syscalls/lgetxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(lgetxattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_lgetxattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(lgetxattr)
diff --git a/libc/arch-arm/syscalls/listxattr.S b/libc/arch-arm/syscalls/listxattr.S
new file mode 100644
index 0000000..6bbdb6a
--- /dev/null
+++ b/libc/arch-arm/syscalls/listxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(listxattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_listxattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(listxattr)
diff --git a/libc/arch-arm/syscalls/llistxattr.S b/libc/arch-arm/syscalls/llistxattr.S
new file mode 100644
index 0000000..89682df
--- /dev/null
+++ b/libc/arch-arm/syscalls/llistxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(llistxattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_llistxattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(llistxattr)
diff --git a/libc/arch-arm/syscalls/lremovexattr.S b/libc/arch-arm/syscalls/lremovexattr.S
new file mode 100644
index 0000000..62f6722
--- /dev/null
+++ b/libc/arch-arm/syscalls/lremovexattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(lremovexattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_lremovexattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(lremovexattr)
diff --git a/libc/arch-arm/syscalls/lsetxattr.S b/libc/arch-arm/syscalls/lsetxattr.S
new file mode 100644
index 0000000..bde7c24
--- /dev/null
+++ b/libc/arch-arm/syscalls/lsetxattr.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(lsetxattr)
+ mov ip, sp
+ .save {r4, r5, r6, r7}
+ stmfd sp!, {r4, r5, r6, r7}
+ ldmfd ip, {r4, r5, r6}
+ ldr r7, =__NR_lsetxattr
+ swi #0
+ ldmfd sp!, {r4, r5, r6, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(lsetxattr)
diff --git a/libc/arch-arm/syscalls/removexattr.S b/libc/arch-arm/syscalls/removexattr.S
new file mode 100644
index 0000000..1a44caf
--- /dev/null
+++ b/libc/arch-arm/syscalls/removexattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(removexattr)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_removexattr
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(removexattr)
diff --git a/libc/arch-arm/syscalls/setxattr.S b/libc/arch-arm/syscalls/setxattr.S
new file mode 100644
index 0000000..e86fe9f
--- /dev/null
+++ b/libc/arch-arm/syscalls/setxattr.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(setxattr)
+ mov ip, sp
+ .save {r4, r5, r6, r7}
+ stmfd sp!, {r4, r5, r6, r7}
+ ldmfd ip, {r4, r5, r6}
+ ldr r7, =__NR_setxattr
+ swi #0
+ ldmfd sp!, {r4, r5, r6, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(setxattr)
diff --git a/libc/arch-sh/syscalls.mk b/libc/arch-sh/syscalls.mk
index 9970fcf..03ce7fd 100644
--- a/libc/arch-sh/syscalls.mk
+++ b/libc/arch-sh/syscalls.mk
@@ -88,6 +88,10 @@ syscall_src += arch-sh/syscalls/mkdirat.S
syscall_src += arch-sh/syscalls/fchownat.S
syscall_src += arch-sh/syscalls/fchmodat.S
syscall_src += arch-sh/syscalls/renameat.S
+syscall_src += arch-sh/syscalls/fsetxattr.S
+syscall_src += arch-sh/syscalls/fgetxattr.S
+syscall_src += arch-sh/syscalls/flistxattr.S
+syscall_src += arch-sh/syscalls/fremovexattr.S
syscall_src += arch-sh/syscalls/link.S
syscall_src += arch-sh/syscalls/unlink.S
syscall_src += arch-sh/syscalls/unlinkat.S
@@ -110,6 +114,14 @@ syscall_src += arch-sh/syscalls/access.S
syscall_src += arch-sh/syscalls/symlink.S
syscall_src += arch-sh/syscalls/fchdir.S
syscall_src += arch-sh/syscalls/truncate.S
+syscall_src += arch-sh/syscalls/setxattr.S
+syscall_src += arch-sh/syscalls/lsetxattr.S
+syscall_src += arch-sh/syscalls/getxattr.S
+syscall_src += arch-sh/syscalls/lgetxattr.S
+syscall_src += arch-sh/syscalls/listxattr.S
+syscall_src += arch-sh/syscalls/llistxattr.S
+syscall_src += arch-sh/syscalls/removexattr.S
+syscall_src += arch-sh/syscalls/lremovexattr.S
syscall_src += arch-sh/syscalls/__statfs64.S
syscall_src += arch-sh/syscalls/pause.S
syscall_src += arch-sh/syscalls/gettimeofday.S
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
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index 48d1731..2f8cc49 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -88,6 +88,10 @@ syscall_src += arch-x86/syscalls/mkdirat.S
syscall_src += arch-x86/syscalls/fchownat.S
syscall_src += arch-x86/syscalls/fchmodat.S
syscall_src += arch-x86/syscalls/renameat.S
+syscall_src += arch-x86/syscalls/fsetxattr.S
+syscall_src += arch-x86/syscalls/fgetxattr.S
+syscall_src += arch-x86/syscalls/flistxattr.S
+syscall_src += arch-x86/syscalls/fremovexattr.S
syscall_src += arch-x86/syscalls/link.S
syscall_src += arch-x86/syscalls/unlink.S
syscall_src += arch-x86/syscalls/unlinkat.S
@@ -110,6 +114,14 @@ syscall_src += arch-x86/syscalls/access.S
syscall_src += arch-x86/syscalls/symlink.S
syscall_src += arch-x86/syscalls/fchdir.S
syscall_src += arch-x86/syscalls/truncate.S
+syscall_src += arch-x86/syscalls/setxattr.S
+syscall_src += arch-x86/syscalls/lsetxattr.S
+syscall_src += arch-x86/syscalls/getxattr.S
+syscall_src += arch-x86/syscalls/lgetxattr.S
+syscall_src += arch-x86/syscalls/listxattr.S
+syscall_src += arch-x86/syscalls/llistxattr.S
+syscall_src += arch-x86/syscalls/removexattr.S
+syscall_src += arch-x86/syscalls/lremovexattr.S
syscall_src += arch-x86/syscalls/__statfs64.S
syscall_src += arch-x86/syscalls/pause.S
syscall_src += arch-x86/syscalls/gettimeofday.S
diff --git a/libc/arch-x86/syscalls/fgetxattr.S b/libc/arch-x86/syscalls/fgetxattr.S
new file mode 100644
index 0000000..d9f582f
--- /dev/null
+++ b/libc/arch-x86/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:
+ 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_fgetxattr, %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/arch-x86/syscalls/flistxattr.S b/libc/arch-x86/syscalls/flistxattr.S
new file mode 100644
index 0000000..43ff73d
--- /dev/null
+++ b/libc/arch-x86/syscalls/flistxattr.S
@@ -0,0 +1,29 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type flistxattr, @function
+ .globl flistxattr
+ .align 4
+
+flistxattr:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ mov 16(%esp), %ebx
+ mov 20(%esp), %ecx
+ mov 24(%esp), %edx
+ movl $__NR_flistxattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/fremovexattr.S b/libc/arch-x86/syscalls/fremovexattr.S
new file mode 100644
index 0000000..eeed57f
--- /dev/null
+++ b/libc/arch-x86/syscalls/fremovexattr.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type fremovexattr, @function
+ .globl fremovexattr
+ .align 4
+
+fremovexattr:
+ pushl %ebx
+ pushl %ecx
+ mov 12(%esp), %ebx
+ mov 16(%esp), %ecx
+ movl $__NR_fremovexattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/fsetxattr.S b/libc/arch-x86/syscalls/fsetxattr.S
new file mode 100644
index 0000000..a70ca4f
--- /dev/null
+++ b/libc/arch-x86/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:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ 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_fsetxattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %edi
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/getxattr.S b/libc/arch-x86/syscalls/getxattr.S
new file mode 100644
index 0000000..80d2fc4
--- /dev/null
+++ b/libc/arch-x86/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:
+ 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_getxattr, %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/arch-x86/syscalls/lgetxattr.S b/libc/arch-x86/syscalls/lgetxattr.S
new file mode 100644
index 0000000..3f5b63e
--- /dev/null
+++ b/libc/arch-x86/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:
+ 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_lgetxattr, %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/arch-x86/syscalls/listxattr.S b/libc/arch-x86/syscalls/listxattr.S
new file mode 100644
index 0000000..88109bb
--- /dev/null
+++ b/libc/arch-x86/syscalls/listxattr.S
@@ -0,0 +1,29 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type listxattr, @function
+ .globl listxattr
+ .align 4
+
+listxattr:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ mov 16(%esp), %ebx
+ mov 20(%esp), %ecx
+ mov 24(%esp), %edx
+ movl $__NR_listxattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/llistxattr.S b/libc/arch-x86/syscalls/llistxattr.S
new file mode 100644
index 0000000..fa8505c
--- /dev/null
+++ b/libc/arch-x86/syscalls/llistxattr.S
@@ -0,0 +1,29 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type llistxattr, @function
+ .globl llistxattr
+ .align 4
+
+llistxattr:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ mov 16(%esp), %ebx
+ mov 20(%esp), %ecx
+ mov 24(%esp), %edx
+ movl $__NR_llistxattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/lremovexattr.S b/libc/arch-x86/syscalls/lremovexattr.S
new file mode 100644
index 0000000..f6c7afe
--- /dev/null
+++ b/libc/arch-x86/syscalls/lremovexattr.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type lremovexattr, @function
+ .globl lremovexattr
+ .align 4
+
+lremovexattr:
+ pushl %ebx
+ pushl %ecx
+ mov 12(%esp), %ebx
+ mov 16(%esp), %ecx
+ movl $__NR_lremovexattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/lsetxattr.S b/libc/arch-x86/syscalls/lsetxattr.S
new file mode 100644
index 0000000..56c8cf8
--- /dev/null
+++ b/libc/arch-x86/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:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ 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_lsetxattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %edi
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/removexattr.S b/libc/arch-x86/syscalls/removexattr.S
new file mode 100644
index 0000000..2350865
--- /dev/null
+++ b/libc/arch-x86/syscalls/removexattr.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type removexattr, @function
+ .globl removexattr
+ .align 4
+
+removexattr:
+ pushl %ebx
+ pushl %ecx
+ mov 12(%esp), %ebx
+ mov 16(%esp), %ecx
+ movl $__NR_removexattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/arch-x86/syscalls/setxattr.S b/libc/arch-x86/syscalls/setxattr.S
new file mode 100644
index 0000000..38be736
--- /dev/null
+++ b/libc/arch-x86/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:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ 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_setxattr, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %edi
+ 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 2fa5d3a..54f86f8 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -79,6 +79,10 @@
#define __NR_sync (__NR_SYSCALL_BASE + 36)
#define __NR_fcntl64 (__NR_SYSCALL_BASE + 221)
#define __NR_sendfile (__NR_SYSCALL_BASE + 187)
+#define __NR_fsetxattr (__NR_SYSCALL_BASE + 228)
+#define __NR_fgetxattr (__NR_SYSCALL_BASE + 231)
+#define __NR_flistxattr (__NR_SYSCALL_BASE + 234)
+#define __NR_fremovexattr (__NR_SYSCALL_BASE + 237)
#define __NR_link (__NR_SYSCALL_BASE + 9)
#define __NR_unlink (__NR_SYSCALL_BASE + 10)
#define __NR_chdir (__NR_SYSCALL_BASE + 12)
@@ -100,6 +104,14 @@
#define __NR_symlink (__NR_SYSCALL_BASE + 83)
#define __NR_fchdir (__NR_SYSCALL_BASE + 133)
#define __NR_truncate (__NR_SYSCALL_BASE + 92)
+#define __NR_setxattr (__NR_SYSCALL_BASE + 226)
+#define __NR_lsetxattr (__NR_SYSCALL_BASE + 227)
+#define __NR_getxattr (__NR_SYSCALL_BASE + 229)
+#define __NR_lgetxattr (__NR_SYSCALL_BASE + 230)
+#define __NR_listxattr (__NR_SYSCALL_BASE + 232)
+#define __NR_llistxattr (__NR_SYSCALL_BASE + 233)
+#define __NR_removexattr (__NR_SYSCALL_BASE + 235)
+#define __NR_lremovexattr (__NR_SYSCALL_BASE + 236)
#define __NR_pause (__NR_SYSCALL_BASE + 29)
#define __NR_gettimeofday (__NR_SYSCALL_BASE + 78)
#define __NR_settimeofday (__NR_SYSCALL_BASE + 79)
diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h
index f060374..693302d 100644
--- a/libc/include/sys/linux-unistd.h
+++ b/libc/include/sys/linux-unistd.h
@@ -98,6 +98,10 @@ int mkdirat (int dirfd, const char *pathname, mode_t mode);
int fchownat (int dirfd, const char *path, uid_t owner, gid_t group, int flags);
int fchmodat (int dirfd, const char *path, mode_t mode, int flags);
int renameat (int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+int fsetxattr (int, const char *, const void *, size_t, int);
+ssize_t fgetxattr (int, const char *, void *, size_t);
+ssize_t flistxattr (int, char *, size_t);
+int fremovexattr (int, const char *);
int link (const char*, const char*);
int unlink (const char*);
int unlinkat (int, const char *, int);
@@ -121,6 +125,14 @@ int access (const char *, int);
int symlink (const char *, const char *);
int fchdir (int);
int truncate (const char*, off_t);
+int setxattr (const char *, const char *, const void *, size_t, int);
+int lsetxattr (const char *, const char *, const void *, size_t, int);
+ssize_t getxattr (const char *, const char *, void *, size_t);
+ssize_t lgetxattr (const char *, const char *, void *, size_t);
+ssize_t listxattr (const char *, char *, size_t);
+ssize_t llistxattr (const char *, char *, size_t);
+int removexattr (const char *, const char *);
+int lremovexattr (const char *, const char *);
int __statfs64 (const char *, size_t, struct statfs *);
int pause (void);
int gettimeofday (struct timeval*, struct timezone*);
diff --git a/libc/include/sys/xattr.h b/libc/include/sys/xattr.h
new file mode 100644
index 0000000..39b25b1
--- /dev/null
+++ b/libc/include/sys/xattr.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+#ifndef _SYS_XATTR_H_
+#define _SYS_XATTR_H_
+
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+extern int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
+extern int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+extern int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+
+extern ssize_t fgetxattr(int fd, const char *name, void *value, size_t size);
+extern ssize_t getxattr(const char *path, const char *name, void *value, size_t size);
+extern ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size);
+
+extern ssize_t listxattr(const char *path, char *list, size_t size);
+extern ssize_t llistxattr(const char *path, char *list, size_t size);
+extern ssize_t flistxattr(int fd, char *list, size_t size);
+
+extern int removexattr(const char *path, const char *name);
+extern int lremovexattr(const char *path, const char *name);
+extern int fremovexattr(int fd, const char *name);
+
+__END_DECLS
+
+#endif /* _SYS_XATTR_H_ */