From 5467f25f82934d611c60f8bc57a05114f3c1bea0 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 10 Aug 2012 11:17:59 -0700 Subject: [PATCH] Add unshare() syscall. Bug: 6925012 Change-Id: I2530a8f6cea49eb32b60f8f9c4d86963773456ca --- libc/SYSCALLS.TXT | 3 ++- libc/arch-arm/syscalls.mk | 1 + libc/arch-arm/syscalls/unshare.S | 14 ++++++++++++++ libc/arch-mips/syscalls.mk | 1 + libc/arch-mips/syscalls/unshare.S | 22 ++++++++++++++++++++++ libc/arch-x86/syscalls.mk | 1 + libc/arch-x86/syscalls/unshare.S | 23 +++++++++++++++++++++++ libc/include/sys/linux-syscalls.h | 3 +++ 8 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 libc/arch-arm/syscalls/unshare.S create mode 100644 libc/arch-mips/syscalls/unshare.S create mode 100644 libc/arch-x86/syscalls/unshare.S diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index 504a05099..8f78e7f11 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -1,6 +1,6 @@ # this file is used to list all the syscalls that will be supported by # the Bionic C library. It is used to automatically generate the syscall -# stubs, the list of syscall constants (__NR_xxxx) and the content of +# stubs, the list of syscall constants (__NR_xxxx) and the content of # # each non comment line has the following format: # @@ -191,6 +191,7 @@ ssize_t llistxattr(const char *, char *, size_t) 233,233,231 int removexattr(const char *, const char *) 235,235,233 int lremovexattr(const char *, const char *) 236,236,234 int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268,255 +long unshare(unsigned long) 337,310,303 # time int pause () 29 diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk index e635e68aa..b1c669df8 100644 --- a/libc/arch-arm/syscalls.mk +++ b/libc/arch-arm/syscalls.mk @@ -121,6 +121,7 @@ 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/unshare.S syscall_src += arch-arm/syscalls/pause.S syscall_src += arch-arm/syscalls/gettimeofday.S syscall_src += arch-arm/syscalls/settimeofday.S diff --git a/libc/arch-arm/syscalls/unshare.S b/libc/arch-arm/syscalls/unshare.S new file mode 100644 index 000000000..0a92b2105 --- /dev/null +++ b/libc/arch-arm/syscalls/unshare.S @@ -0,0 +1,14 @@ +/* autogenerated by gensyscalls.py */ +#include +#include + +ENTRY(unshare) + .save {r4, r7} + stmfd sp!, {r4, r7} + ldr r7, =__NR_unshare + swi #0 + ldmfd sp!, {r4, r7} + movs r0, r0 + bxpl lr + b __set_syscall_errno +END(unshare) diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk index 8c0c4dccb..6de0c8fb0 100644 --- a/libc/arch-mips/syscalls.mk +++ b/libc/arch-mips/syscalls.mk @@ -124,6 +124,7 @@ syscall_src += arch-mips/syscalls/llistxattr.S syscall_src += arch-mips/syscalls/removexattr.S syscall_src += arch-mips/syscalls/lremovexattr.S syscall_src += arch-mips/syscalls/__statfs64.S +syscall_src += arch-mips/syscalls/unshare.S syscall_src += arch-mips/syscalls/pause.S syscall_src += arch-mips/syscalls/gettimeofday.S syscall_src += arch-mips/syscalls/settimeofday.S diff --git a/libc/arch-mips/syscalls/unshare.S b/libc/arch-mips/syscalls/unshare.S new file mode 100644 index 000000000..11af3545f --- /dev/null +++ b/libc/arch-mips/syscalls/unshare.S @@ -0,0 +1,22 @@ +/* autogenerated by gensyscalls.py */ +#include + .text + .globl unshare + .align 4 + .ent unshare + +unshare: + .set noreorder + .cpload $t9 + li $v0, __NR_unshare + syscall + bnez $a3, 1f + move $a0, $v0 + j $ra + nop +1: + la $t9,__set_errno + j $t9 + nop + .set reorder + .end unshare diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk index f1b7e7608..235222160 100644 --- a/libc/arch-x86/syscalls.mk +++ b/libc/arch-x86/syscalls.mk @@ -125,6 +125,7 @@ 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/unshare.S syscall_src += arch-x86/syscalls/pause.S syscall_src += arch-x86/syscalls/gettimeofday.S syscall_src += arch-x86/syscalls/settimeofday.S diff --git a/libc/arch-x86/syscalls/unshare.S b/libc/arch-x86/syscalls/unshare.S new file mode 100644 index 000000000..ef31a3574 --- /dev/null +++ b/libc/arch-x86/syscalls/unshare.S @@ -0,0 +1,23 @@ +/* autogenerated by gensyscalls.py */ +#include + + .text + .type unshare, @function + .globl unshare + .align 4 + +unshare: + pushl %ebx + mov 8(%esp), %ebx + movl $__NR_unshare, %eax + int $0x80 + cmpl $-129, %eax + jb 1f + negl %eax + pushl %eax + call __set_errno + addl $4, %esp + orl $-1, %eax +1: + popl %ebx + ret diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h index c8a654ca8..c33dc9fa3 100644 --- a/libc/include/sys/linux-syscalls.h +++ b/libc/include/sys/linux-syscalls.h @@ -155,6 +155,7 @@ #define __NR_removexattr (__NR_SYSCALL_BASE + 235) #define __NR_lremovexattr (__NR_SYSCALL_BASE + 236) #define __NR_statfs64 (__NR_SYSCALL_BASE + 266) +#define __NR_unshare (__NR_SYSCALL_BASE + 337) #define __NR_nanosleep (__NR_SYSCALL_BASE + 162) #define __NR_clock_gettime (__NR_SYSCALL_BASE + 263) #define __NR_clock_settime (__NR_SYSCALL_BASE + 262) @@ -318,6 +319,7 @@ #define __NR_renameat (__NR_SYSCALL_BASE + 302) #define __NR_fchmodat (__NR_SYSCALL_BASE + 306) #define __NR_faccessat (__NR_SYSCALL_BASE + 307) +#define __NR_unshare (__NR_SYSCALL_BASE + 310) #define __NR_getcpu (__NR_SYSCALL_BASE + 318) #define __NR_utimensat (__NR_SYSCALL_BASE + 320) #define __NR_eventfd2 (__NR_SYSCALL_BASE + 328) @@ -444,6 +446,7 @@ #define __NR_renameat (__NR_SYSCALL_BASE + 295) #define __NR_fchmodat (__NR_SYSCALL_BASE + 299) #define __NR_faccessat (__NR_SYSCALL_BASE + 300) +#define __NR_unshare (__NR_SYSCALL_BASE + 303) #define __NR_getcpu (__NR_SYSCALL_BASE + 312) #define __NR_ioprio_set (__NR_SYSCALL_BASE + 314) #define __NR_ioprio_get (__NR_SYSCALL_BASE + 315)