aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32
diff options
context:
space:
mode:
Diffstat (limited to 'main/libc0.9.32')
-rw-r--r--main/libc0.9.32/0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch72
-rw-r--r--main/libc0.9.32/0001-add-posix_madvise.c.patch60
-rw-r--r--main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch139
-rw-r--r--main/libc0.9.32/0001-ldd-subdepends-check-stderr.patch11
-rw-r--r--main/libc0.9.32/0001-libc-add-get-set-swap-make-context-user-context-mani.patch2550
-rw-r--r--main/libc0.9.32/0001-libc-stdlib-add-mkostemp-helpers.patch155
-rw-r--r--main/libc0.9.32/0001-libm-x86_64-implement-fegetround.patch50
-rw-r--r--main/libc0.9.32/0001-librt-add-posix_spawn-support.patch853
-rw-r--r--main/libc0.9.32/0001-stdio-inline-getchar-putchar.patch114
-rw-r--r--main/libc0.9.32/0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch44
-rw-r--r--main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch113
-rw-r--r--main/libc0.9.32/0002-resolv-res_query-for-CNAMEs.patch41
-rw-r--r--main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch385
-rw-r--r--main/libc0.9.32/0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch266
-rw-r--r--main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch144
-rw-r--r--main/libc0.9.32/0004-libm-x86_64-implement-some-fenv-functions.patch288
-rw-r--r--main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch671
-rw-r--r--main/libc0.9.32/0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch62
-rw-r--r--main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch37
-rw-r--r--main/libc0.9.32/0006-malloc-standard-synchronize-on-fork.patch55
-rw-r--r--main/libc0.9.32/0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch251
-rw-r--r--main/libc0.9.32/0008-ldso-limited-support-for-ORIGIN-in-rpath.patch183
-rw-r--r--main/libc0.9.32/0009-sys-quota.h-sync-with-glibc.patch163
-rw-r--r--main/libc0.9.32/560-res_init_asterisk.patch77
-rw-r--r--main/libc0.9.32/970-add___kernel_long_and___kernel_ulong.patch320
-rw-r--r--main/libc0.9.32/APKBUILD322
-rw-r--r--main/libc0.9.32/STATUS70
-rw-r--r--main/libc0.9.32/avoid-forced-unwind.patch10
-rw-r--r--main/libc0.9.32/eventfd.patch14
-rw-r--r--main/libc0.9.32/libdl.patch29
-rw-r--r--main/libc0.9.32/librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch32
-rw-r--r--main/libc0.9.32/posix_fallocate-fix.patch29
-rw-r--r--main/libc0.9.32/posix_fallocate.patch342
-rw-r--r--main/libc0.9.32/spawn-use-glibc-style-to-keep-differences-down.patch399
-rw-r--r--main/libc0.9.32/uClibc-0.9.33-avahi.patch418
-rw-r--r--main/libc0.9.32/uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch36
-rw-r--r--main/libc0.9.32/uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch28
-rw-r--r--main/libc0.9.32/uClibc-0.9.33.2-dup3.patch56
-rw-r--r--main/libc0.9.32/uclibc-dlclose-fix.patch14
-rw-r--r--main/libc0.9.32/uclibc-rtld_next-fix.patch27
-rw-r--r--main/libc0.9.32/uclibc-utils.trigger3
-rw-r--r--main/libc0.9.32/uclibcconfig.arm269
l---------main/libc0.9.32/uclibcconfig.i4861
-rw-r--r--main/libc0.9.32/uclibcconfig.powerpc253
-rw-r--r--main/libc0.9.32/uclibcconfig.x86275
-rw-r--r--main/libc0.9.32/uclibcconfig.x86_64257
-rw-r--r--main/libc0.9.32/ucontext-reentrant.patch12
47 files changed, 0 insertions, 10000 deletions
diff --git a/main/libc0.9.32/0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch b/main/libc0.9.32/0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
deleted file mode 100644
index eb60a50a94..0000000000
--- a/main/libc0.9.32/0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From d0d708fffcc475973736aea3759f4d7944a4629a Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Fri, 23 Dec 2011 14:06:09 +0100
-Subject: [PATCH 1/8] Compatible stack protector for non Thread Local storage
-
-Before we had thread local storage the __stack_chk_guard was a global
-variable that was referenced to by the older binaries.
-
-We since then have changed ABI so this patch can probably go away.
----
- ldso/ldso/ldso.c | 7 +------
- libc/misc/internals/__uClibc_main.c | 8 +-------
- 2 files changed, 2 insertions(+), 13 deletions(-)
-
-diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
-index 014bbf5..7690036 100644
---- a/ldso/ldso/ldso.c
-+++ b/ldso/ldso/ldso.c
-@@ -121,11 +121,7 @@ extern void _start(void);
- #ifdef __UCLIBC_HAS_SSP__
- # include <dl-osinfo.h>
- static uintptr_t stack_chk_guard;
--# ifndef THREAD_SET_STACK_GUARD
--/* Only exported for architectures that don't store the stack guard canary
-- * in local thread area. */
- uintptr_t __stack_chk_guard attribute_relro;
--# endif
- # ifdef __UCLIBC_HAS_SSP_COMPAT__
- uintptr_t __guard attribute_relro;
- # endif
-@@ -1189,9 +1185,8 @@ of this helper program; chances are you did not intend to run this program.\n\
- stack_chk_guard = _dl_setup_stack_chk_guard ();
- # ifdef THREAD_SET_STACK_GUARD
- THREAD_SET_STACK_GUARD (stack_chk_guard);
--# else
-- __stack_chk_guard = stack_chk_guard;
- # endif
-+ __stack_chk_guard = stack_chk_guard;
- # ifdef __UCLIBC_HAS_SSP_COMPAT__
- __guard = stack_chk_guard;
- # endif
-diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
-index 71fdbd8..3a24acd 100644
---- a/libc/misc/internals/__uClibc_main.c
-+++ b/libc/misc/internals/__uClibc_main.c
-@@ -46,12 +46,7 @@ void *__libc_stack_end = NULL;
- # ifdef __UCLIBC_HAS_SSP__
- # include <dl-osinfo.h>
- static uintptr_t stack_chk_guard;
--# ifndef THREAD_SET_STACK_GUARD
--/* Only exported for architectures that don't store the stack guard canary
-- * in thread local area. */
--/* for gcc-4.1 non-TLS */
- uintptr_t __stack_chk_guard attribute_relro;
--# endif
- /* for gcc-3.x + Etoh ssp */
- # ifdef __UCLIBC_HAS_SSP_COMPAT__
- uintptr_t __guard attribute_relro;
-@@ -251,9 +246,8 @@ void __uClibc_init(void)
- stack_chk_guard = _dl_setup_stack_chk_guard();
- # ifdef THREAD_SET_STACK_GUARD
- THREAD_SET_STACK_GUARD (stack_chk_guard);
--# else
-- __stack_chk_guard = stack_chk_guard;
- # endif
-+ __stack_chk_guard = stack_chk_guard;
- # ifdef __UCLIBC_HAS_SSP_COMPAT__
- __guard = stack_chk_guard;
- # endif
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0001-add-posix_madvise.c.patch b/main/libc0.9.32/0001-add-posix_madvise.c.patch
deleted file mode 100644
index 5b8ca538a9..0000000000
--- a/main/libc0.9.32/0001-add-posix_madvise.c.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 9d101732ad0609f2f19ef20062a00cd26b01d859 Mon Sep 17 00:00:00 2001
-From: "Peter S. Mazinger" <ps.m@gmx.net>
-Date: Tue, 26 Apr 2011 23:03:44 +0200
-Subject: [PATCH] add posix_madvise.c
-
-Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
- libc/sysdeps/linux/common/Makefile.in | 2 +-
- libc/sysdeps/linux/common/posix_madvise.c | 25 +++++++++++++++++++++++++
- 2 files changed, 26 insertions(+), 1 deletion(-)
- create mode 100644 libc/sysdeps/linux/common/posix_madvise.c
-
-diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
-index cf9f25a..b40bb78 100644
---- a/libc/sysdeps/linux/common/Makefile.in
-+++ b/libc/sysdeps/linux/common/Makefile.in
-@@ -81,7 +81,7 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
- sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
- sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
- # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
--CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c
-+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
- CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
- CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
- CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
-diff --git a/libc/sysdeps/linux/common/posix_madvise.c b/libc/sysdeps/linux/common/posix_madvise.c
-new file mode 100644
-index 0000000..2f95bcb
---- /dev/null
-+++ b/libc/sysdeps/linux/common/posix_madvise.c
-@@ -0,0 +1,25 @@
-+/* vi: set sw=4 ts=4: */
-+/* Licensed under the LGPL v2.1, see the file LICENSE in this tarball. */
-+
-+#include <sys/mman.h>
-+#include <sys/syscall.h>
-+
-+#if defined __NR_madvise && defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
-+int posix_madvise(void *addr, size_t len, int advice)
-+{
-+ int result;
-+ /* We have one problem: the kernel's MADV_DONTNEED does not
-+ * correspond to POSIX's POSIX_MADV_DONTNEED. The former simply
-+ * discards changes made to the memory without writing it back to
-+ * disk, if this would be necessary. The POSIX behaviour does not
-+ * allow this. There is no functionality mapping for the POSIX
-+ * behaviour so far so we ignore that advice for now. */
-+ if (advice == POSIX_MADV_DONTNEED)
-+ return 0;
-+
-+ /* this part might use madvise function */
-+ INTERNAL_SYSCALL_DECL (err);
-+ result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
-+ return INTERNAL_SYSCALL_ERRNO (result, err);
-+}
-+#endif
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch b/main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
deleted file mode 100644
index 59faf075ee..0000000000
--- a/main/libc0.9.32/0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From b26db0813ca2aab8882535caa9d0a6c8671e9bbc Mon Sep 17 00:00:00 2001
-From: "Peter S. Mazinger" <ps.m@gmx.net>
-Date: Thu, 21 Apr 2011 21:19:39 +0200
-Subject: [PATCH 1/6] cancel.h: add generic file to ease cancellation support
-
-Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-(cherry picked from commit 9f68f0cbf8c8eea6a7f9e195e4617bbaa808d7c6)
-
-Conflicts:
- Makefile.in
----
- Makefile.in | 1 +
- include/cancel.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 102 insertions(+)
- create mode 100644 include/cancel.h
-
-diff --git a/Makefile.in b/Makefile.in
-index 9ba590d..e81926d 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -210,6 +210,7 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
- # a "y" here means the feature is enabled and so we should *not* rm it.
- # if the option expands to nothing though, we can punt the headers.
- HEADERS_RM- := \
-+ cancel.h \
- dl-osinfo.h \
- hp-timing.h \
- _lfs_64.h \
-diff --git a/include/cancel.h b/include/cancel.h
-new file mode 100644
-index 0000000..ac6f6b6
---- /dev/null
-+++ b/include/cancel.h
-@@ -0,0 +1,101 @@
-+/* vi: set sw=4 ts=4: */
-+/*
-+ * Copyright (C) 2000-2011 Erik Andersen <andersen@uclibc.org>
-+ *
-+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+ */
-+
-+#ifndef _CANCEL_H
-+#define _CANCEL_H
-+
-+/*
-+ * Usage of this header:
-+ * 1. define a static or hidden function __NC(NAME) - expands to __NAME_nocancel
-+ * 2. if it is hidden, add the prototype to the appropiate header where NAME has
-+ * it's prototype (guarded by _LIBC)
-+ * 3. add a CANCELLABLE_SYSCALL(...) line at the end, this will create the function
-+ * NAME (as weak) with enabled cancellation for NPTL (and later for new LT), for
-+ * LT_OLD it will also create a strong_alias to __libc_NAME to be used in libpthread
-+ * 4. if you need libc_hidden_(weak|def) line, use instead lt_libc_hidden, this will
-+ * take care of the correct type, weak or strong depending on the THREADS type
-+ * 5. If the implementation can't be done using CANCELLABLE_SYSCALL (like for fcntl)
-+ * you need to manually add lt_strong_alias() line too, to optionally create the
-+ * __libc_NAME alias
-+ * 6. if functions are needed to implement __NC(NAME), that themselves are cancellable,
-+ * decide how the cancellation should be solved, two variants are possible:
-+ * a. use the other function as __NC(FUNC), this way you access the non-cancellable
-+ * variant and provide by CANCELLABLE_SYSCALL(...) the dedicated cancellation for NAME.
-+ * be aware, that for this case __NC(FUNC) has to be hidden (not static)
-+ * b. use the other function with it's name (FUNC) and add LIBC_CANCEL_HANDLED(); at
-+ * the end of file with a comment telling us which function took care of the cancellation
-+ * Note: LIBC_CANCEL_HANDLED() is noop on uClibc, glibc uses it only for tests, we use
-+ * it only for "documentation".
-+ *
-+ * For now the use of this file is limited to libc, will expand later to support libpthread
-+ * and librt as well.
-+ */
-+
-+#include <features.h>
-+
-+#ifndef NOT_IN_libc
-+
-+#define __NC(name) _NC(name)
-+#define _NC(name) __##name##_nocancel
-+
-+#define __NC_OLD(name) _NC_OLD(name)
-+#define _NC_OLD(name) __libc_##name
-+
-+#define __NC_PROTO(name) extern __typeof(name) __NC(name) attribute_hidden;
-+#define __NC_OLD_PROTO(name) extern __typeof(name) __NC_OLD(name);
-+
-+#if defined __UCLIBC_HAS_THREADS__ && !defined __LINUXTHREADS_OLD__
-+# define __NEW_THREADS 1
-+#else
-+# define SINGLE_THREAD_P 1
-+#endif
-+
-+#ifdef __NEW_THREADS
-+# include <sysdep-cancel.h>
-+
-+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
-+res_type weak_function name param_list \
-+{ \
-+ if (SINGLE_THREAD_P) \
-+ return __NC(name) params; \
-+ int oldtype = LIBC_CANCEL_ASYNC(); \
-+ res_type result = __NC(name) params; \
-+ LIBC_CANCEL_RESET(oldtype); \
-+ return result; \
-+}
-+
-+# define lt_strong_alias(name)
-+# define lt_libc_hidden(name) libc_hidden_def(name)
-+
-+#elif defined __LINUXTHREADS_OLD__
-+
-+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
-+weak_alias(__NC(name),name) \
-+lt_strong_alias(name)
-+
-+# define lt_strong_alias(name) \
-+__NC_OLD_PROTO(name) \
-+strong_alias(name,__NC_OLD(name))
-+# define lt_libc_hidden(name) libc_hidden_weak(name)
-+
-+#else
-+
-+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
-+strong_alias(__NC(name),name)
-+
-+# define lt_strong_alias(name)
-+# define lt_libc_hidden(name) libc_hidden_def(name)
-+
-+#endif
-+
-+/* disable it, useless, glibc uses it only for tests */
-+# undef LIBC_CANCEL_HANDLED
-+# define LIBC_CANCEL_HANDLED()
-+
-+#endif /* NOT_IN_libc */
-+
-+#endif
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0001-ldd-subdepends-check-stderr.patch b/main/libc0.9.32/0001-ldd-subdepends-check-stderr.patch
deleted file mode 100644
index c26f65eafd..0000000000
--- a/main/libc0.9.32/0001-ldd-subdepends-check-stderr.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- uClibc-0.9.33.2.orig/utils/ldd.c
-+++ uClibc-0.9.33.2/utils/ldd.c
-@@ -827,7 +827,7 @@
- for (cur = lib_list; cur; cur = cur->next) {
- if (cur->resolved == 0 && cur->path) {
- got_em_all = 1;
-- printf("checking sub-depends for '%s'\n", cur->path);
-+ fprintf(stderr, "checking sub-depends for '%s'\n", cur->path);
- find_dependencies(cur->path);
- cur->resolved = 1;
- }
diff --git a/main/libc0.9.32/0001-libc-add-get-set-swap-make-context-user-context-mani.patch b/main/libc0.9.32/0001-libc-add-get-set-swap-make-context-user-context-mani.patch
deleted file mode 100644
index 98bb707b01..0000000000
--- a/main/libc0.9.32/0001-libc-add-get-set-swap-make-context-user-context-mani.patch
+++ /dev/null
@@ -1,2550 +0,0 @@
-From a8dc90eaaa5e6474beac828558d969b1aafee4af Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <florian@openwrt.org>
-Date: Wed, 9 Jan 2013 16:17:21 +0100
-Subject: [PATCH] libc: add {get,set,swap,make}context user context
- manipulation functions
-
-Add the obsolescent SUSv3 family of user context manipulating functions
-for arm, i386, mips, x86_64.
-
-Signed-off-by: Timon ter Braak <timonterbraak@gmail.com>
-Signed-off-by: Florian Fainelli <florian@openwrt.org>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
- Rules.mak | 2 +
- extra/Configs/Config.arm | 1 +
- extra/Configs/Config.i386 | 1 +
- extra/Configs/Config.in | 16 ++
- extra/Configs/Config.mips | 1 +
- extra/Configs/Config.x86_64 | 1 +
- include/ucontext.h | 32 +++-
- libc/.gitignore | 1 +
- libc/sysdeps/linux/Makefile.commonarch | 20 +-
- libc/sysdeps/linux/arm/Makefile.arch | 5 +
- libc/sysdeps/linux/arm/getcontext.S | 80 ++++++++
- libc/sysdeps/linux/arm/makecontext.c | 73 +++++++
- libc/sysdeps/linux/arm/setcontext.S | 76 ++++++++
- libc/sysdeps/linux/arm/swapcontext.S | 63 ++++++
- libc/sysdeps/linux/arm/ucontext_i.sym | 30 +++
- libc/sysdeps/linux/i386/Makefile.arch | 4 +
- libc/sysdeps/linux/i386/getcontext.S | 84 ++++++++
- libc/sysdeps/linux/i386/makecontext.S | 123 ++++++++++++
- libc/sysdeps/linux/i386/setcontext.S | 96 ++++++++++
- libc/sysdeps/linux/i386/swapcontext.S | 110 +++++++++++
- libc/sysdeps/linux/i386/ucontext_i.sym | 30 +++
- libc/sysdeps/linux/mips/Makefile.arch | 4 +
- libc/sysdeps/linux/mips/getcontext.S | 148 +++++++++++++++
- libc/sysdeps/linux/mips/kernel_rt_sigframe.h | 10 +
- libc/sysdeps/linux/mips/makecontext.S | 188 ++++++++++++++++++
- libc/sysdeps/linux/mips/setcontext.S | 191 +++++++++++++++++++
- libc/sysdeps/linux/mips/swapcontext.S | 211 +++++++++++++++++++++
- libc/sysdeps/linux/mips/ucontext_i.sym | 52 +++++
- libc/sysdeps/linux/x86_64/Makefile.arch | 5 +
- libc/sysdeps/linux/x86_64/__start_context.S | 49 +++++
- libc/sysdeps/linux/x86_64/getcontext.S | 88 +++++++++
- libc/sysdeps/linux/x86_64/makecontext.c | 121 ++++++++++++
- libc/sysdeps/linux/x86_64/setcontext.S | 103 ++++++++++
- libc/sysdeps/linux/x86_64/swapcontext.S | 121 ++++++++++++
- libc/sysdeps/linux/x86_64/ucontext_i.sym | 37 ++++
- libpthread/nptl/sysdeps/Makefile.commonarch | 3 +-
- .../sysdeps/unix/sysv/linux/Makefile.commonarch | 2 -
- 37 files changed, 2174 insertions(+), 8 deletions(-)
- create mode 100644 libc/.gitignore
- create mode 100644 libc/sysdeps/linux/arm/getcontext.S
- create mode 100644 libc/sysdeps/linux/arm/makecontext.c
- create mode 100644 libc/sysdeps/linux/arm/setcontext.S
- create mode 100644 libc/sysdeps/linux/arm/swapcontext.S
- create mode 100644 libc/sysdeps/linux/arm/ucontext_i.sym
- create mode 100644 libc/sysdeps/linux/i386/getcontext.S
- create mode 100644 libc/sysdeps/linux/i386/makecontext.S
- create mode 100644 libc/sysdeps/linux/i386/setcontext.S
- create mode 100644 libc/sysdeps/linux/i386/swapcontext.S
- create mode 100644 libc/sysdeps/linux/i386/ucontext_i.sym
- create mode 100644 libc/sysdeps/linux/mips/getcontext.S
- create mode 100644 libc/sysdeps/linux/mips/kernel_rt_sigframe.h
- create mode 100644 libc/sysdeps/linux/mips/makecontext.S
- create mode 100644 libc/sysdeps/linux/mips/setcontext.S
- create mode 100644 libc/sysdeps/linux/mips/swapcontext.S
- create mode 100644 libc/sysdeps/linux/mips/ucontext_i.sym
- create mode 100644 libc/sysdeps/linux/x86_64/__start_context.S
- create mode 100644 libc/sysdeps/linux/x86_64/getcontext.S
- create mode 100644 libc/sysdeps/linux/x86_64/makecontext.c
- create mode 100644 libc/sysdeps/linux/x86_64/setcontext.S
- create mode 100644 libc/sysdeps/linux/x86_64/swapcontext.S
- create mode 100644 libc/sysdeps/linux/x86_64/ucontext_i.sym
-
-diff --git a/Rules.mak b/Rules.mak
-index 96871e1..8943fbf 100644
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -813,3 +813,5 @@ SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(top_builddir)lib/crtn.o
- endif
-
- LOCAL_INSTALL_PATH := install_dir
-+
-+PTHREAD_GENERATE_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
-diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
-index 0bb2971..dc53643 100644
---- a/extra/Configs/Config.arm
-+++ b/extra/Configs/Config.arm
-@@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
- bool
- default y
- select ARCH_ANY_ENDIAN
-+ select ARCH_HAS_UCONTEXT
-
- config CONFIG_ARM_EABI
- bool "Build for EABI"
-diff --git a/extra/Configs/Config.i386 b/extra/Configs/Config.i386
-index 288aa5e..92cee3b 100644
---- a/extra/Configs/Config.i386
-+++ b/extra/Configs/Config.i386
-@@ -12,6 +12,7 @@ config FORCE_OPTIONS_FOR_ARCH
- default y
- select ARCH_LITTLE_ENDIAN
- select ARCH_HAS_MMU
-+ select ARCH_HAS_UCONTEXT
-
- choice
- prompt "Target x86 Processor Family"
-diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
-index 4bb6812..62bcd9b 100644
---- a/extra/Configs/Config.in
-+++ b/extra/Configs/Config.in
-@@ -261,6 +261,9 @@ config ARCH_HAS_NO_LDSO
- bool
- select ARCH_HAS_NO_SHARED
-
-+config ARCH_HAS_UCONTEXT
-+ bool
-+
- config HAVE_SHARED
- bool "Enable shared libraries"
- depends on !ARCH_HAS_NO_SHARED
-@@ -678,6 +681,19 @@ config UCLIBC_SUSV3_LEGACY
-
- WARNING! ABI incompatibility.
-
-+config UCLIBC_HAS_CONTEXT_FUNCS
-+ bool "Use obsolescent context control functions"
-+ depends on UCLIBC_SUSV3_LEGACY && ARCH_HAS_UCONTEXT
-+ help
-+ Add into library the SuSv3 obsolescent functions used for context
-+ control. The setcontext family allows the implementation in C of
-+ advanced control flow patterns such as iterators, fibers, and
-+ coroutines. They may be viewed as an advanced version of
-+ setjmp/longjmp; whereas the latter allows only a single non-local jump
-+ up the stack, setcontext allows the creation of multiple cooperative
-+ threads of control, each with its own stack.
-+ These functions are: setcontext, getcontext, makecontext, swapcontext.
-+
- config UCLIBC_SUSV3_LEGACY_MACROS
- bool "Enable SuSv3 LEGACY macros"
- help
-diff --git a/extra/Configs/Config.mips b/extra/Configs/Config.mips
-index 063b07c..48e0b64 100644
---- a/extra/Configs/Config.mips
-+++ b/extra/Configs/Config.mips
-@@ -11,6 +11,7 @@ config FORCE_OPTIONS_FOR_ARCH
- bool
- default y
- select ARCH_ANY_ENDIAN
-+ select ARCH_HAS_UCONTEXT
-
- choice
- prompt "Target ABI"
-diff --git a/extra/Configs/Config.x86_64 b/extra/Configs/Config.x86_64
-index 1b28088..4c8c3a9 100644
---- a/extra/Configs/Config.x86_64
-+++ b/extra/Configs/Config.x86_64
-@@ -12,3 +12,4 @@ config FORCE_OPTIONS_FOR_ARCH
- default y
- select ARCH_LITTLE_ENDIAN
- select ARCH_HAS_MMU
-+ select ARCH_HAS_UCONTEXT
-diff --git a/include/ucontext.h b/include/ucontext.h
-index 14a1270..f11db77 100644
---- a/include/ucontext.h
-+++ b/include/ucontext.h
-@@ -15,17 +15,43 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-+/* The System V ABI user-level context switching support functions
-+ are marked obsolescent by SuSv3. */
-+
- #ifndef _UCONTEXT_H
- #define _UCONTEXT_H 1
-
- #include <features.h>
-
-+#ifdef __UCLIBC_HAS_CONTEXT_FUNCS__
-+
- /* Get machine dependent definition of data structures. */
- #include <sys/ucontext.h>
-
--/* The System V ABI user-level context switching support functions
-- * are marked obsolescent by SuSv3, and are not implemented by
-- * uClibc. This header is therefore empty. */
-+__BEGIN_DECLS
-+
-+/* Get user context and store it in variable pointed to by UCP. */
-+extern int getcontext (ucontext_t *__ucp) __THROW;
-+
-+/* Set user context from information of variable pointed to by UCP. */
-+extern int setcontext (const ucontext_t *__ucp) __THROW;
-+
-+/* Save current context in context variable pointed to by OUCP and set
-+ context from variable pointed to by UCP. */
-+extern int swapcontext (ucontext_t *__restrict __oucp,
-+ const ucontext_t *__restrict __ucp) __THROW;
-+
-+/* Manipulate user context UCP to continue with calling functions FUNC
-+ and the ARGC-1 parameters following ARGC when the context is used
-+ the next time in `setcontext' or `swapcontext'.
-+
-+ We cannot say anything about the parameters FUNC takes; `void'
-+ is as good as any other choice. */
-+extern void makecontext (ucontext_t *__ucp, void (*__func) (void),
-+ int __argc, ...) __THROW;
-+
-+__END_DECLS
-
-+#endif
-
- #endif /* ucontext.h */
-diff --git a/libc/.gitignore b/libc/.gitignore
-new file mode 100644
-index 0000000..f4c0305
---- /dev/null
-+++ b/libc/.gitignore
-@@ -0,0 +1 @@
-+ucontext_i.[chs]
-diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
-index c1bc5df..ac89e72 100644
---- a/libc/sysdeps/linux/Makefile.commonarch
-+++ b/libc/sysdeps/linux/Makefile.commonarch
-@@ -37,5 +37,23 @@ headers-y += $(ARCH_HEADERS_OUT)
- headers_clean-y += HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
- HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
- $(do_rm) $(ARCH_HEADERS_OUT)
--
- endif
-+
-+CFLAGS-ucontext_i.c = -S
-+
-+$(ARCH_OUT)/ucontext_i.c: $(ARCH_DIR)/ucontext_i.sym
-+ $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-+
-+$(ARCH_OUT)/ucontext_i.s: $(ARCH_OUT)/ucontext_i.c
-+ $(compile.c)
-+
-+$(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.s
-+ $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
-+
-+pregen-headers-$(UCLIBC_HAS_CONTEXT_FUNCS) += $(ARCH_OUT)/ucontext_i.h
-+
-+headers_clean-$(UCLIBC_HAS_CONTEXT_FUNCS) += \
-+ HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)/ucontext_i)
-+
-+HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)/ucontext_i):
-+ $(do_rm) $(addprefix $(ARCH_OUT)/ucontext_i., c h s)
-diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
-index 5fc3e54..36d988b 100644
---- a/libc/sysdeps/linux/arm/Makefile.arch
-+++ b/libc/sysdeps/linux/arm/Makefile.arch
-@@ -43,3 +43,8 @@ libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \
- libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \
- $(ARCH_OUT)/aeabi_sighandlers.os $(ARCH_OUT)/aeabi_unwind_cpp_pr1.o
- endif
-+
-+ifeq ($(UCLIBC_HAS_CONTEXT_FUNCS),y)
-+CSRC += makecontext.c
-+SSRC += getcontext.S setcontext.S swapcontext.S
-+endif
-diff --git a/libc/sysdeps/linux/arm/getcontext.S b/libc/sysdeps/linux/arm/getcontext.S
-new file mode 100644
-index 0000000..a987c52
---- /dev/null
-+++ b/libc/sysdeps/linux/arm/getcontext.S
-@@ -0,0 +1,80 @@
-+/* Copyright (C) 2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+ .syntax unified
-+ .text
-+
-+/* int getcontext (ucontext_t *ucp) */
-+
-+ENTRY(__getcontext)
-+ /* No need to save r0-r3, d0-d7, or d16-d31. */
-+ add r1, r0, #MCONTEXT_ARM_R4
-+ stmia r1, {r4-r11}
-+
-+ /* Save R13 separately as Thumb can't STM it. */
-+ str r13, [r0, #MCONTEXT_ARM_SP]
-+ str r14, [r0, #MCONTEXT_ARM_LR]
-+ /* Return to LR */
-+ str r14, [r0, #MCONTEXT_ARM_PC]
-+ /* Return zero */
-+ mov r2, #0
-+ str r2, [r0, #MCONTEXT_ARM_R0]
-+
-+ /* Save ucontext_t * across the next call. */
-+ mov r4, r0
-+
-+ /* __sigprocmask(SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */
-+ mov r0, #SIG_BLOCK
-+ mov r1, #0
-+ add r2, r4, #UCONTEXT_SIGMASK
-+ bl PLTJMP(sigprocmask)
-+
-+#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
-+# ifdef __VFP_FP__
-+ /* Store the VFP registers. */
-+ /* Following instruction is fstmiax ip!, {d8-d15}. */
-+ stc p11, cr8, [r0], #64
-+ /* Store the floating-point status register. */
-+ /* Following instruction is fmrx r2, fpscr. */
-+ mrc p10, 7, r1, cr1, cr0, 0
-+ str r1, [r0], #4
-+# endif
-+#endif
-+#ifdef __IWMMXT__
-+ /* Save the call-preserved iWMMXt registers. */
-+ /* Following instructions are wstrd wr10, [r0], #8 (etc.) */
-+ stcl p1, cr10, [r0], #8
-+ stcl p1, cr11, [r0], #8
-+ stcl p1, cr12, [r0], #8
-+ stcl p1, cr13, [r0], #8
-+ stcl p1, cr14, [r0], #8
-+ stcl p1, cr15, [r0], #8
-+#endif
-+
-+ /* Restore the clobbered R4 and LR. */
-+ ldr r14, [r4, #MCONTEXT_ARM_LR]
-+ ldr r4, [r4, #MCONTEXT_ARM_R4]
-+
-+ mov r0, #0
-+ DO_RET(r14)
-+
-+END(__getcontext)
-+weak_alias(__getcontext, getcontext)
-diff --git a/libc/sysdeps/linux/arm/makecontext.c b/libc/sysdeps/linux/arm/makecontext.c
-new file mode 100644
-index 0000000..d6ae6f0
---- /dev/null
-+++ b/libc/sysdeps/linux/arm/makecontext.c
-@@ -0,0 +1,73 @@
-+/* Copyright (C) 2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <stdarg.h>
-+#include <ucontext.h>
-+
-+/* Number of arguments that go in registers. */
-+#define NREG_ARGS 4
-+
-+/* Take a context previously prepared via getcontext() and set to
-+ call func() with the given int only args. */
-+void
-+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
-+{
-+ extern void __startcontext (void);
-+ unsigned long *funcstack;
-+ va_list vl;
-+ unsigned long *regptr;
-+ unsigned int reg;
-+ int misaligned;
-+
-+ /* Start at the top of stack. */
-+ funcstack = (unsigned long *) (ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
-+
-+ /* Ensure the stack stays eight byte aligned. */
-+ misaligned = ((unsigned long) funcstack & 4) != 0;
-+
-+ if ((argc > NREG_ARGS) && (argc & 1) != 0)
-+ misaligned = !misaligned;
-+
-+ if (misaligned)
-+ funcstack -= 1;
-+
-+ va_start (vl, argc);
-+
-+ /* Reserve space for the on-stack arguments. */
-+ if (argc > NREG_ARGS)
-+ funcstack -= (argc - NREG_ARGS);
-+
-+ ucp->uc_mcontext.arm_sp = (unsigned long) funcstack;
-+ ucp->uc_mcontext.arm_pc = (unsigned long) func;
-+
-+ /* Exit to startcontext() with the next context in R4 */
-+ ucp->uc_mcontext.arm_r4 = (unsigned long) ucp->uc_link;
-+ ucp->uc_mcontext.arm_lr = (unsigned long) __startcontext;
-+
-+ /* The first four arguments go into registers. */
-+ regptr = &(ucp->uc_mcontext.arm_r0);
-+
-+ for (reg = 0; (reg < argc) && (reg < NREG_ARGS); reg++)
-+ *regptr++ = va_arg (vl, unsigned long);
-+
-+ /* And the remainder on the stack. */
-+ for (; reg < argc; reg++)
-+ *funcstack++ = va_arg (vl, unsigned long);
-+
-+ va_end (vl);
-+}
-+weak_alias (__makecontext, makecontext)
-diff --git a/libc/sysdeps/linux/arm/setcontext.S b/libc/sysdeps/linux/arm/setcontext.S
-new file mode 100644
-index 0000000..a5c33a0
---- /dev/null
-+++ b/libc/sysdeps/linux/arm/setcontext.S
-@@ -0,0 +1,76 @@
-+/* Copyright (C) 2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+ .syntax unified
-+ .text
-+
-+/* int setcontext (const ucontext_t *ucp) */
-+
-+ENTRY(__setcontext)
-+ mov r4, r0
-+
-+#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
-+# ifdef __VFP_FP__
-+ /* Following instruction is vldmia r0!, {d8-d15}. */
-+ ldc p11, cr8, [r0], #64
-+ /* Restore the floating-point status register. */
-+ ldr r1, [r0], #4
-+ /* Following instruction is fmxr fpscr, r1. */
-+ mcr p10, 7, r1, cr1, cr0, 0
-+# endif
-+#endif
-+
-+#ifdef __IWMMXT__
-+ /* Restore the call-preserved iWMMXt registers. */
-+ /* Following instructions are wldrd wr10, [r0], #8 (etc.) */
-+ ldcl p1, cr10, [r0], #8
-+ ldcl p1, cr11, [r0], #8
-+ ldcl p1, cr12, [r0], #8
-+ ldcl p1, cr13, [r0], #8
-+ ldcl p1, cr14, [r0], #8
-+ ldcl p1, cr15, [r0], #8
-+#endif
-+
-+ /* Now bring back the signal status. */
-+ mov r0, #SIG_SETMASK
-+ add r1, r4, #UCONTEXT_SIGMASK
-+ mov r2, #0
-+ bl PLTJMP(sigprocmask)
-+
-+ /* Loading r0-r3 makes makecontext easier. */
-+ add r14, r4, #MCONTEXT_ARM_R0
-+ ldmia r14, {r0-r11}
-+ ldr r13, [r14, #(MCONTEXT_ARM_SP - MCONTEXT_ARM_R0)]
-+ add r14, r14, #(MCONTEXT_ARM_LR - MCONTEXT_ARM_R0)
-+ ldmia r14, {r14, pc}
-+
-+END(setcontext)
-+weak_alias(__setcontext, setcontext)
-+
-+ /* Called when a makecontext() context returns. Start the
-+ context in R4 or fall through to exit(). */
-+ENTRY(__startcontext)
-+ movs r0, r4
-+ bne PLTJMP(__setcontext)
-+
-+ @ New context was 0 - exit
-+ b PLTJMP(_exit)
-+END(__startcontext)
-diff --git a/libc/sysdeps/linux/arm/swapcontext.S b/libc/sysdeps/linux/arm/swapcontext.S
-new file mode 100644
-index 0000000..ba6e31c
---- /dev/null
-+++ b/libc/sysdeps/linux/arm/swapcontext.S
-@@ -0,0 +1,63 @@
-+/* Copyright (C) 2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+ .syntax unified
-+ .text
-+
-+/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
-+
-+ENTRY(swapcontext)
-+
-+ /* Have getcontext() do most of the work then fix up
-+ LR afterwards. Save R3 to keep the stack aligned. */
-+ push {r0,r1,r3,r14}
-+ cfi_adjust_cfa_offset (16)
-+ cfi_rel_offset (r0,0)
-+ cfi_rel_offset (r1,4)
-+ cfi_rel_offset (r3,8)
-+ cfi_rel_offset (r14,12)
-+
-+ bl __getcontext
-+ mov r4, r0
-+
-+ pop {r0,r1,r3,r14}
-+ cfi_adjust_cfa_offset (-16)
-+ cfi_restore (r0)
-+ cfi_restore (r1)
-+ cfi_restore (r3)
-+ cfi_restore (r14)
-+
-+ /* Exit if getcontext() failed. */
-+ cmp r4, #0
-+ itt ne
-+ movne r0, r4
-+ RETINSTR(ne, r14)
-+
-+ /* Fix up LR and the PC. */
-+ str r13,[r0, #MCONTEXT_ARM_SP]
-+ str r14,[r0, #MCONTEXT_ARM_LR]
-+ str r14,[r0, #MCONTEXT_ARM_PC]
-+
-+ /* And swap using swapcontext(). */
-+ mov r0, r1
-+ b __setcontext
-+
-+END(swapcontext)
-diff --git a/libc/sysdeps/linux/arm/ucontext_i.sym b/libc/sysdeps/linux/arm/ucontext_i.sym
-new file mode 100644
-index 0000000..9650322
---- /dev/null
-+++ b/libc/sysdeps/linux/arm/ucontext_i.sym
-@@ -0,0 +1,30 @@
-+#include <inttypes.h>
-+#include <signal.h>
-+#include <stddef.h>
-+#include <sys/ucontext.h>
-+
-+SIG_BLOCK
-+SIG_SETMASK
-+
-+-- Offsets of the fields in the ucontext_t structure.
-+#define ucontext(member) offsetof (ucontext_t, member)
-+#define mcontext(member) ucontext (uc_mcontext.member)
-+
-+UCONTEXT_FLAGS ucontext (uc_flags)
-+UCONTEXT_LINK ucontext (uc_link)
-+UCONTEXT_STACK ucontext (uc_stack)
-+UCONTEXT_MCONTEXT ucontext (uc_mcontext)
-+UCONTEXT_SIGMASK ucontext (uc_sigmask)
-+
-+UCONTEXT_REGSPACE ucontext (uc_regspace)
-+
-+MCONTEXT_TRAP_NO mcontext (trap_no)
-+MCONTEXT_ERROR_CODE mcontext (error_code)
-+MCONTEXT_OLDMASK mcontext (oldmask)
-+MCONTEXT_ARM_R0 mcontext (arm_r0)
-+MCONTEXT_ARM_R4 mcontext (arm_r4)
-+MCONTEXT_ARM_SP mcontext (arm_sp)
-+MCONTEXT_ARM_LR mcontext (arm_lr)
-+MCONTEXT_ARM_PC mcontext (arm_pc)
-+MCONTEXT_ARM_CPSR mcontext (arm_cpsr)
-+MCONTEXT_FAULT_ADDRESS mcontext (fault_address)
-diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch
-index a3bf32f..e7fd28e 100644
---- a/libc/sysdeps/linux/i386/Makefile.arch
-+++ b/libc/sysdeps/linux/i386/Makefile.arch
-@@ -18,3 +18,7 @@ endif
- ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- SSRC += vfork.S clone.S
- endif
-+
-+ifeq ($(UCLIBC_HAS_CONTEXT_FUNCS),y)
-+SSRC += makecontext.S setcontext.S getcontext.S swapcontext.S
-+endif
-diff --git a/libc/sysdeps/linux/i386/getcontext.S b/libc/sysdeps/linux/i386/getcontext.S
-new file mode 100644
-index 0000000..3221b59
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/getcontext.S
-@@ -0,0 +1,84 @@
-+/* Save current context.
-+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+
-+ENTRY(__getcontext)
-+ /* Load address of the context data structure. */
-+ movl 4(%esp), %eax
-+
-+ /* Return value of getcontext. EAX is the only register whose
-+ value is not preserved. */
-+ movl $0, oEAX(%eax)
-+
-+ /* Save the 32-bit register values and the return address. */
-+ movl %ecx, oECX(%eax)
-+ movl %edx, oEDX(%eax)
-+ movl %edi, oEDI(%eax)
-+ movl %esi, oESI(%eax)
-+ movl %ebp, oEBP(%eax)
-+ movl (%esp), %ecx
-+ movl %ecx, oEIP(%eax)
-+ leal 4(%esp), %ecx /* Exclude the return address. */
-+ movl %ecx, oESP(%eax)
-+ movl %ebx, oEBX(%eax)
-+
-+ /* Save the FS segment register. We don't touch the GS register
-+ since it is used for threads. */
-+ xorl %edx, %edx
-+ movw %fs, %dx
-+ movl %edx, oFS(%eax)
-+
-+ /* We have separate floating-point register content memory on the
-+ stack. We use the __fpregs_mem block in the context. Set the
-+ links up correctly. */
-+ leal oFPREGSMEM(%eax), %ecx
-+ movl %ecx, oFPREGS(%eax)
-+ /* Save the floating-point context. */
-+ fnstenv (%ecx)
-+ /* And load it right back since the processor changes the mask.
-+ Intel thought this opcode to be used in interrupt handlers which
-+ would block all exceptions. */
-+ fldenv (%ecx)
-+
-+ /* Save the current signal mask. */
-+ pushl %ebx
-+ cfi_adjust_cfa_offset (4)
-+ cfi_rel_offset (ebx, 0)
-+ leal oSIGMASK(%eax), %edx
-+ xorl %ecx, %ecx
-+ movl $SIG_BLOCK, %ebx
-+ movl $__NR_sigprocmask, %eax
-+ ENTER_KERNEL
-+ popl %ebx
-+ cfi_adjust_cfa_offset (-4)
-+ cfi_restore (ebx)
-+ cmpl $-4095, %eax /* Check %eax for error. */
-+ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
-+
-+ /* All done, return 0 for success. */
-+ xorl %eax, %eax
-+L(pseudo_end):
-+ ret
-+PSEUDO_END(__getcontext)
-+
-+weak_alias (__getcontext, getcontext)
-diff --git a/libc/sysdeps/linux/i386/makecontext.S b/libc/sysdeps/linux/i386/makecontext.S
-new file mode 100644
-index 0000000..d12799d
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/makecontext.S
-@@ -0,0 +1,123 @@
-+/* Create new context.
-+ Copyright (C) 2001,2002,2005,2007,2008,2009 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+
-+ENTRY(__makecontext)
-+ movl 4(%esp), %eax
-+
-+ /* Load the address of the function we are supposed to run. */
-+ movl 8(%esp), %ecx
-+
-+ /* Compute the address of the stack. The information comes from
-+ to us_stack element. */
-+ movl oSS_SP(%eax), %edx
-+ movl %ecx, oEIP(%eax)
-+ addl oSS_SIZE(%eax), %edx
-+
-+ /* Remember the number of parameters for the exit handler since
-+ it has to remove them. We store the number in the EBX register
-+ which the function we will call must preserve. */
-+ movl 12(%esp), %ecx
-+ movl %ecx, oEBX(%eax)
-+
-+ /* Make room on the new stack for the parameters.
-+ Room for the arguments, return address (== L(exitcode)) and
-+ oLINK pointer is needed. One of the pointer sizes is subtracted
-+ after aligning the stack. */
-+ negl %ecx
-+ leal -4(%edx,%ecx,4), %edx
-+ negl %ecx
-+
-+ /* Align the stack. */
-+ andl $0xfffffff0, %edx
-+ subl $4, %edx
-+
-+ /* Store the future stack pointer. */
-+ movl %edx, oESP(%eax)
-+
-+ /* Put the next context on the new stack (from the uc_link
-+ element). */
-+ movl oLINK(%eax), %eax
-+ movl %eax, 4(%edx,%ecx,4)
-+
-+ /* Copy all the parameters. */
-+ jecxz 2f
-+1: movl 12(%esp,%ecx,4), %eax
-+ movl %eax, (%edx,%ecx,4)
-+ decl %ecx
-+ jnz 1b
-+2:
-+
-+ /* If the function we call returns we must continue with the
-+ context which is given in the uc_link element. To do this
-+ set the return address for the function the user provides
-+ to a little bit of helper code which does the magic (see
-+ below). */
-+#ifdef __PIC__
-+ call 1f
-+ cfi_adjust_cfa_offset (4)
-+1: popl %ecx
-+ cfi_adjust_cfa_offset (-4)
-+ addl $L(exitcode)-1b, %ecx
-+ movl %ecx, (%edx)
-+#else
-+ movl $L(exitcode), (%edx)
-+#endif
-+ /* 'makecontext' returns no value. */
-+L(pseudo_end):
-+ ret
-+
-+ /* This is the helper code which gets called if a function which
-+ is registered with 'makecontext' returns. In this case we
-+ have to install the context listed in the uc_link element of
-+ the context 'makecontext' manipulated at the time of the
-+ 'makecontext' call. If the pointer is NULL the process must
-+ terminate. */
-+ cfi_endproc
-+L(exitcode):
-+ /* This removes the parameters passed to the function given to
-+ 'makecontext' from the stack. EBX contains the number of
-+ parameters (see above). */
-+ leal (%esp,%ebx,4), %esp
-+
-+#ifdef __PIC__
-+ call 1f
-+1: popl %ebx
-+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
-+#endif
-+ cmpl $0, (%esp) /* Check the next context. */
-+ je 2f /* If it is zero exit. */
-+
-+ call JUMPTARGET(__setcontext)
-+ /* If this returns (which can happen if the syscall fails) we'll
-+ exit the program with the return error value (-1). */
-+
-+ movl %eax, (%esp)
-+2: call HIDDEN_JUMPTARGET(exit)
-+ /* The 'exit' call should never return. In case it does cause
-+ the process to terminate. */
-+ hlt
-+ cfi_startproc
-+END(__makecontext)
-+
-+weak_alias (__makecontext, makecontext)
-diff --git a/libc/sysdeps/linux/i386/setcontext.S b/libc/sysdeps/linux/i386/setcontext.S
-new file mode 100644
-index 0000000..ae953cc
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/setcontext.S
-@@ -0,0 +1,96 @@
-+/* Install given context.
-+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+
-+ENTRY(__setcontext)
-+ /* Load address of the context data structure. */
-+ movl 4(%esp), %eax
-+
-+ /* Get the current signal mask. Note that we preserve EBX in case
-+ the system call fails and we return from the function with an
-+ error. */
-+ pushl %ebx
-+ cfi_adjust_cfa_offset (4)
-+ xorl %edx, %edx
-+ leal oSIGMASK(%eax), %ecx
-+ movl $SIG_SETMASK, %ebx
-+ cfi_rel_offset (ebx, 0)
-+ movl $__NR_sigprocmask, %eax
-+ ENTER_KERNEL
-+ popl %ebx
-+ cfi_adjust_cfa_offset (-4)
-+ cfi_restore (ebx)
-+ cmpl $-4095, %eax /* Check %eax for error. */
-+ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
-+
-+ /* EAX was modified, reload it. */
-+ movl 4(%esp), %eax
-+
-+ /* Restore the floating-point context. Not the registers, only the
-+ rest. */
-+ movl oFPREGS(%eax), %ecx
-+ fldenv (%ecx)
-+
-+ /* Restore the FS segment register. We don't touch the GS register
-+ since it is used for threads. */
-+ movl oFS(%eax), %ecx
-+ movw %cx, %fs
-+
-+ /* Fetch the address to return to. */
-+ movl oEIP(%eax), %ecx
-+
-+ /* Load the new stack pointer. */
-+ cfi_def_cfa (eax, 0)
-+ cfi_offset (edi, oEDI)
-+ cfi_offset (esi, oESI)
-+ cfi_offset (ebp, oEBP)
-+ cfi_offset (ebx, oEBX)
-+ cfi_offset (edx, oEDX)
-+ cfi_offset (ecx, oECX)
-+ movl oESP(%eax), %esp
-+
-+ /* Push the return address on the new stack so we can return there. */
-+ pushl %ecx
-+
-+ /* Load the values of all the 32-bit registers (except ESP).
-+ Since we are loading from EAX, it must be last. */
-+ movl oEDI(%eax), %edi
-+ movl oESI(%eax), %esi
-+ movl oEBP(%eax), %ebp
-+ movl oEBX(%eax), %ebx
-+ movl oEDX(%eax), %edx
-+ movl oECX(%eax), %ecx
-+ movl oEAX(%eax), %eax
-+
-+ /* End FDE here, we fall into another context. */
-+ cfi_endproc
-+ cfi_startproc
-+
-+ /* The following 'ret' will pop the address of the code and jump
-+ to it. */
-+
-+L(pseudo_end):
-+ ret
-+PSEUDO_END(__setcontext)
-+
-+weak_alias (__setcontext, setcontext)
-diff --git a/libc/sysdeps/linux/i386/swapcontext.S b/libc/sysdeps/linux/i386/swapcontext.S
-new file mode 100644
-index 0000000..ee5d0e4
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/swapcontext.S
-@@ -0,0 +1,110 @@
-+/* Save current context and install the given one.
-+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+
-+ENTRY(__swapcontext)
-+ /* Load address of the context data structure we save in. */
-+ movl 4(%esp), %eax
-+
-+ /* Return value of swapcontext. EAX is the only register whose
-+ value is not preserved. */
-+ movl $0, oEAX(%eax)
-+
-+ /* Save the 32-bit register values and the return address. */
-+ movl %ecx, oECX(%eax)
-+ movl %edx, oEDX(%eax)
-+ movl %edi, oEDI(%eax)
-+ movl %esi, oESI(%eax)
-+ movl %ebp, oEBP(%eax)
-+ movl (%esp), %ecx
-+ movl %ecx, oEIP(%eax)
-+ leal 4(%esp), %ecx
-+ movl %ecx, oESP(%eax)
-+ movl %ebx, oEBX(%eax)
-+
-+ /* Save the FS segment register. */
-+ xorl %edx, %edx
-+ movw %fs, %dx
-+ movl %edx, oFS(%eax)
-+
-+ /* We have separate floating-point register content memory on the
-+ stack. We use the __fpregs_mem block in the context. Set the
-+ links up correctly. */
-+ leal oFPREGSMEM(%eax), %ecx
-+ movl %ecx, oFPREGS(%eax)
-+ /* Save the floating-point context. */
-+ fnstenv (%ecx)
-+
-+ /* Load address of the context data structure we have to load. */
-+ movl 8(%esp), %ecx
-+
-+ /* Save the current signal mask and install the new one. */
-+ pushl %ebx
-+ leal oSIGMASK(%eax), %edx
-+ leal oSIGMASK(%ecx), %ecx
-+ movl $SIG_SETMASK, %ebx
-+ movl $__NR_sigprocmask, %eax
-+ ENTER_KERNEL
-+ popl %ebx
-+ cmpl $-4095, %eax /* Check %eax for error. */
-+ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
-+
-+ /* EAX was modified, reload it. */
-+ movl 8(%esp), %eax
-+
-+ /* Restore the floating-point context. Not the registers, only the
-+ rest. */
-+ movl oFPREGS(%eax), %ecx
-+ fldenv (%ecx)
-+
-+ /* Restore the FS segment register. We don't touch the GS register
-+ since it is used for threads. */
-+ movl oFS(%eax), %edx
-+ movw %dx, %fs
-+
-+ /* Fetch the address to return to. */
-+ movl oEIP(%eax), %ecx
-+
-+ /* Load the new stack pointer. */
-+ movl oESP(%eax), %esp
-+
-+ /* Push the return address on the new stack so we can return there. */
-+ pushl %ecx
-+
-+ /* Load the values of all the 32-bit registers (except ESP).
-+ Since we are loading from EAX, it must be last. */
-+ movl oEDI(%eax), %edi
-+ movl oESI(%eax), %esi
-+ movl oEBP(%eax), %ebp
-+ movl oEBX(%eax), %ebx
-+ movl oEDX(%eax), %edx
-+ movl oECX(%eax), %ecx
-+ movl oEAX(%eax), %eax
-+
-+ /* The following 'ret' will pop the address of the code and jump
-+ to it. */
-+L(pseudo_end):
-+ ret
-+PSEUDO_END(__swapcontext)
-+
-+weak_alias (__swapcontext, swapcontext)
-diff --git a/libc/sysdeps/linux/i386/ucontext_i.sym b/libc/sysdeps/linux/i386/ucontext_i.sym
-new file mode 100644
-index 0000000..b11a550
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/ucontext_i.sym
-@@ -0,0 +1,30 @@
-+#include <stddef.h>
-+#include <signal.h>
-+#include <sys/ucontext.h>
-+
-+--
-+
-+SIG_BLOCK
-+SIG_SETMASK
-+
-+#define ucontext(member) offsetof (ucontext_t, member)
-+#define mcontext(member) ucontext (uc_mcontext.member)
-+#define mreg(reg) mcontext (gregs[REG_##reg])
-+
-+oLINK ucontext (uc_link)
-+oSS_SP ucontext (uc_stack.ss_sp)
-+oSS_SIZE ucontext (uc_stack.ss_size)
-+oGS mreg (GS)
-+oFS mreg (FS)
-+oEDI mreg (EDI)
-+oESI mreg (ESI)
-+oEBP mreg (EBP)
-+oESP mreg (ESP)
-+oEBX mreg (EBX)
-+oEDX mreg (EDX)
-+oECX mreg (ECX)
-+oEAX mreg (EAX)
-+oEIP mreg (EIP)
-+oFPREGS mcontext (fpregs)
-+oSIGMASK ucontext (uc_sigmask)
-+oFPREGSMEM ucontext (__fpregs_mem)
-diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch
-index fce99f8..00b9331 100644
---- a/libc/sysdeps/linux/mips/Makefile.arch
-+++ b/libc/sysdeps/linux/mips/Makefile.arch
-@@ -27,3 +27,7 @@ ASFLAGS-syscall_error.S += -D_LIBC_REENTRANT
-
- ARCH_HEADERS := sgidefs.h
- # regdef.h
-+
-+ifeq ($(UCLIBC_HAS_CONTEXT_FUNCS),y)
-+SSRC += makecontext.S setcontext.S getcontext.S swapcontext.S
-+endif
-diff --git a/libc/sysdeps/linux/mips/getcontext.S b/libc/sysdeps/linux/mips/getcontext.S
-new file mode 100644
-index 0000000..c4ad081
---- /dev/null
-+++ b/libc/sysdeps/linux/mips/getcontext.S
-@@ -0,0 +1,148 @@
-+/* Save current context.
-+ Copyright (C) 2009 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Maciej W. Rozycki <macro@codesourcery.com>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library. If not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+#include <sys/asm.h>
-+#include <sys/fpregdef.h>
-+#include <sys/regdef.h>
-+
-+#include "ucontext_i.h"
-+
-+/* int getcontext (ucontext_t *ucp) */
-+
-+ .text
-+LOCALSZ = 0
-+MASK = 0x00000000
-+#ifdef __PIC__
-+LOCALSZ = 1 /* save gp */
-+# if _MIPS_SIM != _ABIO32
-+MASK = 0x10000000
-+# endif
-+#endif
-+FRAMESZ = ((LOCALSZ * SZREG) + ALSZ) & ALMASK
-+GPOFF = FRAMESZ - (1 * SZREG)
-+
-+NESTED (__getcontext, FRAMESZ, ra)
-+ .mask MASK, 0
-+ .fmask 0x00000000, 0
-+
-+#ifdef __PIC__
-+ SETUP_GP
-+
-+ move a2, sp
-+# define _SP a2
-+
-+# if _MIPS_SIM != _ABIO32
-+ move a3, gp
-+# define _GP a3
-+# endif
-+
-+ PTR_ADDIU sp, -FRAMESZ
-+ SETUP_GP64 (GPOFF, __getcontext)
-+ SAVE_GP (GPOFF)
-+
-+#else /* ! __PIC__ */
-+# define _SP sp
-+# define _GP gp
-+
-+#endif /* ! __PIC__ */
-+
-+#ifdef PROF
-+ .set noat
-+ move AT, ra
-+ jal _mcount
-+ .set at
-+#endif
-+
-+ /* Store a magic flag. */
-+ li v1, 1
-+ REG_S v1, (0 * SZREG + MCONTEXT_GREGS)(a0) /* zero */
-+
-+ REG_S s0, (16 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s1, (17 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s2, (18 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s3, (19 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s4, (20 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s5, (21 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s6, (22 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s7, (23 * SZREG + MCONTEXT_GREGS)(a0)
-+#if ! defined (__PIC__) || _MIPS_SIM != _ABIO32
-+ REG_S _GP, (28 * SZREG + MCONTEXT_GREGS)(a0)
-+#endif
-+ REG_S _SP, (29 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S fp, (30 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S ra, (31 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S ra, MCONTEXT_PC(a0)
-+
-+#ifdef __mips_hard_float
-+# if _MIPS_SIM == _ABI64
-+ s.d fs0, (24 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs1, (25 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs2, (26 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs3, (27 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs5, (29 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs6, (30 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs7, (31 * SZREG + MCONTEXT_FPREGS)(a0)
-+
-+# else /* _MIPS_SIM != _ABI64 */
-+ s.d fs0, (20 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs1, (22 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs2, (24 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs3, (26 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs5, (30 * SZREG + MCONTEXT_FPREGS)(a0)
-+
-+# endif /* _MIPS_SIM != _ABI64 */
-+
-+ cfc1 v1, fcr31
-+ sw v1, MCONTEXT_FPC_CSR(a0)
-+#endif /* __mips_hard_float */
-+
-+/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
-+ li a3, _NSIG8
-+ PTR_ADDU a2, a0, UCONTEXT_SIGMASK
-+ move a1, zero
-+ li a0, SIG_BLOCK
-+
-+ li v0, SYS_ify (rt_sigprocmask)
-+ syscall
-+ bnez a3, 99f
-+
-+#ifdef __PIC__
-+ RESTORE_GP64
-+ PTR_ADDIU sp, FRAMESZ
-+#endif
-+ move v0, zero
-+ jr ra
-+
-+99:
-+#ifdef __PIC__
-+ PTR_LA t9, JUMPTARGET (__syscall_error)
-+ RESTORE_GP64
-+ PTR_ADDIU sp, FRAMESZ
-+ jr t9
-+
-+#else /* ! __PIC__ */
-+
-+ j JUMPTARGET (__syscall_error)
-+#endif /* ! __PIC__ */
-+PSEUDO_END (__getcontext)
-+
-+weak_alias (__getcontext, getcontext)
-diff --git a/libc/sysdeps/linux/mips/kernel_rt_sigframe.h b/libc/sysdeps/linux/mips/kernel_rt_sigframe.h
-new file mode 100644
-index 0000000..77ffaf6
---- /dev/null
-+++ b/libc/sysdeps/linux/mips/kernel_rt_sigframe.h
-@@ -0,0 +1,10 @@
-+/* Linux kernel RT signal frame. */
-+typedef struct kernel_rt_sigframe
-+ {
-+ uint32_t rs_ass[4];
-+ uint32_t rs_code[2];
-+ siginfo_t rs_info;
-+ struct ucontext rs_uc;
-+ uint32_t rs_altcode[8] __attribute__ ((__aligned__ (1 << 7)));
-+ }
-+kernel_rt_sigframe_t;
-diff --git a/libc/sysdeps/linux/mips/makecontext.S b/libc/sysdeps/linux/mips/makecontext.S
-new file mode 100644
-index 0000000..6427339
---- /dev/null
-+++ b/libc/sysdeps/linux/mips/makecontext.S
-@@ -0,0 +1,188 @@
-+/* Modify saved context.
-+ Copyright (C) 2009 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Maciej W. Rozycki <macro@codesourcery.com>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library. If not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+#include <sys/asm.h>
-+#include <sys/fpregdef.h>
-+#include <sys/regdef.h>
-+
-+#include "ucontext_i.h"
-+
-+/* int makecontext (ucontext_t *ucp, (void *func) (), int argc, ...) */
-+
-+ .text
-+LOCALSZ = 0
-+ARGSZ = 0
-+MASK = 0x00000000
-+#ifdef __PIC__
-+LOCALSZ = 1 /* save gp */
-+#endif
-+#if _MIPS_SIM != _ABIO32
-+ARGSZ = 5 /* save a3-a7 */
-+# ifdef __PIC__
-+MASK = 0x10000000
-+# endif
-+#endif
-+FRAMESZ = (((ARGSZ + LOCALSZ) * SZREG) + ALSZ) & ALMASK
-+GPOFF = FRAMESZ - ((ARGSZ + 1) * SZREG)
-+#if _MIPS_SIM != _ABIO32
-+A3OFF = FRAMESZ - (5 * SZREG) /* callee-allocated */
-+A4OFF = FRAMESZ - (4 * SZREG)
-+A5OFF = FRAMESZ - (3 * SZREG)
-+A6OFF = FRAMESZ - (2 * SZREG)
-+A7OFF = FRAMESZ - (1 * SZREG)
-+NARGREGS = 8
-+#else
-+A3OFF = FRAMESZ + (3 * SZREG) /* caller-allocated */
-+NARGREGS = 4
-+#endif
-+
-+NESTED (__makecontext, FRAMESZ, ra)
-+ .mask MASK, -(ARGSZ * SZREG)
-+ .fmask 0x00000000, 0
-+
-+98:
-+#ifdef __PIC__
-+ SETUP_GP
-+#endif
-+
-+ PTR_ADDIU sp, -FRAMESZ
-+
-+#ifdef __PIC__
-+ SETUP_GP64 (GPOFF, __makecontext)
-+ SAVE_GP (GPOFF)
-+#endif
-+
-+#ifdef PROF
-+ .set noat
-+ move AT, ra
-+ jal _mcount
-+ .set at
-+#endif
-+
-+ /* Store args to be passed. */
-+ REG_S a3, A3OFF(sp)
-+#if _MIPS_SIM != _ABIO32
-+ REG_S a4, A4OFF(sp)
-+ REG_S a5, A5OFF(sp)
-+ REG_S a6, A6OFF(sp)
-+ REG_S a7, A7OFF(sp)
-+#endif
-+
-+ /* Store a magic flag. */
-+ li v1, 1
-+ REG_S v1, (0 * SZREG + MCONTEXT_GREGS)(a0) /* zero */
-+
-+ /* Set up the stack. */
-+ PTR_L t0, STACK_SP(a0)
-+ PTR_L t2, STACK_SIZE(a0)
-+ PTR_ADDIU t1, sp, A3OFF
-+ PTR_ADDU t0, t2
-+ and t0, ALMASK
-+ blez a2, 2f /* no arguments */
-+
-+ /* Store register arguments. */
-+ PTR_ADDIU t2, a0, MCONTEXT_GREGS + 4 * SZREG
-+ move t3, zero
-+0:
-+ addiu t3, 1
-+ REG_L v1, (t1)
-+ PTR_ADDIU t1, SZREG
-+ REG_S v1, (t2)
-+ PTR_ADDIU t2, SZREG
-+ bgeu t3, a2, 2f /* all done */
-+ bltu t3, NARGREGS, 0b /* next */
-+
-+ /* Make room for stack arguments. */
-+ PTR_SUBU t2, a2, t3
-+ PTR_SLL t2, 3
-+ PTR_SUBU t0, t2
-+ and t0, ALMASK
-+
-+ /* Store stack arguments. */
-+ move t2, t0
-+1:
-+ addiu t3, 1
-+ REG_L v1, (t1)
-+ PTR_ADDIU t1, SZREG
-+ REG_S v1, (t2)
-+ PTR_ADDIU t2, SZREG
-+ bltu t3, a2, 1b /* next */
-+
-+2:
-+#if _MIPS_SIM == _ABIO32
-+ /* Make room for a0-a3 storage. */
-+ PTR_ADDIU t0, -(NARGSAVE * SZREG)
-+#endif
-+ PTR_L v1, UCONTEXT_LINK(a0)
-+#ifdef __PIC__
-+ PTR_ADDIU t9, 99f - 98b
-+#else
-+ PTR_LA t9, 99f
-+#endif
-+ REG_S t0, (29 * SZREG + MCONTEXT_GREGS)(a0) /* sp */
-+ REG_S v1, (16 * SZREG + MCONTEXT_GREGS)(a0) /* s0 */
-+#ifdef __PIC__
-+ REG_S gp, (17 * SZREG + MCONTEXT_GREGS)(a0) /* s1 */
-+#endif
-+ REG_S t9, (31 * SZREG + MCONTEXT_GREGS)(a0) /* ra */
-+ REG_S a1, MCONTEXT_PC(a0)
-+
-+#ifdef __PIC__
-+ RESTORE_GP64
-+ PTR_ADDIU sp, FRAMESZ
-+#endif
-+ jr ra
-+
-+99:
-+#ifdef __PIC__
-+ move gp, s1
-+#endif
-+ move a0, zero
-+ beqz s0, 0f
-+
-+ /* setcontext (ucp) */
-+ move a0, s0
-+#ifdef __PIC__
-+ PTR_LA t9, JUMPTARGET (__setcontext)
-+ jalr t9
-+# if _MIPS_SIM == _ABIO32
-+ move gp, s1
-+# endif
-+#else
-+ jal JUMPTARGET (__setcontext)
-+#endif
-+ move a0, v0
-+
-+0:
-+ /* exit (a0) */
-+#ifdef __PIC__
-+ PTR_LA t9, HIDDEN_JUMPTARGET (exit)
-+ jalr t9
-+#else
-+ jal HIDDEN_JUMPTARGET (exit)
-+#endif
-+
-+ /* You don't exist, you won't feel anything. */
-+1:
-+ lb zero, (zero)
-+ b 1b
-+PSEUDO_END (__makecontext)
-+
-+weak_alias (__makecontext, makecontext)
-diff --git a/libc/sysdeps/linux/mips/setcontext.S b/libc/sysdeps/linux/mips/setcontext.S
-new file mode 100644
-index 0000000..d3cde0e
---- /dev/null
-+++ b/libc/sysdeps/linux/mips/setcontext.S
-@@ -0,0 +1,191 @@
-+/* Set current context.
-+ Copyright (C) 2009 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Maciej W. Rozycki <macro@codesourcery.com>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library. If not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+#include <sys/asm.h>
-+#include <sys/fpregdef.h>
-+#include <sys/regdef.h>
-+
-+#include "ucontext_i.h"
-+
-+/* int setcontext (const ucontext_t *ucp) */
-+
-+ .text
-+LOCALSZ = 0
-+ARGSZ = 0
-+MASK = 0x00000000
-+#ifdef __PIC__
-+LOCALSZ = 1 /* save gp */
-+#endif
-+#if _MIPS_SIM != _ABIO32
-+ARGSZ = 1 /* save a0 */
-+# ifdef __PIC__
-+MASK = 0x10000000
-+# endif
-+#endif
-+FRAMESZ = (((ARGSZ + LOCALSZ) * SZREG) + ALSZ) & ALMASK
-+GPOFF = FRAMESZ - ((ARGSZ + 1) * SZREG)
-+#if _MIPS_SIM != _ABIO32
-+A0OFF = FRAMESZ - (1 * SZREG) /* callee-allocated */
-+#else
-+A0OFF = FRAMESZ + (0 * SZREG) /* caller-allocated */
-+#endif
-+
-+NESTED (__setcontext, FRAMESZ, ra)
-+ .mask MASK, -(ARGSZ * SZREG)
-+ .fmask 0x00000000, 0
-+
-+#ifdef __PIC__
-+ SETUP_GP
-+#endif
-+
-+ PTR_ADDIU sp, -FRAMESZ
-+
-+#ifdef __PIC__
-+ SETUP_GP64 (GPOFF, __setcontext)
-+ SAVE_GP (GPOFF)
-+#endif
-+
-+#ifdef PROF
-+ .set noat
-+ move AT, ra
-+ jal _mcount
-+ .set at
-+#endif
-+
-+ /* Check for the magic flag. */
-+ li v0, 1
-+ REG_L v1, (0 * SZREG + MCONTEXT_GREGS)(a0) /* zero */
-+ bne v0, v1, 98f
-+
-+ REG_S a0, A0OFF(sp)
-+
-+/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
-+ li a3, _NSIG8
-+ move a2, zero
-+ PTR_ADDU a1, a0, UCONTEXT_SIGMASK
-+ li a0, SIG_SETMASK
-+
-+ li v0, SYS_ify (rt_sigprocmask)
-+ syscall
-+ bnez a3, 99f
-+
-+ REG_L v0, A0OFF(sp)
-+
-+#ifdef __mips_hard_float
-+# if _MIPS_SIM == _ABI64
-+ l.d fs0, (24 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs1, (25 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs2, (26 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs3, (27 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs5, (29 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs6, (30 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs7, (31 * SZREG + MCONTEXT_FPREGS)(v0)
-+
-+# else /* _MIPS_SIM != _ABI64 */
-+ l.d fs0, (20 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs1, (22 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs2, (24 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs3, (26 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs5, (30 * SZREG + MCONTEXT_FPREGS)(v0)
-+
-+# endif /* _MIPS_SIM != _ABI64 */
-+
-+ lw v1, MCONTEXT_FPC_CSR(v0)
-+ ctc1 v1, fcr31
-+#endif /* __mips_hard_float */
-+
-+ /* Note the contents of argument registers will be random
-+ unless makecontext() has been called. */
-+ REG_L a0, (4 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a1, (5 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a2, (6 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a3, (7 * SZREG + MCONTEXT_GREGS)(v0)
-+#if _MIPS_SIM != _ABIO32
-+ REG_L a4, (8 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a5, (9 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a6, (10 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a7, (11 * SZREG + MCONTEXT_GREGS)(v0)
-+#endif
-+
-+ REG_L s0, (16 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s1, (17 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s2, (18 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s3, (19 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s4, (20 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s5, (21 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s6, (22 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s7, (23 * SZREG + MCONTEXT_GREGS)(v0)
-+#if ! defined (__PIC__) || _MIPS_SIM != _ABIO32
-+ REG_L gp, (28 * SZREG + MCONTEXT_GREGS)(v0)
-+#endif
-+ REG_L sp, (29 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L fp, (30 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L ra, (31 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L t9, MCONTEXT_PC(v0)
-+
-+ move v0, zero
-+ jr t9
-+
-+98:
-+ /* This is a context obtained from a signal handler.
-+ Perform a full restore by pushing the context
-+ passed onto a simulated signal frame on the stack
-+ and call the signal return syscall as if a signal
-+ handler exited normally. */
-+ PTR_ADDIU sp, -((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
-+
-+ /* Only ucontext is referred to from rt_sigreturn,
-+ copy it. */
-+ PTR_ADDIU t1, sp, RT_SIGFRAME_UCONTEXT
-+ li t3, ((UCONTEXT_SIZE + SZREG - 1) / SZREG) - 1
-+0:
-+ REG_L t2, (a0)
-+ PTR_ADDIU a0, SZREG
-+ REG_S t2, (t1)
-+ PTR_ADDIU t1, SZREG
-+ .set noreorder
-+ bgtz t3, 0b
-+ addiu t3, -1
-+ .set reorder
-+
-+/* rt_sigreturn () -- no arguments, sp points to struct rt_sigframe. */
-+ li v0, SYS_ify (rt_sigreturn)
-+ syscall
-+
-+ /* Restore the stack and fall through to the error
-+ path. Successful rt_sigreturn never returns to
-+ its calling place. */
-+ PTR_ADDIU sp, ((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
-+99:
-+#ifdef __PIC__
-+ PTR_LA t9, JUMPTARGET (__syscall_error)
-+ RESTORE_GP64
-+ PTR_ADDIU sp, FRAMESZ
-+ jr t9
-+
-+#else /* ! __PIC__ */
-+
-+ j JUMPTARGET (__syscall_error)
-+#endif /* ! __PIC__ */
-+PSEUDO_END (__setcontext)
-+
-+weak_alias (__setcontext, setcontext)
-diff --git a/libc/sysdeps/linux/mips/swapcontext.S b/libc/sysdeps/linux/mips/swapcontext.S
-new file mode 100644
-index 0000000..c7ac19b
---- /dev/null
-+++ b/libc/sysdeps/linux/mips/swapcontext.S
-@@ -0,0 +1,211 @@
-+/* Save and set current context.
-+ Copyright (C) 2009 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Maciej W. Rozycki <macro@codesourcery.com>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library. If not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+#include <sys/asm.h>
-+#include <sys/fpregdef.h>
-+#include <sys/regdef.h>
-+
-+#include "ucontext_i.h"
-+
-+/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
-+
-+ .text
-+LOCALSZ = 0
-+ARGSZ = 0
-+MASK = 0x00000000
-+#ifdef __PIC__
-+LOCALSZ = 1 /* save gp */
-+#endif
-+#if _MIPS_SIM != _ABIO32
-+ARGSZ = 1 /* save a1 */
-+# ifdef __PIC__
-+MASK = 0x10000000
-+# endif
-+#endif
-+FRAMESZ = (((ARGSZ + LOCALSZ) * SZREG) + ALSZ) & ALMASK
-+GPOFF = FRAMESZ - ((ARGSZ + 1) * SZREG)
-+#if _MIPS_SIM != _ABIO32
-+A1OFF = FRAMESZ - (1 * SZREG) /* callee-allocated */
-+#else
-+A1OFF = FRAMESZ + (1 * SZREG) /* caller-allocated */
-+#endif
-+
-+NESTED (__swapcontext, FRAMESZ, ra)
-+ .mask MASK, -(ARGSZ * SZREG)
-+ .fmask 0x00000000, 0
-+
-+#ifdef __PIC__
-+ SETUP_GP
-+
-+ move a2, sp
-+# define _SP a2
-+
-+# if _MIPS_SIM != _ABIO32
-+ move a3, gp
-+# define _GP a3
-+# endif
-+
-+ PTR_ADDIU sp, -FRAMESZ
-+ SETUP_GP64 (GPOFF, __swapcontext)
-+ SAVE_GP (GPOFF)
-+
-+#else /* ! __PIC__ */
-+# define _SP sp
-+# define _GP gp
-+
-+#endif /* ! __PIC__ */
-+
-+#ifdef PROF
-+ .set noat
-+ move AT, ra
-+ jal _mcount
-+ .set at
-+#endif
-+
-+ /* Store a magic flag. */
-+ li v1, 1
-+ REG_S v1, (0 * SZREG + MCONTEXT_GREGS)(a0) /* zero */
-+
-+ REG_S s0, (16 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s1, (17 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s2, (18 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s3, (19 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s4, (20 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s5, (21 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s6, (22 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S s7, (23 * SZREG + MCONTEXT_GREGS)(a0)
-+#if ! defined (__PIC__) || _MIPS_SIM != _ABIO32
-+ REG_S _GP, (28 * SZREG + MCONTEXT_GREGS)(a0)
-+#endif
-+ REG_S _SP, (29 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S fp, (30 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S ra, (31 * SZREG + MCONTEXT_GREGS)(a0)
-+ REG_S ra, MCONTEXT_PC(a0)
-+
-+#ifdef __mips_hard_float
-+# if _MIPS_SIM == _ABI64
-+ s.d fs0, (24 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs1, (25 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs2, (26 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs3, (27 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs5, (29 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs6, (30 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs7, (31 * SZREG + MCONTEXT_FPREGS)(a0)
-+
-+# else /* _MIPS_SIM != _ABI64 */
-+ s.d fs0, (20 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs1, (22 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs2, (24 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs3, (26 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(a0)
-+ s.d fs5, (30 * SZREG + MCONTEXT_FPREGS)(a0)
-+
-+# endif /* _MIPS_SIM != _ABI64 */
-+
-+ cfc1 v1, fcr31
-+ sw v1, MCONTEXT_FPC_CSR(a0)
-+#endif /* __mips_hard_float */
-+
-+ REG_S a1, A1OFF(sp)
-+
-+/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, &oucp->uc_sigmask, _NSIG8) */
-+ li a3, _NSIG8
-+ PTR_ADDU a2, a0, UCONTEXT_SIGMASK
-+ PTR_ADDU a1, a1, UCONTEXT_SIGMASK
-+ li a0, SIG_SETMASK
-+
-+ li v0, SYS_ify (rt_sigprocmask)
-+ syscall
-+ bnez a3, 99f
-+
-+ REG_L v0, A1OFF(sp)
-+
-+#ifdef __mips_hard_float
-+# if _MIPS_SIM == _ABI64
-+ l.d fs0, (24 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs1, (25 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs2, (26 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs3, (27 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs5, (29 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs6, (30 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs7, (31 * SZREG + MCONTEXT_FPREGS)(v0)
-+
-+# else /* _MIPS_SIM != _ABI64 */
-+ l.d fs0, (20 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs1, (22 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs2, (24 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs3, (26 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs4, (28 * SZREG + MCONTEXT_FPREGS)(v0)
-+ l.d fs5, (30 * SZREG + MCONTEXT_FPREGS)(v0)
-+
-+# endif /* _MIPS_SIM != _ABI64 */
-+
-+ lw v1, MCONTEXT_FPC_CSR(v0)
-+ ctc1 v1, fcr31
-+#endif /* __mips_hard_float */
-+
-+ /* Note the contents of argument registers will be random
-+ unless makecontext() has been called. */
-+ REG_L a0, (4 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a1, (5 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a2, (6 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a3, (7 * SZREG + MCONTEXT_GREGS)(v0)
-+#if _MIPS_SIM != _ABIO32
-+ REG_L a4, (8 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a5, (9 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a6, (10 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L a7, (11 * SZREG + MCONTEXT_GREGS)(v0)
-+#endif
-+
-+ REG_L s0, (16 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s1, (17 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s2, (18 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s3, (19 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s4, (20 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s5, (21 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s6, (22 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L s7, (23 * SZREG + MCONTEXT_GREGS)(v0)
-+#if ! defined (__PIC__) || _MIPS_SIM != _ABIO32
-+ REG_L gp, (28 * SZREG + MCONTEXT_GREGS)(v0)
-+#endif
-+ REG_L sp, (29 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L fp, (30 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L ra, (31 * SZREG + MCONTEXT_GREGS)(v0)
-+ REG_L t9, MCONTEXT_PC(v0)
-+
-+ move v0, zero
-+ jr t9
-+
-+99:
-+#ifdef __PIC__
-+ PTR_LA t9, JUMPTARGET (__syscall_error)
-+ RESTORE_GP64
-+ PTR_ADDIU sp, FRAMESZ
-+ jr t9
-+
-+#else /* ! __PIC__ */
-+
-+ j JUMPTARGET (__syscall_error)
-+#endif /* ! __PIC__ */
-+PSEUDO_END (__swapcontext)
-+
-+weak_alias (__swapcontext, swapcontext)
-diff --git a/libc/sysdeps/linux/mips/ucontext_i.sym b/libc/sysdeps/linux/mips/ucontext_i.sym
-new file mode 100644
-index 0000000..f14b886
---- /dev/null
-+++ b/libc/sysdeps/linux/mips/ucontext_i.sym
-@@ -0,0 +1,52 @@
-+#include <inttypes.h>
-+#include <signal.h>
-+#include <stddef.h>
-+#include <sys/ucontext.h>
-+
-+#include <kernel_rt_sigframe.h>
-+
-+-- Constants used by the rt_sigprocmask call.
-+
-+SIG_BLOCK
-+SIG_SETMASK
-+
-+_NSIG8 (_NSIG / 8)
-+
-+-- Offsets of the fields in the kernel rt_sigframe_t structure.
-+#define rt_sigframe(member) offsetof (kernel_rt_sigframe_t, member)
-+
-+RT_SIGFRAME_UCONTEXT rt_sigframe (rs_uc)
-+
-+RT_SIGFRAME_SIZE sizeof (kernel_rt_sigframe_t)
-+
-+-- Offsets of the fields in the ucontext_t structure.
-+#define ucontext(member) offsetof (ucontext_t, member)
-+#define stack(member) ucontext (uc_stack.member)
-+#define mcontext(member) ucontext (uc_mcontext.member)
-+
-+UCONTEXT_FLAGS ucontext (uc_flags)
-+UCONTEXT_LINK ucontext (uc_link)
-+UCONTEXT_STACK ucontext (uc_stack)
-+UCONTEXT_MCONTEXT ucontext (uc_mcontext)
-+UCONTEXT_SIGMASK ucontext (uc_sigmask)
-+
-+STACK_SP stack (ss_sp)
-+STACK_SIZE stack (ss_size)
-+STACK_FLAGS stack (ss_flags)
-+
-+MCONTEXT_GREGS mcontext (gregs)
-+MCONTEXT_FPREGS mcontext (fpregs)
-+MCONTEXT_MDHI mcontext (mdhi)
-+MCONTEXT_HI1 mcontext (hi1)
-+MCONTEXT_HI2 mcontext (hi2)
-+MCONTEXT_HI3 mcontext (hi3)
-+MCONTEXT_MDLO mcontext (mdlo)
-+MCONTEXT_LO1 mcontext (lo1)
-+MCONTEXT_LO2 mcontext (lo2)
-+MCONTEXT_LO3 mcontext (lo3)
-+MCONTEXT_PC mcontext (pc)
-+MCONTEXT_FPC_CSR mcontext (fpc_csr)
-+MCONTEXT_USED_MATH mcontext (used_math)
-+MCONTEXT_DSP mcontext (dsp)
-+
-+UCONTEXT_SIZE sizeof (ucontext_t)
-diff --git a/libc/sysdeps/linux/x86_64/Makefile.arch b/libc/sysdeps/linux/x86_64/Makefile.arch
-index 7491d92..93b8259 100644
---- a/libc/sysdeps/linux/x86_64/Makefile.arch
-+++ b/libc/sysdeps/linux/x86_64/Makefile.arch
-@@ -20,3 +20,8 @@ ifeq ($(UCLIBC_HAS_TLS),y)
- SSRC += sched_getcpu.S
- endif
- endif
-+
-+ifeq ($(UCLIBC_HAS_CONTEXT_FUNCS),y)
-+CSRC += makecontext.c
-+SSRC += setcontext.S getcontext.S swapcontext.S __start_context.S
-+endif
-diff --git a/libc/sysdeps/linux/x86_64/__start_context.S b/libc/sysdeps/linux/x86_64/__start_context.S
-new file mode 100644
-index 0000000..9f2ee23
---- /dev/null
-+++ b/libc/sysdeps/linux/x86_64/__start_context.S
-@@ -0,0 +1,49 @@
-+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+/* This is the helper code which gets called if a function which is
-+ registered with 'makecontext' returns. In this case we have to
-+ install the context listed in the uc_link element of the context
-+ 'makecontext' manipulated at the time of the 'makecontext' call.
-+ If the pointer is NULL the process must terminate. */
-+
-+
-+ENTRY(__start_context)
-+ /* This removes the parameters passed to the function given to
-+ 'makecontext' from the stack. RBX contains the address
-+ on the stack pointer for the next context. */
-+ movq %rbx, %rsp
-+
-+ popq %rdi /* This is the next context. */
-+ cfi_adjust_cfa_offset(-8)
-+ testq %rdi, %rdi
-+ je 2f /* If it is zero exit. */
-+
-+ call JUMPTARGET(__setcontext)
-+ /* If this returns (which can happen if the syscall fails) we'll
-+ exit the program with the return error value (-1). */
-+ movq %rax,%rdi
-+
-+2:
-+ call HIDDEN_JUMPTARGET(exit)
-+ /* The 'exit' call should never return. In case it does cause
-+ the process to terminate. */
-+ hlt
-+END(__start_context)
-diff --git a/libc/sysdeps/linux/x86_64/getcontext.S b/libc/sysdeps/linux/x86_64/getcontext.S
-new file mode 100644
-index 0000000..dcebc4f
---- /dev/null
-+++ b/libc/sysdeps/linux/x86_64/getcontext.S
-@@ -0,0 +1,88 @@
-+/* Save current context.
-+ Copyright (C) 2002-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+/* int __getcontext (ucontext_t *ucp)
-+
-+ Saves the machine context in UCP such that when it is activated,
-+ it appears as if __getcontext() returned again.
-+
-+ This implementation is intended to be used for *synchronous* context
-+ switches only. Therefore, it does not have to save anything
-+ other than the PRESERVED state. */
-+
-+
-+ENTRY(__getcontext)
-+ /* Save the preserved registers, the registers used for passing
-+ args, and the return address. */
-+ movq %rbx, oRBX(%rdi)
-+ movq %rbp, oRBP(%rdi)
-+ movq %r12, oR12(%rdi)
-+ movq %r13, oR13(%rdi)
-+ movq %r14, oR14(%rdi)
-+ movq %r15, oR15(%rdi)
-+
-+ movq %rdi, oRDI(%rdi)
-+ movq %rsi, oRSI(%rdi)
-+ movq %rdx, oRDX(%rdi)
-+ movq %rcx, oRCX(%rdi)
-+ movq %r8, oR8(%rdi)
-+ movq %r9, oR9(%rdi)
-+
-+ movq (%rsp), %rcx
-+ movq %rcx, oRIP(%rdi)
-+ leaq 8(%rsp), %rcx /* Exclude the return address. */
-+ movq %rcx, oRSP(%rdi)
-+
-+ /* We have separate floating-point register content memory on the
-+ stack. We use the __fpregs_mem block in the context. Set the
-+ links up correctly. */
-+
-+ leaq oFPREGSMEM(%rdi), %rcx
-+ movq %rcx, oFPREGS(%rdi)
-+ /* Save the floating-point environment. */
-+ fnstenv (%rcx)
-+ fldenv (%rcx)
-+ stmxcsr oMXCSR(%rdi)
-+
-+ /* Save the current signal mask with
-+ rt_sigprocmask (SIG_BLOCK, NULL, set,_NSIG/8). */
-+ leaq oSIGMASK(%rdi), %rdx
-+ xorl %esi,%esi
-+#if SIG_BLOCK == 0
-+ xorl %edi, %edi
-+#else
-+ movl $SIG_BLOCK, %edi
-+#endif
-+ movl $_NSIG8,%r10d
-+ movl $__NR_rt_sigprocmask, %eax
-+ syscall
-+ cmpq $-4095, %rax /* Check %rax for error. */
-+ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
-+
-+ /* All done, return 0 for success. */
-+ xorl %eax, %eax
-+L(pseudo_end):
-+ ret
-+PSEUDO_END(__getcontext)
-+
-+weak_alias (__getcontext, getcontext)
-diff --git a/libc/sysdeps/linux/x86_64/makecontext.c b/libc/sysdeps/linux/x86_64/makecontext.c
-new file mode 100644
-index 0000000..5473031
---- /dev/null
-+++ b/libc/sysdeps/linux/x86_64/makecontext.c
-@@ -0,0 +1,121 @@
-+/* Create new context.
-+ Copyright (C) 2002, 2004, 2005, 2008 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+#include <stdarg.h>
-+#include <stdint.h>
-+#include <ucontext.h>
-+
-+#include "ucontext_i.h"
-+
-+/* This implementation can handle any ARGC value but only
-+ normal integer parameters.
-+ makecontext sets up a stack and the registers for the
-+ user context. The stack looks like this:
-+ +-----------------------+
-+ | next context |
-+ +-----------------------+
-+ | parameter 7-n |
-+ +-----------------------+
-+ | trampoline address |
-+ %rsp -> +-----------------------+
-+
-+ The registers are set up like this:
-+ %rdi,%rsi,%rdx,%rcx,%r8,%r9: parameter 1 to 6
-+ %rbx : address of next context
-+ %rsp : stack pointer.
-+*/
-+
-+/* XXX: This implementation currently only handles integer arguments.
-+ To handle long int and pointer arguments the va_arg arguments needs
-+ to be changed to long and also the stdlib/tst-setcontext.c file needs
-+ to be changed to pass long arguments to makecontext. */
-+
-+
-+void
-+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
-+{
-+ extern void __start_context (void);
-+ greg_t *sp;
-+ unsigned int idx_uc_link;
-+ va_list ap;
-+ int i;
-+
-+ /* Generate room on stack for parameter if needed and uc_link. */
-+ sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp
-+ + ucp->uc_stack.ss_size);
-+ sp -= (argc > 6 ? argc - 6 : 0) + 1;
-+ /* Align stack and make space for trampoline address. */
-+ sp = (greg_t *) ((((uintptr_t) sp) & -16L) - 8);
-+
-+ idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
-+
-+ /* Setup context ucp. */
-+ /* Address to jump to. */
-+ ucp->uc_mcontext.gregs[REG_RIP] = (uintptr_t) func;
-+ /* Setup rbx.*/
-+ ucp->uc_mcontext.gregs[REG_RBX] = (uintptr_t) &sp[idx_uc_link];
-+ ucp->uc_mcontext.gregs[REG_RSP] = (uintptr_t) sp;
-+
-+ /* Setup stack. */
-+ sp[0] = (uintptr_t) &__start_context;
-+ sp[idx_uc_link] = (uintptr_t) ucp->uc_link;
-+
-+ va_start (ap, argc);
-+ /* Handle arguments.
-+
-+ The standard says the parameters must all be int values. This is
-+ an historic accident and would be done differently today. For
-+ x86-64 all integer values are passed as 64-bit values and
-+ therefore extending the API to copy 64-bit values instead of
-+ 32-bit ints makes sense. It does not break existing
-+ functionality and it does not violate the standard which says
-+ that passing non-int values means undefined behavior. */
-+ for (i = 0; i < argc; ++i)
-+ switch (i)
-+ {
-+ case 0:
-+ ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, greg_t);
-+ break;
-+ case 1:
-+ ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, greg_t);
-+ break;
-+ case 2:
-+ ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, greg_t);
-+ break;
-+ case 3:
-+ ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, greg_t);
-+ break;
-+ case 4:
-+ ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, greg_t);
-+ break;
-+ case 5:
-+ ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, greg_t);
-+ break;
-+ default:
-+ /* Put value on stack. */
-+ sp[i - 5] = va_arg (ap, greg_t);
-+ break;
-+ }
-+ va_end (ap);
-+
-+}
-+
-+
-+weak_alias (__makecontext, makecontext)
-diff --git a/libc/sysdeps/linux/x86_64/setcontext.S b/libc/sysdeps/linux/x86_64/setcontext.S
-new file mode 100644
-index 0000000..561ab9f
---- /dev/null
-+++ b/libc/sysdeps/linux/x86_64/setcontext.S
-@@ -0,0 +1,103 @@
-+/* Install given context.
-+ Copyright (C) 2002-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+
-+/* int __setcontext (const ucontext_t *ucp)
-+
-+ Restores the machine context in UCP and thereby resumes execution
-+ in that context.
-+
-+ This implementation is intended to be used for *synchronous* context
-+ switches only. Therefore, it does not have to restore anything
-+ other than the PRESERVED state. */
-+
-+ENTRY(__setcontext)
-+ /* Save argument since syscall will destroy it. */
-+ pushq %rdi
-+ cfi_adjust_cfa_offset(8)
-+
-+ /* Set the signal mask with
-+ rt_sigprocmask (SIG_SETMASK, mask, NULL, _NSIG/8). */
-+ leaq oSIGMASK(%rdi), %rsi
-+ xorl %edx, %edx
-+ movl $SIG_SETMASK, %edi
-+ movl $_NSIG8,%r10d
-+ movl $__NR_rt_sigprocmask, %eax
-+ syscall
-+ popq %rdi /* Reload %rdi, adjust stack. */
-+ cfi_adjust_cfa_offset(-8)
-+ cmpq $-4095, %rax /* Check %rax for error. */
-+ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
-+
-+ /* Restore the floating-point context. Not the registers, only the
-+ rest. */
-+ movq oFPREGS(%rdi), %rcx
-+ fldenv (%rcx)
-+ ldmxcsr oMXCSR(%rdi)
-+
-+
-+ /* Load the new stack pointer, the preserved registers and
-+ registers used for passing args. */
-+ cfi_def_cfa(%rdi, 0)
-+ cfi_offset(%rbx,oRBX)
-+ cfi_offset(%rbp,oRBP)
-+ cfi_offset(%r12,oR12)
-+ cfi_offset(%r13,oR13)
-+ cfi_offset(%r14,oR14)
-+ cfi_offset(%r15,oR15)
-+ cfi_offset(%rsp,oRSP)
-+ cfi_offset(%rip,oRIP)
-+
-+ movq oRSP(%rdi), %rsp
-+ movq oRBX(%rdi), %rbx
-+ movq oRBP(%rdi), %rbp
-+ movq oR12(%rdi), %r12
-+ movq oR13(%rdi), %r13
-+ movq oR14(%rdi), %r14
-+ movq oR15(%rdi), %r15
-+
-+ /* The following ret should return to the address set with
-+ getcontext. Therefore push the address on the stack. */
-+ movq oRIP(%rdi), %rcx
-+ pushq %rcx
-+
-+ movq oRSI(%rdi), %rsi
-+ movq oRDX(%rdi), %rdx
-+ movq oRCX(%rdi), %rcx
-+ movq oR8(%rdi), %r8
-+ movq oR9(%rdi), %r9
-+
-+ /* Setup finally %rdi. */
-+ movq oRDI(%rdi), %rdi
-+
-+ /* End FDE here, we fall into another context. */
-+ cfi_endproc
-+ cfi_startproc
-+
-+ /* Clear rax to indicate success. */
-+ xorl %eax, %eax
-+L(pseudo_end):
-+ ret
-+PSEUDO_END(__setcontext)
-+
-+weak_alias (__setcontext, setcontext)
-diff --git a/libc/sysdeps/linux/x86_64/swapcontext.S b/libc/sysdeps/linux/x86_64/swapcontext.S
-new file mode 100644
-index 0000000..6d2ebb8
---- /dev/null
-+++ b/libc/sysdeps/linux/x86_64/swapcontext.S
-@@ -0,0 +1,121 @@
-+/* Save current context and install the given one.
-+ Copyright (C) 2002-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <sysdep.h>
-+
-+#include "ucontext_i.h"
-+
-+
-+/* int __swapcontext (ucontext_t *oucp, const ucontext_t *ucp);
-+
-+ Saves the machine context in oucp such that when it is activated,
-+ it appears as if __swapcontextt() returned again, restores the
-+ machine context in ucp and thereby resumes execution in that
-+ context.
-+
-+ This implementation is intended to be used for *synchronous* context
-+ switches only. Therefore, it does not have to save anything
-+ other than the PRESERVED state. */
-+
-+ENTRY(__swapcontext)
-+ /* Save the preserved registers, the registers used for passing args,
-+ and the return address. */
-+ movq %rbx, oRBX(%rdi)
-+ movq %rbp, oRBP(%rdi)
-+ movq %r12, oR12(%rdi)
-+ movq %r13, oR13(%rdi)
-+ movq %r14, oR14(%rdi)
-+ movq %r15, oR15(%rdi)
-+
-+ movq %rdi, oRDI(%rdi)
-+ movq %rsi, oRSI(%rdi)
-+ movq %rdx, oRDX(%rdi)
-+ movq %rcx, oRCX(%rdi)
-+ movq %r8, oR8(%rdi)
-+ movq %r9, oR9(%rdi)
-+
-+ movq (%rsp), %rcx
-+ movq %rcx, oRIP(%rdi)
-+ leaq 8(%rsp), %rcx /* Exclude the return address. */
-+ movq %rcx, oRSP(%rdi)
-+
-+ /* We have separate floating-point register content memory on the
-+ stack. We use the __fpregs_mem block in the context. Set the
-+ links up correctly. */
-+ leaq oFPREGSMEM(%rdi), %rcx
-+ movq %rcx, oFPREGS(%rdi)
-+ /* Save the floating-point environment. */
-+ fnstenv (%rcx)
-+ stmxcsr oMXCSR(%rdi)
-+
-+
-+ /* The syscall destroys some registers, save them. */
-+ movq %rsi, %r12
-+
-+ /* Save the current signal mask and install the new one with
-+ rt_sigprocmask (SIG_BLOCK, newset, oldset,_NSIG/8). */
-+ leaq oSIGMASK(%rdi), %rdx
-+ leaq oSIGMASK(%rsi), %rsi
-+ movl $SIG_SETMASK, %edi
-+ movl $_NSIG8,%r10d
-+ movl $__NR_rt_sigprocmask, %eax
-+ syscall
-+ cmpq $-4095, %rax /* Check %rax for error. */
-+ jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
-+
-+ /* Restore destroyed registers. */
-+ movq %r12, %rsi
-+
-+ /* Restore the floating-point context. Not the registers, only the
-+ rest. */
-+ movq oFPREGS(%rsi), %rcx
-+ fldenv (%rcx)
-+ ldmxcsr oMXCSR(%rsi)
-+
-+ /* Load the new stack pointer and the preserved registers. */
-+ movq oRSP(%rsi), %rsp
-+ movq oRBX(%rsi), %rbx
-+ movq oRBP(%rsi), %rbp
-+ movq oR12(%rsi), %r12
-+ movq oR13(%rsi), %r13
-+ movq oR14(%rsi), %r14
-+ movq oR15(%rsi), %r15
-+
-+ /* The following ret should return to the address set with
-+ getcontext. Therefore push the address on the stack. */
-+ movq oRIP(%rsi), %rcx
-+ pushq %rcx
-+
-+ /* Setup registers used for passing args. */
-+ movq oRDI(%rsi), %rdi
-+ movq oRDX(%rsi), %rdx
-+ movq oRCX(%rsi), %rcx
-+ movq oR8(%rsi), %r8
-+ movq oR9(%rsi), %r9
-+
-+ /* Setup finally %rsi. */
-+ movq oRSI(%rsi), %rsi
-+
-+ /* Clear rax to indicate success. */
-+ xorl %eax, %eax
-+L(pseudo_end):
-+ ret
-+PSEUDO_END(__swapcontext)
-+
-+weak_alias (__swapcontext, swapcontext)
-diff --git a/libc/sysdeps/linux/x86_64/ucontext_i.sym b/libc/sysdeps/linux/x86_64/ucontext_i.sym
-new file mode 100644
-index 0000000..af3e0e5
---- /dev/null
-+++ b/libc/sysdeps/linux/x86_64/ucontext_i.sym
-@@ -0,0 +1,37 @@
-+#include <stddef.h>
-+#include <signal.h>
-+#include <sys/ucontext.h>
-+
-+--
-+
-+SIG_BLOCK
-+SIG_SETMASK
-+
-+_NSIG8 (_NSIG / 8)
-+
-+#define ucontext(member) offsetof (ucontext_t, member)
-+#define mcontext(member) ucontext (uc_mcontext.member)
-+#define mreg(reg) mcontext (gregs[REG_##reg])
-+
-+oRBP mreg (RBP)
-+oRSP mreg (RSP)
-+oRBX mreg (RBX)
-+oR8 mreg (R8)
-+oR9 mreg (R9)
-+oR10 mreg (R10)
-+oR11 mreg (R11)
-+oR12 mreg (R12)
-+oR13 mreg (R13)
-+oR14 mreg (R14)
-+oR15 mreg (R15)
-+oRDI mreg (RDI)
-+oRSI mreg (RSI)
-+oRDX mreg (RDX)
-+oRAX mreg (RAX)
-+oRCX mreg (RCX)
-+oRIP mreg (RIP)
-+oEFL mreg (EFL)
-+oFPREGS mcontext (fpregs)
-+oSIGMASK ucontext (uc_sigmask)
-+oFPREGSMEM ucontext (__fpregs_mem)
-+oMXCSR ucontext (__fpregs_mem.mxcsr)
-diff --git a/libpthread/nptl/sysdeps/Makefile.commonarch b/libpthread/nptl/sysdeps/Makefile.commonarch
-index 0c19216..8f5d61d 100644
---- a/libpthread/nptl/sysdeps/Makefile.commonarch
-+++ b/libpthread/nptl/sysdeps/Makefile.commonarch
-@@ -47,9 +47,8 @@ $(libpthread_arch_OUT)/gen_tcb-offsets.c: $(libpthread_arch_DIR)/tcb-offsets.sym
- $(libpthread_arch_OUT)/gen_tcb-offsets.s: $(libpthread_arch_OUT)/gen_tcb-offsets.c | headers
- $(compile.c)
- libpthread-generated-y += $(libpthread_arch_OUT)/gen_tcb-offsets.s
--PTHREAD_TCB_OFFSET_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
- $(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_OUT)/gen_tcb-offsets.s
-- $(do_sed) $(PTHREAD_TCB_OFFSET_MANGLE) $< > $@
-+ $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
- @if test ! -s $@ ; then rm -f $@ ; false ; fi
-
- pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_arch_OUT)/tcb-offsets.h
-diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
-index 477fb1a..3372214 100644
---- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
-+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
-@@ -177,8 +177,6 @@ CFLAGS-gen_pthread-pi-defines.c = -S
- CFLAGS-gen_structsem.c = -S
- CFLAGS-gen_unwindbuf.c = -S
-
--PTHREAD_GENERATE_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
--
- PTHREAD_LINUX_SYM := $(notdir $(wildcard $(libpthread_linux_DIR)/*.sym))
- PTHREAD_LINUX_SYM_C := $(addprefix $(libpthread_linux_OUT)/gen_,$(PTHREAD_LINUX_SYM:.sym=.c))
- PTHREAD_LINUX_SYM_S := $(PTHREAD_LINUX_SYM_C:.c=.s)
---
-1.8.4
-
diff --git a/main/libc0.9.32/0001-libc-stdlib-add-mkostemp-helpers.patch b/main/libc0.9.32/0001-libc-stdlib-add-mkostemp-helpers.patch
deleted file mode 100644
index 371177f561..0000000000
--- a/main/libc0.9.32/0001-libc-stdlib-add-mkostemp-helpers.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-From 42d1b23fc0f3748b8bf474e456d6c44aa7e563fd Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Wed, 14 Nov 2012 00:30:54 -0500
-Subject: [PATCH] libc/stdlib: add mkostemp helpers
-
-Some projects (like udev) are starting to use this.
-
-Imported from glibc.
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- include/stdlib.h | 23 +++++++++++++++++++++++
- libc/stdlib/Makefile.in | 4 ++--
- libc/stdlib/mkostemp.c | 32 ++++++++++++++++++++++++++++++++
- libc/stdlib/mkostemp64.c | 33 +++++++++++++++++++++++++++++++++
- 4 files changed, 90 insertions(+), 2 deletions(-)
- create mode 100644 libc/stdlib/mkostemp.c
- create mode 100644 libc/stdlib/mkostemp64.c
-
-diff --git a/include/stdlib.h b/include/stdlib.h
-index 354fc66..79ccc55 100644
---- a/include/stdlib.h
-+++ b/include/stdlib.h
-@@ -652,6 +652,29 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
- extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
- #endif
-
-+#ifdef __USE_GNU
-+/* Generate a unique temporary file name from TEMPLATE similar to
-+ mkstemp. But allow the caller to pass additional flags which are
-+ used in the open call to create the file..
-+
-+ This function is a possible cancellation point and therefore not
-+ marked with __THROW. */
-+# ifndef __USE_FILE_OFFSET64
-+extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
-+# else
-+# ifdef __REDIRECT
-+extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
-+ __nonnull ((1)) __wur;
-+# else
-+# define mkostemp mkostemp64
-+# endif
-+# endif
-+# ifdef __USE_LARGEFILE64
-+extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
-+# endif
-+
-+#endif
-+
-
- __BEGIN_NAMESPACE_STD
- /* Execute the given line as a shell command.
-diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
-index 3166b8e..b92f7ce 100644
---- a/libc/stdlib/Makefile.in
-+++ b/libc/stdlib/Makefile.in
-@@ -12,7 +12,7 @@ include $(top_srcdir)libc/stdlib/malloc-simple/Makefile.in
- include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
-
- CSRC-y := \
-- abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c \
-+ abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c mkostemp.c \
- rand.c random.c random_r.c setenv.c div.c ldiv.c lldiv.c \
- getpt.c drand48-iter.c jrand48.c \
- jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
-@@ -21,7 +21,7 @@ CSRC-y := \
- CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c
- CSRC-$(UCLIBC_HAS_PTY) += grantpt.c unlockpt.c ptsname.c
- CSRC-$(UCLIBC_HAS_ARC4RANDOM) += arc4random.c
--CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c
-+CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c mkostemp64.c
- CSRC-$(UCLIBC_HAS_FLOATS) += drand48.c drand48_r.c erand48.c erand48_r.c
- CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_SUSV3_LEGACY)),y) += \
- gcvt.c
-diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c
-new file mode 100644
-index 0000000..93b50fc
---- /dev/null
-+++ b/libc/stdlib/mkostemp.c
-@@ -0,0 +1,32 @@
-+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include "../misc/internals/tempname.h"
-+
-+/* Generate a unique temporary file name from TEMPLATE.
-+ The last six characters of TEMPLATE must be "XXXXXX";
-+ they are replaced with a string that makes the filename unique.
-+ Then open the file and return a fd. */
-+int
-+mkostemp (template, flags)
-+ char *template;
-+ int flags;
-+{
-+ return __gen_tempname (template, __GT_FILE, flags);
-+}
-diff --git a/libc/stdlib/mkostemp64.c b/libc/stdlib/mkostemp64.c
-new file mode 100644
-index 0000000..5509d8c
---- /dev/null
-+++ b/libc/stdlib/mkostemp64.c
-@@ -0,0 +1,33 @@
-+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <fcntl.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include "../misc/internals/tempname.h"
-+
-+/* Generate a unique temporary file name from TEMPLATE.
-+ The last six characters of TEMPLATE must be "XXXXXX";
-+ they are replaced with a string that makes the filename unique.
-+ Then open the file and return a fd. */
-+int
-+mkostemp64 (template, flags)
-+ char *template;
-+ int flags;
-+{
-+ return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE);
-+}
---
-1.8.3.3
-
diff --git a/main/libc0.9.32/0001-libm-x86_64-implement-fegetround.patch b/main/libc0.9.32/0001-libm-x86_64-implement-fegetround.patch
deleted file mode 100644
index cb0a4a17db..0000000000
--- a/main/libc0.9.32/0001-libm-x86_64-implement-fegetround.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From a66161f44853403b2cf464de08753d4b5aa6d2dd Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Thu, 25 Apr 2013 11:28:37 +0000
-Subject: [PATCH] libm/x86_64: implement fegetround
-
----
- libm/x86_64/fegetround.c | 31 +++++++++++++++++++++++++++++++
- 1 file changed, 31 insertions(+)
- create mode 100644 libm/x86_64/fegetround.c
-
-diff --git a/libm/x86_64/fegetround.c b/libm/x86_64/fegetround.c
-new file mode 100644
-index 0000000..8ae0c3a
---- /dev/null
-+++ b/libm/x86_64/fegetround.c
-@@ -0,0 +1,31 @@
-+/* Return current rounding direction.
-+ Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fenv.h>
-+
-+int
-+fegetround (void)
-+{
-+ int cw;
-+
-+ __asm__ ("fnstcw %0" : "=m" (*&cw));
-+
-+ return cw & 0xc00;
-+}
---
-1.8.2.1
-
diff --git a/main/libc0.9.32/0001-librt-add-posix_spawn-support.patch b/main/libc0.9.32/0001-librt-add-posix_spawn-support.patch
deleted file mode 100644
index 29725529ce..0000000000
--- a/main/libc0.9.32/0001-librt-add-posix_spawn-support.patch
+++ /dev/null
@@ -1,853 +0,0 @@
-From 0dcf66744f533e160232072bd03273ca1c448879 Mon Sep 17 00:00:00 2001
-From: Ismael Luceno <ismael.luceno@gmail.com>
-Date: Mon, 5 Mar 2012 06:43:49 -0200
-Subject: [PATCH] librt: add posix_spawn support
-
-Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- Makefile.in | 1 +
- include/spawn.h | 266 +++++++++++++++++++++++++++++++++++++++++
- librt/Makefile.in | 8 ++
- librt/spawn.c | 259 +++++++++++++++++++++++++++++++++++++++
- librt/spawn_faction_addclose.c | 51 ++++++++
- librt/spawn_faction_adddup2.c | 52 ++++++++
- librt/spawn_faction_addopen.c | 55 +++++++++
- librt/spawn_faction_init.c | 42 +++++++
- librt/spawn_int.h | 26 ++++
- 9 files changed, 760 insertions(+)
- create mode 100644 include/spawn.h
- create mode 100644 librt/spawn.c
- create mode 100644 librt/spawn_faction_addclose.c
- create mode 100644 librt/spawn_faction_adddup2.c
- create mode 100644 librt/spawn_faction_addopen.c
- create mode 100644 librt/spawn_faction_init.c
- create mode 100644 librt/spawn_int.h
-
-diff --git a/Makefile.in b/Makefile.in
-index d0ac6c0..82a2eff 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -290,6 +290,7 @@ HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG) += ifaddrs.h
- HEADERS_RM-$(UCLIBC_SV4_DEPRECATED) += ustat.h sys/ustat.h bits/ustat.h
- HEADERS_RM-$(UCLIBC_SUSV3_LEGACY) += sys/timeb.h regexp.h
- HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h ucontext.h
-+HEADERS_RM-$(UCLIBC_HAS_ADVANCED_REALTIME) += spawn.h
-
- ifneq ($(findstring install,$(MAKECMDGOALS)),)
- $(addprefix $(PREFIX)$(DEVEL_PREFIX),include $(MULTILIB_DIR)):
-diff --git a/include/spawn.h b/include/spawn.h
-new file mode 100644
-index 0000000..8b07bb8
---- /dev/null
-+++ b/include/spawn.h
-@@ -0,0 +1,266 @@
-+/* Definitions for POSIX spawn interface.
-+ Copyright (C) 2000,2003,2004,2009,2011,2012 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#ifndef _SPAWN_H
-+#define _SPAWN_H 1
-+
-+#include <errno.h>
-+#include <string.h>
-+#include <stdlib.h>
-+
-+#include <features.h>
-+#include <sched.h>
-+#define __need_sigset_t
-+#include <signal.h>
-+#include <sys/types.h>
-+
-+
-+/* Data structure to contain attributes for thread creation. */
-+typedef struct {
-+ short int __flags;
-+ pid_t __pgrp;
-+ sigset_t __sd;
-+ sigset_t __ss;
-+ struct sched_param __sp;
-+ int __policy;
-+ int __pad[16];
-+} posix_spawnattr_t;
-+
-+
-+/* Data structure to contain information about the actions to be
-+ performed in the new process with respect to file descriptors. */
-+typedef struct {
-+ int __allocated;
-+ int __used;
-+ struct __spawn_action *__actions;
-+ int __pad[16];
-+} posix_spawn_file_actions_t;
-+
-+
-+/* Flags to be set in the `posix_spawnattr_t'. */
-+#define POSIX_SPAWN_RESETIDS 0x01
-+#define POSIX_SPAWN_SETPGROUP 0x02
-+#define POSIX_SPAWN_SETSIGDEF 0x04
-+#define POSIX_SPAWN_SETSIGMASK 0x08
-+#define POSIX_SPAWN_SETSCHEDPARAM 0x10
-+#define POSIX_SPAWN_SETSCHEDULER 0x20
-+#define POSIX_SPAWN_USEVFORK 0x40 /* GNU extension */
-+
-+
-+#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
-+ | POSIX_SPAWN_SETPGROUP \
-+ | POSIX_SPAWN_SETSIGDEF \
-+ | POSIX_SPAWN_SETSIGMASK \
-+ | POSIX_SPAWN_SETSCHEDPARAM \
-+ | POSIX_SPAWN_SETSCHEDULER \
-+ | POSIX_SPAWN_USEVFORK)
-+
-+__BEGIN_DECLS
-+
-+/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
-+ Before running the process perform the actions described in FILE-ACTIONS.
-+
-+ This function is a possible cancellation point and therefore not
-+ marked with __THROW. */
-+int posix_spawn(pid_t * restrict pid, const char * restrict path,
-+ const posix_spawn_file_actions_t * restrict file_actions,
-+ const posix_spawnattr_t * restrict attrp,
-+ char * const argv[restrict],
-+ char * const envp[restrict]);
-+
-+/* Similar to `posix_spawn' but search for FILE in the PATH.
-+
-+ This function is a possible cancellation point and therefore not
-+ marked with __THROW. */
-+int posix_spawnp(pid_t *pid, const char *file,
-+ const posix_spawn_file_actions_t *file_actions,
-+ const posix_spawnattr_t *attrp,
-+ char * const argv[], char * const envp[]);
-+
-+/* Initialize data structure with attributes for `spawn' to default values. */
-+inline static int
-+posix_spawnattr_init(posix_spawnattr_t *attr)
-+{
-+ memset(attr, 0, sizeof(*attr));
-+ return 0;
-+}
-+
-+/* Free resources associated with ATTR. */
-+inline static int
-+posix_spawnattr_destroy(posix_spawnattr_t *attr)
-+{
-+ return 0;
-+}
-+
-+/* Store signal mask for signals with default handling from ATTR in
-+ SIGDEFAULT. */
-+inline static int
-+posix_spawnattr_getsigdefault(const posix_spawnattr_t *attr,
-+ sigset_t *sigdefault)
-+{
-+ memcpy(sigdefault, &attr->__sd, sizeof(sigset_t));
-+ return 0;
-+}
-+
-+
-+/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
-+inline static int
-+posix_spawnattr_setsigdefault(posix_spawnattr_t *attr,
-+ const sigset_t *sigdefault)
-+{
-+ memcpy(&attr->__sd, sigdefault, sizeof(sigset_t));
-+ return 0;
-+}
-+
-+/* Store signal mask for the new process from ATTR in SIGMASK. */
-+inline static int
-+posix_spawnattr_getsigmask(const posix_spawnattr_t *attr,
-+ sigset_t *sigmask)
-+{
-+ memcpy(sigmask, &attr->__ss, sizeof(sigset_t));
-+ return 0;
-+}
-+
-+
-+/* Set signal mask for the new process in ATTR to SIGMASK. */
-+inline static int
-+posix_spawnattr_setsigmask(posix_spawnattr_t *attr,
-+ const sigset_t *sigmask)
-+{
-+ memcpy(&attr->__ss, sigmask, sizeof(sigset_t));
-+ return 0;
-+}
-+
-+/* Get flag word from the attribute structure. */
-+inline static int
-+posix_spawnattr_getflags(const posix_spawnattr_t *attr, short int *flags)
-+{
-+ *flags = attr->__flags;
-+ return 0;
-+}
-+
-+/* Store flags in the attribute structure. */
-+inline static int
-+posix_spawnattr_setflags(posix_spawnattr_t *attr, short int flags)
-+{
-+ /* Check no invalid bits are set. */
-+ if (flags & ~__POSIX_SPAWN_MASK)
-+ return EINVAL;
-+
-+ attr->__flags = flags;
-+ return 0;
-+}
-+
-+/* Get process group ID from the attribute structure. */
-+inline static int
-+posix_spawnattr_getpgroup(const posix_spawnattr_t *attr, pid_t *pgroup)
-+{
-+ *pgroup = attr->__pgrp;
-+ return 0;
-+}
-+
-+/* Store process group ID in the attribute structure. */
-+inline static int
-+posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup)
-+{
-+ attr->__pgrp = pgroup;
-+ return 0;
-+}
-+
-+/* Get scheduling policy from the attribute structure. */
-+inline static int
-+posix_spawnattr_getschedpolicy(const posix_spawnattr_t *attr,
-+ int *schedpolicy)
-+{
-+ *schedpolicy = attr->__policy;
-+ return 0;
-+}
-+
-+/* Store scheduling policy in the attribute structure. */
-+inline static int
-+posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr, int schedpolicy)
-+{
-+ switch (schedpolicy) {
-+ case SCHED_OTHER:
-+ case SCHED_FIFO:
-+ case SCHED_RR:
-+ break;
-+ default:
-+ return EINVAL;
-+ }
-+
-+ attr->__policy = schedpolicy;
-+ return 0;
-+}
-+
-+/* Get scheduling parameters from the attribute structure. */
-+static inline int
-+posix_spawnattr_getschedparam(const posix_spawnattr_t *attr,
-+ struct sched_param *schedparam)
-+{
-+ memcpy(schedparam, &attr->__sp, sizeof(attr->__sp));
-+ return 0;
-+}
-+
-+/* Store scheduling parameters in the attribute structure. */
-+static inline int
-+posix_spawnattr_setschedparam(posix_spawnattr_t *attr,
-+ const struct sched_param *schedparam)
-+{
-+ attr->__sp = *schedparam;
-+ return 0;
-+}
-+
-+/* Initialize data structure for file attribute for `spawn' call. */
-+inline static int
-+posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions)
-+{
-+ memset(file_actions, 0, sizeof(*file_actions));
-+ return 0;
-+}
-+
-+/* Free resources associated with FILE-ACTIONS. */
-+inline static int
-+posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions)
-+{
-+ free(file_actions->__actions);
-+ return 0;
-+}
-+
-+/* Add an action to FILE-ACTIONS which tells the implementation to call
-+ `open' for the given file during the `spawn' call. */
-+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * restrict
-+ file_actions, int fd,
-+ const char * restrict path,
-+ int oflag, mode_t mode)
-+ __THROW;
-+
-+/* Add an action to FILE-ACTIONS which tells the implementation to call
-+ `close' for the given file descriptor during the `spawn' call. */
-+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions,
-+ int fd)
-+ __THROW;
-+
-+/* Add an action to FILE-ACTIONS which tells the implementation to call
-+ `dup2' for the given file descriptors during the `spawn' call. */
-+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions,
-+ int fd, int newfd) __THROW;
-+
-+__END_DECLS
-+
-+#endif /* spawn.h */
-diff --git a/librt/Makefile.in b/librt/Makefile.in
-index 909afd8..857efb5 100644
---- a/librt/Makefile.in
-+++ b/librt/Makefile.in
-@@ -33,6 +33,14 @@ else
- librt_filter_SRC += clock_nanosleep.c clock_getcpuclockid.c clock_gettime.c
- librt_SSRC :=
- endif
-+
-+librt_filter_SRC += $(if $(UCLIBC_HAS_ADVANCED_REALTIME),, \
-+ spawn.c \
-+ spawn_faction_addclose.c \
-+ spawn_faction_adddup2.c \
-+ spawn_faction_addopen.c \
-+ spawn_faction_init.c)
-+
- librt_SRC := $(filter-out $(librt_filter_SRC),$(librt_SRC))
-
- librt_OBJ := $(patsubst %.c,$(librt_OUT)/%.o,$(librt_SRC))
-diff --git a/librt/spawn.c b/librt/spawn.c
-new file mode 100644
-index 0000000..b5935a1
---- /dev/null
-+++ b/librt/spawn.c
-@@ -0,0 +1,259 @@
-+/* Copyright (C) 2000, 2011 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <alloca.h>
-+#include <unistd.h>
-+#include <signal.h>
-+#include <stdbool.h>
-+#include <fcntl.h>
-+
-+#include <sys/resource.h>
-+#include <not-cancel.h>
-+
-+#include <spawn.h>
-+#include "spawn_int.h"
-+
-+/* The Unix standard contains a long explanation of the way to signal
-+ an error after the fork() was successful. Since no new wait status
-+ was wanted there is no way to signal an error using one of the
-+ available methods. The committee chose to signal an error by a
-+ normal program exit with the exit code 127. */
-+#define SPAWN_ERROR 127
-+
-+/* Execute file actions.
-+ * Returns true on error.
-+ */
-+inline static bool execute_file_actions(const posix_spawn_file_actions_t *fa)
-+{
-+ struct rlimit64 fdlimit;
-+ bool have_fdlimit = false;
-+
-+ for (int cnt = 0; cnt < fa->__used; ++cnt) {
-+ struct __spawn_action *action = &fa->__actions[cnt];
-+
-+ switch (action->tag) {
-+ case spawn_do_close:
-+ if (close_not_cancel(action->action.close_action.fd) != 0) {
-+ if (!have_fdlimit) {
-+ getrlimit64(RLIMIT_NOFILE, &fdlimit);
-+ have_fdlimit = true;
-+ }
-+
-+ /* Only signal errors for file descriptors out of range. */
-+ if (0 > action->action.close_action.fd
-+ || action->action.close_action.fd >= fdlimit.rlim_cur)
-+ /* Signal the error. */
-+ return true;
-+ }
-+ break;
-+
-+ case spawn_do_open:;
-+ int new_fd = open_not_cancel(action->action.open_action.path,
-+ action->action.open_action.oflag
-+ | O_LARGEFILE,
-+ action->action.open_action.mode);
-+
-+ if (new_fd == -1)
-+ return true;
-+
-+ /* Make sure the desired file descriptor is used. */
-+ if (new_fd != action->action.open_action.fd) {
-+ if (dup2(new_fd, action->action.open_action.fd)
-+ != action->action.open_action.fd)
-+ return true;
-+
-+ if (close_not_cancel(new_fd) != 0)
-+ return true;
-+ }
-+ break;
-+
-+ case spawn_do_dup2:
-+ if (dup2(action->action.dup2_action.fd,
-+ action->action.dup2_action.newfd)
-+ != action->action.dup2_action.newfd)
-+ return true;
-+ break;
-+ }
-+ }
-+
-+ return false;
-+}
-+
-+#define DANGEROUS (POSIX_SPAWN_SETSIGMASK \
-+ | POSIX_SPAWN_SETSIGDEF \
-+ | POSIX_SPAWN_SETSCHEDPARAM \
-+ | POSIX_SPAWN_SETSCHEDULER \
-+ | POSIX_SPAWN_SETPGROUP \
-+ | POSIX_SPAWN_RESETIDS)
-+inline static bool is_vfork_safe(short int flags)
-+{
-+ return ((flags & POSIX_SPAWN_USEVFORK) || !(flags & DANGEROUS));
-+}
-+
-+
-+/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
-+ Before running the process perform the actions described in FILE-ACTIONS. */
-+static int
-+__spawni(pid_t *pid, const char *file,
-+ const posix_spawn_file_actions_t *fa,
-+ const posix_spawnattr_t *attrp, char *const argv[],
-+ char *const envp[], const char *path)
-+{
-+ short int flags = attrp ? attrp->__flags : 0;
-+
-+ pid_t new_pid;
-+ if (is_vfork_safe(flags) && !fa)
-+ new_pid = vfork();
-+ else
-+ new_pid = fork();
-+
-+ if (new_pid) {
-+ if (new_pid < 0)
-+ return errno;
-+
-+ if (pid)
-+ *pid = new_pid;
-+
-+ return 0;
-+ }
-+
-+ if (flags & POSIX_SPAWN_SETSIGMASK) {
-+ if (sigprocmask(SIG_SETMASK, &attrp->__ss, NULL) != 0)
-+ goto error;
-+ }
-+
-+ if (flags & POSIX_SPAWN_SETSIGDEF) {
-+ /* We have to iterate over all signals. This could possibly be
-+ done better but it requires system specific solutions since
-+ the sigset_t data type can be very different on different
-+ architectures. */
-+ struct sigaction sa;
-+
-+ memset(&sa, 0, sizeof(sa));
-+ sa.sa_handler = SIG_DFL;
-+
-+ for (int sig = 1; sig <= _NSIG; ++sig) {
-+ if (sigismember(&attrp->__sd, sig)) {
-+ if (sigaction(sig, &sa, NULL) != 0)
-+ goto error;
-+ }
-+ }
-+ }
-+
-+ if (flags & POSIX_SPAWN_SETSCHEDULER) {
-+ if (sched_setscheduler(0, attrp->__policy, &attrp->__sp) == -1)
-+ goto error;
-+ } else if (flags & POSIX_SPAWN_SETSCHEDPARAM) {
-+ if (sched_setparam(0, &attrp->__sp) == -1)
-+ goto error;
-+ }
-+
-+ if (flags & POSIX_SPAWN_SETPGROUP) {
-+ if (setpgid(0, attrp->__pgrp) != 0)
-+ goto error;
-+ }
-+
-+ if (flags & POSIX_SPAWN_RESETIDS) {
-+ if (seteuid(getuid()) || setegid(getgid()))
-+ goto error;
-+ }
-+
-+ if (fa && execute_file_actions(fa))
-+ goto error;
-+
-+ if (!path || strchr(file, '/')) {
-+ execve(file, argv, envp);
-+ goto error;
-+ }
-+
-+
-+ char *name;
-+ {
-+ size_t filelen = strlen(file) + 1;
-+ size_t pathlen = strlen(path) + 1;
-+ name = alloca(pathlen + filelen);
-+
-+ /* Copy the file name at the top. */
-+ name = (char *) memcpy(name + pathlen, file, filelen);
-+
-+ /* And add the slash. */
-+ *--name = '/';
-+ }
-+
-+ char *p;
-+ do {
-+ char *startp;
-+ p = strchrnul(path, ':');
-+
-+ /* Two adjacent colons, or a colon at the beginning or the end
-+ of `PATH' means to search the current directory. */
-+ if (p == path)
-+ startp = name + 1;
-+ else
-+ startp = (char *) memcpy(name - (p - path), path, p - path);
-+
-+ execve(startp, argv, envp);
-+
-+ switch (errno) {
-+ case EACCES:
-+ case ENOENT:
-+ case ESTALE:
-+ case ENOTDIR:
-+ /* Those errors indicate the file is missing or not
-+ executable by us, in which case we want to just try
-+ the next path directory. */
-+ break;
-+ default:
-+ /* Some other error means we found an executable file,
-+ but something went wrong executing it; return the
-+ error to our caller. */
-+ goto error;
-+ }
-+
-+ path = p;
-+ } while (*p++ != '\0');
-+
-+error:
-+ _exit(SPAWN_ERROR);
-+}
-+
-+/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
-+ Before running the process perform the actions described in FILE-ACTIONS. */
-+int posix_spawn (pid_t *pid, const char *path,
-+ const posix_spawn_file_actions_t *fa,
-+ const posix_spawnattr_t *attrp, char *const argv[],
-+ char *const envp[])
-+{
-+ return __spawni(pid, path, fa, attrp, argv, envp, NULL);
-+}
-+
-+/* Spawn a new process executing FILE with the attributes describes in *ATTRP.
-+ Before running the process perform the actions described in FILE-ACTIONS. */
-+int
-+posix_spawnp(pid_t *pid, const char *file,
-+ const posix_spawn_file_actions_t *fa,
-+ const posix_spawnattr_t *attrp, char *const argv[],
-+ char *const envp[])
-+{
-+ const char *path = getenv("PATH");
-+
-+ if (!path)
-+ path = ":/bin:/usr/bin";
-+
-+ return __spawni(pid, file, fa, attrp, argv, envp, path);
-+}
-diff --git a/librt/spawn_faction_addclose.c b/librt/spawn_faction_addclose.c
-new file mode 100644
-index 0000000..b418f96
---- /dev/null
-+++ b/librt/spawn_faction_addclose.c
-@@ -0,0 +1,51 @@
-+/* Copyright (C) 2000 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <spawn.h>
-+#include <unistd.h>
-+
-+#include "spawn_int.h"
-+
-+/* Add an action to FILE-ACTIONS which tells the implementation to call
-+ `close' for the given file descriptor during the `spawn' call. */
-+int
-+posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions,
-+ int fd)
-+{
-+ int maxfd = sysconf(_SC_OPEN_MAX);
-+ struct __spawn_action *rec;
-+
-+ /* Test for the validity of the file descriptor. */
-+ if (fd < 0 || fd >= maxfd)
-+ return EBADF;
-+
-+ /* Allocate more memory if needed. */
-+ if (file_actions->__used == file_actions->__allocated
-+ && __posix_spawn_file_actions_realloc(file_actions) != 0)
-+ /* This can only mean we ran out of memory. */
-+ return ENOMEM;
-+
-+ /* Add the new value. */
-+ rec = &file_actions->__actions[file_actions->__used];
-+ rec->tag = spawn_do_close;
-+ rec->action.open_action.fd = fd;
-+
-+ /* Account for the new entry. */
-+ ++file_actions->__used;
-+ return 0;
-+}
-diff --git a/librt/spawn_faction_adddup2.c b/librt/spawn_faction_adddup2.c
-new file mode 100644
-index 0000000..6d73313
---- /dev/null
-+++ b/librt/spawn_faction_adddup2.c
-@@ -0,0 +1,52 @@
-+/* Copyright (C) 2000 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <spawn.h>
-+#include <unistd.h>
-+
-+#include "spawn_int.h"
-+
-+/* Add an action to FILE-ACTIONS which tells the implementation to call
-+ `dup2' for the given file descriptors during the `spawn' call. */
-+int
-+posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions,
-+ int fd, int newfd)
-+{
-+ int maxfd = sysconf(_SC_OPEN_MAX);
-+ struct __spawn_action *rec;
-+
-+ /* Test for the validity of the file descriptor. */
-+ if (fd < 0 || newfd < 0 || fd >= maxfd || newfd >= maxfd)
-+ return EBADF;
-+
-+ /* Allocate more memory if needed. */
-+ if (file_actions->__used == file_actions->__allocated
-+ && __posix_spawn_file_actions_realloc (file_actions) != 0)
-+ /* This can only mean we ran out of memory. */
-+ return ENOMEM;
-+
-+ /* Add the new value. */
-+ rec = &file_actions->__actions[file_actions->__used];
-+ rec->tag = spawn_do_dup2;
-+ rec->action.dup2_action.fd = fd;
-+ rec->action.dup2_action.newfd = newfd;
-+
-+ /* Account for the new entry. */
-+ ++file_actions->__used;
-+ return 0;
-+}
-diff --git a/librt/spawn_faction_addopen.c b/librt/spawn_faction_addopen.c
-new file mode 100644
-index 0000000..285ca71
---- /dev/null
-+++ b/librt/spawn_faction_addopen.c
-@@ -0,0 +1,55 @@
-+/* Copyright (C) 2000 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <spawn.h>
-+#include <unistd.h>
-+
-+#include "spawn_int.h"
-+
-+/* Add an action to FILE-ACTIONS which tells the implementation to call
-+ `open' for the given file during the `spawn' call. */
-+int
-+posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *file_actions,
-+ int fd, const char *path, int oflag,
-+ mode_t mode)
-+{
-+ int maxfd = sysconf(_SC_OPEN_MAX);
-+ struct __spawn_action *rec;
-+
-+ /* Test for the validity of the file descriptor. */
-+ if (fd < 0 || fd >= maxfd)
-+ return EBADF;
-+
-+ /* Allocate more memory if needed. */
-+ if (file_actions->__used == file_actions->__allocated
-+ && __posix_spawn_file_actions_realloc (file_actions) != 0)
-+ /* This can only mean we ran out of memory. */
-+ return ENOMEM;
-+
-+ /* Add the new value. */
-+ rec = &file_actions->__actions[file_actions->__used];
-+ rec->tag = spawn_do_open;
-+ rec->action.open_action.fd = fd;
-+ rec->action.open_action.path = path;
-+ rec->action.open_action.oflag = oflag;
-+ rec->action.open_action.mode = mode;
-+
-+ /* Account for the new entry. */
-+ ++file_actions->__used;
-+ return 0;
-+}
-diff --git a/librt/spawn_faction_init.c b/librt/spawn_faction_init.c
-new file mode 100644
-index 0000000..fb398a5
---- /dev/null
-+++ b/librt/spawn_faction_init.c
-@@ -0,0 +1,42 @@
-+/* Copyright (C) 2000 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <errno.h>
-+#include <spawn.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+#include "spawn_int.h"
-+
-+
-+/* Function used to increase the size of the allocated array. This
-+ function is called from the `add'-functions. */
-+int
-+__posix_spawn_file_actions_realloc(posix_spawn_file_actions_t *file_actions)
-+{
-+ int newalloc = file_actions->__allocated + 8;
-+ void *newmem = realloc(file_actions->__actions,
-+ newalloc * sizeof(struct __spawn_action));
-+
-+ if (newmem == NULL)
-+ /* Not enough memory. */
-+ return ENOMEM;
-+
-+ file_actions->__actions = (struct __spawn_action *)newmem;
-+ file_actions->__allocated = newalloc;
-+ return 0;
-+}
-diff --git a/librt/spawn_int.h b/librt/spawn_int.h
-new file mode 100644
-index 0000000..89c88db
---- /dev/null
-+++ b/librt/spawn_int.h
-@@ -0,0 +1,26 @@
-+/* Data structure to contain the action information. */
-+struct __spawn_action {
-+ enum {
-+ spawn_do_close,
-+ spawn_do_dup2,
-+ spawn_do_open
-+ } tag;
-+
-+ union {
-+ struct {
-+ int fd;
-+ } close_action;
-+ struct {
-+ int fd;
-+ int newfd;
-+ } dup2_action;
-+ struct {
-+ int fd;
-+ const char *path;
-+ int oflag;
-+ mode_t mode;
-+ } open_action;
-+ } action;
-+};
-+
-+int __posix_spawn_file_actions_realloc(posix_spawn_file_actions_t *fa);
---
-1.8.4
-
diff --git a/main/libc0.9.32/0001-stdio-inline-getchar-putchar.patch b/main/libc0.9.32/0001-stdio-inline-getchar-putchar.patch
deleted file mode 100644
index e6fe9fed2b..0000000000
--- a/main/libc0.9.32/0001-stdio-inline-getchar-putchar.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 79899f6b3cade5b0ad39b70d30ccf15f182ba045 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Thu, 16 May 2013 14:04:39 +0000
-Subject: [PATCH] stdio: inline getchar/putchar
-
-Some apps like lvm2 modifies stdin. This breaks getchar since it is
-a macro that uses __stdin.
-(cherry picked from commit aabeb90f74aa2736fb993cd5840a894eff3b958f)
-
-Conflicts:
- include/stdio.h
- libc/sysdeps/linux/common/bits/uClibc_stdio.h
----
- include/stdio.h | 17 +++++++----------
- libc/stdio/getchar.c | 2 --
- libc/stdio/putchar.c | 3 ---
- libc/sysdeps/linux/common/bits/uClibc_stdio.h | 6 ------
- 4 files changed, 7 insertions(+), 21 deletions(-)
-
-diff --git a/include/stdio.h b/include/stdio.h
-index 289b861..4d6092a 100644
---- a/include/stdio.h
-+++ b/include/stdio.h
-@@ -906,19 +906,16 @@ extern void funlockfile (FILE *__stream) __THROW;
- #define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp)
- #endif
-
--#ifndef __STDIO_GETC_MACRO
--#define __stdin stdin
--#endif
--#define getchar() __GETC(__stdin)
-+#ifdef __USE_EXTERN_INLINES
-
--#ifndef __STDIO_PUTC_MACRO
--#define __stdout stdout
--#endif
--#define putchar(_ch) __PUTC((_ch), __stdout)
-+__extern_inline int getchar(void) { return __GETC(stdin); }
-+__extern_inline int putchar(int c) { return __PUTC(c, stdout); }
-
- #if defined __USE_POSIX || defined __USE_MISC
--#define getchar_unlocked() __GETC_UNLOCKED(__stdin)
--#define putchar_unlocked(_ch) __PUTC_UNLOCKED((_ch), __stdout)
-+__extern_inline int getchar_unlocked(void) { return __GETC_UNLOCKED(stdin); }
-+__extern_inline int putchar_unlocked(int c) { return __PUTC_UNLOCKED(c, stdout); }
-+#endif
-+
- #endif
-
- /* Clear the error and EOF indicators for STREAM. */
-diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c
-index b6c650c..f8c487b 100644
---- a/libc/stdio/getchar.c
-+++ b/libc/stdio/getchar.c
-@@ -8,11 +8,9 @@
- #include "_stdio.h"
-
-
--#undef getchar
- #ifdef __DO_UNLOCKED
-
- /* the only use of the hidden getchar_unlocked is in gets.c */
--#undef getchar_unlocked
- int getchar_unlocked(void)
- {
- register FILE *stream = stdin;
-diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c
-index 583e90f..804b09d 100644
---- a/libc/stdio/putchar.c
-+++ b/libc/stdio/putchar.c
-@@ -7,11 +7,8 @@
-
- #include "_stdio.h"
-
--
--#undef putchar
- #ifdef __DO_UNLOCKED
-
--#undef putchar_unlocked
- int putchar_unlocked(int c)
- {
- register FILE *stream = stdout;
-diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
-index a8cf4eb..2ec8ad4 100644
---- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h
-+++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
-@@ -411,8 +411,6 @@ libc_hidden_proto(__fputc_unlocked)
-
- #ifdef __STDIO_GETC_MACRO
-
--extern FILE *__stdin; /* For getchar() macro. */
--
- # undef __GETC_UNLOCKED_MACRO
- # define __GETC_UNLOCKED_MACRO(__stream) \
- ( ((__stream)->__bufpos < (__stream)->__bufgetc_u) \
-@@ -463,15 +461,11 @@ extern FILE *__stdin; /* For getchar() macro. */
- # endif
- # endif
-
--#else
--
- #endif /* __STDIO_GETC_MACRO */
-
-
- #ifdef __STDIO_PUTC_MACRO
-
--extern FILE *__stdout; /* For putchar() macro. */
--
- # undef __PUTC_UNLOCKED_MACRO
- # define __PUTC_UNLOCKED_MACRO(__c, __stream) \
- ( ((__stream)->__bufpos < (__stream)->__bufputc_u) \
---
-1.8.2.3
-
diff --git a/main/libc0.9.32/0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch b/main/libc0.9.32/0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
deleted file mode 100644
index cd0285d09d..0000000000
--- a/main/libc0.9.32/0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 5084cf8b6b8f01890b62bfd0edf085d04887d084 Mon Sep 17 00:00:00 2001
-From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-Date: Sun, 10 Feb 2013 17:21:15 +0100
-Subject: [PATCH] stdlib: Fix fndecl of mkostemp, mkostemp64
-
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
- libc/stdlib/mkostemp.c | 4 +---
- libc/stdlib/mkostemp64.c | 4 +---
- 2 files changed, 2 insertions(+), 6 deletions(-)
-
-diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c
-index 93b50fc..0369235 100644
---- a/libc/stdlib/mkostemp.c
-+++ b/libc/stdlib/mkostemp.c
-@@ -24,9 +24,7 @@
- they are replaced with a string that makes the filename unique.
- Then open the file and return a fd. */
- int
--mkostemp (template, flags)
-- char *template;
-- int flags;
-+mkostemp (char *template, int flags)
- {
- return __gen_tempname (template, __GT_FILE, flags);
- }
-diff --git a/libc/stdlib/mkostemp64.c b/libc/stdlib/mkostemp64.c
-index 5509d8c..d21def5 100644
---- a/libc/stdlib/mkostemp64.c
-+++ b/libc/stdlib/mkostemp64.c
-@@ -25,9 +25,7 @@
- they are replaced with a string that makes the filename unique.
- Then open the file and return a fd. */
- int
--mkostemp64 (template, flags)
-- char *template;
-- int flags;
-+mkostemp64 (char *template, int flags)
- {
- return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE);
- }
---
-1.8.3.4
-
diff --git a/main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch b/main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
deleted file mode 100644
index c11fcc55fd..0000000000
--- a/main/libc0.9.32/0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 1bdc1ab2938ddc824c01b9b4487ea6a73e4216cd Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Wed, 30 May 2012 01:15:03 -0400
-Subject: [PATCH 2/6] pread/pwrite: handle renamed syscalls in
- common/ppc/xtensa code
-
-Some arches got this fix, but many did not. So copy the ifdef logic to
-the ones that missed it to fix behavior in linux-2.6+.
-
-URL: https://bugs.busybox.net/show_bug.cgi?id=5258
-Reported-by: David Laight <david.laight@aculab.com>
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-(cherry picked from commit 52fa45da0f86651b70608a58914f3aece7fdfed5)
----
- libc/sysdeps/linux/common/pread_write.c | 10 ++++++++++
- libc/sysdeps/linux/powerpc/pread_write.c | 13 +++++++++++++
- libc/sysdeps/linux/xtensa/pread_write.c | 14 ++++++++++++++
- 3 files changed, 37 insertions(+)
-
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
-index 88e6957..089ee93 100644
---- a/libc/sysdeps/linux/common/pread_write.c
-+++ b/libc/sysdeps/linux/common/pread_write.c
-@@ -25,6 +25,11 @@ extern __typeof(pread64) __libc_pread64;
- extern __typeof(pwrite64) __libc_pwrite64;
- #endif
-
-+#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+# undef __NR_pread
-+# define __NR_pread __NR_pread64
-+#endif
-+
- #include <bits/kernel_types.h>
-
- #ifdef __NR_pread
-@@ -51,6 +56,11 @@ weak_alias(__libc_pread64,pread64)
-
- #endif /* __NR_pread */
-
-+#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+# undef __NR_pwrite
-+# define __NR_pwrite __NR_pwrite64
-+#endif
-+
- #ifdef __NR_pwrite
-
- # define __NR___syscall_pwrite __NR_pwrite
-diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
-index 7f988d3..23f256f 100644
---- a/libc/sysdeps/linux/powerpc/pread_write.c
-+++ b/libc/sysdeps/linux/powerpc/pread_write.c
-@@ -20,6 +20,13 @@
- # define off64_t off_t
- #endif
-
-+#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+# ifdef __NR_pread
-+# error "__NR_pread and __NR_pread64 both defined???"
-+# endif
-+# define __NR_pread __NR_pread64
-+#endif
-+
- #ifdef __NR_pread
- extern __typeof(pread) __libc_pread;
- # define __NR___syscall_pread __NR_pread
-@@ -42,6 +49,12 @@ weak_alias(__libc_pread64,pread64)
- # endif /* __UCLIBC_HAS_LFS__ */
- #endif /* __NR_pread */
-
-+#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+# ifdef __NR_pwrite
-+# error "__NR_pwrite and __NR_pwrite64 both defined???"
-+# endif
-+# define __NR_pwrite __NR_pwrite64
-+#endif
-
- #ifdef __NR_pwrite
- extern __typeof(pwrite) __libc_pwrite;
-diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c
-index 71ba22b..bcf7dee 100644
---- a/libc/sysdeps/linux/xtensa/pread_write.c
-+++ b/libc/sysdeps/linux/xtensa/pread_write.c
-@@ -27,6 +27,13 @@ extern __typeof(pwrite64) __libc_pwrite64;
-
- #include <bits/kernel_types.h>
-
-+#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+# ifdef __NR_pread
-+# error "__NR_pread and __NR_pread64 both defined???"
-+# endif
-+# define __NR_pread __NR_pread64
-+#endif
-+
- #ifdef __NR_pread
-
- # define __NR___syscall_pread __NR_pread
-@@ -52,6 +59,13 @@ weak_alias(__libc_pread64,pread64)
-
- #endif /* __NR_pread */
-
-+#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+# ifdef __NR_pwrite
-+# error "__NR_pwrite and __NR_pwrite64 both defined???"
-+# endif
-+# define __NR_pwrite __NR_pwrite64
-+#endif
-+
- #ifdef __NR_pwrite
-
- # define __NR___syscall_pwrite __NR_pwrite
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0002-resolv-res_query-for-CNAMEs.patch b/main/libc0.9.32/0002-resolv-res_query-for-CNAMEs.patch
deleted file mode 100644
index 466c2fafe7..0000000000
--- a/main/libc0.9.32/0002-resolv-res_query-for-CNAMEs.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From e7d64120a2cb382c1167977b0aefa388d5ab62e8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Fri, 23 Dec 2011 14:15:16 +0100
-Subject: [PATCH 2/8] resolv: res_query for CNAMEs
-
-From: http://lists.busybox.net/pipermail/uclibc/2009-June/042583.html
-
-I had postfix failing for domains with MX->CNAME->A chain. In glibc it works.
-I tracked it to be a problem in uclibc res_query. It returns bogus data
-for CNAME entries, apparently intentionally, which is wrong.
-
-glibc return CNAME entries even for CNAME queries and most applications rely
-on this. So we should do the same in uclibc.
-
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- libc/inet/resolv.c | 8 +++-----
- 1 files changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
-index a730584..632bfaf 100644
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -3740,11 +3740,9 @@ int res_query(const char *dname, int class, int type,
-
- free(a.dotted);
-
-- if (a.atype == type) { /* CNAME */
-- if (i > anslen)
-- i = anslen;
-- memcpy(answer, packet, i);
-- }
-+ i = MIN(anslen, i);
-+ memcpy(answer, packet, i);
-+
- free(packet);
- return i;
- }
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch b/main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch
deleted file mode 100644
index 0f4091ffe9..0000000000
--- a/main/libc0.9.32/0003-pread-pwrite-drop-fallback-funcs.patch
+++ /dev/null
@@ -1,385 +0,0 @@
-From eb5db626afa3dccbd5d2cb0f4fbec6a1606dcfff Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Wed, 30 May 2012 01:40:33 -0400
-Subject: [PATCH 3/6] pread/pwrite: drop fallback funcs
-
-Linux has provided these functions since the 2.1.x era, so no need to
-keep these around. We'd rather find out when things are missing (and
-fix that) than fall back to the unsafe hacks.
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-(cherry picked from commit 80c9bfc4668e2370b3434a801dc266f336265832)
----
- libc/sysdeps/linux/common/pread_write.c | 112 -----------------------------
- libc/sysdeps/linux/powerpc/pread_write.c | 117 -------------------------------
- libc/sysdeps/linux/xtensa/pread_write.c | 112 -----------------------------
- 3 files changed, 341 deletions(-)
-
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
-index 089ee93..48fe7dd 100644
---- a/libc/sysdeps/linux/common/pread_write.c
-+++ b/libc/sysdeps/linux/common/pread_write.c
-@@ -83,115 +83,3 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
- weak_alias(__libc_pwrite64,pwrite64)
- # endif /* __UCLIBC_HAS_LFS__ */
- #endif /* __NR_pwrite */
--
--#if ! defined __NR_pread || ! defined __NR_pwrite
--
--static ssize_t __fake_pread_write(int fd, void *buf,
-- size_t count, off_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. If this fails we
-- * have to return this as an error. */
-- save_errno = errno;
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
-- {
-- if (result == -1)
-- __set_errno(save_errno);
-- return -1;
-- }
-- __set_errno(save_errno);
-- return(result);
--}
--
--# ifdef __UCLIBC_HAS_LFS__
--
--static ssize_t __fake_pread_write64(int fd, void *buf,
-- size_t count, off64_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off64_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. */
-- save_errno = errno;
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
-- if (result == -1)
-- __set_errno (save_errno);
-- return -1;
-- }
-- __set_errno (save_errno);
-- return result;
--}
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
--
--#ifndef __NR_pread
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return __fake_pread_write(fd, buf, count, offset, 0);
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- return __fake_pread_write64(fd, buf, count, offset, 0);
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pread */
--
--#ifndef __NR_pwrite
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- /* we won't actually be modifying the buffer,
-- *just cast it to get rid of warnings */
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1);
--}
--weak_alias(__libc_pwrite,pwrite)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1);
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pwrite */
-diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
-index 23f256f..92a184c 100644
---- a/libc/sysdeps/linux/powerpc/pread_write.c
-+++ b/libc/sysdeps/linux/powerpc/pread_write.c
-@@ -77,120 +77,3 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
- weak_alias(__libc_pwrite64,pwrite64)
- # endif /* __UCLIBC_HAS_LFS__ */
- #endif /* __NR_pwrite */
--
--
--
--#if ! defined __NR_pread || ! defined __NR_pwrite
--
--static ssize_t __fake_pread_write(int fd, void *buf,
-- size_t count, off_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek (fd, offset, SEEK_SET) == (off_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. If this fails we
-- * have to return this as an error. */
-- save_errno = errno;
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
-- {
-- if (result == -1)
-- __set_errno(save_errno);
-- return -1;
-- }
-- __set_errno(save_errno);
-- return(result);
--}
--
--# ifdef __UCLIBC_HAS_LFS__
--
--static ssize_t __fake_pread_write64(int fd, void *buf,
-- size_t count, off64_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off64_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. */
-- save_errno = errno;
-- if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) {
-- if (result == -1)
-- __set_errno (save_errno);
-- return -1;
-- }
-- __set_errno (save_errno);
-- return result;
--}
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
--
--#ifndef __NR_pread
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset);
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return(__fake_pread_write(fd, buf, count, offset, 0));
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset);
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- return(__fake_pread_write64(fd, buf, count, offset, 0));
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pread */
--
--
--#ifndef __NR_pwrite
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset);
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- return(__fake_pread_write(fd, (void*)buf, count, offset, 1));
--}
--weak_alias(__libc_pwrite,pwrite)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset);
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pwrite */
-diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c
-index bcf7dee..e8b39e9 100644
---- a/libc/sysdeps/linux/xtensa/pread_write.c
-+++ b/libc/sysdeps/linux/xtensa/pread_write.c
-@@ -89,115 +89,3 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
- weak_alias(__libc_pwrite64,pwrite64)
- # endif /* __UCLIBC_HAS_LFS__ */
- #endif /* __NR_pwrite */
--
--#if ! defined __NR_pread || ! defined __NR_pwrite
--
--static ssize_t __fake_pread_write(int fd, void *buf,
-- size_t count, off_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. If this fails we
-- * have to return this as an error. */
-- save_errno = errno;
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
-- {
-- if (result == -1)
-- __set_errno(save_errno);
-- return -1;
-- }
-- __set_errno(save_errno);
-- return(result);
--}
--
--# ifdef __UCLIBC_HAS_LFS__
--
--static ssize_t __fake_pread_write64(int fd, void *buf,
-- size_t count, off64_t offset, int do_pwrite)
--{
-- int save_errno;
-- ssize_t result;
-- off64_t old_offset;
--
-- /* Since we must not change the file pointer preserve the
-- * value so that we can restore it later. */
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
-- return -1;
--
-- /* Set to wanted position. */
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
-- return -1;
--
-- if (do_pwrite == 1) {
-- /* Write the data. */
-- result = write(fd, buf, count);
-- } else {
-- /* Read the data. */
-- result = read(fd, buf, count);
-- }
--
-- /* Now we have to restore the position. */
-- save_errno = errno;
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
-- if (result == -1)
-- __set_errno (save_errno);
-- return -1;
-- }
-- __set_errno (save_errno);
-- return result;
--}
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
--
--#ifndef __NR_pread
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return __fake_pread_write(fd, buf, count, offset, 0);
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- return __fake_pread_write64(fd, buf, count, offset, 0);
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pread */
--
--#ifndef __NR_pwrite
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- /* we won't actually be modifying the buffer,
-- *just cast it to get rid of warnings */
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1);
--}
--weak_alias(__libc_pwrite,pwrite)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1);
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* ! __NR_pwrite */
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch b/main/libc0.9.32/0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
deleted file mode 100644
index c1d14a8fc1..0000000000
--- a/main/libc0.9.32/0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
+++ /dev/null
@@ -1,266 +0,0 @@
-From ebe605c538137a070c0eb7294c171fd6e3658558 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Thu, 7 Jul 2011 18:47:26 +0300
-Subject: [PATCH 3/8] resolv: fix resolver to return TRY_AGAIN on timeout
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This fixes the internal __dns_lookup to get a h_errno pointer so
-it works nicely with the _r variants. Additionally the function is
-modified to permanent error if the static buffer lengths are not
-enough. And finally it fixed to return TRY_AGAIN if the nameservers
-timeout.
-
-res_search is fixed to continue searching if we receive TRY_AGAIN.
-It could be a problem with the specific search domain's server
-and not necessarily a problem in the recursive resolver we are
-querying. For same reason, it does not make sense to differentiate
-timeout or SERVFAIL error reply.
-
-The biggest issue this fixes is that we now properly set h_errno
-to TRY_AGAIN if upstream nameserver(s) timed out. Previously we
-would have returned NETDB_INTERNAL.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- libc/inet/resolv.c | 95 +++++++++++++++++++++++++++-------------------------
- 1 files changed, 49 insertions(+), 46 deletions(-)
-
-diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
-index 632bfaf..15065cf 100644
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -457,7 +457,8 @@ extern int __read_etc_hosts_r(parser_t *parser,
- extern int __dns_lookup(const char *name,
- int type,
- unsigned char **outpacket,
-- struct resolv_answer *a) attribute_hidden;
-+ struct resolv_answer *a,
-+ int *h_errnop) attribute_hidden;
- extern int __encode_dotted(const char *dotted,
- unsigned char *dest,
- int maxlen) attribute_hidden;
-@@ -1234,7 +1235,8 @@ static int __decode_answer(const unsigned char *message, /* packet */
- int attribute_hidden __dns_lookup(const char *name,
- int type,
- unsigned char **outpacket,
-- struct resolv_answer *a)
-+ struct resolv_answer *a,
-+ int *h_errnop)
- {
- /* Protected by __resolv_lock: */
- static int last_ns_num = 0;
-@@ -1266,11 +1268,15 @@ int attribute_hidden __dns_lookup(const char *name,
- fd = -1;
- lookup = NULL;
- name_len = strlen(name);
-- if ((unsigned)name_len >= MAXDNAME - MAXLEN_searchdomain - 2)
-- goto fail; /* paranoia */
-+ if ((unsigned)name_len >= MAXDNAME - MAXLEN_searchdomain - 2) {
-+ *h_errnop = NO_RECOVERY;
-+ goto fail1; /* paranoia */
-+ }
- lookup = malloc(name_len + 1/*for '.'*/ + MAXLEN_searchdomain + 1);
-- if (!packet || !lookup || !name[0])
-- goto fail;
-+ if (!packet || !lookup || !name[0]) {
-+ *h_errnop = NO_RECOVERY;
-+ goto fail1;
-+ }
- ends_with_dot = (name[name_len - 1] == '.');
- /* no strcpy! paranoia, user might change name[] under us */
- memcpy(lookup, name, name_len);
-@@ -1338,8 +1344,10 @@ int attribute_hidden __dns_lookup(const char *name,
- h.rd = 1;
- DPRINTF("encoding header\n", h.rd);
- i = __encode_header(&h, packet, PACKETSZ);
-- if (i < 0)
-- goto fail;
-+ if (i < 0) {
-+ *h_errnop = NO_RECOVERY;
-+ goto fail1;
-+ }
-
- /* encode question */
- DPRINTF("lookup name: %s\n", lookup);
-@@ -1347,8 +1355,10 @@ int attribute_hidden __dns_lookup(const char *name,
- q.qtype = type;
- q.qclass = C_IN; /* CLASS_IN */
- j = __encode_question(&q, packet+i, PACKETSZ-i);
-- if (j < 0)
-- goto fail;
-+ if (j < 0) {
-+ *h_errnop = NO_RECOVERY;
-+ goto fail1;
-+ }
- packet_len = i + j;
-
- /* send packet */
-@@ -1474,7 +1484,7 @@ int attribute_hidden __dns_lookup(const char *name,
- /* no more search domains to try */
- }
- /* dont loop, this is "no such host" situation */
-- h_errno = HOST_NOT_FOUND;
-+ *h_errnop = HOST_NOT_FOUND;
- goto fail1;
- }
- /* Insert other non-fatal errors here, which do not warrant
-@@ -1486,7 +1496,7 @@ int attribute_hidden __dns_lookup(const char *name,
-
- /* Code below won't work correctly with h.ancount == 0, so... */
- if (h.ancount <= 0) {
-- h_errno = NO_DATA; /* [is this correct code to check for?] */
-+ *h_errnop = NO_DATA; /* [is this correct code to check for?] */
- goto fail1;
- }
- pos = HFIXEDSZ;
-@@ -1565,8 +1575,7 @@ int attribute_hidden __dns_lookup(const char *name,
- variant = -1;
- } while (retries_left > 0);
-
-- fail:
-- h_errno = NETDB_INTERNAL;
-+ *h_errnop = TRY_AGAIN;
- fail1:
- if (fd != -1)
- close(fd);
-@@ -2107,9 +2116,8 @@ int gethostbyname_r(const char *name,
- * we'll need space for one in_addr + two addr_list[] elems */
- a.buflen = buflen - ((sizeof(addr_list[0]) * 2 + sizeof(struct in_addr)));
- a.add_count = 0;
-- packet_len = __dns_lookup(name, T_A, &packet, &a);
-+ packet_len = __dns_lookup(name, T_A, &packet, &a, h_errnop);
- if (packet_len < 0) {
-- *h_errnop = HOST_NOT_FOUND;
- DPRINTF("__dns_lookup returned < 0\n");
- return TRY_AGAIN;
- }
-@@ -2294,9 +2302,8 @@ int gethostbyname2_r(const char *name,
- int packet_len;
-
- /* Hmm why we memset(a) to zeros only once? */
-- packet_len = __dns_lookup(buf, T_AAAA, &packet, &a);
-+ packet_len = __dns_lookup(buf, T_AAAA, &packet, &a, h_errnop);
- if (packet_len < 0) {
-- *h_errnop = HOST_NOT_FOUND;
- return TRY_AGAIN;
- }
- strncpy(buf, a.dotted, buflen);
-@@ -2452,9 +2459,8 @@ int gethostbyaddr_r(const void *addr, socklen_t addrlen,
- memset(&a, '\0', sizeof(a));
- for (;;) {
- /* Hmm why we memset(a) to zeros only once? */
-- packet_len = __dns_lookup(buf, T_PTR, &packet, &a);
-+ packet_len = __dns_lookup(buf, T_PTR, &packet, &a, h_errnop);
- if (packet_len < 0) {
-- *h_errnop = HOST_NOT_FOUND;
- return TRY_AGAIN;
- }
-
-@@ -3730,7 +3736,7 @@ int res_query(const char *dname, int class, int type,
- }
-
- memset(&a, '\0', sizeof(a));
-- i = __dns_lookup(dname, type, &packet, &a);
-+ i = __dns_lookup(dname, type, &packet, &a, &h_errno);
-
- if (i < 0) {
- if (!h_errno) /* TODO: can this ever happen? */
-@@ -3756,14 +3762,13 @@ libc_hidden_def(res_query)
- */
- #define __TRAILING_DOT (1<<0)
- #define __GOT_NODATA (1<<1)
--#define __GOT_SERVFAIL (1<<2)
-+#define __GOT_TRYAGAIN (1<<2)
- #define __TRIED_AS_IS (1<<3)
- int res_search(const char *name, int class, int type, u_char *answer,
- int anslen)
- {
- const char *cp;
- char **domain;
-- HEADER *hp = (HEADER *)(void *)answer;
- unsigned dots;
- unsigned state;
- int ret, saved_herrno;
-@@ -3828,19 +3833,9 @@ int res_search(const char *name, int class, int type, u_char *answer,
- if (ret > 0)
- return ret;
-
-- /*
-- * If no server present, give up.
-- * If name isn't found in this domain,
-- * keep trying higher domains in the search list
-- * (if that's enabled).
-- * On a NO_DATA error, keep trying, otherwise
-- * a wildcard entry of another type could keep us
-- * from finding this entry higher in the domain.
-- * If we get some other error (negative answer or
-- * server failure), then stop searching up,
-- * but try the input name below in case it's
-- * fully-qualified.
-- */
-+ /* our resolver refused to talk to us -
-+ * no sense to retry, as the retry would likely
-+ * fail too */
- if (errno == ECONNREFUSED) {
- h_errno = TRY_AGAIN;
- return -1;
-@@ -3848,21 +3843,29 @@ int res_search(const char *name, int class, int type, u_char *answer,
-
- switch (h_errno) {
- case NO_DATA:
-+ /* Keep trying, otherwise a
-+ * wildcard entry of another type
-+ * could keep us from finding this
-+ * entry from higher in the domain
-+ * search. */
- state |= __GOT_NODATA;
-- /* FALLTHROUGH */
-+ break;
- case HOST_NOT_FOUND:
-- /* keep trying */
-+ /* Not found - keep trying higher
-+ * domains in the search list. */
- break;
- case TRY_AGAIN:
-- if (hp->rcode == SERVFAIL) {
-- /* try next search element, if any */
-- state |= __GOT_SERVFAIL;
-- break;
-- }
-- /* FALLTHROUGH */
-+ /* Server error or timeout. Could
-+ * be caused by a problem in servers
-+ * our resolver queried. Keep trying
-+ * search, but remember that there
-+ * was a temporary problem. */
-+ state |= __GOT_TRYAGAIN;
-+ break;
- default:
- /* anything else implies that we're done */
- done = 1;
-+ break;
- }
- /*
- * if we got here for some reason other than DNSRCH,
-@@ -3896,13 +3899,13 @@ int res_search(const char *name, int class, int type, u_char *answer,
- h_errno = saved_herrno;
- else if (state & __GOT_NODATA)
- h_errno = NO_DATA;
-- else if (state & __GOT_SERVFAIL)
-+ else if (state & __GOT_TRYAGAIN)
- h_errno = TRY_AGAIN;
- return -1;
- }
- #undef __TRAILING_DOT
- #undef __GOT_NODATA
--#undef __GOT_SERVFAIL
-+#undef __GOT_TRYAGAIN
- #undef __TRIED_AS_IS
- /*
- * Perform a call on res_query on the concatenation of name and domain,
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch b/main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch
deleted file mode 100644
index 555bc5850f..0000000000
--- a/main/libc0.9.32/0004-add-cancellation-to-generic-pread_write.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-From 25fae380b721fdb3fe27872dda57d4534d7d78c1 Mon Sep 17 00:00:00 2001
-From: "Peter S. Mazinger" <ps.m@gmx.net>
-Date: Fri, 22 Apr 2011 01:25:31 +0200
-Subject: [PATCH 4/6] add cancellation to generic pread_write
-
-Prepare the file to be used in all arch specific files
-
-Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-(cherry picked from commit 61198b43ee8a639544622d0e666b972418c9c383)
----
- libc/sysdeps/linux/common/pread_write.c | 100 ++++++++++++++++----------------
- 1 file changed, 51 insertions(+), 49 deletions(-)
-
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
-index 48fe7dd..3d04bb7 100644
---- a/libc/sysdeps/linux/common/pread_write.c
-+++ b/libc/sysdeps/linux/common/pread_write.c
-@@ -15,71 +15,73 @@
-
- #include <sys/syscall.h>
- #include <unistd.h>
--#include <stdint.h>
- #include <endian.h>
-+#include <bits/wordsize.h>
-+#include <cancel.h>
-
--extern __typeof(pread) __libc_pread;
--extern __typeof(pwrite) __libc_pwrite;
--#ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pread64) __libc_pread64;
--extern __typeof(pwrite64) __libc_pwrite64;
--#endif
--
--#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pread64
- # undef __NR_pread
- # define __NR_pread __NR_pread64
- #endif
-+#ifdef __NR_pwrite64
-+# undef __NR_pwrite
-+# define __NR_pwrite __NR_pwrite64
-+#endif
-
--#include <bits/kernel_types.h>
--
--#ifdef __NR_pread
-+#ifndef MY_PREAD
-+# ifdef __NR_pread
-+# define __NR___syscall_pread __NR_pread
-+static _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PREAD(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF_HI_LO(offset))
-+# define MY_PREAD64(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF64_HI_LO(offset))
-+#endif
-
--# define __NR___syscall_pread __NR_pread
--static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
-- size_t, count, off_t, offset_hi, off_t, offset_lo)
-+#ifndef MY_PWRITE
-+# ifdef __NR_pwrite
-+# define __NR___syscall_pwrite __NR_pwrite
-+static _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-+ size_t, count, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PWRITE(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF_HI_LO(offset))
-+# define MY_PWRITE64(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF64_HI_LO(offset))
-+#endif
-
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
-+static ssize_t __NC(pread)(int fd, void *buf, size_t count, off_t offset)
- {
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
-+ return MY_PREAD(fd, buf, count, offset);
- }
--weak_alias(__libc_pread,pread)
-+CANCELLABLE_SYSCALL(ssize_t, pread, (int fd, void *buf, size_t count, off_t offset),
-+ (fd, buf, count, offset))
-
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
-+static ssize_t __NC(pwrite)(int fd, const void *buf, size_t count, off_t offset)
- {
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low));
-+ return MY_PWRITE(fd, buf, count, offset);
- }
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
-+CANCELLABLE_SYSCALL(ssize_t, pwrite, (int fd, const void *buf, size_t count, off_t offset),
-+ (fd, buf, count, offset))
-
--#endif /* __NR_pread */
--
--#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
--# undef __NR_pwrite
--# define __NR_pwrite __NR_pwrite64
--#endif
--
--#ifdef __NR_pwrite
--
--# define __NR___syscall_pwrite __NR_pwrite
--static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-- size_t, count, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
-+#ifdef __UCLIBC_HAS_LFS__
-+# if __WORDSIZE == 32
-+static ssize_t __NC(pread64)(int fd, void *buf, size_t count, off64_t offset)
- {
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
-+ return MY_PREAD64(fd, buf, count, offset);
- }
--weak_alias(__libc_pwrite,pwrite)
-+CANCELLABLE_SYSCALL(ssize_t, pread64, (int fd, void *buf, size_t count, off64_t offset),
-+ (fd, buf, count, offset))
-
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
-+static ssize_t __NC(pwrite64)(int fd, const void *buf, size_t count, off64_t offset)
- {
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low));
-+ return MY_PWRITE64(fd, buf, count, offset);
- }
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pwrite */
-+CANCELLABLE_SYSCALL(ssize_t, pwrite64, (int fd, const void *buf, size_t count, off64_t offset),
-+ (fd, buf, count, offset))
-+# else
-+# ifdef __LINUXTHREADS_OLD__
-+weak_alias(pread,pread64)
-+weak_alias(pwrite,pwrite64)
-+# else
-+strong_alias_untyped(pread,pread64)
-+strong_alias_untyped(pwrite,pwrite64)
-+# endif
-+# endif
-+#endif
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0004-libm-x86_64-implement-some-fenv-functions.patch b/main/libc0.9.32/0004-libm-x86_64-implement-some-fenv-functions.patch
deleted file mode 100644
index bcdbe2940c..0000000000
--- a/main/libc0.9.32/0004-libm-x86_64-implement-some-fenv-functions.patch
+++ /dev/null
@@ -1,288 +0,0 @@
-From fce995147f17b47ade2bebbf8d49553132a29227 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <natanael.copa@gmail.com>
-Date: Sun, 28 Nov 2010 12:43:33 +0000
-Subject: [PATCH 4/8] libm/x86_64: implement some fenv functions
-
-from glibc
-
-Posted to uclibc:
-http://lists.busybox.net/pipermail/uclibc/2010-December/044523.html
-
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- libm/x86_64/Makefile.arch | 24 ++++++++++++++++++++
- libm/x86_64/fclrexcpt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
- libm/x86_64/fegetexcept.c | 32 +++++++++++++++++++++++++++
- libm/x86_64/fesetround.c | 46 ++++++++++++++++++++++++++++++++++++++
- libm/x86_64/fgetexcptflg.c | 36 ++++++++++++++++++++++++++++++
- libm/x86_64/ftestexcept.c | 33 +++++++++++++++++++++++++++
- 6 files changed, 223 insertions(+), 0 deletions(-)
- create mode 100644 libm/x86_64/Makefile.arch
- create mode 100644 libm/x86_64/fclrexcpt.c
- create mode 100644 libm/x86_64/fegetexcept.c
- create mode 100644 libm/x86_64/fesetround.c
- create mode 100644 libm/x86_64/fgetexcptflg.c
- create mode 100644 libm/x86_64/ftestexcept.c
-
-diff --git a/libm/x86_64/Makefile.arch b/libm/x86_64/Makefile.arch
-new file mode 100644
-index 0000000..e1be961
---- /dev/null
-+++ b/libm/x86_64/Makefile.arch
-@@ -0,0 +1,24 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+# The routines included in this math library are derived from
-+# glibc's libm.
-+#
-+
-+ifeq ($(UCLIBC_HAS_FENV),y)
-+libm_ARCH_SRC:=$(wildcard $(libm_ARCH_DIR)/*.c)
-+libm_ARCH_OBJ:=$(patsubst $(libm_ARCH_DIR)/%.c,$(libm_ARCH_OUT)/%.o,$(libm_ARCH_SRC))
-+endif
-+
-+libm_ARCH_OBJS:=$(libm_ARCH_OBJ)
-+
-+ifeq ($(DOPIC),y)
-+libm-a-y+=$(libm_ARCH_OBJS:.o=.os)
-+else
-+libm-a-y+=$(libm_ARCH_OBJS)
-+endif
-+libm-so-y+=$(libm_ARCH_OBJS:.o=.os)
-+
-diff --git a/libm/x86_64/fclrexcpt.c b/libm/x86_64/fclrexcpt.c
-new file mode 100644
-index 0000000..4fc3bfb
---- /dev/null
-+++ b/libm/x86_64/fclrexcpt.c
-@@ -0,0 +1,52 @@
-+/* Clear given exceptions in current floating-point environment.
-+ Copyright (C) 2001 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fenv.h>
-+
-+int
-+feclearexcept (int excepts)
-+{
-+ fenv_t temp;
-+ unsigned int mxcsr;
-+
-+ /* Mask out unsupported bits/exceptions. */
-+ excepts &= FE_ALL_EXCEPT;
-+
-+ /* Bah, we have to clear selected exceptions. Since there is no
-+ `fldsw' instruction we have to do it the hard way. */
-+ __asm__ ("fnstenv %0" : "=m" (*&temp));
-+
-+ /* Clear the relevant bits. */
-+ temp.__status_word &= excepts ^ FE_ALL_EXCEPT;
-+
-+ /* Put the new data in effect. */
-+ __asm__ ("fldenv %0" : : "m" (*&temp));
-+
-+ /* And the same procedure for SSE. */
-+ __asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
-+
-+ /* Clear the relevant bits. */
-+ mxcsr &= ~excepts;
-+
-+ /* And put them into effect. */
-+ __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
-+
-+ /* Success. */
-+ return 0;
-+}
-diff --git a/libm/x86_64/fegetexcept.c b/libm/x86_64/fegetexcept.c
-new file mode 100644
-index 0000000..04df4b6
---- /dev/null
-+++ b/libm/x86_64/fegetexcept.c
-@@ -0,0 +1,32 @@
-+/* Get enabled floating-point exceptions.
-+ Copyright (C) 2001 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Andreas Jaeger <aj@suse.de>, 2001.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fenv.h>
-+
-+int
-+fegetexcept (void)
-+{
-+ unsigned short int exc;
-+
-+ /* Get the current control word. */
-+ __asm__ ("fstcw %0" : "=m" (*&exc));
-+
-+ return (~exc) & FE_ALL_EXCEPT;
-+}
-diff --git a/libm/x86_64/fesetround.c b/libm/x86_64/fesetround.c
-new file mode 100644
-index 0000000..3d2ef4c
---- /dev/null
-+++ b/libm/x86_64/fesetround.c
-@@ -0,0 +1,46 @@
-+/* Set current rounding direction.
-+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fenv.h>
-+
-+int
-+fesetround (int round)
-+{
-+ unsigned short int cw;
-+ int mxcsr;
-+
-+ if ((round & ~0xc00) != 0)
-+ /* ROUND is no valid rounding mode. */
-+ return 1;
-+
-+ /* First set the x87 FPU. */
-+ __asm__ ("fnstcw %0" : "=m" (*&cw));
-+ cw &= ~0xc00;
-+ cw |= round;
-+ __asm__ ("fldcw %0" : : "m" (*&cw));
-+
-+ /* And now the MSCSR register for SSE, the precision is at different bit
-+ positions in the different units, we need to shift it 3 bits. */
-+ __asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
-+ mxcsr &= ~ 0x6000;
-+ mxcsr |= round << 3;
-+ __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
-+
-+ return 0;
-+}
-diff --git a/libm/x86_64/fgetexcptflg.c b/libm/x86_64/fgetexcptflg.c
-new file mode 100644
-index 0000000..f0681dc
---- /dev/null
-+++ b/libm/x86_64/fgetexcptflg.c
-@@ -0,0 +1,36 @@
-+/* Store current representation for exceptions.
-+ Copyright (C) 2001 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fenv.h>
-+
-+int
-+fegetexceptflag (fexcept_t *flagp, int excepts)
-+{
-+ fexcept_t temp;
-+ unsigned int mxscr;
-+
-+ /* Get the current exceptions for the x87 FPU and SSE unit. */
-+ __asm__ ("fnstsw %0\n"
-+ "stmxcsr %1" : "=m" (*&temp), "=m" (*&mxscr));
-+
-+ *flagp = (temp | mxscr) & FE_ALL_EXCEPT & excepts;
-+
-+ /* Success. */
-+ return 0;
-+}
-diff --git a/libm/x86_64/ftestexcept.c b/libm/x86_64/ftestexcept.c
-new file mode 100644
-index 0000000..091c251
---- /dev/null
-+++ b/libm/x86_64/ftestexcept.c
-@@ -0,0 +1,33 @@
-+/* Test exception in current environment.
-+ Copyright (C) 2001 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <fenv.h>
-+
-+int
-+fetestexcept (int excepts)
-+{
-+ int temp;
-+ unsigned int mxscr;
-+
-+ /* Get current exceptions. */
-+ __asm__ ("fnstsw %0\n"
-+ "stmxcsr %1" : "=m" (*&temp), "=m" (*&mxscr));
-+
-+ return (temp | mxscr) & excepts & FE_ALL_EXCEPT;
-+}
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch b/main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch
deleted file mode 100644
index 5377a3f02a..0000000000
--- a/main/libc0.9.32/0005-pread_write.c-make-all-archs-use-common-code.patch
+++ /dev/null
@@ -1,671 +0,0 @@
-From 5c7b0eadf777ba9539e723882138273d631ddc05 Mon Sep 17 00:00:00 2001
-From: "Peter S. Mazinger" <ps.m@gmx.net>
-Date: Fri, 22 Apr 2011 02:22:07 +0200
-Subject: [PATCH 5/6] pread_write.c: make all archs use common code
-
-c6x does not need own version at all
-
-Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-(cherry picked from commit 836d74b92d70b71792d3d6136db7cdf0c3775ee3)
----
- libc/sysdeps/linux/c6x/Makefile.arch | 3 +-
- libc/sysdeps/linux/c6x/pread_write.c | 103 ---------------------------
- libc/sysdeps/linux/common/pread_write.c | 2 +
- libc/sysdeps/linux/mips/pread_write.c | 116 +++++++++----------------------
- libc/sysdeps/linux/powerpc/pread_write.c | 70 +++++--------------
- libc/sysdeps/linux/sh/pread_write.c | 109 ++++-------------------------
- libc/sysdeps/linux/xtensa/pread_write.c | 79 +++++----------------
- 7 files changed, 88 insertions(+), 394 deletions(-)
- delete mode 100644 libc/sysdeps/linux/c6x/pread_write.c
-
-diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch
-index 6bb44f2..5f8aaec 100644
---- a/libc/sysdeps/linux/c6x/Makefile.arch
-+++ b/libc/sysdeps/linux/c6x/Makefile.arch
-@@ -5,6 +5,7 @@
- # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- #
-
--CSRC := brk.c pread_write.c syscall.c prctl.c
-+CSRC := brk.c syscall.c prctl.c
-+#CSRC :=
-
- SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S
-diff --git a/libc/sysdeps/linux/c6x/pread_write.c b/libc/sysdeps/linux/c6x/pread_write.c
-deleted file mode 100644
-index f985b43..0000000
---- a/libc/sysdeps/linux/c6x/pread_write.c
-+++ /dev/null
-@@ -1,103 +0,0 @@
--/* vi: set sw=4 ts=4:
-- *
-- * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
-- * Based in part on the files
-- * ./sysdeps/unix/sysv/linux/pwrite.c,
-- * ./sysdeps/unix/sysv/linux/pread.c,
-- * sysdeps/posix/pread.c
-- * sysdeps/posix/pwrite.c
-- * from GNU libc 2.2.5, but reworked considerably...
-- *
-- * This program is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU Library General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or (at your
-- * option) any later version.
-- *
-- * This program is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
-- * for more details.
-- *
-- * You should have received a copy of the GNU Library General Public License
-- * along with this program; if not, write to the Free Software Foundation,
-- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#define _LARGEFILE64_SOURCE
--#include <features.h>
--#undef __OPTIMIZE__
--/* We absolutely do _NOT_ want interfaces silently
-- * * * renamed under us or very bad things will happen... */
--#ifdef __USE_FILE_OFFSET64
--# undef __USE_FILE_OFFSET64
--#endif
--
--
--#include <errno.h>
--#include <sys/types.h>
--#include <sys/syscall.h>
--#include <unistd.h>
--#include <stdint.h>
--
--extern __typeof(pread) __libc_pread;
--extern __typeof(pwrite) __libc_pwrite;
--#ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pread64) __libc_pread64;
--extern __typeof(pwrite64) __libc_pwrite64;
--#endif
--
--#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
--# ifdef __NR_pread
--# error "__NR_pread and __NR_pread64 both defined???"
--# endif
--# define __NR_pread __NR_pread64
--#endif
--
--#define __NR___syscall_pread __NR_pread
--static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
-- size_t, count, off_t, offset_hi, off_t, offset_lo);
--
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return(__syscall_pread(fd,buf,count,offset,offset >> 31));
--}
--weak_alias (__libc_pread, pread)
--
--#if defined __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return(__syscall_pread(fd, buf, count, low, high));
--}
--weak_alias (__libc_pread64, pread64)
--#endif /* __UCLIBC_HAS_LFS__ */
--
--
--#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
--# ifdef __NR_pwrite
--# error "__NR_pwrite and __NR_pwrite64 both defined???"
--# endif
--# define __NR_pwrite __NR_pwrite64
--#endif
--
--#define __NR___syscall_pwrite __NR_pwrite
--static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-- size_t, count, off_t, offset_hi, off_t, offset_lo);
--
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- return(__syscall_pwrite(fd,buf,count,offset,offset >> 31));
--}
--weak_alias (__libc_pwrite, pwrite)
--
--#if defined __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return(__syscall_pwrite(fd, buf, count, low, high));
--}
--weak_alias (__libc_pwrite64, pwrite64)
--#endif /* __UCLIBC_HAS_LFS__ */
--
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
-index 3d04bb7..dd5d36c 100644
---- a/libc/sysdeps/linux/common/pread_write.c
-+++ b/libc/sysdeps/linux/common/pread_write.c
-@@ -35,6 +35,7 @@ static _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
- size_t, count, off_t, offset_hi, off_t, offset_lo)
- # define MY_PREAD(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF_HI_LO(offset))
- # define MY_PREAD64(fd, buf, count, offset) __syscall_pread(fd, buf, count, OFF64_HI_LO(offset))
-+# endif
- #endif
-
- #ifndef MY_PWRITE
-@@ -44,6 +45,7 @@ static _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
- size_t, count, off_t, offset_hi, off_t, offset_lo)
- # define MY_PWRITE(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF_HI_LO(offset))
- # define MY_PWRITE64(fd, buf, count, offset) __syscall_pwrite(fd, buf, count, OFF64_HI_LO(offset))
-+# endif
- #endif
-
- static ssize_t __NC(pread)(int fd, void *buf, size_t count, off_t offset)
-diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c
-index ea6b15f..b777dc4 100644
---- a/libc/sysdeps/linux/mips/pread_write.c
-+++ b/libc/sysdeps/linux/mips/pread_write.c
-@@ -4,76 +4,39 @@
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
--/*
-- * Based in part on the files
-- * ./sysdeps/unix/sysv/linux/pwrite.c,
-- * ./sysdeps/unix/sysv/linux/pread.c,
-- * sysdeps/posix/pread.c
-- * sysdeps/posix/pwrite.c
-- * from GNU libc 2.2.5, but reworked considerably...
-- */
-
- #include <sys/syscall.h>
- #include <unistd.h>
--#include <stdint.h>
- #include <endian.h>
- #include <sgidefs.h>
-
--#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pread64
- # ifdef __NR_pread
- # error "__NR_pread and __NR_pread64 both defined???"
- # endif
- # define __NR_pread __NR_pread64
- #endif
-
--extern __typeof(pread) __libc_pread;
--extern __typeof(pwrite) __libc_pwrite;
--#ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pread64) __libc_pread64;
--extern __typeof(pwrite64) __libc_pwrite64;
--#endif
--
--#include <bits/kernel_types.h>
--
--
- #ifdef __NR_pread
--
--# if _MIPS_SIM == _MIPS_SIM_ABI64
--# define __NR___libc_pread __NR_pread
--_syscall4(ssize_t, __libc_pread, int, fd, void *, buf, size_t, count, off_t, offset)
--weak_alias (__libc_pread, pread)
--# ifdef __UCLIBC_HAS_LFS__
--# define __NR___libc_pread64 __NR_pread
--_syscall4(ssize_t, __libc_pread64, int, fd, void *, buf, size_t, count, off64_t, offset)
--weak_alias (__libc_pread64, pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
-+# if _MIPS_SIM == _MIPS_SIM_ABI64 /* glibc uses it for N32 as well */
-+# define __NR___syscall_pread __NR_pread
-+static _syscall4(ssize_t, __syscall_pread, int, fd, void *, buf, size_t, count, off_t, offset)
-+# define MY_PREAD(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, offset)
-+# define MY_PREAD64(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, offset)
- # else /* O32 || N32 */
- # define __NR___syscall_pread __NR_pread
--static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--# endif /* O32 || N32 */
--
--#endif /* __NR_pread */
--
--/**********************************************************************/
-+static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PREAD(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PREAD64(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
-+# endif
-+#endif
-
--#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pwrite64
- # ifdef __NR_pwrite
- # error "__NR_pwrite and __NR_pwrite64 both defined???"
- # endif
-@@ -81,35 +44,22 @@ weak_alias(__libc_pread64,pread64)
- #endif
-
- #ifdef __NR_pwrite
--
--# if _MIPS_SIM == _MIPS_SIM_ABI64
--# define __NR___libc_pwrite __NR_pwrite
--_syscall4(ssize_t, __libc_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset)
--weak_alias (__libc_pwrite, pwrite)
--# ifdef __UCLIBC_HAS_LFS__
--# define __NR___libc_pwrite64 __NR_pwrite
--_syscall4(ssize_t, __libc_pwrite64, int, fd, const void *, buf, size_t, count, off64_t, offset)
--weak_alias (__libc_pwrite64, pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
-+# if _MIPS_SIM == _MIPS_SIM_ABI64 /* glibc uses it for N32 as well */
-+# define __NR___syscall_pwrite __NR_pwrite
-+static _syscall4(ssize_t, __syscall_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset)
-+# define MY_PWRITE(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, offset)
-+# define MY_PWRITE64(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, offset)
- # else /* O32 || N32 */
- # define __NR___syscall_pwrite __NR_pwrite
--static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
--}
--weak_alias(__libc_pwrite,pwrite)
-+static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PWRITE(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PWRITE64(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
-+# endif
-+#endif
-
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--# endif /* O32 || N32 */
--#endif /* __NR_pwrite */
-+#include "../common/pread_write.c"
-diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
-index 92a184c..5cb3386 100644
---- a/libc/sysdeps/linux/powerpc/pread_write.c
-+++ b/libc/sysdeps/linux/powerpc/pread_write.c
-@@ -1,26 +1,15 @@
--/* vi: set sw=4 ts=4:
-- *
-+/* vi: set sw=4 ts=4: */
-+/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
--/* Based in part on the files
-- * ./sysdeps/unix/sysv/linux/pwrite.c,
-- * ./sysdeps/unix/sysv/linux/pread.c,
-- * sysdeps/posix/pread.c
-- * sysdeps/posix/pwrite.c
-- * from GNU libc 2.2.5, but reworked considerably...
-- */
-
- #include <sys/syscall.h>
- #include <unistd.h>
- #include <endian.h>
-
--#ifndef __UCLIBC_HAS_LFS__
--# define off64_t off_t
--#endif
--
--#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pread64
- # ifdef __NR_pread
- # error "__NR_pread and __NR_pread64 both defined???"
- # endif
-@@ -28,28 +17,16 @@
- #endif
-
- #ifdef __NR_pread
--extern __typeof(pread) __libc_pread;
- # define __NR___syscall_pread __NR_pread
--static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd,
-- void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset)));
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pread64) __libc_pread64;
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 32, offset)));
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pread */
-+static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PREAD(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PREAD64(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
-+#endif
-
--#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pwrite64
- # ifdef __NR_pwrite
- # error "__NR_pwrite and __NR_pwrite64 both defined???"
- # endif
-@@ -57,23 +34,14 @@ weak_alias(__libc_pread64,pread64)
- #endif
-
- #ifdef __NR_pwrite
--extern __typeof(pwrite) __libc_pwrite;
- # define __NR___syscall_pwrite __NR_pwrite
--static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd,
-- const void *, buf, size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset)));
--}
--weak_alias(__libc_pwrite,pwrite)
-+static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PWRITE(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PWRITE64(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
-+#endif
-
--# ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pwrite64) __libc_pwrite64;
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 32, offset)));
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pwrite */
-+#include "../common/pread_write.c"
-diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c
-index 86feb9c..f4453a6 100644
---- a/libc/sysdeps/linux/sh/pread_write.c
-+++ b/libc/sysdeps/linux/sh/pread_write.c
-@@ -4,28 +4,12 @@
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
--/*
-- * Based in part on the files
-- * ./sysdeps/unix/sysv/linux/pwrite.c,
-- * ./sysdeps/unix/sysv/linux/pread.c,
-- * sysdeps/posix/pread.c
-- * sysdeps/posix/pwrite.c
-- * from GNU libc 2.2.5, but reworked considerably...
-- */
-
- #include <sys/syscall.h>
- #include <unistd.h>
--#include <stdint.h>
- #include <endian.h>
-
--#ifdef __UCLIBC_HAS_THREADS_NATIVE__
--#include <sysdep-cancel.h>
--#else
--#define SINGLE_THREAD_P 1
--#endif
--
--
--#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pread64
- # ifdef __NR_pread
- # error "__NR_pread and __NR_pread64 both defined???"
- # endif
-@@ -33,49 +17,16 @@
- #endif
-
- #ifdef __NR_pread
--extern __typeof(pread) __libc_pread;
- # define __NR___syscall_pread __NR_pread
--static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- if (SINGLE_THREAD_P)
-- return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)));
--
--#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-- int oldtype = LIBC_CANCEL_ASYNC ();
-- ssize_t result = __syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset));
-- LIBC_CANCEL_RESET (oldtype);
-- return result;
--#endif
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pread64) __libc_pread64;
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
--
-- if (SINGLE_THREAD_P)
-- return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
--
--#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-- int oldtype = LIBC_CANCEL_ASYNC ();
-- ssize_t result = __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
-- LIBC_CANCEL_RESET (oldtype);
-- return result;
-+static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PREAD(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PREAD64(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
- #endif
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pread */
--
--/**********************************************************************/
-
--#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pwrite64
- # ifdef __NR_pwrite
- # error "__NR_pwrite and __NR_pwrite64 both defined???"
- # endif
-@@ -83,43 +34,13 @@ weak_alias(__libc_pread64,pread64)
- #endif
-
- #ifdef __NR_pwrite
--extern __typeof(pwrite) __libc_pwrite;
- # define __NR___syscall_pwrite __NR_pwrite
--static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-- size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- if (SINGLE_THREAD_P)
-- return __syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset));
--
--#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-- int oldtype = LIBC_CANCEL_ASYNC ();
-- ssize_t result = __syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset));
-- LIBC_CANCEL_RESET (oldtype);
-- return result;
-+static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PWRITE(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PWRITE64(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
- #endif
-
--}
--weak_alias(__libc_pwrite,pwrite)
--
--# ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pwrite64) __libc_pwrite64;
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
--
-- if (SINGLE_THREAD_P)
-- return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
--
--#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-- int oldtype = LIBC_CANCEL_ASYNC ();
-- ssize_t result = __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low));
-- LIBC_CANCEL_RESET (oldtype);
-- return result;
--#endif
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pwrite */
-+#include "../common/pread_write.c"
-diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c
-index e8b39e9..f4453a6 100644
---- a/libc/sysdeps/linux/xtensa/pread_write.c
-+++ b/libc/sysdeps/linux/xtensa/pread_write.c
-@@ -4,30 +4,12 @@
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
--/*
-- * Based in part on the files
-- * ./sysdeps/unix/sysv/linux/pwrite.c,
-- * ./sysdeps/unix/sysv/linux/pread.c,
-- * sysdeps/posix/pread.c
-- * sysdeps/posix/pwrite.c
-- * from GNU libc 2.2.5, but reworked considerably...
-- */
-
- #include <sys/syscall.h>
- #include <unistd.h>
--#include <stdint.h>
- #include <endian.h>
-
--extern __typeof(pread) __libc_pread;
--extern __typeof(pwrite) __libc_pwrite;
--#ifdef __UCLIBC_HAS_LFS__
--extern __typeof(pread64) __libc_pread64;
--extern __typeof(pwrite64) __libc_pwrite64;
--#endif
--
--#include <bits/kernel_types.h>
--
--#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pread64
- # ifdef __NR_pread
- # error "__NR_pread and __NR_pread64 both defined???"
- # endif
-@@ -35,31 +17,16 @@ extern __typeof(pwrite64) __libc_pwrite64;
- #endif
-
- #ifdef __NR_pread
--
- # define __NR___syscall_pread __NR_pread
--/* On Xtensa, 64-bit values are aligned in even/odd register pairs. */
--static __inline__ _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-- size_t, count, int, pad, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
--{
-- return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset));
--}
--weak_alias(__libc_pread,pread)
--
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(high, low));
--}
--weak_alias(__libc_pread64,pread64)
--# endif /* __UCLIBC_HAS_LFS__ */
--
--#endif /* __NR_pread */
-+static _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PREAD(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PREAD64(fd, buf, count, offset) \
-+ __syscall_pread(fd, buf, count, 0, OFF64_HI_LO(offset))
-+#endif
-
--#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
-+#ifdef __NR_pwrite64
- # ifdef __NR_pwrite
- # error "__NR_pwrite and __NR_pwrite64 both defined???"
- # endif
-@@ -67,25 +34,13 @@ weak_alias(__libc_pread64,pread64)
- #endif
-
- #ifdef __NR_pwrite
--
- # define __NR___syscall_pwrite __NR_pwrite
--/* On Xtensa, 64-bit values are aligned in even/odd register pairs. */
--static __inline__ _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-- size_t, count, int, pad, off_t, offset_hi, off_t, offset_lo)
--
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
--{
-- return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(offset >> 31, offset));
--}
--weak_alias(__libc_pwrite,pwrite)
-+static _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
-+ size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo)
-+# define MY_PWRITE(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF_HI_LO(offset))
-+# define MY_PWRITE64(fd, buf, count, offset) \
-+ __syscall_pwrite(fd, buf, count, 0, OFF64_HI_LO(offset))
-+#endif
-
--# ifdef __UCLIBC_HAS_LFS__
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
--{
-- uint32_t low = offset & 0xffffffff;
-- uint32_t high = offset >> 32;
-- return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(high, low));
--}
--weak_alias(__libc_pwrite64,pwrite64)
--# endif /* __UCLIBC_HAS_LFS__ */
--#endif /* __NR_pwrite */
-+#include "../common/pread_write.c"
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch b/main/libc0.9.32/0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
deleted file mode 100644
index 91ff10a94b..0000000000
--- a/main/libc0.9.32/0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 1337133b489f02e5cbde81a87051abaf6e1a2799 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Fri, 18 Mar 2011 10:57:31 +0200
-Subject: [PATCH 5/8] stdlib: fix arc4random return type to u_int32_t
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It's documented to be u_int32_t and not uint32_t:
- http://www.manpagez.com/man/3/arc4random/
-
-This also fixes a major bug that stdlib.h includes stdint.h. Things
-might go very wrong because stdint.h has conditional defines and
-if stdlib.h is included before #define's for stdint.h we end up
-missing things and breaking builds (e.g. openjdk).
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- include/stdlib.h | 4 ++--
- libc/stdlib/arc4random.c | 3 ++-
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/include/stdlib.h b/include/stdlib.h
-index 352e58a..37e0248 100644
---- a/include/stdlib.h
-+++ b/include/stdlib.h
-@@ -910,8 +910,8 @@ extern int getloadavg (double __loadavg[], int __nelem)
- #endif
-
- #ifdef __UCLIBC_HAS_ARC4RANDOM__
--#include <stdint.h>
--extern uint32_t arc4random(void);
-+# include <sys/types.h>
-+extern u_int32_t arc4random(void);
- extern void arc4random_stir(void);
- extern void arc4random_addrandom(unsigned char *, int);
- #endif
-diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c
-index c7aed66..7b9b12d 100644
---- a/libc/stdlib/arc4random.c
-+++ b/libc/stdlib/arc4random.c
-@@ -30,6 +30,7 @@
- #include <fcntl.h>
- #include <stdlib.h>
- #include <unistd.h>
-+#include <stdint.h>
- #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/time.h>
-@@ -175,7 +176,7 @@ arc4random_addrandom(u_char *dat, int datlen)
- arc4_addrandom(&rs, dat, datlen);
- }
-
--uint32_t
-+u_int32_t
- arc4random(void)
- {
- if (!rs_initialized)
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch b/main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
deleted file mode 100644
index 252c4b7c5a..0000000000
--- a/main/libc0.9.32/0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 3dfbb6b7778d05aa7e3809e139115edfd2e0a342 Mon Sep 17 00:00:00 2001
-From: "Peter S. Mazinger" <ps.m@gmx.net>
-Date: Thu, 21 Apr 2011 21:20:55 +0200
-Subject: [PATCH 6/6] endian.h: add some handy macros to be used in syscalls
-
-Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-(cherry picked from commit f6a03f19cf2807170717593b4de8056a1248b99b)
----
- include/endian.h | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/include/endian.h b/include/endian.h
-index 0ba7384..1e2fc93 100644
---- a/include/endian.h
-+++ b/include/endian.h
-@@ -55,6 +55,17 @@
- # define __LONG_LONG_PAIR(HI, LO) HI, LO
- #endif
-
-+#ifdef _LIBC
-+# ifndef __ASSEMBLER__
-+# include <stdint.h>
-+# define OFF_HI(offset) (offset >> 31)
-+# define OFF_LO(offset) (offset)
-+# define OFF64_HI(offset) (uint32_t)(offset >> 32)
-+# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff)
-+# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset))
-+# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset))
-+# endif
-+#endif
-
- #ifdef __USE_BSD
- /* Conversion interfaces. */
---
-1.7.11.1
-
diff --git a/main/libc0.9.32/0006-malloc-standard-synchronize-on-fork.patch b/main/libc0.9.32/0006-malloc-standard-synchronize-on-fork.patch
deleted file mode 100644
index cb2f074cd3..0000000000
--- a/main/libc0.9.32/0006-malloc-standard-synchronize-on-fork.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From b5c064a6fc9660cf643cd79caaa18309498ec0d4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Sat, 26 Mar 2011 20:23:09 +0200
-Subject: [PATCH 6/8] malloc-standard: synchronize on fork
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Otherwise other threads can leave malloc state locked, and the child
-will hang indefinitely if it tries to malloc something.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- libc/stdlib/malloc-standard/free.c | 17 +++++++++++++++++
- 1 files changed, 17 insertions(+), 0 deletions(-)
-
-diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c
-index 39e54d6..df512cc 100644
---- a/libc/stdlib/malloc-standard/free.c
-+++ b/libc/stdlib/malloc-standard/free.c
-@@ -118,6 +118,21 @@ int malloc_trim(size_t pad)
- to inline it at all call points, which turns out not to be an
- optimization at all. (Inlining it in __malloc_consolidate is fine though.)
- */
-+static void _malloc_lock(void)
-+{
-+ __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE(__malloc_lock);
-+}
-+
-+static void _malloc_unlock(void)
-+{
-+ __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE(__malloc_lock);
-+}
-+
-+static void _malloc_reset(void)
-+{
-+ __UCLIBC_MUTEX_INIT_VAR(__malloc_lock);
-+}
-+
- static void malloc_init_state(mstate av)
- {
- int i;
-@@ -145,6 +160,8 @@ static void malloc_init_state(mstate av)
-
- av->top = initial_top(av);
- av->pagesize = malloc_getpagesize;
-+
-+ __libc_atfork(_malloc_lock, _malloc_unlock, _malloc_reset);
- }
-
-
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch b/main/libc0.9.32/0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
deleted file mode 100644
index ba3681f334..0000000000
--- a/main/libc0.9.32/0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
+++ /dev/null
@@ -1,251 +0,0 @@
-From caed9d8dbc7e7b1e39a3e666d691d844da3ab12d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Thu, 10 Nov 2011 09:36:44 +0200
-Subject: [PATCH 7/8] libc/x86: fix stack unwinding and backtrace information
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When compiled without framepointer, the DWARF-2 CFI data is required
-for proper stack unwinding.
-
-This patch adds the CFI information to:
- * syscalls (so we get proper backtrace even for release builds)
- the ebx hack was removed as it would complicate the CFI generation
- * new thread stub function (so the backtrace is clean for user
- created threads)
-
-Also pads the signal return trampolines separate from other functions.
-If CFI info was found for signal return code (which seems to happen if
-it's located right next a valid function), it will not be recognized
-as signal trampoline (gcc unwinder and gdb check first CFI info, and
-only if it does not exists it compares the exact opcode sequence to
-see if we are at signal return code block). This fixes a real crash
-if thread is cancelled and the cancellation handler fails to detect the
-signal return frame.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- libc/sysdeps/linux/i386/bits/syscalls.h | 82 +++----------------------------
- libc/sysdeps/linux/i386/clone.S | 17 ++++++
- libc/sysdeps/linux/i386/sigaction.c | 4 ++
- 3 files changed, 28 insertions(+), 75 deletions(-)
-
-diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h
-index 9fb4f35..35b09bb 100644
---- a/libc/sysdeps/linux/i386/bits/syscalls.h
-+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
-@@ -13,6 +13,7 @@
- #ifndef __ASSEMBLER__
-
- #include <errno.h>
-+#include <common/sysdep.h>
-
- #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- (__extension__ \
-@@ -32,90 +33,21 @@
-
- #if 1 /* defined __PIC__ || defined __pic__ */
-
--/* This code avoids pushing/popping ebx as much as possible.
-- * I think the main reason was that older GCCs had problems
-- * with proper saving/restoring of ebx if "b" constraint was used,
-- * which was breaking -fPIC code really badly.
-- * At least gcc 4.2.x seems to not need these tricks anymore,
-- * but this code is still useful because it often avoids
-- * using stack for saving ebx.
-- * Keeping it unconditionally enabled for now.
-- */
--
--/* We need some help from the assembler to generate optimal code.
-- * We define some macros here which later will be used. */
--/* gcc>=4.6 with LTO need the same guards as IMA (a.k.a --combine) did.
-- * See gcc.gnu.org/PR47577 */
--/* FIXME: drop these b* macros! */
--
--__asm__ (
--#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6)
-- /* Protect against asm macro redefinition (happens in __DOMULTI__ mode).
-- * Unfortunately, it ends up visible in .o files. */
-- ".ifndef _BITS_SYSCALLS_ASM\n\t"
-- ".set _BITS_SYSCALLS_ASM,1\n\t"
--#endif
-- ".L__X'%ebx = 1\n\t"
-- ".L__X'%ecx = 2\n\t"
-- ".L__X'%edx = 2\n\t"
-- ".L__X'%eax = 3\n\t"
-- ".L__X'%esi = 3\n\t"
-- ".L__X'%edi = 3\n\t"
-- ".L__X'%ebp = 3\n\t"
-- ".L__X'%esp = 3\n\t"
--
-- /* Loading param #1 (ebx) is done by loading it into
-- * another register, and then performing bpushl+bmovl,
-- * since we must preserve ebx */
--
-- ".macro bpushl name reg\n\t"
-- ".if 1 - \\name\n\t" /* if reg!=ebx... */
-- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
-- "pushl %ebx\n\t" /* save ebx on stack */
-- ".else\n\t"
-- "xchgl \\reg, %ebx\n\t" /* else save ebx in reg, and load reg to ebx */
-- ".endif\n\t"
-- ".endif\n\t"
-- ".endm\n\t"
--
-- ".macro bmovl name reg\n\t"
-- ".if 1 - \\name\n\t"
-- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
-- "movl \\reg, %ebx\n\t" /* load reg to ebx */
-- ".endif\n\t"
-- ".endif\n\t"
-- ".endm\n\t"
--
-- ".macro bpopl name reg\n\t"
-- ".if 1 - \\name\n\t"
-- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
-- "popl %ebx\n\t" /* restore ebx from stack */
-- ".else\n\t"
-- "xchgl \\reg, %ebx\n\t" /* else restore ebx from reg */
-- ".endif\n\t"
-- ".endif\n\t"
-- ".endm\n\t"
--
--#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6)
-- ".endif\n\t" /* _BITS_SYSCALLS_ASM */
--#endif
--);
--
- #define LOADARGS_0
--#define LOADARGS_1 "bpushl .L__X'%k2, %k2\n\t" "bmovl .L__X'%k2, %k2\n\t"
-+#define LOADARGS_1 "push %%ebx\n\t" CFI_ADJUST_CFA_OFFSET(4) "\n\t" CFI_REL_OFFSET(ebx, 0) "\n\t" "movl %k2, %%ebx\n\t"
- #define LOADARGS_2 LOADARGS_1
- #define LOADARGS_3 LOADARGS_1
- #define LOADARGS_4 LOADARGS_1
- #define LOADARGS_5 LOADARGS_1
--#define LOADARGS_6 LOADARGS_1 "push %%ebp\n\t" "movl %7, %%ebp\n\t"
-+#define LOADARGS_6 LOADARGS_1 "push %%ebp\n\t" CFI_ADJUST_CFA_OFFSET(4) "\n\t" CFI_REL_OFFSET(ebp, 0) "\n\t" "movl %7, %%ebp\n\t"
-
- #define RESTOREARGS_0
--#define RESTOREARGS_1 "bpopl .L__X'%k2, %k2\n\t"
-+#define RESTOREARGS_1 "pop %%ebx\n\t" CFI_ADJUST_CFA_OFFSET(-4) "\n\t" CFI_RESTORE(ebx) "\n\t" RESTOREARGS_0
- #define RESTOREARGS_2 RESTOREARGS_1
- #define RESTOREARGS_3 RESTOREARGS_1
- #define RESTOREARGS_4 RESTOREARGS_1
- #define RESTOREARGS_5 RESTOREARGS_1
--#define RESTOREARGS_6 "pop %%ebp\n\t" RESTOREARGS_1
-+#define RESTOREARGS_6 "pop %%ebp\n\t" CFI_ADJUST_CFA_OFFSET(-4) "\n\t" CFI_RESTORE(ebp) "\n\t" RESTOREARGS_1
-
- #define ASMFMT_0()
- /* "acdSD" constraint would work too, but "SD" would use esi/edi and cause
-@@ -163,7 +95,7 @@ __asm__ (
- #define LOADARGS_3
- #define LOADARGS_4
- #define LOADARGS_5
--#define LOADARGS_6 "push %%ebp\n\t" "movl %7, %%ebp\n\t"
-+#define LOADARGS_6 "push %%ebp\n\t" CFI_ADJUST_CFA_OFFSET(4) "\n\t" CFI_REL_OFFSET(ebp, 0) "\n\t" "movl %7, %%ebp\n\t"
-
- #define RESTOREARGS_0
- #define RESTOREARGS_1
-@@ -171,7 +103,7 @@ __asm__ (
- #define RESTOREARGS_3
- #define RESTOREARGS_4
- #define RESTOREARGS_5
--#define RESTOREARGS_6 "pop %%ebp\n\t"
-+#define RESTOREARGS_6 "pop %%ebp\n\t" CFI_ADJUST_CFA_OFFSET(-4) "\n\t" CFI_RESTORE(ebp) "\n\t"
-
- #define ASMFMT_0()
- #define ASMFMT_1(arg1) \
-diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
-index a7de3fe..cf6cd35 100644
---- a/libc/sysdeps/linux/i386/clone.S
-+++ b/libc/sysdeps/linux/i386/clone.S
-@@ -25,6 +25,7 @@
-
- #define _ERRNO_H 1
- #include <bits/errno.h>
-+#include <sysdep.h>
- #include <sys/syscall.h>
-
- /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
-@@ -45,6 +46,7 @@
- .global clone
- .type clone,%function
- clone:
-+ cfi_startproc;
- /* Sanity check arguments. */
- movl $-EINVAL,%eax
-
-@@ -86,17 +88,28 @@ clone:
-
- /* Do the system call */
- pushl %ebx
-+ cfi_adjust_cfa_offset (4)
- pushl %esi
-+ cfi_adjust_cfa_offset (4)
- pushl %edi
-+ cfi_adjust_cfa_offset (4)
-+
- movl TLS+12(%esp),%esi
-+ cfi_rel_offset (esi, 4)
- movl PTID+12(%esp),%edx
- movl FLAGS+12(%esp),%ebx
-+ cfi_rel_offset (ebx, 8)
- movl CTID+12(%esp),%edi
-+ cfi_rel_offset (edi, 0)
- movl $__NR_clone,%eax
- #ifdef RESET_PID
- /* Remember the flag value. */
- movl %ebx, (%ecx)
- #endif
-+ /* End FDE now, because in the child the unwind info will be
-+ wrong. */
-+ cfi_endproc
-+
- int $0x80
- popl %edi
- popl %esi
-@@ -108,6 +121,9 @@ clone:
- ret
-
- .Lthread_start:
-+ cfi_startproc;
-+ /* Clearing frame pointer is insufficient, use CFI. */
-+ cfi_undefined (eip);
- /* Note: %esi is zero. */
- movl %esi,%ebp /* terminate the stack frame */
- call *%ebx
-@@ -120,6 +136,7 @@ clone:
- movl %eax, %ebx
- movl $__NR_exit, %eax
- int $0x80
-+ cfi_endproc;
-
- /* Need to indirect jump to syscall error
- * or we end up with TEXTREL's
-diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c
-index a6a22de..1b787a6 100644
---- a/libc/sysdeps/linux/i386/sigaction.c
-+++ b/libc/sysdeps/linux/i386/sigaction.c
-@@ -120,6 +120,9 @@ libc_hidden_weak(sigaction)
- # define RESTORE2(name, syscall) \
- __asm__ ( \
- ".text\n" \
-+ ".align 8\n" \
-+ " nop\n" \
-+ ".align 16\n" \
- "__" #name ":\n" \
- " movl $" #syscall ", %eax\n" \
- " int $0x80\n" \
-@@ -133,6 +136,7 @@ RESTORE(restore_rt, __NR_rt_sigreturn)
- # define RESTORE2(name, syscall) \
- __asm__ ( \
- ".text\n" \
-+ ".align 8\n" \
- "__" #name ":\n" \
- " popl %eax\n" \
- " movl $" #syscall ", %eax\n" \
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0008-ldso-limited-support-for-ORIGIN-in-rpath.patch b/main/libc0.9.32/0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
deleted file mode 100644
index 58386eb896..0000000000
--- a/main/libc0.9.32/0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From 4eb3c29b8ee0e77f3b8b98e697a6ce0b5571a0f7 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Fri, 18 Mar 2011 10:53:56 +0200
-Subject: [PATCH 8/8] ldso: limited support for $ORIGIN in rpath
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Handle it if it's in the beginning of the rpath entry as it
-should be.
-
-Posted to uclibc ml:
-http://old.nabble.com/-PATCH-1-3--ldso%3A-limited-support-for-$ORIGIN-in-rpath-td31181219.html
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
-
-Conflicts:
-
- ldso/ldso/dl-elf.c
- ldso/ldso/ldso.c
----
- ldso/ldso/dl-elf.c | 81 ++++++++++++++++++++++++++++++---------------------
- ldso/ldso/ldso.c | 18 +++++++++--
- 2 files changed, 63 insertions(+), 36 deletions(-)
-
-diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
-index b9de199..547d9e0 100644
---- a/ldso/ldso/dl-elf.c
-+++ b/ldso/ldso/dl-elf.c
-@@ -132,57 +132,71 @@ _dl_protect_relro (struct elf_resolve *l)
- /* This function's behavior must exactly match that
- * in uClibc/ldso/util/ldd.c */
- static struct elf_resolve *
--search_for_named_library(const char *name, unsigned rflags, const char *path_list,
-- struct dyn_elf **rpnt)
-+search_for_named_library_with_origin(const char *name, int secure,
-+ const char *path_list, struct dyn_elf **rpnt, const char *origin)
- {
-- char *path, *path_n, *mylibname;
-+ char *mylibname;
-+ const char *p, *pn;
- struct elf_resolve *tpnt;
-- int done;
-+ int plen;
-
- if (path_list==NULL)
- return NULL;
-
-- /* We need a writable copy of this string, but we don't
-- * need this allocated permanently since we don't want
-- * to leak memory, so use alloca to put path on the stack */
-- done = _dl_strlen(path_list);
-- path = alloca(done + 1);
--
- /* another bit of local storage */
- mylibname = alloca(2050);
-
-- _dl_memcpy(path, path_list, done+1);
--
- /* Unlike ldd.c, don't bother to eliminate double //s */
-
- /* Replace colons with zeros in path_list */
- /* : at the beginning or end of path maps to CWD */
- /* :: anywhere maps CWD */
- /* "" maps to CWD */
-- done = 0;
-- path_n = path;
-- do {
-- if (*path == 0) {
-- *path = ':';
-- done = 1;
-- }
-- if (*path == ':') {
-- *path = 0;
-- if (*path_n)
-- _dl_strcpy(mylibname, path_n);
-- else
-- _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */
-- _dl_strcat(mylibname, "/");
-- _dl_strcat(mylibname, name);
-- if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
-- return tpnt;
-- path_n = path+1;
-+ for (p = path_list; p != NULL; p = pn) {
-+ pn = _dl_strchr(p + 1, ':');
-+ if (pn != NULL) {
-+ plen = pn - p;
-+ pn++;
-+ } else
-+ plen = _dl_strlen(p);
-+
-+ if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) {
-+ int olen;
-+ if (secure && plen != 7)
-+ continue;
-+ if (origin == NULL)
-+ continue;
-+ for (olen = _dl_strlen(origin) - 1; olen >= 0 && origin[olen] != '/'; olen--)
-+ ;
-+ if (olen <= 0)
-+ continue;
-+ _dl_memcpy(&mylibname[0], origin, olen);
-+ _dl_memcpy(&mylibname[olen], p + 7, plen - 7);
-+ mylibname[olen + plen - 7] = 0;
-+ } else if (plen != 0) {
-+ _dl_memcpy(mylibname, p, plen);
-+ mylibname[plen] = 0;
-+ } else {
-+ _dl_strcpy(mylibname, ".");
- }
-- path++;
-- } while (!done);
-+ _dl_strcat(mylibname, "/");
-+ _dl_strcat(mylibname, name);
-+
-+ tpnt = _dl_load_elf_shared_library(secure, rpnt, mylibname);
-+ if (tpnt != NULL)
-+ return tpnt;
-+ }
-+
- return NULL;
- }
-
-+static struct elf_resolve *
-+search_for_named_library(const char *name, int secure, const char *path_list,
-+ struct dyn_elf **rpnt)
-+{
-+ return search_for_named_library_with_origin(name, secure, path_list, rpnt, NULL);
-+}
-+
- /* Used to return error codes back to dlopen et. al. */
- unsigned long _dl_error_number;
- unsigned long _dl_internal_error_number;
-@@ -231,7 +245,8 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
- if (pnt) {
- pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
- _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt);
-- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
-+ if ((tpnt1 = search_for_named_library_with_origin(libname, rflags, pnt, rpnt,
-+ tpnt->libname)) != NULL)
- return tpnt1;
- }
- #endif
-diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
-index 7690036..78dc92d 100644
---- a/ldso/ldso/ldso.c
-+++ b/ldso/ldso/ldso.c
-@@ -403,6 +403,20 @@ static ptrdiff_t _dl_build_local_scope (struct elf_resolve **list,
- return p - list;
- }
-
-+static void _dl_setup_progname(const char *argv0)
-+{
-+ char image[PATH_MAX];
-+ ssize_t s;
-+
-+ s = _dl_readlink("/proc/self/exe", image, sizeof(image));
-+ if (s > 0 && image[0] == '/') {
-+ image[s] = 0;
-+ _dl_progname = _dl_strdup(image);
-+ } else if (argv0) {
-+ _dl_progname = argv0;
-+ }
-+}
-+
- void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
- ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
- DL_GET_READY_TO_RUN_EXTRA_PARMS)
-@@ -454,9 +468,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
- * been fixed up by now. Still no function calls outside of this
- * library, since the dynamic resolver is not yet ready.
- */
-- if (argv[0]) {
-- _dl_progname = argv[0];
-- }
-+ _dl_setup_progname(argv[0]);
-
- #ifndef __LDSO_STANDALONE_SUPPORT__
- if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
---
-1.7.8.4
-
diff --git a/main/libc0.9.32/0009-sys-quota.h-sync-with-glibc.patch b/main/libc0.9.32/0009-sys-quota.h-sync-with-glibc.patch
deleted file mode 100644
index 528e014038..0000000000
--- a/main/libc0.9.32/0009-sys-quota.h-sync-with-glibc.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-From 4bb4a75c61b9746be6746589bc8ac418bf304b47 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Wed, 29 Aug 2012 09:24:25 +0000
-Subject: [PATCH] sys/quota.h: sync with glibc
-
-This fixes build error when building Firefox 15:
-error: 'struct dqblk' has no member named 'dqb_curspace'
----
- include/sys/quota.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++-------
- 1 file changed, 79 insertions(+), 12 deletions(-)
-
-diff --git a/include/sys/quota.h b/include/sys/quota.h
-index a6afdbe..5aa0ec0 100644
---- a/include/sys/quota.h
-+++ b/include/sys/quota.h
-@@ -30,8 +30,6 @@
- * 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.
-- *
-- * Version: $Id: quota.h,v 1.1 2002/01/03 04:00:09 andersen Exp $
- */
-
- #ifndef _SYS_QUOTA_H
-@@ -41,6 +39,14 @@
- #include <sys/types.h>
-
- /*
-+ * Select between different incompatible quota versions.
-+ * Default to the version used by Linux kernel version 2.4.22
-+ * or later. */
-+#ifndef _LINUX_QUOTA_VERSION
-+# define _LINUX_QUOTA_VERSION 2
-+#endif
-+
-+/*
- * Convert diskblocks to blocks and the other way around.
- * currently only to fool the BSD source. :-)
- */
-@@ -94,21 +100,33 @@
- #define SUBCMDSHIFT 8
- #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
-
--#define Q_QUOTAON 0x0100 /* enable quotas */
--#define Q_QUOTAOFF 0x0200 /* disable quotas */
--#define Q_GETQUOTA 0x0300 /* get limits and usage */
--#define Q_SETQUOTA 0x0400 /* set limits and usage */
--#define Q_SETUSE 0x0500 /* set usage */
--#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
--#define Q_SETQLIM 0x0700 /* set limits */
--#define Q_GETSTATS 0x0800 /* get collected stats */
--#define Q_RSQUASH 0x1000 /* set root_squash option */
-+#if _LINUX_QUOTA_VERSION < 2
-+# define Q_QUOTAON 0x0100 /* enable quotas */
-+# define Q_QUOTAOFF 0x0200 /* disable quotas */
-+# define Q_GETQUOTA 0x0300 /* get limits and usage */
-+# define Q_SETQUOTA 0x0400 /* set limits and usage */
-+# define Q_SETUSE 0x0500 /* set usage */
-+# define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
-+# define Q_SETQLIM 0x0700 /* set limits */
-+# define Q_GETSTATS 0x0800 /* get collected stats */
-+# define Q_RSQUASH 0x1000 /* set root_squash option */
-+#else
-+# define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */
-+# define Q_QUOTAON 0x800002 /* turn quotas on */
-+# define Q_QUOTAOFF 0x800003 /* turn quotas off */
-+# define Q_GETFMT 0x800004 /* get quota format used on given filesystem */
-+# define Q_GETINFO 0x800005 /* get information about quota files */
-+# define Q_SETINFO 0x800006 /* set information about quota files */
-+# define Q_GETQUOTA 0x800007 /* get user quota structure */
-+# define Q_SETQUOTA 0x800008 /* set user quota structure */
-+#endif
-
- /*
- * The following structure defines the format of the disk quota file
- * (as it appears on disk) - the file is an array of these structures
- * indexed by user or group number.
- */
-+#if _LINUX_QUOTA_VERSION < 2
- struct dqblk
- {
- u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
-@@ -120,13 +138,45 @@ struct dqblk
- time_t dqb_btime; /* time limit for excessive disk use */
- time_t dqb_itime; /* time limit for excessive files */
- };
-+#else
-+
-+/* Flags that indicate which fields in dqblk structure are valid. */
-+#define QIF_BLIMITS 1
-+#define QIF_SPACE 2
-+#define QIF_ILIMITS 4
-+#define QIF_INODES 8
-+#define QIF_BTIME 16
-+#define QIF_ITIME 32
-+#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
-+#define QIF_USAGE (QIF_SPACE | QIF_INODES)
-+#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
-+#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
-+
-+struct dqblk
-+ {
-+ u_int64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */
-+ u_int64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */
-+ u_int64_t dqb_curspace; /* current quota block count */
-+ u_int64_t dqb_ihardlimit; /* maximum # allocated inodes */
-+ u_int64_t dqb_isoftlimit; /* preferred inode limit */
-+ u_int64_t dqb_curinodes; /* current # allocated inodes */
-+ u_int64_t dqb_btime; /* time limit for excessive disk use */
-+ u_int64_t dqb_itime; /* time limit for excessive files */
-+ u_int32_t dqb_valid; /* bitmask of QIF_* constants */
-+ };
-+#endif
-
- /*
- * Shorthand notation.
- */
- #define dq_bhardlimit dq_dqb.dqb_bhardlimit
- #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
--#define dq_curblocks dq_dqb.dqb_curblocks
-+#if _LINUX_QUOTA_VERSION < 2
-+# define dq_curblocks dq_dqb.dqb_curblocks
-+#else
-+# define dq_curspace dq_dqb.dqb_curspace
-+# define dq_valid dq_dqb.dqb_valid
-+#endif
- #define dq_ihardlimit dq_dqb.dqb_ihardlimit
- #define dq_isoftlimit dq_dqb.dqb_isoftlimit
- #define dq_curinodes dq_dqb.dqb_curinodes
-@@ -135,6 +185,7 @@ struct dqblk
-
- #define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk)))
-
-+#if _LINUX_QUOTA_VERSION < 2
- struct dqstats
- {
- u_int32_t lookups;
-@@ -147,6 +198,22 @@ struct dqstats
- u_int32_t free_dquots;
- u_int32_t syncs;
- };
-+#else
-+
-+/* Flags that indicate which fields in dqinfo structure are valid. */
-+# define IIF_BGRACE 1
-+# define IIF_IGRACE 2
-+# define IIF_FLAGS 4
-+# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
-+
-+struct dqinfo
-+ {
-+ u_int64_t dqi_bgrace;
-+ u_int64_t dqi_igrace;
-+ u_int32_t dqi_flags;
-+ u_int32_t dqi_valid;
-+ };
-+#endif
-
- __BEGIN_DECLS
-
---
-1.7.12
-
diff --git a/main/libc0.9.32/560-res_init_asterisk.patch b/main/libc0.9.32/560-res_init_asterisk.patch
deleted file mode 100644
index c86c96a5ee..0000000000
--- a/main/libc0.9.32/560-res_init_asterisk.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From: https://dev.openwrt.org/ticket/11929
-
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -3580,35 +3580,6 @@
- }
- #endif
-
--/* This needs to be after the use of _res in res_init, above. */
--#undef _res
--
--#ifndef __UCLIBC_HAS_THREADS__
--/* The resolver state for use by single-threaded programs.
-- This differs from plain `struct __res_state _res;' in that it doesn't
-- create a common definition, but a plain symbol that resides in .bss,
-- which can have an alias. */
--struct __res_state _res __attribute__((section (".bss")));
--struct __res_state *__resp = &_res;
--#else /* __UCLIBC_HAS_THREADS__ */
--struct __res_state _res __attribute__((section (".bss"))) attribute_hidden;
--
--# if defined __UCLIBC_HAS_TLS__
--# undef __resp
--__thread struct __res_state *__resp = &_res;
--/*
-- * FIXME: Add usage of hidden attribute for this when used in the shared
-- * library. It currently crashes the linker when doing section
-- * relocations.
-- */
--extern __thread struct __res_state *__libc_resp
-- __attribute__ ((alias ("__resp"))) attribute_hidden;
--# else
--# undef __resp
--struct __res_state *__resp = &_res;
--# endif
--#endif /* !__UCLIBC_HAS_THREADS__ */
--
- static unsigned int
- res_randomid(void)
- {
-@@ -3664,6 +3635,36 @@
- }
- libc_hidden_def(res_init)
-
-+/* This needs to be after the use of _res in res_init, above. */
-+#undef _res
-+
-+#ifndef __UCLIBC_HAS_THREADS__
-+/* The resolver state for use by single-threaded programs.
-+ This differs from plain `struct __res_state _res;' in that it doesn't
-+ create a common definition, but a plain symbol that resides in .bss,
-+ which can have an alias. */
-+struct __res_state _res __attribute__((section (".bss")));
-+struct __res_state *__resp = &_res;
-+#else /* __UCLIBC_HAS_THREADS__ */
-+struct __res_state _res __attribute__((section (".bss"))) attribute_hidden;
-+
-+# if defined __UCLIBC_HAS_TLS__
-+# undef __resp
-+__thread struct __res_state *__resp = &_res;
-+/*
-+ * FIXME: Add usage of hidden attribute for this when used in the shared
-+ * library. It currently crashes the linker when doing section
-+ * relocations.
-+ */
-+extern __thread struct __res_state *__libc_resp
-+ __attribute__ ((alias ("__resp"))) attribute_hidden;
-+# else
-+# undef __resp
-+struct __res_state *__resp = &_res;
-+# endif
-+#endif /* !__UCLIBC_HAS_THREADS__ */
-+
-+
- /*
- * Set up default settings. If the configuration file exist, the values
- * there will have precedence. Otherwise, the server address is set to
diff --git a/main/libc0.9.32/970-add___kernel_long_and___kernel_ulong.patch b/main/libc0.9.32/970-add___kernel_long_and___kernel_ulong.patch
deleted file mode 100644
index d790664ba4..0000000000
--- a/main/libc0.9.32/970-add___kernel_long_and___kernel_ulong.patch
+++ /dev/null
@@ -1,320 +0,0 @@
-From 6a76edddaa62ff06f178143b582167734cb55c18 Mon Sep 17 00:00:00 2001
-From: Chris Packham <chris.packham@alliedtelesis.co.nz>
-Date: Mon, 01 Oct 2012 05:12:54 +0000
-Subject: libc/sysdeps: add __kernel_long and __kernel_ulong
-
-Linux 3.4 added __kernel_long_t and __kernel_ulong_t and various
-exported header files were updated to use these new types. Add the
-definitions for __kernel_long_t and __kernel_ulong_t to the relevant
-kernel_types.h headers.
-
-This change was automated with the following scriptlet
-
- git grep --name-only 'typedef.*__kernel_old_dev_t' \
- | xargs sed -i '/typedef.*__kernel_old_dev_t/ a\
- typedef long\t\t__kernel_long_t;\
- typedef unsigned long\t__kernel_ulong_t;'
-
-Whitespace in arm, avr32, hppa, sparc was then manually fixed up.
-
-Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
-Here's a cleaned up patch which should get the whitespace right. I'm a
-bit iffy about the sparc changes they make sense to me but it's not a
-platform I have access to.
-
-I can break this up per arch or per maintainer if requested.
-
- libc/sysdeps/linux/alpha/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/arm/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/avr32/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/bfin/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/c6x/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/cris/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/e1/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/h8300/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/hppa/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/i386/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/ia64/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/m68k/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/microblaze/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/mips/bits/kernel_types.h | 4 ++++
- libc/sysdeps/linux/nios2/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/powerpc/bits/kernel_types.h | 4 ++++
- libc/sysdeps/linux/sh/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/sh64/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/sparc/bits/kernel_types.h | 4 ++++
- libc/sysdeps/linux/v850/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/x86_64/bits/kernel_types.h | 2 ++
- libc/sysdeps/linux/xtensa/bits/kernel_types.h | 2 ++
- 22 files changed, 50 insertions(+)
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
---- a/libc/sysdeps/linux/alpha/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/alpha/bits/kernel_types.h
-@@ -33,6 +33,8 @@ typedef __kernel_gid_t __kernel_old_gid_
- typedef __kernel_uid_t __kernel_uid32_t;
- typedef __kernel_gid_t __kernel_gid32_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- int val[2];
---- a/libc/sysdeps/linux/arm/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/arm/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid
- typedef unsigned short __kernel_old_gid_t;
- typedef long long __kernel_loff_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- #ifdef __USE_ALL
---- a/libc/sysdeps/linux/avr32/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/avr32/bits/kernel_types.h
-@@ -39,6 +39,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef unsigned short __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- #ifdef __GNUC__
- typedef long long __kernel_loff_t;
---- a/libc/sysdeps/linux/bfin/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/bfin/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
- typedef unsigned short __kernel_old_gid_t;
- typedef long long __kernel_loff_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- #ifdef __USE_ALL
---- a/libc/sysdeps/linux/c6x/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h
-@@ -22,6 +22,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned int __kernel_old_uid_t;
- typedef unsigned int __kernel_old_gid_t;
- typedef unsigned int __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef unsigned int __kernel_size_t;
- typedef int __kernel_ssize_t;
- typedef int __kernel_ptrdiff_t;
---- a/libc/sysdeps/linux/cris/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/cris/bits/kernel_types.h
-@@ -28,6 +28,8 @@ typedef unsigned int __kernel_gid32_t
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- #ifdef __GNUC__
- typedef long long __kernel_loff_t;
---- a/libc/sysdeps/linux/e1/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/e1/bits/kernel_types.h
-@@ -31,6 +31,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- /*
---- a/libc/sysdeps/linux/h8300/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/h8300/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
- typedef unsigned short __kernel_old_gid_t;
- typedef long long __kernel_loff_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- #ifdef __USE_ALL
---- a/libc/sysdeps/linux/hppa/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/hppa/bits/kernel_types.h
-@@ -45,6 +45,8 @@ typedef long long __kernel_off64_t;
- typedef unsigned long long __kernel_ino64_t;
-
- typedef unsigned int __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- #ifdef __USE_ALL
---- a/libc/sysdeps/linux/i386/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/i386/bits/kernel_types.h
-@@ -40,6 +40,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- typedef struct {
---- a/libc/sysdeps/linux/ia64/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/ia64/bits/kernel_types.h
-@@ -52,5 +52,7 @@ typedef __kernel_gid_t __kernel_gid32_t;
-
- typedef unsigned int __kernel_dev_t;
- typedef unsigned int __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- #endif /* _ASM_IA64_POSIX_TYPES_H */
---- a/libc/sysdeps/linux/m68k/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/m68k/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
- typedef unsigned short __kernel_old_gid_t;
- typedef long long __kernel_loff_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- #ifdef __USE_ALL
---- a/libc/sysdeps/linux/microblaze/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/microblaze/bits/kernel_types.h
-@@ -44,6 +44,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned int __kernel_old_uid_t;
- typedef unsigned int __kernel_old_gid_t;
- typedef unsigned int __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- #ifdef __GNUC__
- typedef long long __kernel_loff_t;
---- a/libc/sysdeps/linux/mips/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/mips/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef int __kernel_gid32_t;
- typedef __kernel_uid_t __kernel_old_uid_t;
- typedef __kernel_gid_t __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
- #else
- typedef unsigned int __kernel_dev_t;
-@@ -68,6 +70,8 @@ typedef int __kernel_gid32_t;
- typedef __kernel_uid_t __kernel_old_uid_t;
- typedef __kernel_gid_t __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
- #endif
-
---- a/libc/sysdeps/linux/nios2/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/nios2/bits/kernel_types.h
-@@ -31,6 +31,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef unsigned short __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- typedef struct {
---- a/libc/sysdeps/linux/powerpc/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/powerpc/bits/kernel_types.h
-@@ -36,6 +36,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned int __kernel_old_uid_t;
- typedef unsigned int __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- #else
- typedef unsigned int __kernel_dev_t;
- typedef unsigned int __kernel_ino_t;
-@@ -61,6 +63,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned int __kernel_old_uid_t;
- typedef unsigned int __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
- #endif
-
---- a/libc/sysdeps/linux/sh/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/sh/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- typedef struct {
---- a/libc/sysdeps/linux/sh64/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/sh64/bits/kernel_types.h
-@@ -43,6 +43,8 @@ typedef unsigned int __kernel_gid32_t
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- typedef struct {
---- a/libc/sysdeps/linux/sparc/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/sparc/bits/kernel_types.h
-@@ -32,6 +32,8 @@ typedef unsigned short __kernel_g
- typedef __kernel_uid_t __kernel_old_uid_t;
- typedef __kernel_gid_t __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef __kernel_uid_t __kernel_uid32_t;
- typedef __kernel_gid_t __kernel_gid32_t;
- typedef int __kernel_suseconds_t;
-@@ -62,6 +64,8 @@ typedef unsigned int __kernel_gid
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
- #endif
-
---- a/libc/sysdeps/linux/v850/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/v850/bits/kernel_types.h
-@@ -41,6 +41,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
-
- typedef struct {
- #ifdef __USE_ALL
---- a/libc/sysdeps/linux/x86_64/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/x86_64/bits/kernel_types.h
-@@ -40,6 +40,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef __kernel_dev_t __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- typedef struct {
---- a/libc/sysdeps/linux/xtensa/bits/kernel_types.h
-+++ b/libc/sysdeps/linux/xtensa/bits/kernel_types.h
-@@ -33,6 +33,8 @@ typedef unsigned int __kernel_gid32_t;
- typedef unsigned short __kernel_old_uid_t;
- typedef unsigned short __kernel_old_gid_t;
- typedef unsigned short __kernel_old_dev_t;
-+typedef long __kernel_long_t;
-+typedef unsigned long __kernel_ulong_t;
- typedef long long __kernel_loff_t;
-
- /* Beginning in 2.6 kernels, which is the first version that includes the
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
deleted file mode 100644
index 994ddd77f3..0000000000
--- a/main/libc0.9.32/APKBUILD
+++ /dev/null
@@ -1,322 +0,0 @@
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-_abiver=0.9.32
-pkgname=libc$_abiver
-_gitver=
-pkgver=0.9.33.2
-_ver=${pkgver/_/-}
-pkgrel=27
-pkgdesc="C library for developing embedded Linux systems"
-url=http://uclibc.org
-license="LGPL-2.0"
-arch="all"
-options="!strip !libc_musl"
-makedepends="linux-headers"
-# libc subpackage must be last
-subpackages="uclibc-dev:dev uclibc-utils:utils libthread_db libpthread libc"
-depends_dev="linux-headers=>2.6.32"
-replaces=uclibc
-depends="libpthread libc"
-triggers="uclibc-utils.trigger=/lib:/usr/lib"
-
-_snapurl="http://git.uclibc.org/uClibc/snapshot/master.tar.bz2"
-_snapfile="$pkgname-$pkgver.tar.bz2"
-
-# patches are tracked in http://git.alpinelinux.org/cgit/uClibc-alpine/
-# branch 0.9.32-alpine
-
-source="http://uclibc.org/downloads/uClibc-${_ver}.tar.xz
-0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
-0002-resolv-res_query-for-CNAMEs.patch
-0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
-0004-libm-x86_64-implement-some-fenv-functions.patch
-0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
-0006-malloc-standard-synchronize-on-fork.patch
-0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
-0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
-eventfd.patch
-uClibc-0.9.33-avahi.patch
-librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
-
- 0001-add-posix_madvise.c.patch
- posix_fallocate.patch
- posix_fallocate-fix.patch
-
- 0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
- 0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
- 0003-pread-pwrite-drop-fallback-funcs.patch
- 0004-add-cancellation-to-generic-pread_write.patch
- 0005-pread_write.c-make-all-archs-use-common-code.patch
- 0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
-
- 0009-sys-quota.h-sync-with-glibc.patch
-
- 0001-libc-add-get-set-swap-make-context-user-context-mani.patch
- ucontext-reentrant.patch
- uclibc-dlclose-fix.patch
- uclibc-rtld_next-fix.patch
- 560-res_init_asterisk.patch
-
- 0001-libm-x86_64-implement-fegetround.patch
- libdl.patch
- 0001-ldd-subdepends-check-stderr.patch
- 0001-stdio-inline-getchar-putchar.patch
-
- 0001-librt-add-posix_spawn-support.patch
-
- uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch
- uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch
- uClibc-0.9.33.2-dup3.patch
-
- avoid-forced-unwind.patch
- 0001-libc-stdlib-add-mkostemp-helpers.patch
- 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
-
- 970-add___kernel_long_and___kernel_ulong.patch
- spawn-use-glibc-style-to-keep-differences-down.patch
-
- uclibcconfig.x86
- uclibcconfig.x86_64
- uclibcconfig.i486
- uclibcconfig.arm
- uclibcconfig.powerpc
- uclibc-utils.trigger
- "
-
-_config="$srcdir"/uclibcconfig.${CARCH}
-_builddir="$srcdir"/uClibc-${_ver}
-
-snapshot() {
- local _date=$(date +%y%m%d%H%M)
- _gitver=$_date
- pkgver=${_abiver}_alpha0_git$_gitver
- _snapfile="$pkgname-$pkgver.tar.bz2"
-
- rm -f "$SRCDEST"/$_snapfile
- msg "snapfile=$_snapfile"
- wget -O "$SRCDEST"/$_snapfile $_snapurl
- pkgrel=0
- sed -i -e "s/^_gitver=.*/_gitver=$_gitver/" \
- -e "s/^pkgrel=.*/pkgrel=$pkgrel/" \
- APKBUILD
- checksum
-}
-
-prepare() {
- local i
- cd "$_builddir"
- # patches goes here
- for i in $source; do
- case $i in
- *.patch|*.diff)
- msg "Applying $i..."
- patch -p1 -i "$srcdir"/$i || return 1
- ;;
- esac
- done
- # set abi version and remove unsupported warnings c flag
- sed -i -e "s/^ABI_VERSION.*/ABI_VERSION := $_abiver/" \
- -e "s/-Wold-style-declaration//g" \
- Rules.mak
-}
-
-build() {
- cd "$_builddir"
- cp "$_config" .config
- if [ -n "$DEBUG" ]; then
- sed -i -e 's/# DODEBUG is not set/DODEBUG=y/' \
- -e 's/DOSTRIP=y/# DOSTRIP is not set/' \
- .config
- fi
- make V=2 silentoldconfig
- make -j1 V=2 pregen KERNEL_HEADERS="$SYSROOT"/usr/include \
- CROSS="$CROSS" || return 1
- make all V=2 KERNEL_HEADERS="$SYSROOT/usr/include" CROSS="$CROSS" || return 1
- make utils V=2 CROSS="$CROSS" || return 1
-}
-
-package() {
- cd "$_builddir"
- make V=2 DESTDIR="$pkgdir" KERNEL_HEADERS="$SYSROOT/usr/include" \
- CROSS="$CROSS" install install_utils
- install -Dm755 extra/scripts/getent "$pkgdir"/usr/bin/getent
-}
-
-dev() {
- default_dev
- replaces="uclibc linux-headers fts-dev"
- mkdir -p "$subpkgdir"/usr/lib
- mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/
-}
-
-utils() {
- pkgdesc="uClibc utility programs"
- replaces="uclibc $pkgname"
- depends=
- mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/sbin
- mv "$pkgdir"/sbin/* "$subpkgdir"/sbin/
- mv "$pkgdir"/usr/bin/* "$subpkgdir"/usr/bin/
-}
-
-libthread_db() {
- pkgdesc="uClibc thread debugging library"
- depends=
- mkdir -p "$subpkgdir"/lib
- mv "$pkgdir"/lib/libthread_db* "$subpkgdir"/lib/
-}
-
-libpthread() {
- pkgdesc="uClibc threading and realtime libraries"
- replaces="libc0.9.32"
- depends=
- mkdir -p "$subpkgdir"/lib
- mv "$pkgdir"/lib/libpthread* \
- "$pkgdir"/lib/librt* \
- "$subpkgdir"/lib/
-}
-
-libc() {
- pkgdesc="uClibc standard C libraries"
- replaces="libc0.9.32"
- depends=
- mkdir -p "$subpkgdir"/lib
- mv "$pkgdir"/lib/* "$subpkgdir"/lib/
-}
-
-md5sums="73e6fe215648d02246f4d195b25fb17e uClibc-0.9.33.2.tar.xz
-d4c8fb190eb4327453ed924159ca432e 0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
-f9c9de09da5eade2fb9dff8f9f8b3fc9 0002-resolv-res_query-for-CNAMEs.patch
-96e5deaa662695a56571f47c7ac2fc94 0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
-e726ab363c0f8aed8dc31b8c54495b5d 0004-libm-x86_64-implement-some-fenv-functions.patch
-d8e62f8016274fc8605e6f77d4def79e 0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
-235ca36ca8c10878d63d68ba61f76634 0006-malloc-standard-synchronize-on-fork.patch
-d9611de57fb72b74c0b9e243b8e9165b 0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
-12cf5330b092ee7e00d14909737abc70 0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
-a86eb40e8aca531a1cfee5faff3c53d4 eventfd.patch
-d91fcb785ae14632a4ea8fa03ba0236f uClibc-0.9.33-avahi.patch
-b99adbb951c35aec0a09930e12efab86 librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
-f88dac5fe54a1bffce7d1ff4b53a755c 0001-add-posix_madvise.c.patch
-ddc2778790a0f3537828c2c3dbcdb042 posix_fallocate.patch
-a93a0e50e73bb6e8d8abf6e4340378b6 posix_fallocate-fix.patch
-085d98078455ad0f0c2d63c6fa9ea67c 0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
-583a8b6d4a29abe0b6ac449a1694b079 0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
-f059f5e437ed4fe1b6973dd08972e583 0003-pread-pwrite-drop-fallback-funcs.patch
-1983ddd723a96432aba74b1132bd6e29 0004-add-cancellation-to-generic-pread_write.patch
-32544dc16cc1b4845484535bf758a4b1 0005-pread_write.c-make-all-archs-use-common-code.patch
-73037bc978897e20ae2fc531759443eb 0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
-f41ab6cf22545d2e629d4c7107ac6f85 0009-sys-quota.h-sync-with-glibc.patch
-604d034ec978a0a4901a8f8d5f05be3e 0001-libc-add-get-set-swap-make-context-user-context-mani.patch
-28a0832cabb167e4c27bdd79fc6eca6d ucontext-reentrant.patch
-8374c98e769e603af4adad12e01cf358 uclibc-dlclose-fix.patch
-ffe7564afe846026a278dd8c0251ace9 uclibc-rtld_next-fix.patch
-1c4199349874608161575f047c32be02 560-res_init_asterisk.patch
-2e27c00c1af216eb5fb3aef81d7ba515 0001-libm-x86_64-implement-fegetround.patch
-747efb42244760ad3ae72a42b18ec8c3 libdl.patch
-e5352b7ebaa21e2ed787ce124ef67c9f 0001-ldd-subdepends-check-stderr.patch
-851808f9ec347dce3407d0ad4cb5ee49 0001-stdio-inline-getchar-putchar.patch
-7937aeaa99d5795f4cb64579c0ee536e 0001-librt-add-posix_spawn-support.patch
-7b6d467ce0cc5cf232f8526a3be5a491 uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch
-cbbd96f04cf17a403c1f74767e144fa2 uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch
-7671d02a05a074bbcbcd6193492772d6 uClibc-0.9.33.2-dup3.patch
-bfe02411af06545da375f177cfaf7efe avoid-forced-unwind.patch
-5320bafb053938dda439cdf06095d172 0001-libc-stdlib-add-mkostemp-helpers.patch
-d1dd50e417383d46acdd5976813c9862 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
-ae818855a1460fb46bcb1de31c46fe95 970-add___kernel_long_and___kernel_ulong.patch
-ef3188af11a702ef06586939e58e4416 spawn-use-glibc-style-to-keep-differences-down.patch
-05dba6fb46e8d1cb2e38cbd5b93c1d95 uclibcconfig.x86
-2b1755754cd72cd06a23ef1db26d8c59 uclibcconfig.x86_64
-05dba6fb46e8d1cb2e38cbd5b93c1d95 uclibcconfig.i486
-3f1e788cfa922c5a39d22a509bf49b60 uclibcconfig.arm
-820d5176004ccfa2baa3607ba576360f uclibcconfig.powerpc
-f3be4f2bc54d7561d252937e10abf0d2 uclibc-utils.trigger"
-sha256sums="62333167b79afb0b25a843513288c67b59547acf653e8fbe62ee64e71ebd1587 uClibc-0.9.33.2.tar.xz
-90139f7b7d847a5b852baff49d84abc2f7c641f0bb98fda6159d8813498fc161 0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
-4652accf749109dc5e8a74e2b54a5f45e19f748128b6811f41341e42181254a0 0002-resolv-res_query-for-CNAMEs.patch
-4646f2db4002f1e4f536dbf936eeeead9791004dd8fd58b3dcb9900fc0a0596b 0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
-d023eaa61b00779ad2eb2a5793ec3d4320d3c8f9b9c2f15ab38ebc1d006acbaa 0004-libm-x86_64-implement-some-fenv-functions.patch
-c7cc520e03af2dda59e7d843a52c532db446def521890d20af428cd4337140d2 0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
-6a17db227de4e70297d1c5f2b6be8d01182bdfbf05ba971f022304b3bfa38938 0006-malloc-standard-synchronize-on-fork.patch
-1ead4bfcf9c7d8eca7b111173d4ad462bf7a065ecda1aa707408fff251000cf7 0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
-7b6f5400a6fd6ef7638aab021bef9c6584e934fedd6b4e48c7899913b8841853 0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
-f3c9c1ae0a97c89b3b2f9f29249c947d103cd2decbac2d84b36808d06cd8c545 eventfd.patch
-4a71e1907e52cd99d00c9071485326539578ec6ef800de169cef57cf75b68205 uClibc-0.9.33-avahi.patch
-c9f7fd61c8be8f428b932de4420d9f28d81c6dedea33ceed991df59d732da6f7 librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
-397bc0813e9cdf92c791fa159d1fb7111100564d82beeffeb9561393925bd6ad 0001-add-posix_madvise.c.patch
-3ae0cd12f1bc5b9aa9ea03ce3784cc0dfbe8a26ed065f58fd9e6ed80a322af30 posix_fallocate.patch
-ac5ca8708958886a0cd1419eb09f68e2684d4d3a9ddce01462d44e42081f4f8d posix_fallocate-fix.patch
-fe4b84cd3dc8f2853c42ab7fc91d8bd4d28be89cc4f09a7855ef69423757919c 0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
-2b0984e687d59b2391c36b6078413509224b317f2771a7036f2226ce05f0c578 0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
-ba5b0cb1c42bb221a38cc3b22e150a08e64952716d24a4af3b61036b23d60bfd 0003-pread-pwrite-drop-fallback-funcs.patch
-66de0d92329c846728cae2bfa14f05209a1feb170394d1c537065abc52d7310b 0004-add-cancellation-to-generic-pread_write.patch
-46a53a40657c3403fe485ebb6e6c61733c0e6f708af80ceabc2e5d4b26d83a57 0005-pread_write.c-make-all-archs-use-common-code.patch
-54868bc052a588e685a068e1a030535f7b8be0297350f528c554baaee66519d1 0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
-233c022a00c6e0ff704e0403e2ce0aedcc972cc2642da671ad2a19f12de96139 0009-sys-quota.h-sync-with-glibc.patch
-294264c56ab245772c14bd60ea2338cb70503e5c638cff7383badc8550cb25d0 0001-libc-add-get-set-swap-make-context-user-context-mani.patch
-5721f722f98d55548dab70cdbcc7be61b9315ce5bfe506a3c372af173f8dc13f ucontext-reentrant.patch
-08bfb952464d1b3876d88f38929e8c98c074e40579685733e21612442ed0472e uclibc-dlclose-fix.patch
-16ace72a805b39a623364cfd1e884e6d9f19bb85f650a03712e4104533f5186f uclibc-rtld_next-fix.patch
-d7f11efbce5c4ef27849e7a3cd370be86540c635effd51d5374194b65c7c7e83 560-res_init_asterisk.patch
-b4cd24a506f4f286144080b3e95a2999efb4ec58e759255e82e09a1d7c353549 0001-libm-x86_64-implement-fegetround.patch
-b284cf0f0f19897272ca0c8e10c7aa05a837807efcaad2b44e4f1a2c2fb1bbe4 libdl.patch
-2ec9f978c34e2ce573fc9dc91c70b170c0b7699fd393d0e93b9f1cd312af7532 0001-ldd-subdepends-check-stderr.patch
-703799e579e4c28eda028b49f8212c4d4447ffbcf83fadf48ee10db4eceaa0c4 0001-stdio-inline-getchar-putchar.patch
-88f324f318a91b4552b35e27ef570b02fdcbae960ecbb6206feaf39b662a3609 0001-librt-add-posix_spawn-support.patch
-1edc91ca3cc16b8786f4ea29fcf3a51db6e04bd3247e72fc3ff12496f52ad479 uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch
-a53bbdbe8af14cb6918836bea42ec0c85fca1a0e3de1ba3a3767d0bb97d08c92 uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch
-cf0ce515c8d98e68cec01e805cb568371dd6f4aa21c14ea8bf841a0a0c26b358 uClibc-0.9.33.2-dup3.patch
-59265ece74b907c34186d47f035c9cc3b390f19bc4ef932d915317119574e709 avoid-forced-unwind.patch
-013f33861790a75d3ec1c28861d57a86e990a06f47120d992f40a36985132550 0001-libc-stdlib-add-mkostemp-helpers.patch
-646dc019fd010c16d9c2cbea251be816ce44ad780eac8aad58108923d2b473bd 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
-2f77d8572a03385c35de75b5f8cd2982f2e18316637231f22f8a62c0af742bb4 970-add___kernel_long_and___kernel_ulong.patch
-ca983d49d7df5989c4272b6e07db05a5223f08bd7968404f4cc5320f31e74556 spawn-use-glibc-style-to-keep-differences-down.patch
-ede1827b14e310a2b048d12431fada583560bcfe3a6164004f38568617cc74ef uclibcconfig.x86
-d793fa91cb758eb482c9f795632972b2c1559d4ce76a855db0fd2d05c01492c3 uclibcconfig.x86_64
-ede1827b14e310a2b048d12431fada583560bcfe3a6164004f38568617cc74ef uclibcconfig.i486
-84b3954fb1b2f27a22517a2cd70744ba535dec689e1df2cb064c3feb0e396f9a uclibcconfig.arm
-baf4491a141010b2aa9f92ab7203154a73d4ca96a7ea0a3e72c5bc920d241783 uclibcconfig.powerpc
-04a6db65443a95e7977e25210024ce3fe8472888d16e8fb476ba91db0d92efb1 uclibc-utils.trigger"
-sha512sums="5884c3ed1c0f3dd32fbcc4336fbfe4636439322ed944130c48d6272d894f2f806ce9917c87250b4e04c41fa19b6633b777e0a8548792d10571413464483b8326 uClibc-0.9.33.2.tar.xz
-4618dc3feca6e1f897b43bc8ed4713153e9f2e6fd601ff079d617f149b83bf30a4ed48ea10390f646bf238bfe767c0b905c8586182036dcee969ec37ad954eff 0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
-e0d1f913fac9f7ac6cf60c32ef40c3c2acebedc2a97c70b1c6c1438f0ad34eb299c5bfa188c88902135080eeecee26ae7aee74282382f82edc510afc04c82680 0002-resolv-res_query-for-CNAMEs.patch
-f35d413433ae8cc1886875849de7e10f5b669d3404268029e45680a670642bbf2577ee216f94096a20365274c628729debe0556bf546746167c7bb7fcf4809c0 0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
-0367ea74354698d2447a411ecf16d9f808f448dd9103c8b13311b43fb34314cdd0b78c7fb09fb782b01ed1e1c3bb598cf876e04e2b680de2680b263e0210a10f 0004-libm-x86_64-implement-some-fenv-functions.patch
-1af8de988bb80702ca8f1b4823970e37553aeadba569da35d53d38bd4f4b7c5774abe312240a01fb4842f70d4ebb3720dbc41e426bfe397341e7f3e76a0e7495 0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
-93f3a6a4fa6c176086512fe48884102c18ccc466641af53918f6fe5e1bf663bfec9323b6fd3a8d86e0c46fa81129ccf22dd99a68fdf05627f01c22ece7677781 0006-malloc-standard-synchronize-on-fork.patch
-69ff91658924779e9181e12dad4103670288818e4f8b5b2e3e7a03c8c1afc9b79f76234f38b9153996b319e9e2e5cc5a6706a968e548433d829bb8abc2eb52be 0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
-81e161b5444d6ccb88cf291b1fc1495d1b611e00525568ccb20057e17159b96c2d01f589092ff1e31eaa0764634a002fc86e66389af90d203e8bb43bf3857b1c 0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
-5d891ff426c3fcf52edbf77d2826a6dcc01e6e9bb0d6a3acc41fd217835717aa35f4f4f5063712ef8880c993f271f35565651626adf0387bf207b48b2a1113b2 eventfd.patch
-3abae39129220a477b230d16da75e36e974c3e97abac918a69c79b52f4fa2ffc7b6df9e305590fa1c30dd8cf0a4588cd0b02e78c8f0b025c971cacea10bf76f3 uClibc-0.9.33-avahi.patch
-19bc46aacdaaf617d3efa76cd9885dd3df14ccd22b5eb3d5435b8c4ed0101e4b2dd537fc47a6beee593323d67e41ccba79170873c4e5367323a18f4e4230cd91 librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
-c4c71f522ffa6792019ea8e62004b611947abce07548e1d35ca5b87ee1cafe213cac1748201ea4423c543fb2d34c317a17089f572bb6d6e02c6f91c9472b6aa9 0001-add-posix_madvise.c.patch
-4b77d0763b86a0d60be850cdc8713e15e6d8be30da841d9cfd8cfbffb0164cc92ab0c08939164a5668a1700c0c8a46f32d394b975d3da7214110ac06b89fdf27 posix_fallocate.patch
-aff90e54dce9849bc8d8ceffad2165177681aa9a3b844f8e7808f0a83d88d8219db4fc15262e778bc86795c1fbfdee446098ec8af7fa98de4a862f1a6d7a708d posix_fallocate-fix.patch
-806a73a5fca445f85efec49e05aee4509b9b5ff117ba8963ca05650269a7e0f9f796bb1d528833239fa65123c1e2acb676d661d5a83ce75ca28ba7bc0821b3d3 0001-cancel.h-add-generic-file-to-ease-cancellation-suppo.patch
-4d4a6add5000dc9b28ef812ef48e9c3023d39cdb0a3cec8df6bebc5986a4a6bd4132b4a5510f21478f3654a677c5ae41bfb40ce47189cbd3a8dbfec50bf3288a 0002-pread-pwrite-handle-renamed-syscalls-in-common-ppc-x.patch
-95e103b20fcf9ee0bfea4f255671d50b0c802468177907017a7a42d30c5528c4d2c1da555d2219711a9d47c33df641b601f04f5674628111d40d28eecc41bd58 0003-pread-pwrite-drop-fallback-funcs.patch
-f5ef0feac6b036062d2c6c346a12e71850c183233678979008aa70d5fb4da9adc7ae561ba42cb299cf96923c70575017d24b099d3fd8c0505def68cb84511bfd 0004-add-cancellation-to-generic-pread_write.patch
-6eceeebd8914e03866057f643ffd9f175cbfb1dd46f93c5d220dcf4ca1ad3e9d0271961243314936e8c155586df4d3d6ad2fd5e4775a36458453c58f3ff6b26d 0005-pread_write.c-make-all-archs-use-common-code.patch
-86eb00a7c824bc9de8e5164d252c40f9cc44abe4bec640c5f8df7372dbc9b9a4079f4cb6929f22e24194d280f48df20f0e04d854080ad7be42693cf9cf8b0c65 0006-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
-7a4f5dd295479e44daa937a53262be15ed578d7a01df2964d881adf43af48fa18a843390a0e60648998bafc85bd487b07f4d4251c7b64a5b6e11d447aa7811bd 0009-sys-quota.h-sync-with-glibc.patch
-9db2c720078c76441f64c3c21ed4829d8ad7a32a5eced830b5f5d728d8503062cde06f55fde8a7c5c528f22032430ddcb9fb6915c31544f1d6d13e9d6f1b2755 0001-libc-add-get-set-swap-make-context-user-context-mani.patch
-5f47e1c65f0a51b3703b1d722742d6d9f29f921d747c6e97e5f9c426d93dae2d717abd0a131337ec0b3d2927fbff92dab6f2671b9ac6a77bf14099e35ce894c1 ucontext-reentrant.patch
-f6de454c16a56c5978b9e840440baf4b17cd92c30191407fd371a88a5764ea3f119a5b639ca9aab57fc3e08ab5f94eefdcca4e84bd63a71788cb8ee50531af0c uclibc-dlclose-fix.patch
-8068fb6f40c370f3fd6cf05f39c0d8f54adb442faf279fa14a7f7d0e14a49f9220aacae9617460ccea71824e2f1272faf5bf1dab12ffeeb42129869c8b61c30d uclibc-rtld_next-fix.patch
-3d06e204dcca1f570356c42b9a3265448217668db7df4c9641dccd14190d7578df8be1fc1a6d7824544736348bd54f816d10b49b860b9c390d109803f3ea5b6a 560-res_init_asterisk.patch
-72e1aa3bb6b97c86d2539c370d47da5aa6b9ef80f1514229bf6acb366f91b87b55207c904f228cce6156cba8b10cf1318d00a69f677e498235ac69f10bf5c240 0001-libm-x86_64-implement-fegetround.patch
-5e03d0a81145e572463642dd90aefe700979df7e5be9e2d3b029a7ff21f5b79064f97676c069cd287e6319b9c9a28ab5703bcc547f901e2d90cb09f85ca74ac6 libdl.patch
-8a3d1ecc97e297be1b998a1117d41ae852a9c3d5e3c8ec0a760d8c29a11107c13875ecda2a7e091efded4e8a454669c9c23a28a7bf564348671e8bf4473b74aa 0001-ldd-subdepends-check-stderr.patch
-984b9ec269ba679d8ad94f62187b0966347adf2b3daea64588f0884df81534687c8e7dad141ad48ff6332334eb3bd158bdd4d2ee22526255105b427cd334ff77 0001-stdio-inline-getchar-putchar.patch
-bbab9a917e3a5e7066e03caed4799388438327d008bd8987a45c4f7da72723b24de8d66a7d1ab9f18ef6dbb497ef1777db83ac3d3b7b7a0807c915d7059627cb 0001-librt-add-posix_spawn-support.patch
-be0bc446a030b1e59ccd8fa564b773cf12f6aac1ecb645ceeeb54958ebd8dd8619431bc395aeb640a7701cd48af123a50814180e848385f78a7545ae4349e704 uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch
-2982f918b8d73cff688fca4363eb9f165bc5383937e5d669e57c35dc2b9d4ec6efa6592ee7450f01382adaf7dbb92f6f7e623e9f885aa698c831cc7861131530 uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch
-1e3241a2b8332a23793da9a1dacd3622f38499f1c1a9fe67f5afc5147007693826921d9f3c7521d4bb57d868a349f911db2bb35d2e988080527cce9fb2b187dd uClibc-0.9.33.2-dup3.patch
-265a805fd75197782cbfa527289966eacd5453c677a33f336cdcc80ec001a4f945bfb3348e219bc3d754a9ba9f519bf09270cc17e2f23d0575649bbf867022bd avoid-forced-unwind.patch
-c95a1e96308c761dbe4d11fc7d84aee04a5abc8d8da191cc5aae407eba4fec9b7c62f9c7f8294004d7a160fc7051c3d9de64368e4c85c633609ee3dfb5d97e3c 0001-libc-stdlib-add-mkostemp-helpers.patch
-1867ca0de857afc43e430cb18bbdd279e795c73062184c18c82c8d5970fad88cd60aee8c24a1ab16595dfb5df002be19eb46f24017d5a0432358107a213f43d6 0001-stdlib-Fix-fndecl-of-mkostemp-mkostemp64.patch
-71bcca7ca61f055f5496bbd9c11495e6c9d6d6598fd6ff34bd259f4eac6a4b46c852450123011215e8950fb6aa86e11a4d7767cca6a16bf8f2d5882432e1d6a7 970-add___kernel_long_and___kernel_ulong.patch
-ab08ac546c890244866a2120e18bdc1b550a9bce9668d2fe3b9534e4c4d5ecddcec4042c2a51dae55573ed7c389330c14753977a96dcdaeefa8b307b1db615cd spawn-use-glibc-style-to-keep-differences-down.patch
-ef8e7225e8dc82cf16f428359b117ac643179e5bab96a8613915ad34a3b0df945bf650216516502ffed6254c023e0ef000892875ce813e7532016abf54b57758 uclibcconfig.x86
-bd8ff2c359e221607943f8c55508b4e5ac0dcd344ccbe0e4579bc16e34694a27f27b0aea141ecb6f4fc42c44dc85aa5a2bbf282cbee592550f45af01276caefd uclibcconfig.x86_64
-ef8e7225e8dc82cf16f428359b117ac643179e5bab96a8613915ad34a3b0df945bf650216516502ffed6254c023e0ef000892875ce813e7532016abf54b57758 uclibcconfig.i486
-80527db34a47a5f9cd830df87bfdb2ac3766c67f2e7aec9d6574385fb8b5100e45454afe921be27b6dd3b04ea71e7859f590810ec2678d3098c31538bdbf001c uclibcconfig.arm
-43592243780bfb5b1c97b6be04708cb0a878ba2311667286a6c41a88773081e14d6c927ca119a0dfd3b4dd9e28bae0e423c5e9d56d4927dbe504966cfdf55b76 uclibcconfig.powerpc
-468f122e0be5ad76e5c5914013de6971cbace846ecfb2a2b906ce52f175cad13a2641567f65d5be88d4d9781f442fa5531da041ced3b0410bdfcf31f72ae20de uclibc-utils.trigger"
diff --git a/main/libc0.9.32/STATUS b/main/libc0.9.32/STATUS
deleted file mode 100644
index 155df167fb..0000000000
--- a/main/libc0.9.32/STATUS
+++ /dev/null
@@ -1,70 +0,0 @@
-0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
- Origin: Alpine
- This patch is specific to Alpine and should not be upstreamed.
-
-0002-resolv-res_query-for-CNAMEs.patch
- Origin: Alpine
- Needs to be upstreamed once again:
- http://lists.busybox.net/pipermail/uclibc/2009-June/042583.html
-
-0003-resolv-fix-resolver-to-return-TRY_AGAIN-on-timeout.patch
- Origin: Alpine
- Upstreaming is needed.
-
-0004-libm-x86_64-implement-some-fenv-functions.patch
- Origin: Alpine
- Needs to be fixed for upstream:
- http://www.mail-archive.com/uclibc@uclibc.org/msg05947.html
-
-0005-stdlib-fix-arc4random-return-type-to-u_int32_t.patch
- Origin: Alpine
- Patch sent upstream a while ago, and merged into "future" branch.
- http://lists.busybox.net/pipermail/uclibc/2011-March/045015.html
-
-0006-malloc-standard-synchronize-on-fork.patch
- Origin: Alpine
- Bugzilla: https://bugs.busybox.net/show_bug.cgi?id=2341
-
- Patch sent upstream a while ago:
- http://lists.busybox.net/pipermail/uclibc/2011-March/045117.html
-
- But needs more work since it introduces a race:
- http://lists.busybox.net/pipermail/uclibc/2011-March/045139.html
-
-
-0007-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
- Origin: Alpine
-
- Sent upstream:
- http://lists.uclibc.org/pipermail/uclibc/2011-November/045945.html
-
- Needs more work:
- http://lists.uclibc.org/pipermail/uclibc/2011-November/045948.html
-
-0008-ldso-limited-support-for-ORIGIN-in-rpath.patch
- Origin: Alpine
-
- Rebased version of the patch that was sent upstream:
- http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html
-
- Needs to be upstreamed
-
-uclibc-dlclose-fix.patch
- Origin: Alpine
- Author: Timo Teräs
-
- Fix dlclose() to not try to free static TLS symbols. This seems
- to happen on x86_64 with certain .so's. They probably link against
- TLS symbol defined in the main binary (or the loader has additional
- bug on this).
-
- Needs to be upstreamed
-
-uclibc-rtld_next-fix.patch
- Origin: Alpine
- Author: Timo Teräs
-
- Fix dlsym(RTLD_NEXT) lookups to search all linked-in modules
- instead of just the first one of them.
-
- Needs to be upstreamed
diff --git a/main/libc0.9.32/avoid-forced-unwind.patch b/main/libc0.9.32/avoid-forced-unwind.patch
deleted file mode 100644
index 044e2ffdd7..0000000000
--- a/main/libc0.9.32/avoid-forced-unwind.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- uClibc-0.9.33.2.orig/Rules.mak
-+++ uClibc-0.9.33.2/Rules.mak
-@@ -707,7 +707,6 @@
- ifeq ($(UCLIBC_HAS_THREADS),y)
- ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- PTNAME := nptl
-- CFLAGS += -DHAVE_FORCED_UNWIND
- else
- ifeq ($(LINUXTHREADS_OLD),y)
- PTNAME := linuxthreads.old
diff --git a/main/libc0.9.32/eventfd.patch b/main/libc0.9.32/eventfd.patch
deleted file mode 100644
index 930521eaa1..0000000000
--- a/main/libc0.9.32/eventfd.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c
-index cc3f3f0..06a26ee 100644
---- a/libc/sysdeps/linux/common/eventfd.c
-+++ b/libc/sysdeps/linux/common/eventfd.c
-@@ -14,5 +14,9 @@
- * eventfd()
- */
- #ifdef __NR_eventfd
-+#ifdef __NR_eventfd2
-+#undef __NR_eventfd
-+#define __NR_eventfd __NR_eventfd2
-+#endif
- _syscall2(int, eventfd, int, count, int, flags)
- #endif
diff --git a/main/libc0.9.32/libdl.patch b/main/libc0.9.32/libdl.patch
deleted file mode 100644
index ead6a6ad19..0000000000
--- a/main/libc0.9.32/libdl.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
-index 95a0650..91aa926 100644
---- a/ldso/libdl/libdl.c
-+++ b/ldso/libdl/libdl.c
-@@ -544,11 +544,19 @@ static void *do_dlopen(const char *libname, int flag)
- * to the GOT tables. We need to do this in reverse order so that COPY
- * directives work correctly */
-
-- /* Get the tail of the list */
-- for (ls = &_dl_loaded_modules->symbol_scope; ls && ls->next; ls = ls->next);
-+ /* Extend the global scope by adding the local scope of the dlopened DSO.
-+ * But only if it's not there. It can happen under certain cases that the
-+ * DSO had refcount = 0, but was already loaded. (NODELETE flag is set, or
-+ * it is pulled in via both NEEDED dependency and explicit dlopen()). */
-+ for (ls = &_dl_loaded_modules->symbol_scope; ; ls = ls->next) {
-+ if (ls == &dyn_chain->dyn->symbol_scope)
-+ break;
-+ if (ls->next == NULL) {
-+ ls->next = &dyn_chain->dyn->symbol_scope;
-+ break;
-+ }
-+ }
-
-- /* Extend the global scope by adding the local scope of the dlopened DSO. */
-- ls->next = &dyn_chain->dyn->symbol_scope;
- #ifdef __mips__
- /*
- * Relocation of the GOT entries for MIPS have to be done
-
diff --git a/main/libc0.9.32/librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch b/main/libc0.9.32/librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
deleted file mode 100644
index 688d2f5036..0000000000
--- a/main/libc0.9.32/librt-re-add-SIGCANCEL-to-the-list-of-blocked-signal-in-helper-thread.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From fec308fdfaf9f557ef5fb17c308c48259012b825 Mon Sep 17 00:00:00 2001
-From: Filippo Arcidiacono <filippo.arcidiacono@st.com>
-Date: Thu, 12 Jul 2012 07:24:39 +0000
-Subject: librt: re-add SIGCANCEL to the list of blocked signal in helper thread
-
-Indeed if the libpthread is before the libc in the library look up
-the SIGCANCEL is removed from the list of the blocked signal by
-sigfillset func, this can produce the handler not properly called.
-This commit revert what Denys modified in commit
-162cfaea20d807f0ae329efe39292a9b22593b41.
-
-Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
-Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-(cherry picked from commit cb43f2afba0633400387fa7c55dda3396517f58a)
-
-Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
----
-diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
-index 4319d8d..2681961 100644
---- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
-+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
-@@ -175,7 +175,7 @@ __start_helper_thread (void)
- sigset_t ss;
- sigset_t oss;
- sigfillset (&ss);
-- /*__sigaddset (&ss, SIGCANCEL); - already done by sigfillset */
-+ __sigaddset (&ss, SIGCANCEL);
- INTERNAL_SYSCALL_DECL (err);
- INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8);
-
---
-cgit v0.9.0.1-2-gef13
diff --git a/main/libc0.9.32/posix_fallocate-fix.patch b/main/libc0.9.32/posix_fallocate-fix.patch
deleted file mode 100644
index 3ff28a49e2..0000000000
--- a/main/libc0.9.32/posix_fallocate-fix.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- ./libc/sysdeps/linux/common/posix_fallocate.c.orig
-+++ ./libc/sysdeps/linux/common/posix_fallocate.c
-@@ -22,11 +22,10 @@
- uint32_t off_low = offset;
- uint32_t len_low = len;
- /* may assert that these >>31 are 0 */
-- uint32_t zero = 0;
- INTERNAL_SYSCALL_DECL(err);
- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
-- __LONG_LONG_PAIR (zero, off_low),
-- __LONG_LONG_PAIR (zero, len_low)));
-+ __LONG_LONG_PAIR (0, off_low),
-+ __LONG_LONG_PAIR (0, len_low)));
- # elif __WORDSIZE == 64
- INTERNAL_SYSCALL_DECL(err);
- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
-diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h
-index 9fb4f35..566b5ac 100644
---- a/libc/sysdeps/linux/i386/bits/syscalls.h
-+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
-@@ -136,7 +136,7 @@ __asm__ (
- #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
- , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)
- #define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \
-- , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "m" (arg6)
-+ , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "g" (arg6)
-
- #else /* !PIC */
-
diff --git a/main/libc0.9.32/posix_fallocate.patch b/main/libc0.9.32/posix_fallocate.patch
deleted file mode 100644
index da6f5a9464..0000000000
--- a/main/libc0.9.32/posix_fallocate.patch
+++ /dev/null
@@ -1,342 +0,0 @@
-From 987ccf6ee3cbb4bb6055d9f4c635bdaddf2377fc Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Tue, 12 Jun 2012 07:59:16 +0000
-Subject: [PATCH] libc: add posix_fallocate
-
-http://www.mail-archive.com/uclibc@uclibc.org/msg08105.html
-
----
- include/fcntl.h | 4 +-
- libc/sysdeps/linux/common/Makefile.in | 3 +-
- libc/sysdeps/linux/common/bits/kernel-features.h | 8 ++
- libc/sysdeps/linux/common/posix_fallocate.c | 43 ++++++++
- libc/sysdeps/linux/common/posix_fallocate64.c | 39 +++++++
- libc/sysdeps/linux/common/stubs.c | 16 +++
- test/.gitignore | 1 +
- test/unistd/Makefile.in | 3 +
- test/unistd/tst-posix_fallocate.c | 121 ++++++++++++++++++++++
- 9 files changed, 234 insertions(+), 4 deletions(-)
- create mode 100644 libc/sysdeps/linux/common/posix_fallocate.c
- create mode 100644 libc/sysdeps/linux/common/posix_fallocate64.c
- create mode 100644 test/unistd/tst-posix_fallocate.c
-
-diff --git a/include/fcntl.h b/include/fcntl.h
-index 26ad1fe..c4a47af 100644
---- a/include/fcntl.h
-+++ b/include/fcntl.h
-@@ -210,9 +210,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
-
- #endif
-
--#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
--
--/* FIXME -- uClibc should probably implement these... */
-+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
-
- /* Reserve storage for the data of the file associated with FD.
-
-diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
-index 5ea85d2..be00dda 100644
---- a/libc/sysdeps/linux/common/bits/kernel-features.h
-+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
-@@ -494,6 +494,14 @@
- # define __ASSUME_PRIVATE_FUTEX 1
- #endif
-
-+/* Support for fallocate was added in 2.6.23,
-+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
-+#if __LINUX_KERNEL_VERSION >= 0x020617 \
-+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
-+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
-+# define __ASSUME_FALLOCATE 1
-+#endif
-+
- /* getcpu is a syscall for x86-64 since 3.1. */
- #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
- # define __ASSUME_GETCPU_SYSCALL 1
-diff --git a/libc/sysdeps/linux/common/posix_fallocate.c b/libc/sysdeps/linux/common/posix_fallocate.c
-new file mode 100644
-index 0000000..9aaa6ce
---- /dev/null
-+++ b/libc/sysdeps/linux/common/posix_fallocate.c
-@@ -0,0 +1,43 @@
-+/* vi: set sw=4 ts=4: */
-+/*
-+ * posix_fallocate() for uClibc
-+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
-+ *
-+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+ *
-+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
-+ */
-+
-+#include <sys/syscall.h>
-+#include <fcntl.h>
-+#include <bits/kernel-features.h>
-+#include <stdint.h>
-+
-+#if defined __NR_fallocate
-+int posix_fallocate(int fd, __off_t offset, __off_t len)
-+{
-+ int ret;
-+
-+# if __WORDSIZE == 32
-+ uint32_t off_low = offset;
-+ uint32_t len_low = len;
-+ /* may assert that these >>31 are 0 */
-+ uint32_t zero = 0;
-+ INTERNAL_SYSCALL_DECL(err);
-+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
-+ __LONG_LONG_PAIR (zero, off_low),
-+ __LONG_LONG_PAIR (zero, len_low)));
-+# elif __WORDSIZE == 64
-+ INTERNAL_SYSCALL_DECL(err);
-+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
-+# else
-+# error your machine is neither 32 bit or 64 bit ... it must be magical
-+#endif
-+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
-+ return INTERNAL_SYSCALL_ERRNO (ret, err);
-+ return 0;
-+}
-+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
-+strong_alias(posix_fallocate,posix_fallocate64)
-+# endif
-+#endif
-diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c
-new file mode 100644
-index 0000000..818d868
---- /dev/null
-+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
-@@ -0,0 +1,39 @@
-+/* vi: set sw=4 ts=4: */
-+/*
-+ * posix_fallocate() for uClibc
-+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
-+ *
-+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+ *
-+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
-+ */
-+
-+#include <sys/syscall.h>
-+#include <fcntl.h>
-+#include <bits/kernel-features.h>
-+#include <stdint.h>
-+
-+#if defined __NR_fallocate
-+
-+# if __WORDSIZE == 64
-+/* Can use normal posix_fallocate() */
-+# elif __WORDSIZE == 32
-+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
-+{
-+ int ret;
-+ uint32_t off_low = offset & 0xffffffff;
-+ uint32_t off_high = offset >> 32;
-+ uint32_t len_low = len & 0xffffffff;
-+ uint32_t len_high = len >> 32;
-+ INTERNAL_SYSCALL_DECL(err);
-+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
-+ __LONG_LONG_PAIR (off_high, off_low),
-+ __LONG_LONG_PAIR (len_high, len_low)));
-+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
-+ return INTERNAL_SYSCALL_ERRNO (ret, err);
-+ return 0;
-+}
-+# else
-+# error your machine is neither 32 bit or 64 bit ... it must be magical
-+# endif
-+#endif
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
-index 4d1e26c..43d8081 100644
---- a/libc/sysdeps/linux/common/stubs.c
-+++ b/libc/sysdeps/linux/common/stubs.c
-@@ -225,6 +225,22 @@ make_stub(pipe2)
- make_stub(pivot_root)
- #endif
-
-+#if !defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__
-+make_ret_stub(posix_fadvise)
-+#endif
-+
-+#if !defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
-+make_ret_stub(posix_fadvise64)
-+#endif
-+
-+#if !defined __NR_fallocate && defined __UCLIBC_HAS_ADVANCED_REALTIME__
-+make_ret_stub(posix_fallocate)
-+#endif
-+
-+#ifndef __NR_madvise
-+make_ret_stub(posix_madvise)
-+#endif
-+
- #if !defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
- make_stub(ppoll)
- #endif
-diff --git a/test/.gitignore b/test/.gitignore
-index c892816..14cb5d6 100644
---- a/test/.gitignore
-+++ b/test/.gitignore
-@@ -302,6 +302,7 @@ unistd/getcwd
- unistd/getopt
- unistd/getopt_long
- unistd/tstgetopt
-+unistd/tst-posix_fallocate
- unistd/tst-preadwrite
- unistd/tst-preadwrite64
- unistd/vfork
-diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
-index c542f98..6583e42 100644
---- a/test/unistd/Makefile.in
-+++ b/test/unistd/Makefile.in
-@@ -4,6 +4,9 @@
- ifeq ($(UCLIBC_HAS_LFS),)
- TESTS_DISABLED := tst-preadwrite64
- endif
-+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
-+TESTS_DISABLED := tst-posix_fallocate
-+endif
- OPTS_getopt := -abcXXX -9
- OPTS_getopt_long := --add XXX --delete YYY --verbose
- ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
-diff --git a/test/unistd/tst-posix_fallocate.c b/test/unistd/tst-posix_fallocate.c
-new file mode 100644
-index 0000000..eec50ea
---- /dev/null
-+++ b/test/unistd/tst-posix_fallocate.c
-@@ -0,0 +1,121 @@
-+#include <fcntl.h>
-+#include <sys/stat.h>
-+
-+static void do_prepare (void);
-+#define PREPARE(argc, argv) do_prepare ()
-+static int do_test (void);
-+#define TEST_FUNCTION do_test ()
-+#include <test-skeleton.c>
-+
-+static int fd;
-+#ifndef O_LARGEFILE
-+# error no O_LARGEFILE
-+#endif
-+static void
-+do_prepare (void)
-+{
-+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
-+ if (fd == -1)
-+ {
-+ printf ("cannot create temporary file: %m\n");
-+ exit (1);
-+ }
-+}
-+
-+
-+static int
-+do_test (void)
-+{
-+ struct stat64 st;
-+
-+ if (fstat64 (fd, &st) != 0)
-+ {
-+ puts ("1st fstat failed");
-+ return 1;
-+ }
-+
-+ if (st.st_size != 0)
-+ {
-+ puts ("file not created with size 0");
-+ return 1;
-+ }
-+
-+ if (posix_fallocate (fd, 512, 768) != 0)
-+ {
-+ puts ("1st posix_fallocate call failed");
-+ return 1;
-+ }
-+
-+ if (fstat64 (fd, &st) != 0)
-+ {
-+ puts ("2nd fstat failed");
-+ return 1;
-+ }
-+
-+ if (st.st_size != 512 + 768)
-+ {
-+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
-+ (unsigned long long int) st.st_size, 512u + 768u);
-+ return 1;
-+ }
-+
-+ if (posix_fallocate (fd, 0, 1024) != 0)
-+ {
-+ puts ("2nd posix_fallocate call failed");
-+ return 1;
-+ }
-+
-+ if (fstat64 (fd, &st) != 0)
-+ {
-+ puts ("3rd fstat failed");
-+ return 1;
-+ }
-+
-+ if (st.st_size != 512 + 768)
-+ {
-+ puts ("file size changed in 2nd posix_fallocate");
-+ return 1;
-+ }
-+
-+ if (posix_fallocate (fd, 2048, 64) != 0)
-+ {
-+ puts ("3rd posix_fallocate call failed");
-+ return 1;
-+ }
-+
-+ if (fstat64 (fd, &st) != 0)
-+ {
-+ puts ("4th fstat failed");
-+ return 1;
-+ }
-+
-+ if (st.st_size != 2048 + 64)
-+ {
-+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
-+ (unsigned long long int) st.st_size, 2048u + 64u);
-+ return 1;
-+ }
-+
-+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
-+ {
-+ puts ("4th posix_fallocate call failed");
-+ return 1;
-+ }
-+
-+ if (fstat64 (fd, &st) != 0)
-+ {
-+ puts ("5th fstat failed");
-+ return 1;
-+ }
-+
-+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
-+ {
-+ printf ("file size after 4th posix_fallocate call is %llu, expected %u\n",
-+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
-+ return 1;
-+ }
-+
-+ close (fd);
-+
-+ return 0;
-+}
---- ./libc/sysdeps/linux/common/Makefile.in.orig
-+++ ./libc/sysdeps/linux/common/Makefile.in
-@@ -81,7 +81,8 @@
- sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
- sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
- # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
--CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
-+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c \
-+ posix_madvise.c posix_fallocate.c posix_fallocate64.c
- CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
- CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
- CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
diff --git a/main/libc0.9.32/spawn-use-glibc-style-to-keep-differences-down.patch b/main/libc0.9.32/spawn-use-glibc-style-to-keep-differences-down.patch
deleted file mode 100644
index 170c23840c..0000000000
--- a/main/libc0.9.32/spawn-use-glibc-style-to-keep-differences-down.patch
+++ /dev/null
@@ -1,399 +0,0 @@
-From 54935c23e92c7f948ea3c561b3fac7cd4deac22a Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Tue, 27 Mar 2012 03:34:37 +0000
-Subject: spawn: use glibc style to keep differences down
-
-There's no point in reformatting the code style when we're sourcing
-most of it from glibc. Further, the changed style breaks with older
-compilers, and pollutes the namespace with non-double leading under-
-scores.
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
-(limited to 'include/spawn.h')
-
-diff --git a/include/spawn.h b/include/spawn.h
-index 8b07bb8..95fff35 100644
---- a/include/spawn.h
-+++ b/include/spawn.h
-@@ -19,36 +19,39 @@
- #ifndef _SPAWN_H
- #define _SPAWN_H 1
-
--#include <errno.h>
--#include <string.h>
--#include <stdlib.h>
--
- #include <features.h>
- #include <sched.h>
- #define __need_sigset_t
- #include <signal.h>
- #include <sys/types.h>
-
-+/* For the tiny inlines (errno/free/memset). */
-+#include <errno.h>
-+#include <string.h>
-+#include <stdlib.h>
-+
-
- /* Data structure to contain attributes for thread creation. */
--typedef struct {
-- short int __flags;
-- pid_t __pgrp;
-- sigset_t __sd;
-- sigset_t __ss;
-- struct sched_param __sp;
-- int __policy;
-- int __pad[16];
-+typedef struct
-+{
-+ short int __flags;
-+ pid_t __pgrp;
-+ sigset_t __sd;
-+ sigset_t __ss;
-+ struct sched_param __sp;
-+ int __policy;
-+ int __pad[16];
- } posix_spawnattr_t;
-
-
- /* Data structure to contain information about the actions to be
- performed in the new process with respect to file descriptors. */
--typedef struct {
-- int __allocated;
-- int __used;
-- struct __spawn_action *__actions;
-- int __pad[16];
-+typedef struct
-+{
-+ int __allocated;
-+ int __used;
-+ struct __spawn_action *__actions;
-+ int __pad[16];
- } posix_spawn_file_actions_t;
-
-
-@@ -59,7 +62,9 @@ typedef struct {
- #define POSIX_SPAWN_SETSIGMASK 0x08
- #define POSIX_SPAWN_SETSCHEDPARAM 0x10
- #define POSIX_SPAWN_SETSCHEDULER 0x20
--#define POSIX_SPAWN_USEVFORK 0x40 /* GNU extension */
-+#ifdef __USE_GNU
-+# define POSIX_SPAWN_USEVFORK 0x40
-+#endif
-
-
- #define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
-@@ -77,189 +82,207 @@ __BEGIN_DECLS
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
--int posix_spawn(pid_t * restrict pid, const char * restrict path,
-- const posix_spawn_file_actions_t * restrict file_actions,
-- const posix_spawnattr_t * restrict attrp,
-- char * const argv[restrict],
-- char * const envp[restrict]);
-+extern int posix_spawn (pid_t *__restrict __pid,
-+ const char *__restrict __path,
-+ const posix_spawn_file_actions_t *__restrict
-+ __file_actions,
-+ const posix_spawnattr_t *__restrict __attrp,
-+ char *const __argv[__restrict_arr],
-+ char *const __envp[__restrict_arr]);
-
- /* Similar to `posix_spawn' but search for FILE in the PATH.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
--int posix_spawnp(pid_t *pid, const char *file,
-- const posix_spawn_file_actions_t *file_actions,
-- const posix_spawnattr_t *attrp,
-- char * const argv[], char * const envp[]);
--
--/* Initialize data structure with attributes for `spawn' to default values. */
--inline static int
--posix_spawnattr_init(posix_spawnattr_t *attr)
-+extern int posix_spawnp (pid_t *__pid, const char *__file,
-+ const posix_spawn_file_actions_t *__file_actions,
-+ const posix_spawnattr_t *__attrp,
-+ char *const __argv[], char *const __envp[]);
-+
-+
-+/* Initialize data structure with attributes for `spawn' to default values. */
-+static inline
-+int posix_spawnattr_init (posix_spawnattr_t *__attr)
- {
-- memset(attr, 0, sizeof(*attr));
-- return 0;
-+ memset (__attr, 0, sizeof (*__attr));
-+ return 0;
- }
-
- /* Free resources associated with ATTR. */
--inline static int
--posix_spawnattr_destroy(posix_spawnattr_t *attr)
-+static inline
-+int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
- {
-- return 0;
-+ return 0;
- }
-
- /* Store signal mask for signals with default handling from ATTR in
- SIGDEFAULT. */
--inline static int
--posix_spawnattr_getsigdefault(const posix_spawnattr_t *attr,
-- sigset_t *sigdefault)
-+static inline
-+int posix_spawnattr_getsigdefault (const posix_spawnattr_t *
-+ __restrict __attr,
-+ sigset_t *__restrict __sigdefault)
- {
-- memcpy(sigdefault, &attr->__sd, sizeof(sigset_t));
-- return 0;
-+ memcpy (__sigdefault, &__attr->__sd, sizeof (sigset_t));
-+ return 0;
- }
-
--
- /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
--inline static int
--posix_spawnattr_setsigdefault(posix_spawnattr_t *attr,
-- const sigset_t *sigdefault)
-+static inline
-+int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr,
-+ const sigset_t *__restrict
-+ __sigdefault)
- {
-- memcpy(&attr->__sd, sigdefault, sizeof(sigset_t));
-- return 0;
-+ memcpy (&__attr->__sd, __sigdefault, sizeof (sigset_t));
-+ return 0;
- }
-
- /* Store signal mask for the new process from ATTR in SIGMASK. */
--inline static int
--posix_spawnattr_getsigmask(const posix_spawnattr_t *attr,
-- sigset_t *sigmask)
-+static inline
-+int posix_spawnattr_getsigmask (const posix_spawnattr_t *__restrict
-+ __attr,
-+ sigset_t *__restrict __sigmask)
- {
-- memcpy(sigmask, &attr->__ss, sizeof(sigset_t));
-- return 0;
-+ memcpy (__sigmask, &__attr->__ss, sizeof (sigset_t));
-+ return 0;
- }
-
--
- /* Set signal mask for the new process in ATTR to SIGMASK. */
--inline static int
--posix_spawnattr_setsigmask(posix_spawnattr_t *attr,
-- const sigset_t *sigmask)
-+static inline
-+int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr,
-+ const sigset_t *__restrict __sigmask)
- {
-- memcpy(&attr->__ss, sigmask, sizeof(sigset_t));
-- return 0;
-+ memcpy (&__attr->__ss, __sigmask, sizeof (sigset_t));
-+ return 0;
- }
-
- /* Get flag word from the attribute structure. */
--inline static int
--posix_spawnattr_getflags(const posix_spawnattr_t *attr, short int *flags)
-+static inline
-+int posix_spawnattr_getflags (const posix_spawnattr_t *__restrict
-+ __attr,
-+ short int *__restrict __flags)
- {
-- *flags = attr->__flags;
-- return 0;
-+ *__flags = __attr->__flags;
-+ return 0;
- }
-
- /* Store flags in the attribute structure. */
--inline static int
--posix_spawnattr_setflags(posix_spawnattr_t *attr, short int flags)
-+static inline
-+int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
-+ short int __flags)
- {
-- /* Check no invalid bits are set. */
-- if (flags & ~__POSIX_SPAWN_MASK)
-- return EINVAL;
-+ /* Check no invalid bits are set. */
-+ if (__flags & ~__POSIX_SPAWN_MASK)
-+ return EINVAL;
-
-- attr->__flags = flags;
-- return 0;
-+ _attr->__flags = __flags;
-+ return 0;
- }
-
- /* Get process group ID from the attribute structure. */
--inline static int
--posix_spawnattr_getpgroup(const posix_spawnattr_t *attr, pid_t *pgroup)
-+static inline
-+int posix_spawnattr_getpgroup (const posix_spawnattr_t *__restrict
-+ __attr, pid_t *__restrict __pgroup)
- {
-- *pgroup = attr->__pgrp;
-- return 0;
-+ *__pgroup = __attr->__pgrp;
-+ return 0;
- }
-
- /* Store process group ID in the attribute structure. */
--inline static int
--posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup)
-+static inline
-+int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
-+ pid_t __pgroup)
- {
-- attr->__pgrp = pgroup;
-- return 0;
-+ __attr->__pgrp = __pgroup;
-+ return 0;
- }
-
- /* Get scheduling policy from the attribute structure. */
--inline static int
--posix_spawnattr_getschedpolicy(const posix_spawnattr_t *attr,
-- int *schedpolicy)
-+static inline
-+int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *
-+ __restrict __attr,
-+ int *__restrict __schedpolicy)
- {
-- *schedpolicy = attr->__policy;
-- return 0;
-+ *__schedpolicy = __attr->__policy;
-+ return 0;
- }
-
- /* Store scheduling policy in the attribute structure. */
--inline static int
--posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr, int schedpolicy)
-+static inline
-+int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
-+ int __schedpolicy)
- {
-- switch (schedpolicy) {
-- case SCHED_OTHER:
-- case SCHED_FIFO:
-- case SCHED_RR:
-- break;
-- default:
-- return EINVAL;
-- }
--
-- attr->__policy = schedpolicy;
-- return 0;
-+ switch (__schedpolicy) {
-+ case SCHED_OTHER:
-+ case SCHED_FIFO:
-+ case SCHED_RR:
-+ break;
-+ default:
-+ return EINVAL;
-+ }
-+
-+ __attr->__policy = __schedpolicy;
-+ return 0;
- }
-
- /* Get scheduling parameters from the attribute structure. */
--static inline int
--posix_spawnattr_getschedparam(const posix_spawnattr_t *attr,
-- struct sched_param *schedparam)
-+static inline
-+int posix_spawnattr_getschedparam (const posix_spawnattr_t *
-+ __restrict __attr,
-+ struct sched_param *__restrict
-+ __schedparam)
- {
-- memcpy(schedparam, &attr->__sp, sizeof(attr->__sp));
-- return 0;
-+ memcpy (__schedparam, &__attr->__sp, sizeof (__attr->__sp));
-+ return 0;
- }
-
- /* Store scheduling parameters in the attribute structure. */
--static inline int
--posix_spawnattr_setschedparam(posix_spawnattr_t *attr,
-- const struct sched_param *schedparam)
-+static inline
-+int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr,
-+ const struct sched_param *
-+ __restrict __schedparam)
- {
-- attr->__sp = *schedparam;
-- return 0;
-+ __attr->__sp = *__schedparam;
-+ return 0;
- }
-
- /* Initialize data structure for file attribute for `spawn' call. */
--inline static int
--posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions)
-+static inline
-+int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
-+ __file_actions)
- {
-- memset(file_actions, 0, sizeof(*file_actions));
-- return 0;
-+ memset (__file_actions, 0, sizeof (*__file_actions));
-+ return 0;
- }
-
- /* Free resources associated with FILE-ACTIONS. */
--inline static int
--posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions)
-+static inline
-+int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *
-+ __file_actions)
- {
-- free(file_actions->__actions);
-- return 0;
-+ free (__file_actions->__actions);
-+ return 0;
- }
-
- /* Add an action to FILE-ACTIONS which tells the implementation to call
- `open' for the given file during the `spawn' call. */
--int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * restrict
-- file_actions, int fd,
-- const char * restrict path,
-- int oflag, mode_t mode)
-+extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *
-+ __restrict __file_actions,
-+ int __fd,
-+ const char *__restrict __path,
-+ int __oflag, mode_t __mode)
- __THROW;
-
- /* Add an action to FILE-ACTIONS which tells the implementation to call
- `close' for the given file descriptor during the `spawn' call. */
--int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions,
-- int fd)
-+extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
-+ __file_actions, int __fd)
- __THROW;
-
- /* Add an action to FILE-ACTIONS which tells the implementation to call
- `dup2' for the given file descriptors during the `spawn' call. */
--int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions,
-- int fd, int newfd) __THROW;
-+extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
-+ __file_actions,
-+ int __fd, int __newfd) __THROW;
-
- __END_DECLS
-
---
-cgit v0.9.1
diff --git a/main/libc0.9.32/uClibc-0.9.33-avahi.patch b/main/libc0.9.32/uClibc-0.9.33-avahi.patch
deleted file mode 100644
index 017ac5fef8..0000000000
--- a/main/libc0.9.32/uClibc-0.9.33-avahi.patch
+++ /dev/null
@@ -1,418 +0,0 @@
-From 5654318b39dae5e5a32e290849ec590cb85ee0b3 Mon Sep 17 00:00:00 2001
-Message-Id: <5654318b39dae5e5a32e290849ec590cb85ee0b3.1322557154.git.n.voss@weinmann.de>
-In-Reply-To: <cover.1322557154.git.n.voss@weinmann.de>
-References: <cover.1322557154.git.n.voss@weinmann.de>
-From: Nikolaus Voss <n.voss@weinmann.de>
-Date: Mon, 28 Nov 2011 16:18:30 +0100
-Subject: [PATCH 1/2] gethostbyaddr_r: add space for alias pointers
-To: uclibc@uclibc.org
-
-addr_list and alias where on the same buffer offset. This led
-to corrupt addr_list which was overwritten by the resolved name.
-
-Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
----
- libc/inet/resolv.c | 2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
-index 021d5bf..bc596b0 100644
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -2402,6 +2402,8 @@ int gethostbyaddr_r(const void *addr, socklen_t addrlen,
- */
- #define in6 ((struct in6_addr *)in)
- alias = (char **)buf;
-+ buf += sizeof(alias) * 2;
-+ buflen -= sizeof(alias) * 2;
- addr_list = (struct in_addr**)buf;
- buf += sizeof(*addr_list) * 2;
- buflen -= sizeof(*addr_list) * 2;
---
-1.7.5.4
-
-From 5388e302e40b12fb6682899dd4206f3e3d7a84fa Mon Sep 17 00:00:00 2001
-Message-Id: <5388e302e40b12fb6682899dd4206f3e3d7a84fa.1322557154.git.n.voss@weinmann.de>
-In-Reply-To: <cover.1322557154.git.n.voss@weinmann.de>
-References: <cover.1322557154.git.n.voss@weinmann.de>
-From: Nikolaus Voss <n.voss@weinmann.de>
-Date: Mon, 28 Nov 2011 16:22:42 +0100
-Subject: [PATCH 2/2] Make link-local addresses resolvable via running
- avahi-daemon
-To: uclibc@uclibc.org
-
-nss-mdns is an extension to glibc to support resolution of link-local
-(.local) addresses via GNU Name Service Switch (NSS) which redirects
-the queries to a running avahi-daemon, which in turn does the resolution
-via multicast DNS (mdns).
-
-However, this does not work for uClibc, as it does not support NSS.
-
-This patch integrates the nss-mdns approach into uClibc's resolver,
-so getaddrinfo() and getnameinfo() calls get redirected to a running
-avahi-daemon before trying to resolve via unicast DNS.
-
-This increases the size of the library by 50 bytes on ARM.
-
-Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
----
- extra/Configs/Config.in | 19 +++
- libc/inet/Makefile.in | 1 +
- libc/inet/avahi.c | 183 ++++++++++++++++++++++
- libc/inet/avahi.h | 33 ++++
- libc/inet/resolv.c | 23 +++-
- libc/sysdeps/linux/common/bits/kernel-features.h | 7 +-
- 6 files changed, 259 insertions(+), 7 deletions(-)
- create mode 100644 libc/inet/avahi.c
- create mode 100644 libc/inet/avahi.h
-
-diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
-index e41adc4..6053a55 100644
---- a/extra/Configs/Config.in
-+++ b/extra/Configs/Config.in
-@@ -1268,6 +1268,25 @@ config UCLIBC_HAS_EXTRA_COMPAT_RES_STATE
- Answer Y if selecting UCLIBC_HAS_COMPAT_RES_STATE is not enough.
- As far as I can say, this should never be needed.
-
-+config UCLIBC_HAS_AVAHI_RES
-+ bool "Try to resolve link-local IP addresses via avahi-daemon"
-+ default n
-+ depends on UCLIBC_HAS_IPV4 || UCLIBC_HAS_IPV6
-+ help
-+ Answer Y if you want to resolve .local addresses via multicast-dns.
-+ The queries are forwarded to a running avahi-daemon via a domain
-+ socket interface.
-+ Note that this might interfere with a .local domain on your DNS.
-+ Answering N saves around 50 bytes.
-+
-+config UCLIBC_AVAHI_SOCKET_PATH
-+ string "Path to avahi unix domain socket"
-+ default "/var/run/avahi-daemon/socket"
-+ depends on UCLIBC_HAS_AVAHI_RES
-+ help
-+ A running avahi-daemon creates a socket to listen for queries.
-+ Enter the path you configured your avahi-daemon to.
-+
- config UCLIBC_HAS_LIBRESOLV_STUB
- bool "Provide libresolv stub"
- default n
-diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
-index d588220..7f436c9 100644
---- a/libc/inet/Makefile.in
-+++ b/libc/inet/Makefile.in
-@@ -33,6 +33,7 @@ CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \
- dnslookup.c opennameservers.c closenameservers.c \
- getnameinfo.c \
- gethostent.c gethostent_r.c
-+CSRC-$(UCLIBC_HAS_AVAHI_RES) += avahi.c
- CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \
- get_hosts_byaddr_r.c get_hosts_byname_r.c \
- gethostbyaddr_r.c gethostbyname_r.c gethostbyname2_r.c \
-diff --git a/libc/inet/avahi.c b/libc/inet/avahi.c
-new file mode 100644
-index 0000000..11ce055
---- /dev/null
-+++ b/libc/inet/avahi.c
-@@ -0,0 +1,183 @@
-+/*
-+ *
-+ * (C) 2011 Weinmann GmbH, Hamburg, Germany
-+ *
-+ * Author: Nikolaus Voss <n.voss@weinmann.de>
-+ *
-+ * Derived from avahi.c / nss-mdns by Lennart Poettering.
-+ * Copyright 2004-2007 Lennart Poettering <mzaffzqaf (at) 0pointer (dot) de>
-+ *
-+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+ *
-+ */
-+
-+#include <arpa/inet.h>
-+#include <fcntl.h>
-+#include <not-cancel.h>
-+#include <stdio.h>
-+#include <string.h>
-+#include <sys/socket.h>
-+#include <sys/types.h>
-+#include <sys/un.h>
-+#include <unistd.h>
-+
-+#include "avahi.h"
-+
-+#define WHITESPACE " \t"
-+
-+static FILE *avahi_open_socket(void)
-+{
-+ int fd;
-+ struct sockaddr_un sa;
-+ FILE *f;
-+
-+ fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
-+
-+ if (fd < 0)
-+ return NULL;
-+
-+#ifndef __ASSUME_SOCK_CLOEXEC
-+ fcntl_not_cancel(fd, F_SETFD, FD_CLOEXEC);
-+#endif
-+
-+ memset(&sa, 0, sizeof(sa));
-+ sa.sun_family = AF_UNIX;
-+ strncpy(sa.sun_path, __UCLIBC_AVAHI_SOCKET_PATH__,
-+ sizeof(sa.sun_path) - 1);
-+ sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
-+
-+ if (connect(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
-+ goto fail;
-+
-+ f = fdopen(fd, "r+");
-+ if (!f)
-+ goto fail;
-+
-+ return f;
-+
-+fail:
-+ close(fd);
-+
-+ return NULL;
-+}
-+
-+static int avahi_ends_with(const char *name, const char* suffix)
-+{
-+ size_t ln, ls;
-+
-+ if (!name || !suffix)
-+ return 0;
-+
-+ if ((ls = strlen(suffix)) > (ln = strlen(name)))
-+ return 0;
-+
-+ return strcasecmp(name + ln - ls, suffix) == 0;
-+}
-+
-+int __avahi_resolve_name(int af, const char* name, void* data)
-+{
-+ FILE *f;
-+ char *p;
-+ int ret = -1;
-+ char ln[256];
-+
-+ if (af != AF_INET && af != AF_INET6)
-+ return ret;
-+
-+ if (!avahi_ends_with(name, ".local") &&
-+ !avahi_ends_with(name, ".local."))
-+ return ret;
-+
-+ f = avahi_open_socket();
-+ if (!f)
-+ return ret;
-+
-+ fprintf(f, "RESOLVE-HOSTNAME-IPV%d %s\n", af == AF_INET ? 4 : 6, name);
-+ fflush(f);
-+
-+ if (!fgets(ln, sizeof(ln), f))
-+ goto finish;
-+
-+ if (ln[0] != '+') {
-+ ret = 1;
-+ goto finish;
-+ }
-+
-+ p = ln + 1;
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Skip interface */
-+ p += strcspn(p, WHITESPACE);
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Skip protocol */
-+ p += strcspn(p, WHITESPACE);
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Skip host name */
-+ p += strcspn(p, WHITESPACE);
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Cut off end of line */
-+ p[strcspn(p, "\n\r\t ")] = 0;
-+
-+ if (inet_pton(af, p, data) <= 0)
-+ goto finish;
-+
-+ ret = 0;
-+
-+finish:
-+ fclose(f);
-+
-+ return ret;
-+}
-+
-+int __avahi_resolve_address(int af, const void *data, char* name,
-+ size_t name_len)
-+{
-+ FILE *f;
-+ char *p;
-+ int ret = -1;
-+ char a[256], ln[256];
-+
-+ if (af != AF_INET && af != AF_INET6)
-+ return ret;
-+
-+ f = avahi_open_socket();
-+ if (!f)
-+ return ret;
-+
-+ fprintf(f, "RESOLVE-ADDRESS %s\n", inet_ntop(af, data, a, sizeof(a)));
-+
-+ if (!fgets(ln, sizeof(ln), f))
-+ goto finish;
-+
-+ if (ln[0] != '+') {
-+ ret = 1;
-+ goto finish;
-+ }
-+
-+ p = ln + 1;
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Skip interface */
-+ p += strcspn(p, WHITESPACE);
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Skip protocol */
-+ p += strcspn(p, WHITESPACE);
-+ p += strspn(p, WHITESPACE);
-+
-+ /* Cut off end of line */
-+ p[strcspn(p, "\n\r\t ")] = 0;
-+
-+ strncpy(name, p, name_len - 1);
-+ name[name_len - 1] = 0;
-+
-+ ret = 0;
-+
-+finish:
-+ fclose(f);
-+
-+ return ret;
-+}
-diff --git a/libc/inet/avahi.h b/libc/inet/avahi.h
-new file mode 100644
-index 0000000..85df5f6
---- /dev/null
-+++ b/libc/inet/avahi.h
-@@ -0,0 +1,33 @@
-+/*
-+ *
-+ * (C) 2011 Weinmann GmbH, Hamburg, Germany
-+ *
-+ * Author: Nikolaus Voss <n.voss@weinmann.de>
-+ *
-+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+ *
-+ */
-+
-+#ifndef _UCLIBC_AVAHI_H_
-+#define _UCLIBC_AVAHI_H_
-+
-+#ifdef __UCLIBC_HAS_AVAHI_RES__
-+int __avahi_resolve_name(int af, const char* name, void* data) attribute_hidden;
-+
-+int __avahi_resolve_address(int af, const void *data, char* name,
-+ size_t name_len) attribute_hidden;
-+#else
-+static inline int __avahi_resolve_name(int af, const char* name, void* data)
-+ attribute_hidden
-+{
-+ return 1;
-+}
-+
-+static inline int __avahi_resolve_address(int af, const void *data, char* name,
-+ size_t name_len) attribute_hidden
-+{
-+ return 1;
-+}
-+#endif
-+
-+#endif
-diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
-index bc596b0..2527b50 100644
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -318,6 +318,7 @@ Domain name in a message can be represented as either:
- #include <sys/stat.h>
- #include <bits/uClibc_mutex.h>
- #include "internal/parse_config.h"
-+#include "avahi.h"
-
- /* poll() is not supported in kernel <= 2.0, therefore if __NR_poll is
- * not available, we assume an old Linux kernel is in use and we will
-@@ -2073,10 +2074,11 @@ int gethostbyname_r(const char *name,
- alias[0] = alias0;
- alias[1] = NULL;
-
-- /* maybe it is already an address? */
-+ /* maybe it is resolvable via avahi or already an address? */
- {
- struct in_addr *in = (struct in_addr *)(buf + sizeof(addr_list[0]) * 2);
-- if (inet_aton(name, in)) {
-+ if (!__avahi_resolve_name(AF_INET, name, in) ||
-+ inet_aton(name, in)) {
- addr_list[0] = in;
- addr_list[1] = NULL;
- result_buf->h_name = alias0;
-@@ -2263,8 +2265,9 @@ int gethostbyname2_r(const char *name,
- strncpy(buf, name, buflen);
- buf[buflen] = '\0';
-
-- /* maybe it is already an address? */
-- if (inet_pton(AF_INET6, name, in)) {
-+ /* maybe it is resolvable via avahi or already an address? */
-+ if (!__avahi_resolve_name(AF_INET6, name, in) ||
-+ inet_pton(AF_INET6, name, in)) {
- result_buf->h_name = buf;
- result_buf->h_addrtype = AF_INET6;
- result_buf->h_length = sizeof(*in);
-@@ -2427,6 +2430,18 @@ int gethostbyaddr_r(const void *addr, socklen_t addrlen,
- addr_list[1] = NULL;
- memcpy(in, addr, addrlen);
-
-+ /* is this a .local address? */
-+ if (!__avahi_resolve_address(type, in, buf, buflen)) {
-+ result_buf->h_name = buf;
-+ result_buf->h_addrtype = type;
-+ result_buf->h_length = addrlen;
-+ result_buf->h_addr_list = (char **) addr_list;
-+ result_buf->h_aliases = alias;
-+ *result = result_buf;
-+ *h_errnop = NETDB_SUCCESS;
-+ return NETDB_SUCCESS;
-+ }
-+
- if (0) /* nothing */;
- #ifdef __UCLIBC_HAS_IPV4__
- else IF_HAS_BOTH(if (type == AF_INET)) {
-diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
-index 6bf5544..a322334 100644
---- a/libc/sysdeps/linux/common/bits/kernel-features.h
-+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
-@@ -310,11 +310,12 @@
- #endif
-
- /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
-- * x86-64, PPC, IA-64, and SPARC in 2.6.27. */
-+ * x86-64, PPC, IA-64, ARM and SPARC in 2.6.27. */
- #if __LINUX_KERNEL_VERSION >= 0x02061b \
- && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
-- || defined __ia64__ || defined __sparc__ || defined __s390__)
--/* # define __ASSUME_SOCK_CLOEXEC 1 */
-+ || defined __ia64__ || defined __sparc__ || defined __s390__ \
-+ || defined __arm__)
-+# define __ASSUME_SOCK_CLOEXEC 1
- /* # define __ASSUME_IN_NONBLOCK 1 */
- # define __ASSUME_PIPE2 1
- /* # define __ASSUME_EVENTFD2 1 */
---
-1.7.5.4
-
diff --git a/main/libc0.9.32/uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch b/main/libc0.9.32/uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch
deleted file mode 100644
index 2ad00328d2..0000000000
--- a/main/libc0.9.32/uClibc-0.9.33.2-bits-time.h-sync-with-glibc-2.16.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 3d1b82c7d9dce11c733fe23a85df7f975c7e2486 Mon Sep 17 00:00:00 2001
-From: Peter Korsgaard <jacmet@sunsite.dk>
-Date: Tue, 3 Jul 2012 15:54:57 +0200
-Subject: [PATCH] bits/time.h: sync with glibc 2.16
-
-CLOCK_MONOTONIC_RAW is available since 2.6.28
-(2d42244ae71d: clocksource: introduce CLOCK_MONOTONIC_RAW), and
-CLOCK_*_COARSE since 2.6.32 (da15cfdae033: time: Introduce
-CLOCK_REALTIME_COARSE).
-
-Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
- libc/sysdeps/linux/common/bits/time.h | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/libc/sysdeps/linux/common/bits/time.h b/libc/sysdeps/linux/common/bits/time.h
-index 7ed54bf..c871223 100644
---- a/libc/sysdeps/linux/common/bits/time.h
-+++ b/libc/sysdeps/linux/common/bits/time.h
-@@ -54,6 +54,12 @@
- # define CLOCK_PROCESS_CPUTIME_ID 2
- /* Thread-specific CPU-time clock. */
- # define CLOCK_THREAD_CPUTIME_ID 3
-+/* Monotonic system-wide clock, not adjusted for frequency scaling. */
-+# define CLOCK_MONOTONIC_RAW 4
-+/* Identifier for system-wide realtime clock, updated only on ticks. */
-+# define CLOCK_REALTIME_COARSE 5
-+/* Monotonic system-wide clock, updated only on ticks. */
-+# define CLOCK_MONOTONIC_COARSE 6
-
- /* Flag to indicate time is absolute. */
- # define TIMER_ABSTIME 1
---
-1.7.10.4
-
diff --git a/main/libc0.9.32/uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch b/main/libc0.9.32/uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch
deleted file mode 100644
index c699b6b11f..0000000000
--- a/main/libc0.9.32/uClibc-0.9.33.2-define-MSG_CMSG_CLOEXEC.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Add definition of MSG_WAITFORONE and MSG_CMSG_CLOEXEC
-
-From yocto:
-http://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-core/uclibc/uclibc-0.9.33/define-MSG_CMSG_CLOEXEC.patch
-
-Upstream-Status: Pending
-
-Index: git/libc/sysdeps/linux/common/bits/socket.h
-===================================================================
---- git.orig/libc/sysdeps/linux/common/bits/socket.h 2012-01-26 23:23:21.537456132 -0800
-+++ git/libc/sysdeps/linux/common/bits/socket.h 2012-01-26 23:25:10.125461388 -0800
-@@ -235,8 +235,15 @@
- #define MSG_ERRQUEUE MSG_ERRQUEUE
- MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
- #define MSG_NOSIGNAL MSG_NOSIGNAL
-- MSG_MORE = 0x8000 /* Sender will send more. */
-+ MSG_MORE = 0x8000, /* Sender will send more. */
- #define MSG_MORE MSG_MORE
-+ MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/
-+#define MSG_WAITFORONE MSG_WAITFORONE
-+
-+ MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file
-+ descriptor received through
-+ SCM_RIGHTS. */
-+#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
- };
-
-
diff --git a/main/libc0.9.32/uClibc-0.9.33.2-dup3.patch b/main/libc0.9.32/uClibc-0.9.33.2-dup3.patch
deleted file mode 100644
index 87fe2a679f..0000000000
--- a/main/libc0.9.32/uClibc-0.9.33.2-dup3.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From: Jonas Bonn <jonas@southpole.se>
-Subject: [RFC PATCH 16/38] Add dup3 syscall
-Date: Tue, 6 Sep 2011 10:30:40 +0200
-
-Signed-off-by: Jonas Bonn <jonas@southpole.se>
----
- include/unistd.h | 4 ++++
- libc/sysdeps/linux/common/dup3.c | 15 +++++++++++++++
- 2 files changed, 19 insertions(+), 0 deletions(-)
- create mode 100644 libc/sysdeps/linux/common/dup3.c
-
-diff --git a/include/unistd.h b/include/unistd.h
-index 9568790..7c2fa4a 100644
---- a/include/unistd.h
-+++ b/include/unistd.h
-@@ -513,6 +513,10 @@ extern int dup (int __fd) __THROW __wur;
- extern int dup2 (int __fd, int __fd2) __THROW;
- libc_hidden_proto(dup2)
-
-+/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
-+extern int dup3 (int __fd, int __fd2, int __flags) __THROW;
-+libc_hidden_proto(dup3)
-+
- /* NULL-terminated array of "NAME=VALUE" environment variables. */
- extern char **__environ;
- #ifdef __USE_GNU
-diff --git a/libc/sysdeps/linux/common/dup3.c b/libc/sysdeps/linux/common/dup3.c
-new file mode 100644
-index 0000000..5fdab2e
---- /dev/null
-+++ b/libc/sysdeps/linux/common/dup3.c
-@@ -0,0 +1,17 @@
-+/* vi: set sw=4 ts=4: */
-+/*
-+ * dup3() for uClibc
-+ *
-+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+ *
-+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+ */
-+
-+#include <sys/syscall.h>
-+#include <unistd.h>
-+
-+
-+#ifdef __NR_dup3
-+_syscall3(int, dup3, int, oldfd, int, newfd, int, flags)
-+libc_hidden_def(dup3)
-+#endif
---
-1.7.5.4
-
-_______________________________________________
-uClibc mailing list
-uClibc@uclibc.org
-http://lists.busybox.net/mailman/listinfo/uclibc
diff --git a/main/libc0.9.32/uclibc-dlclose-fix.patch b/main/libc0.9.32/uclibc-dlclose-fix.patch
deleted file mode 100644
index c99cd2526c..0000000000
--- a/main/libc0.9.32/uclibc-dlclose-fix.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- ./ldso/libdl/libdl.c.orig
-+++ ./ldso/libdl/libdl.c
-@@ -951,8 +951,8 @@
-
- dtv_t *dtv = THREAD_DTV ();
-
-- _dl_assert(!(dtv[tls_lmap->l_tls_modid].pointer.is_static));
-- if (dtv[tls_lmap->l_tls_modid].pointer.val != TLS_DTV_UNALLOCATED) {
-+ if (!(dtv[tls_lmap->l_tls_modid].pointer.is_static) &&
-+ dtv[tls_lmap->l_tls_modid].pointer.val != TLS_DTV_UNALLOCATED) {
- /* Note that free is called for NULL is well. We
- deallocate even if it is this dtv entry we are
- supposed to load. The reason is that we call
-
diff --git a/main/libc0.9.32/uclibc-rtld_next-fix.patch b/main/libc0.9.32/uclibc-rtld_next-fix.patch
deleted file mode 100644
index f952641f47..0000000000
--- a/main/libc0.9.32/uclibc-rtld_next-fix.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/ldso/libdl/libdl.c
-+++ b/ldso/libdl/libdl.c
-@@ -671,7 +671,7 @@
- {
- struct elf_resolve *tpnt, *tfrom;
- struct dyn_elf *handle;
-- ElfW(Addr) from;
-+ ElfW(Addr) from = 0;
- struct dyn_elf *rpnt;
- void *ret;
- struct symbol_ref sym_ref = { NULL, NULL };
-@@ -729,7 +729,13 @@
- tpnt = NULL;
- if (handle == _dl_symbol_tables)
- tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
-- ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
-+
-+ do {
-+ ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
-+ if (ret != NULL)
-+ break;
-+ handle = handle->next;
-+ } while (from && handle);
-
- #if defined(USE_TLS) && USE_TLS && defined SHARED
- if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
-
diff --git a/main/libc0.9.32/uclibc-utils.trigger b/main/libc0.9.32/uclibc-utils.trigger
deleted file mode 100644
index 072c3c7389..0000000000
--- a/main/libc0.9.32/uclibc-utils.trigger
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec /sbin/ldconfig -X
diff --git a/main/libc0.9.32/uclibcconfig.arm b/main/libc0.9.32/uclibcconfig.arm
deleted file mode 100644
index a7378135a6..0000000000
--- a/main/libc0.9.32/uclibcconfig.arm
+++ /dev/null
@@ -1,269 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Version: 0.9.32-rc3
-# Fri Mar 18 13:13:20 2011
-#
-# TARGET_alpha is not set
-TARGET_arm=y
-# TARGET_avr32 is not set
-# TARGET_bfin is not set
-# TARGET_cris is not set
-# TARGET_e1 is not set
-# TARGET_frv is not set
-# TARGET_h8300 is not set
-# TARGET_hppa is not set
-# TARGET_i386 is not set
-# TARGET_i960 is not set
-# TARGET_ia64 is not set
-# TARGET_m68k is not set
-# TARGET_microblaze is not set
-# TARGET_mips is not set
-# TARGET_nios is not set
-# TARGET_nios2 is not set
-# TARGET_powerpc is not set
-# TARGET_sh is not set
-# TARGET_sh64 is not set
-# TARGET_sparc is not set
-# TARGET_v850 is not set
-# TARGET_vax is not set
-# TARGET_x86_64 is not set
-# TARGET_xtensa is not set
-# TARGET_c6x is not set
-
-#
-# Target Architecture Features and Options
-#
-TARGET_ARCH="arm"
-FORCE_OPTIONS_FOR_ARCH=y
-# CONFIG_ARM_OABI is not set
-CONFIG_ARM_EABI=y
-CONFIG_GENERIC_ARM=y
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_ARM_IWMMXT is not set
-TARGET_SUBARCH=""
-
-#
-# Using ELF file format
-#
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-# ARCH_WANTS_BIG_ENDIAN is not set
-ARCH_WANTS_LITTLE_ENDIAN=y
-ARCH_HAS_MMU=y
-ARCH_USE_MMU=y
-UCLIBC_HAS_FLOATS=y
-UCLIBC_HAS_FPU=y
-DO_C99_MATH=y
-DO_XSI_MATH=y
-UCLIBC_HAS_FENV=y
-KERNEL_HEADERS="/usr/include"
-HAVE_DOT_CONFIG=y
-
-#
-# General Library Settings
-#
-# HAVE_NO_PIC is not set
-DOPIC=y
-# ARCH_HAS_NO_SHARED is not set
-# ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LDSO_LDD_SUPPORT=y
-LDSO_CACHE_SUPPORT=y
-LDSO_PRELOAD_ENV_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_BASE_FILENAME="ld.so"
-UCLIBC_STATIC_LDCONFIG=y
-LDSO_RUNPATH=y
-LDSO_SEARCH_INTERP_PATH=y
-UCLIBC_CTOR_DTOR=y
-LDSO_GNU_HASH_SUPPORT=y
-# HAS_NO_THREADS is not set
-# LINUXTHREADS_OLD is not set
-# LINUXTHREADS_NEW is not set
-UCLIBC_HAS_THREADS_NATIVE=y
-UCLIBC_HAS_THREADS=y
-UCLIBC_HAS_TLS=y
-PTHREADS_DEBUG_SUPPORT=y
-UCLIBC_HAS_SYSLOG=y
-UCLIBC_HAS_LFS=y
-# MALLOC is not set
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-MALLOC_GLIBC_COMPAT=y
-UCLIBC_DYNAMIC_ATEXIT=y
-COMPAT_ATEXIT=y
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-UCLIBC_SUSV4_LEGACY=y
-# UCLIBC_STRICT_HEADERS is not set
-# UCLIBC_HAS_STUBS is not set
-UCLIBC_HAS_SHADOW=y
-UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
-UCLIBC_HAS___PROGNAME=y
-UCLIBC_HAS_PTY=y
-ASSUME_DEVPTS=y
-UNIX98PTY_ONLY=y
-# UCLIBC_HAS_GETPT is not set
-UCLIBC_HAS_LIBUTIL=y
-UCLIBC_HAS_TM_EXTENSIONS=y
-UCLIBC_HAS_TZ_CACHING=y
-UCLIBC_HAS_TZ_FILE=y
-UCLIBC_HAS_TZ_FILE_READ_MANY=y
-UCLIBC_TZ_FILE_PATH="/etc/TZ"
-UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
-
-#
-# Advanced Library Settings
-#
-UCLIBC_PWD_BUFFER_SIZE=256
-UCLIBC_GRP_BUFFER_SIZE=256
-
-#
-# Support various families of functions
-#
-UCLIBC_LINUX_MODULE_24=y
-UCLIBC_LINUX_SPECIFIC=y
-UCLIBC_HAS_GNU_ERROR=y
-UCLIBC_BSD_SPECIFIC=y
-UCLIBC_HAS_BSD_ERR=y
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
-# UCLIBC_NTP_LEGACY is not set
-UCLIBC_SV4_DEPRECATED=y
-UCLIBC_HAS_REALTIME=y
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_EPOLL=y
-UCLIBC_HAS_XATTR=y
-UCLIBC_HAS_PROFILING=y
-UCLIBC_HAS_CRYPT_IMPL=y
-UCLIBC_HAS_SHA256_CRYPT_IMPL=y
-UCLIBC_HAS_SHA512_CRYPT_IMPL=y
-UCLIBC_HAS_CRYPT=y
-UCLIBC_HAS_NETWORK_SUPPORT=y
-UCLIBC_HAS_SOCKET=y
-UCLIBC_HAS_IPV4=y
-UCLIBC_HAS_IPV6=y
-UCLIBC_HAS_RPC=y
-UCLIBC_HAS_FULL_RPC=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_USE_NETLINK=y
-UCLIBC_SUPPORT_AI_ADDRCONFIG=y
-UCLIBC_HAS_BSD_RES_CLOSE=y
-UCLIBC_HAS_COMPAT_RES_STATE=y
-# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
-UCLIBC_HAS_LIBRESOLV_STUB=y
-# UCLIBC_HAS_LIBNSL_STUB is not set
-
-#
-# String and Stdio Support
-#
-UCLIBC_HAS_STRING_GENERIC_OPT=y
-UCLIBC_HAS_STRING_ARCH_OPT=y
-UCLIBC_HAS_CTYPE_TABLES=y
-UCLIBC_HAS_CTYPE_SIGNED=y
-# UCLIBC_HAS_CTYPE_UNSAFE is not set
-UCLIBC_HAS_CTYPE_CHECKED=y
-# UCLIBC_HAS_CTYPE_ENFORCED is not set
-UCLIBC_HAS_WCHAR=y
-# UCLIBC_HAS_LOCALE is not set
-UCLIBC_HAS_HEXADECIMAL_FLOATS=y
-UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
-UCLIBC_HAS_STDIO_BUFSIZ_8192=y
-UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
-# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
-UCLIBC_HAS_STDIO_GETC_MACRO=y
-UCLIBC_HAS_STDIO_PUTC_MACRO=y
-UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
-UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
-UCLIBC_HAS_PRINTF_M_SPEC=y
-UCLIBC_HAS_ERRNO_MESSAGES=y
-# UCLIBC_HAS_SYS_ERRLIST is not set
-UCLIBC_HAS_SIGNUM_MESSAGES=y
-# UCLIBC_HAS_SYS_SIGLIST is not set
-UCLIBC_HAS_GNU_GETOPT=y
-UCLIBC_HAS_STDIO_FUTEXES=y
-UCLIBC_HAS_GNU_GETSUBOPT=y
-
-#
-# Big and Tall
-#
-UCLIBC_HAS_REGEX=y
-# UCLIBC_HAS_REGEX_OLD is not set
-UCLIBC_HAS_FNMATCH=y
-# UCLIBC_HAS_FNMATCH_OLD is not set
-UCLIBC_HAS_WORDEXP=y
-UCLIBC_HAS_NFTW=y
-UCLIBC_HAS_FTW=y
-UCLIBC_HAS_FTS=y
-UCLIBC_HAS_GLOB=y
-UCLIBC_HAS_GNU_GLOB=y
-UCLIBC_HAS_UTMPX=y
-
-#
-# Library Installation Options
-#
-RUNTIME_PREFIX="/"
-DEVEL_PREFIX="/usr"
-MULTILIB_DIR="lib"
-# HARDWIRED_ABSPATH is not set=y
-
-#
-# Security options
-#
-# UCLIBC_BUILD_PIE is not set
-UCLIBC_HAS_ARC4RANDOM=y
-# HAVE_NO_SSP is not set
-UCLIBC_HAS_SSP=y
-UCLIBC_HAS_SSP_COMPAT=y
-# SSP_QUICK_CANARY is not set
-# PROPOLICE_BLOCK_ABRT is not set
-PROPOLICE_BLOCK_SEGV=y
-UCLIBC_BUILD_SSP=y
-UCLIBC_BUILD_RELRO=y
-UCLIBC_BUILD_NOW=y
-UCLIBC_BUILD_NOEXECSTACK=y
-
-#
-# uClibc development/debugging options
-#
-CROSS_COMPILER_PREFIX=""
-UCLIBC_EXTRA_CFLAGS=""
-# DODEBUG is not set
-DOSTRIP=y
-# DOASSERTS is not set
-SUPPORT_LD_DEBUG=y
-# SUPPORT_LD_DEBUG_EARLY is not set
-# UCLIBC_MALLOC_DEBUGGING is not set
-UCLIBC_HAS_BACKTRACE=y
-WARNINGS="-Wall"
-EXTRA_WARNINGS=y
-# DOMULTI is not set
-# UCLIBC_MJN3_ONLY is not set
diff --git a/main/libc0.9.32/uclibcconfig.i486 b/main/libc0.9.32/uclibcconfig.i486
deleted file mode 120000
index 6ab0f7e5d3..0000000000
--- a/main/libc0.9.32/uclibcconfig.i486
+++ /dev/null
@@ -1 +0,0 @@
-uclibcconfig.x86 \ No newline at end of file
diff --git a/main/libc0.9.32/uclibcconfig.powerpc b/main/libc0.9.32/uclibcconfig.powerpc
deleted file mode 100644
index 451727271e..0000000000
--- a/main/libc0.9.32/uclibcconfig.powerpc
+++ /dev/null
@@ -1,253 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Version: 0.9.32-rc3
-# Fri Mar 18 13:12:53 2011
-#
-# TARGET_alpha is not set
-# TARGET_arm is not set
-# TARGET_avr32 is not set
-# TARGET_bfin is not set
-# TARGET_cris is not set
-# TARGET_e1 is not set
-# TARGET_frv is not set
-# TARGET_h8300 is not set
-# TARGET_hppa is not set
-# TARGET_i386 is not set
-# TARGET_i960 is not set
-# TARGET_ia64 is not set
-# TARGET_m68k is not set
-# TARGET_microblaze is not set
-# TARGET_mips is not set
-# TARGET_nios is not set
-# TARGET_nios2 is not set
-TARGET_powerpc=y
-# TARGET_sh is not set
-# TARGET_sh64 is not set
-# TARGET_sparc is not set
-# TARGET_v850 is not set
-# TARGET_vax is not set
-# TARGET_x86_64 is not set
-# TARGET_xtensa is not set
-# TARGET_c6x is not set
-
-#
-# Target Architecture Features and Options
-#
-TARGET_ARCH="powerpc"
-FORCE_OPTIONS_FOR_ARCH=y
-CONFIG_CLASSIC=y
-# CONFIG_E500 is not set
-TARGET_SUBARCH="classic"
-
-#
-# Using ELF file format
-#
-ARCH_BIG_ENDIAN=y
-
-#
-# Using Big Endian
-#
-ARCH_HAS_MMU=y
-ARCH_USE_MMU=y
-UCLIBC_HAS_FLOATS=y
-UCLIBC_HAS_FPU=y
-DO_C99_MATH=y
-DO_XSI_MATH=y
-UCLIBC_HAS_FENV=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
-KERNEL_HEADERS="/usr/include"
-HAVE_DOT_CONFIG=y
-
-#
-# General Library Settings
-#
-# HAVE_NO_PIC is not set
-DOPIC=y
-# ARCH_HAS_NO_SHARED is not set
-# ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LDSO_LDD_SUPPORT=y
-LDSO_CACHE_SUPPORT=y
-LDSO_PRELOAD_ENV_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_BASE_FILENAME="ld.so"
-UCLIBC_STATIC_LDCONFIG=y
-LDSO_RUNPATH=y
-LDSO_SEARCH_INTERP_PATH=y
-UCLIBC_CTOR_DTOR=y
-LDSO_GNU_HASH_SUPPORT=y
-# HAS_NO_THREADS is not set
-# LINUXTHREADS_OLD is not set
-# LINUXTHREADS_NEW is not set
-UCLIBC_HAS_THREADS_NATIVE=y
-UCLIBC_HAS_THREADS=y
-UCLIBC_HAS_TLS=y
-PTHREADS_DEBUG_SUPPORT=y
-UCLIBC_HAS_SYSLOG=y
-UCLIBC_HAS_LFS=y
-# MALLOC is not set
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-MALLOC_GLIBC_COMPAT=y
-UCLIBC_DYNAMIC_ATEXIT=y
-COMPAT_ATEXIT=y
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-UCLIBC_SUSV4_LEGACY=y
-# UCLIBC_STRICT_HEADERS is not set
-# UCLIBC_HAS_STUBS is not set
-UCLIBC_HAS_SHADOW=y
-UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
-UCLIBC_HAS___PROGNAME=y
-UCLIBC_HAS_PTY=y
-ASSUME_DEVPTS=y
-UNIX98PTY_ONLY=y
-# UCLIBC_HAS_GETPT is not set
-UCLIBC_HAS_LIBUTIL=y
-UCLIBC_HAS_TM_EXTENSIONS=y
-UCLIBC_HAS_TZ_CACHING=y
-UCLIBC_HAS_TZ_FILE=y
-UCLIBC_HAS_TZ_FILE_READ_MANY=y
-UCLIBC_TZ_FILE_PATH="/etc/TZ"
-UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
-
-#
-# Advanced Library Settings
-#
-UCLIBC_PWD_BUFFER_SIZE=256
-UCLIBC_GRP_BUFFER_SIZE=256
-
-#
-# Support various families of functions
-#
-UCLIBC_LINUX_MODULE_24=y
-UCLIBC_LINUX_SPECIFIC=y
-UCLIBC_HAS_GNU_ERROR=y
-UCLIBC_BSD_SPECIFIC=y
-UCLIBC_HAS_BSD_ERR=y
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
-# UCLIBC_NTP_LEGACY is not set
-UCLIBC_SV4_DEPRECATED=y
-UCLIBC_HAS_REALTIME=y
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_EPOLL=y
-UCLIBC_HAS_XATTR=y
-UCLIBC_HAS_PROFILING=y
-UCLIBC_HAS_CRYPT_IMPL=y
-UCLIBC_HAS_SHA256_CRYPT_IMPL=y
-UCLIBC_HAS_SHA512_CRYPT_IMPL=y
-UCLIBC_HAS_CRYPT=y
-UCLIBC_HAS_NETWORK_SUPPORT=y
-UCLIBC_HAS_SOCKET=y
-UCLIBC_HAS_IPV4=y
-UCLIBC_HAS_IPV6=y
-UCLIBC_HAS_RPC=y
-UCLIBC_HAS_FULL_RPC=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_USE_NETLINK=y
-UCLIBC_SUPPORT_AI_ADDRCONFIG=y
-UCLIBC_HAS_BSD_RES_CLOSE=y
-UCLIBC_HAS_COMPAT_RES_STATE=y
-# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
-UCLIBC_HAS_LIBRESOLV_STUB=y
-# UCLIBC_HAS_LIBNSL_STUB is not set
-
-#
-# String and Stdio Support
-#
-UCLIBC_HAS_STRING_GENERIC_OPT=y
-UCLIBC_HAS_STRING_ARCH_OPT=y
-UCLIBC_HAS_CTYPE_TABLES=y
-UCLIBC_HAS_CTYPE_SIGNED=y
-# UCLIBC_HAS_CTYPE_UNSAFE is not set
-UCLIBC_HAS_CTYPE_CHECKED=y
-# UCLIBC_HAS_CTYPE_ENFORCED is not set
-UCLIBC_HAS_WCHAR=y
-# UCLIBC_HAS_LOCALE is not set
-UCLIBC_HAS_HEXADECIMAL_FLOATS=y
-UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
-UCLIBC_HAS_STDIO_BUFSIZ_8192=y
-UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
-# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
-UCLIBC_HAS_STDIO_GETC_MACRO=y
-UCLIBC_HAS_STDIO_PUTC_MACRO=y
-UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
-UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
-UCLIBC_HAS_PRINTF_M_SPEC=y
-UCLIBC_HAS_ERRNO_MESSAGES=y
-# UCLIBC_HAS_SYS_ERRLIST is not set
-UCLIBC_HAS_SIGNUM_MESSAGES=y
-# UCLIBC_HAS_SYS_SIGLIST is not set
-UCLIBC_HAS_GNU_GETOPT=y
-UCLIBC_HAS_STDIO_FUTEXES=y
-UCLIBC_HAS_GNU_GETSUBOPT=y
-
-#
-# Big and Tall
-#
-UCLIBC_HAS_REGEX=y
-# UCLIBC_HAS_REGEX_OLD is not set
-UCLIBC_HAS_FNMATCH=y
-# UCLIBC_HAS_FNMATCH_OLD is not set
-UCLIBC_HAS_WORDEXP=y
-UCLIBC_HAS_NFTW=y
-UCLIBC_HAS_FTW=y
-UCLIBC_HAS_FTS=y
-UCLIBC_HAS_GLOB=y
-UCLIBC_HAS_GNU_GLOB=y
-UCLIBC_HAS_UTMPX=y
-
-#
-# Library Installation Options
-#
-RUNTIME_PREFIX="/"
-DEVEL_PREFIX="/usr"
-MULTILIB_DIR="lib"
-# HARDWIRED_ABSPATH is not set=y
-
-#
-# Security options
-#
-# UCLIBC_BUILD_PIE is not set
-UCLIBC_HAS_ARC4RANDOM=y
-# HAVE_NO_SSP is not set
-UCLIBC_HAS_SSP=y
-UCLIBC_HAS_SSP_COMPAT=y
-# SSP_QUICK_CANARY is not set
-# PROPOLICE_BLOCK_ABRT is not set
-PROPOLICE_BLOCK_SEGV=y
-UCLIBC_BUILD_SSP=y
-UCLIBC_BUILD_RELRO=y
-UCLIBC_BUILD_NOW=y
-UCLIBC_BUILD_NOEXECSTACK=y
-
-#
-# uClibc development/debugging options
-#
-CROSS_COMPILER_PREFIX=""
-UCLIBC_EXTRA_CFLAGS=""
-# DODEBUG is not set
-DOSTRIP=y
-# DOASSERTS is not set
-SUPPORT_LD_DEBUG=y
-# SUPPORT_LD_DEBUG_EARLY is not set
-# UCLIBC_MALLOC_DEBUGGING is not set
-UCLIBC_HAS_BACKTRACE=y
-WARNINGS="-Wall"
-EXTRA_WARNINGS=y
-# DOMULTI is not set
-# UCLIBC_MJN3_ONLY is not set
diff --git a/main/libc0.9.32/uclibcconfig.x86 b/main/libc0.9.32/uclibcconfig.x86
deleted file mode 100644
index a83864990c..0000000000
--- a/main/libc0.9.32/uclibcconfig.x86
+++ /dev/null
@@ -1,275 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Version: 0.9.33.2
-# Tue Sep 24 09:44:01 2013
-#
-# TARGET_alpha is not set
-# TARGET_arm is not set
-# TARGET_avr32 is not set
-# TARGET_bfin is not set
-# TARGET_c6x is not set
-# TARGET_cris is not set
-# TARGET_e1 is not set
-# TARGET_frv is not set
-# TARGET_h8300 is not set
-# TARGET_hppa is not set
-TARGET_i386=y
-# TARGET_i960 is not set
-# TARGET_ia64 is not set
-# TARGET_m68k is not set
-# TARGET_microblaze is not set
-# TARGET_mips is not set
-# TARGET_nios is not set
-# TARGET_nios2 is not set
-# TARGET_powerpc is not set
-# TARGET_sh is not set
-# TARGET_sh64 is not set
-# TARGET_sparc is not set
-# TARGET_v850 is not set
-# TARGET_vax is not set
-# TARGET_x86_64 is not set
-# TARGET_xtensa is not set
-
-#
-# Target Architecture Features and Options
-#
-TARGET_ARCH="i386"
-FORCE_OPTIONS_FOR_ARCH=y
-# CONFIG_GENERIC_386 is not set
-# CONFIG_386 is not set
-CONFIG_486=y
-# CONFIG_586 is not set
-# CONFIG_586MMX is not set
-# CONFIG_686 is not set
-# CONFIG_PENTIUMII is not set
-# CONFIG_PENTIUMIII is not set
-# CONFIG_PENTIUM4 is not set
-# CONFIG_K6 is not set
-# CONFIG_K7 is not set
-# CONFIG_ELAN is not set
-# CONFIG_CRUSOE is not set
-# CONFIG_WINCHIPC6 is not set
-# CONFIG_WINCHIP2 is not set
-# CONFIG_CYRIXIII is not set
-# CONFIG_NEHEMIAH is not set
-TARGET_SUBARCH="i486"
-
-#
-# Using ELF file format
-#
-ARCH_LITTLE_ENDIAN=y
-
-#
-# Using Little Endian
-#
-ARCH_HAS_MMU=y
-ARCH_USE_MMU=y
-UCLIBC_HAS_FLOATS=y
-UCLIBC_HAS_FPU=y
-DO_C99_MATH=y
-DO_XSI_MATH=y
-UCLIBC_HAS_FENV=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
-KERNEL_HEADERS="/usr/include"
-HAVE_DOT_CONFIG=y
-
-#
-# General Library Settings
-#
-DOPIC=y
-ARCH_HAS_UCONTEXT=y
-HAVE_SHARED=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LDSO_LDD_SUPPORT=y
-LDSO_CACHE_SUPPORT=y
-LDSO_PRELOAD_ENV_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_BASE_FILENAME="ld.so"
-LDSO_STANDALONE_SUPPORT=y
-# LDSO_PRELINK_SUPPORT is not set
-UCLIBC_STATIC_LDCONFIG=y
-LDSO_RUNPATH=y
-LDSO_SEARCH_INTERP_PATH=y
-LDSO_LD_LIBRARY_PATH=y
-# LDSO_NO_CLEANUP is not set
-UCLIBC_CTOR_DTOR=y
-LDSO_GNU_HASH_SUPPORT=y
-# HAS_NO_THREADS is not set
-# LINUXTHREADS_OLD is not set
-# LINUXTHREADS_NEW is not set
-UCLIBC_HAS_THREADS_NATIVE=y
-UCLIBC_HAS_THREADS=y
-UCLIBC_HAS_TLS=y
-PTHREADS_DEBUG_SUPPORT=y
-UCLIBC_HAS_SYSLOG=y
-UCLIBC_HAS_LFS=y
-# MALLOC is not set
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-MALLOC_GLIBC_COMPAT=y
-UCLIBC_DYNAMIC_ATEXIT=y
-COMPAT_ATEXIT=y
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_HAS_CONTEXT_FUNCS=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-UCLIBC_SUSV4_LEGACY=y
-# UCLIBC_STRICT_HEADERS is not set
-# UCLIBC_HAS_STUBS is not set
-UCLIBC_HAS_SHADOW=y
-UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
-UCLIBC_HAS___PROGNAME=y
-UCLIBC_HAS_PTY=y
-ASSUME_DEVPTS=y
-UNIX98PTY_ONLY=y
-# UCLIBC_HAS_GETPT is not set
-UCLIBC_HAS_LIBUTIL=y
-UCLIBC_HAS_TM_EXTENSIONS=y
-UCLIBC_HAS_TZ_CACHING=y
-UCLIBC_HAS_TZ_FILE=y
-UCLIBC_HAS_TZ_FILE_READ_MANY=y
-UCLIBC_TZ_FILE_PATH="/etc/TZ"
-UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
-
-#
-# Advanced Library Settings
-#
-UCLIBC_PWD_BUFFER_SIZE=256
-UCLIBC_GRP_BUFFER_SIZE=256
-
-#
-# Support various families of functions
-#
-UCLIBC_LINUX_MODULE_26=y
-UCLIBC_LINUX_MODULE_24=y
-UCLIBC_LINUX_SPECIFIC=y
-UCLIBC_HAS_GNU_ERROR=y
-UCLIBC_BSD_SPECIFIC=y
-UCLIBC_HAS_BSD_ERR=y
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
-# UCLIBC_NTP_LEGACY is not set
-UCLIBC_SV4_DEPRECATED=y
-UCLIBC_HAS_REALTIME=y
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_EPOLL=y
-UCLIBC_HAS_XATTR=y
-UCLIBC_HAS_PROFILING=y
-UCLIBC_HAS_CRYPT_IMPL=y
-UCLIBC_HAS_SHA256_CRYPT_IMPL=y
-UCLIBC_HAS_SHA512_CRYPT_IMPL=y
-UCLIBC_HAS_CRYPT=y
-UCLIBC_HAS_NETWORK_SUPPORT=y
-UCLIBC_HAS_SOCKET=y
-UCLIBC_HAS_IPV4=y
-UCLIBC_HAS_IPV6=y
-UCLIBC_HAS_RPC=y
-UCLIBC_HAS_FULL_RPC=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_USE_NETLINK=y
-UCLIBC_SUPPORT_AI_ADDRCONFIG=y
-UCLIBC_HAS_BSD_RES_CLOSE=y
-UCLIBC_HAS_COMPAT_RES_STATE=y
-# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
-UCLIBC_HAS_RESOLVER_SUPPORT=y
-UCLIBC_HAS_AVAHI_RES=y
-UCLIBC_AVAHI_SOCKET_PATH="/var/run/avahi-daemon/socket"
-UCLIBC_HAS_LIBRESOLV_STUB=y
-# UCLIBC_HAS_LIBNSL_STUB is not set
-
-#
-# String and Stdio Support
-#
-UCLIBC_HAS_STRING_GENERIC_OPT=y
-UCLIBC_HAS_STRING_ARCH_OPT=y
-UCLIBC_HAS_CTYPE_TABLES=y
-UCLIBC_HAS_CTYPE_SIGNED=y
-# UCLIBC_HAS_CTYPE_UNSAFE is not set
-UCLIBC_HAS_CTYPE_CHECKED=y
-# UCLIBC_HAS_CTYPE_ENFORCED is not set
-UCLIBC_HAS_WCHAR=y
-# UCLIBC_HAS_LOCALE is not set
-UCLIBC_HAS_HEXADECIMAL_FLOATS=y
-UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
-UCLIBC_HAS_STDIO_BUFSIZ_8192=y
-UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
-# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
-UCLIBC_HAS_STDIO_GETC_MACRO=y
-UCLIBC_HAS_STDIO_PUTC_MACRO=y
-UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
-UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE=y
-UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
-UCLIBC_HAS_PRINTF_M_SPEC=y
-UCLIBC_HAS_ERRNO_MESSAGES=y
-# UCLIBC_HAS_SYS_ERRLIST is not set
-UCLIBC_HAS_SIGNUM_MESSAGES=y
-# UCLIBC_HAS_SYS_SIGLIST is not set
-UCLIBC_HAS_GNU_GETOPT=y
-UCLIBC_HAS_STDIO_FUTEXES=y
-UCLIBC_HAS_GNU_GETSUBOPT=y
-
-#
-# Big and Tall
-#
-UCLIBC_HAS_REGEX=y
-# UCLIBC_HAS_REGEX_OLD is not set
-UCLIBC_HAS_FNMATCH=y
-# UCLIBC_HAS_FNMATCH_OLD is not set
-UCLIBC_HAS_WORDEXP=y
-UCLIBC_HAS_NFTW=y
-UCLIBC_HAS_FTW=y
-UCLIBC_HAS_FTS=y
-UCLIBC_HAS_GLOB=y
-UCLIBC_HAS_GNU_GLOB=y
-UCLIBC_HAS_UTMPX=y
-
-#
-# Library Installation Options
-#
-RUNTIME_PREFIX="/"
-DEVEL_PREFIX="/usr"
-MULTILIB_DIR="lib"
-# HARDWIRED_ABSPATH is not set
-
-#
-# Security options
-#
-UCLIBC_BUILD_PIE=y
-UCLIBC_HAS_ARC4RANDOM=y
-UCLIBC_HAS_SSP=y
-UCLIBC_HAS_SSP_COMPAT=y
-# SSP_QUICK_CANARY is not set
-# PROPOLICE_BLOCK_ABRT is not set
-PROPOLICE_BLOCK_SEGV=y
-UCLIBC_BUILD_SSP=y
-UCLIBC_BUILD_RELRO=y
-UCLIBC_BUILD_NOW=y
-UCLIBC_BUILD_NOEXECSTACK=y
-
-#
-# Development/debugging options
-#
-CROSS_COMPILER_PREFIX=""
-UCLIBC_EXTRA_CFLAGS=""
-# DODEBUG is not set
-DOSTRIP=y
-# DOASSERTS is not set
-SUPPORT_LD_DEBUG=y
-# SUPPORT_LD_DEBUG_EARLY is not set
-# UCLIBC_MALLOC_DEBUGGING is not set
-UCLIBC_HAS_BACKTRACE=y
-WARNINGS="-Wall"
-EXTRA_WARNINGS=y
-# DOMULTI is not set
-# UCLIBC_MJN3_ONLY is not set
diff --git a/main/libc0.9.32/uclibcconfig.x86_64 b/main/libc0.9.32/uclibcconfig.x86_64
deleted file mode 100644
index 228236ea86..0000000000
--- a/main/libc0.9.32/uclibcconfig.x86_64
+++ /dev/null
@@ -1,257 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Version: 0.9.33.2
-# Tue Sep 24 09:44:01 2013
-#
-# TARGET_alpha is not set
-# TARGET_arm is not set
-# TARGET_avr32 is not set
-# TARGET_bfin is not set
-# TARGET_c6x is not set
-# TARGET_cris is not set
-# TARGET_e1 is not set
-# TARGET_frv is not set
-# TARGET_h8300 is not set
-# TARGET_hppa is not set
-# TARGET_i386 is not set
-# TARGET_i960 is not set
-# TARGET_ia64 is not set
-# TARGET_m68k is not set
-# TARGET_microblaze is not set
-# TARGET_mips is not set
-# TARGET_nios is not set
-# TARGET_nios2 is not set
-# TARGET_powerpc is not set
-# TARGET_sh is not set
-# TARGET_sh64 is not set
-# TARGET_sparc is not set
-# TARGET_v850 is not set
-# TARGET_vax is not set
-TARGET_x86_64=y
-# TARGET_xtensa is not set
-
-#
-# Target Architecture Features and Options
-#
-TARGET_ARCH="x86_64"
-FORCE_OPTIONS_FOR_ARCH=y
-TARGET_SUBARCH=""
-
-#
-# Using ELF file format
-#
-ARCH_LITTLE_ENDIAN=y
-
-#
-# Using Little Endian
-#
-ARCH_HAS_MMU=y
-ARCH_USE_MMU=y
-UCLIBC_HAS_FLOATS=y
-UCLIBC_HAS_FPU=y
-DO_C99_MATH=y
-DO_XSI_MATH=y
-UCLIBC_HAS_FENV=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
-KERNEL_HEADERS="/usr/include"
-HAVE_DOT_CONFIG=y
-
-#
-# General Library Settings
-#
-DOPIC=y
-ARCH_HAS_UCONTEXT=y
-HAVE_SHARED=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LDSO_LDD_SUPPORT=y
-LDSO_CACHE_SUPPORT=y
-LDSO_PRELOAD_ENV_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_BASE_FILENAME="ld.so"
-LDSO_STANDALONE_SUPPORT=y
-# LDSO_PRELINK_SUPPORT is not set
-UCLIBC_STATIC_LDCONFIG=y
-LDSO_RUNPATH=y
-LDSO_SEARCH_INTERP_PATH=y
-LDSO_LD_LIBRARY_PATH=y
-# LDSO_NO_CLEANUP is not set
-UCLIBC_CTOR_DTOR=y
-LDSO_GNU_HASH_SUPPORT=y
-# HAS_NO_THREADS is not set
-# LINUXTHREADS_OLD is not set
-# LINUXTHREADS_NEW is not set
-UCLIBC_HAS_THREADS_NATIVE=y
-UCLIBC_HAS_THREADS=y
-UCLIBC_HAS_TLS=y
-PTHREADS_DEBUG_SUPPORT=y
-UCLIBC_HAS_SYSLOG=y
-UCLIBC_HAS_LFS=y
-# MALLOC is not set
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-MALLOC_GLIBC_COMPAT=y
-UCLIBC_DYNAMIC_ATEXIT=y
-COMPAT_ATEXIT=y
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_HAS_CONTEXT_FUNCS=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-UCLIBC_SUSV4_LEGACY=y
-# UCLIBC_STRICT_HEADERS is not set
-# UCLIBC_HAS_STUBS is not set
-UCLIBC_HAS_SHADOW=y
-UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
-UCLIBC_HAS___PROGNAME=y
-UCLIBC_HAS_PTY=y
-ASSUME_DEVPTS=y
-UNIX98PTY_ONLY=y
-# UCLIBC_HAS_GETPT is not set
-UCLIBC_HAS_LIBUTIL=y
-UCLIBC_HAS_TM_EXTENSIONS=y
-UCLIBC_HAS_TZ_CACHING=y
-UCLIBC_HAS_TZ_FILE=y
-UCLIBC_HAS_TZ_FILE_READ_MANY=y
-UCLIBC_TZ_FILE_PATH="/etc/TZ"
-UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
-
-#
-# Advanced Library Settings
-#
-UCLIBC_PWD_BUFFER_SIZE=256
-UCLIBC_GRP_BUFFER_SIZE=256
-
-#
-# Support various families of functions
-#
-UCLIBC_LINUX_MODULE_26=y
-UCLIBC_LINUX_MODULE_24=y
-UCLIBC_LINUX_SPECIFIC=y
-UCLIBC_HAS_GNU_ERROR=y
-UCLIBC_BSD_SPECIFIC=y
-UCLIBC_HAS_BSD_ERR=y
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
-# UCLIBC_NTP_LEGACY is not set
-UCLIBC_SV4_DEPRECATED=y
-UCLIBC_HAS_REALTIME=y
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_EPOLL=y
-UCLIBC_HAS_XATTR=y
-UCLIBC_HAS_PROFILING=y
-UCLIBC_HAS_CRYPT_IMPL=y
-UCLIBC_HAS_SHA256_CRYPT_IMPL=y
-UCLIBC_HAS_SHA512_CRYPT_IMPL=y
-UCLIBC_HAS_CRYPT=y
-UCLIBC_HAS_NETWORK_SUPPORT=y
-UCLIBC_HAS_SOCKET=y
-UCLIBC_HAS_IPV4=y
-UCLIBC_HAS_IPV6=y
-UCLIBC_HAS_RPC=y
-UCLIBC_HAS_FULL_RPC=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_USE_NETLINK=y
-UCLIBC_SUPPORT_AI_ADDRCONFIG=y
-UCLIBC_HAS_BSD_RES_CLOSE=y
-UCLIBC_HAS_COMPAT_RES_STATE=y
-# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
-UCLIBC_HAS_RESOLVER_SUPPORT=y
-UCLIBC_HAS_AVAHI_RES=y
-UCLIBC_AVAHI_SOCKET_PATH="/var/run/avahi-daemon/socket"
-UCLIBC_HAS_LIBRESOLV_STUB=y
-# UCLIBC_HAS_LIBNSL_STUB is not set
-
-#
-# String and Stdio Support
-#
-UCLIBC_HAS_STRING_GENERIC_OPT=y
-UCLIBC_HAS_STRING_ARCH_OPT=y
-UCLIBC_HAS_CTYPE_TABLES=y
-UCLIBC_HAS_CTYPE_SIGNED=y
-# UCLIBC_HAS_CTYPE_UNSAFE is not set
-UCLIBC_HAS_CTYPE_CHECKED=y
-# UCLIBC_HAS_CTYPE_ENFORCED is not set
-UCLIBC_HAS_WCHAR=y
-# UCLIBC_HAS_LOCALE is not set
-UCLIBC_HAS_HEXADECIMAL_FLOATS=y
-UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
-UCLIBC_HAS_STDIO_BUFSIZ_8192=y
-UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
-# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
-UCLIBC_HAS_STDIO_GETC_MACRO=y
-UCLIBC_HAS_STDIO_PUTC_MACRO=y
-UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
-UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE=y
-UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
-UCLIBC_HAS_PRINTF_M_SPEC=y
-UCLIBC_HAS_ERRNO_MESSAGES=y
-# UCLIBC_HAS_SYS_ERRLIST is not set
-UCLIBC_HAS_SIGNUM_MESSAGES=y
-# UCLIBC_HAS_SYS_SIGLIST is not set
-UCLIBC_HAS_GNU_GETOPT=y
-UCLIBC_HAS_STDIO_FUTEXES=y
-UCLIBC_HAS_GNU_GETSUBOPT=y
-
-#
-# Big and Tall
-#
-UCLIBC_HAS_REGEX=y
-# UCLIBC_HAS_REGEX_OLD is not set
-UCLIBC_HAS_FNMATCH=y
-# UCLIBC_HAS_FNMATCH_OLD is not set
-UCLIBC_HAS_WORDEXP=y
-UCLIBC_HAS_NFTW=y
-UCLIBC_HAS_FTW=y
-UCLIBC_HAS_FTS=y
-UCLIBC_HAS_GLOB=y
-UCLIBC_HAS_GNU_GLOB=y
-UCLIBC_HAS_UTMPX=y
-
-#
-# Library Installation Options
-#
-RUNTIME_PREFIX="/"
-DEVEL_PREFIX="/usr"
-MULTILIB_DIR="lib"
-# HARDWIRED_ABSPATH is not set=y
-
-#
-# Security options
-#
-UCLIBC_HAS_ARC4RANDOM=y
-UCLIBC_HAS_SSP=y
-UCLIBC_HAS_SSP_COMPAT=y
-# SSP_QUICK_CANARY is not set
-# PROPOLICE_BLOCK_ABRT is not set
-PROPOLICE_BLOCK_SEGV=y
-UCLIBC_BUILD_SSP=y
-UCLIBC_BUILD_RELRO=y
-UCLIBC_BUILD_NOW=y
-UCLIBC_BUILD_NOEXECSTACK=y
-
-#
-# Development/debugging options
-#
-CROSS_COMPILER_PREFIX=""
-UCLIBC_EXTRA_CFLAGS=""
-# DODEBUG is not set
-DOSTRIP=y
-# DOASSERTS is not set
-SUPPORT_LD_DEBUG=y
-# SUPPORT_LD_DEBUG_EARLY is not set
-# UCLIBC_MALLOC_DEBUGGING is not set
-UCLIBC_HAS_BACKTRACE=y
-WARNINGS="-Wall"
-EXTRA_WARNINGS=y
-# DOMULTI is not set
-# UCLIBC_MJN3_ONLY is not set
diff --git a/main/libc0.9.32/ucontext-reentrant.patch b/main/libc0.9.32/ucontext-reentrant.patch
deleted file mode 100644
index 2417e15a48..0000000000
--- a/main/libc0.9.32/ucontext-reentrant.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch
-index b47f5a0..8b1edc2 100644
---- a/libc/sysdeps/linux/i386/Makefile.arch
-+++ b/libc/sysdeps/linux/i386/Makefile.arch
-@@ -18,4 +18,7 @@ endif
-
- ifeq ($(UCLIBC_HAS_CONTEXT_FUNCS),y)
- SSRC += makecontext.S setcontext.S getcontext.S swapcontext.S
-+ASFLAGS-setcontext.S := -D_LIBC_REENTRANT
-+ASFLAGS-getcontext.S := -D_LIBC_REENTRANT
-+ASFLAGS-swapcontext.S := -D_LIBC_REENTRANT
- endif