# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../uclibc/uClibc-0.9.32.1-unshare.patch # Copyright (C) 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- Backport of unshare() syscall. From uClibc git 19dd090a0f68765db87990ef8eda9bf77bb29581 Signed-off-by: Gustavo Zacarias --- diff -Nura uClibc-0.9.32.orig/libc/sysdeps/linux/common/bits/sched.h uClibc-0.9.32/libc/sysdeps/linux/common/bits/sched.h --- uClibc-0.9.32.orig/libc/sysdeps/linux/common/bits/sched.h 2011-12-02 23:54:30.571841170 -0300 +++ uClibc-0.9.32/libc/sysdeps/linux/common/bits/sched.h 2011-12-02 23:57:45.874205079 -0300 @@ -58,7 +58,13 @@ force CLONE_PTRACE on this clone. */ # define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in the child. */ -# define CLONE_STOPPED 0x02000000 /* Start in stopped state. */ +# define CLONE_STOPPED 0x02000000 /* Start in stopped state. */ +# define CLONE_NEWUTS 0x04000000 /* New utsname group. */ +# define CLONE_NEWIPC 0x08000000 /* New ipcs. */ +# define CLONE_NEWUSER 0x10000000 /* New user namespace. */ +# define CLONE_NEWPID 0x20000000 /* New pid namespace. */ +# define CLONE_NEWNET 0x40000000 /* New network namespace. */ +# define CLONE_IO 0x80000000 /* Clone I/O context. */ #endif /* The official definition. */ @@ -74,11 +80,9 @@ extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg, ...) __THROW; -#if 0 /* Unshare the specified resources. */ extern int unshare (int __flags) __THROW; #endif -#endif __END_DECLS diff -Nura uClibc-0.9.32.orig/libc/sysdeps/linux/common/Makefile.in uClibc-0.9.32/libc/sysdeps/linux/common/Makefile.in --- uClibc-0.9.32.orig/libc/sysdeps/linux/common/Makefile.in 2011-12-02 23:54:30.577841215 -0300 +++ uClibc-0.9.32/libc/sysdeps/linux/common/Makefile.in 2011-12-02 23:56:08.801527166 -0300 @@ -24,7 +24,8 @@ remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ - sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c + sync_file_range.c sysctl.c sysinfo.c timerfd.c unshare.c uselib.c \ + vhangup.c # NPTL needs these internally: madvise.c CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) diff -Nura uClibc-0.9.32.orig/libc/sysdeps/linux/common/stubs.c uClibc-0.9.32/libc/sysdeps/linux/common/stubs.c --- uClibc-0.9.32.orig/libc/sysdeps/linux/common/stubs.c 2011-12-02 23:54:30.577841215 -0300 +++ uClibc-0.9.32/libc/sysdeps/linux/common/stubs.c 2011-12-02 23:58:18.803435042 -0300 @@ -278,6 +278,10 @@ make_stub(umount2) #endif +#if !defined __NR_unshare && defined __UCLIBC_LINUX_SPECIFIC__ +make_stub(unshare) +#endif + #ifndef __NR_utimensat make_stub(futimens) make_stub(utimensat) diff -Nura uClibc-0.9.32.orig/libc/sysdeps/linux/common/unshare.c uClibc-0.9.32/libc/sysdeps/linux/common/unshare.c --- uClibc-0.9.32.orig/libc/sysdeps/linux/common/unshare.c 1969-12-31 21:00:00.000000000 -0300 +++ uClibc-0.9.32/libc/sysdeps/linux/common/unshare.c 2011-12-02 23:58:42.693601880 -0300 @@ -0,0 +1,15 @@ +/* vi: set sw=4 ts=4: */ +/* + * unshare() for uClibc + * + * Copyright (C) 2011 Henning Heinold + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +#if defined __NR_unshare +_syscall1(int, unshare, int, flags) +#endif