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
This commit is contained in:
Stephen Smalley 2012-01-13 07:45:16 -05:00
parent e30e909363
commit 5eb686d105
43 changed files with 1062 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

56
libc/include/sys/xattr.h Normal file
View File

@ -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_ */