aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/020-add-posix_madvise.c.patch48
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/021-libc-add-posix_fallocate.patch301
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/022-libc-add-fallocate-and-fallocate64.patch447
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch6
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch4
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch6
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch2
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch14
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch23
9 files changed, 811 insertions, 40 deletions
diff --git a/toolchain/uClibc/patches-0.9.33.2/020-add-posix_madvise.c.patch b/toolchain/uClibc/patches-0.9.33.2/020-add-posix_madvise.c.patch
new file mode 100644
index 0000000000..2b18c258d9
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/020-add-posix_madvise.c.patch
@@ -0,0 +1,48 @@
+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>
+---
+ create mode 100644 libc/sysdeps/linux/common/posix_madvise.c
+
+--- a/libc/sysdeps/linux/common/Makefile.in
++++ b/libc/sysdeps/linux/common/Makefile.in
+@@ -81,7 +81,7 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_get
+ 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
+--- /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
diff --git a/toolchain/uClibc/patches-0.9.33.2/021-libc-add-posix_fallocate.patch b/toolchain/uClibc/patches-0.9.33.2/021-libc-add-posix_fallocate.patch
new file mode 100644
index 0000000000..504405a716
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/021-libc-add-posix_fallocate.patch
@@ -0,0 +1,301 @@
+From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+Date: Tue, 17 Apr 2012 09:30:15 +0200
+Subject: [PATCH] libc: add posix_fallocate()
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ 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
+ create mode 100644 test/unistd/tst-posix_fallocate64.c
+
+--- a/include/fcntl.h
++++ b/include/fcntl.h
+@@ -210,9 +210,7 @@ extern int posix_fadvise64 (int __fd, __
+
+ #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.
+
+--- a/libc/sysdeps/linux/common/Makefile.in
++++ b/libc/sysdeps/linux/common/Makefile.in
+@@ -81,7 +81,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_get
+ 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
+--- 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
+--- /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
+--- /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
+--- a/test/.gitignore
++++ b/test/.gitignore
+@@ -302,6 +302,8 @@ unistd/getcwd
+ unistd/getopt
+ unistd/getopt_long
+ unistd/tstgetopt
++unistd/tst-posix_fallocate
++unistd/tst-posix_fallocate64
+ unistd/tst-preadwrite
+ unistd/tst-preadwrite64
+ unistd/vfork
+--- a/test/unistd/Makefile.in
++++ b/test/unistd/Makefile.in
+@@ -2,7 +2,10 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ ifeq ($(UCLIBC_HAS_LFS),)
+-TESTS_DISABLED := tst-preadwrite64
++TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
++endif
++ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
++TESTS_DISABLED := tst-posix_fallocate
+ endif
+ OPTS_getopt := -abcXXX -9
+ OPTS_getopt_long := --add XXX --delete YYY --verbose
+--- /dev/null
++++ b/test/unistd/tst-posix_fallocate.c
+@@ -0,0 +1,127 @@
++#include <fcntl.h>
++#include <sys/stat.h>
++
++#ifndef TST_POSIX_FALLOCATE64
++# define stat64 stat
++# define fstat64 fstat
++# else
++# ifndef O_LARGEFILE
++# error no O_LARGEFILE but you want to test with LFS enabled
++# endif
++#endif
++
++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;
++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;
++ }
++#ifdef TST_POSIX_FALLOCATE64
++ 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 %llu\n",
++ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
++ return 1;
++ }
++#endif
++ close (fd);
++
++ return 0;
++}
+--- /dev/null
++++ b/test/unistd/tst-posix_fallocate64.c
+@@ -0,0 +1,2 @@
++#define TST_POSIX_FALLOCATE64
++#include "tst-posix_fallocate.c"
diff --git a/toolchain/uClibc/patches-0.9.33.2/022-libc-add-fallocate-and-fallocate64.patch b/toolchain/uClibc/patches-0.9.33.2/022-libc-add-fallocate-and-fallocate64.patch
new file mode 100644
index 0000000000..282b64f52e
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/022-libc-add-fallocate-and-fallocate64.patch
@@ -0,0 +1,447 @@
+From: "Anthony G. Basile" <blueness@gentoo.org>
+Date: Sun, 7 Sep 2014 15:33:46 -0400
+Subject: [PATCH] libc: add fallocate() and fallocate64()
+
+We add the Linux-specific function fallocate() which allows the user to
+directly manipulate allocate space for a file. fallocate() can operate
+in different modes, but the default mode is equivalent to posix_fallocate()
+which is specified in POSIX.1.
+
+Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be
+available.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ create mode 100644 libc/sysdeps/linux/common/fallocate.c
+ create mode 100644 libc/sysdeps/linux/common/fallocate64.c
+ create mode 100644 test/unistd/tst-fallocate.c
+ create mode 100644 test/unistd/tst-fallocate64.c
+
+--- a/extra/Configs/Config.in
++++ b/extra/Configs/Config.in
+@@ -952,8 +952,8 @@ config UCLIBC_LINUX_SPECIFIC
+ default y
+ help
+ accept4(), bdflush(),
+- capget(), capset(), eventfd(), fstatfs(),
+- inotify_*(), ioperm(), iopl(),
++ capget(), capset(), eventfd(), fallocate(),
++ fstatfs(), inotify_*(), ioperm(), iopl(),
+ madvise(), modify_ldt(), pipe2(), personality(),
+ prctl()/arch_prctl(), pivot_root(), modify_ldt(),
+ ppoll(), readahead(), reboot(), remap_file_pages(),
+--- a/include/fcntl.h
++++ b/include/fcntl.h
+@@ -237,6 +237,38 @@ extern int __fcntl_nocancel (int fd, int
+ libc_hidden_proto(__fcntl_nocancel)
+ #endif
+
++#if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU) || defined _LIBC
++/* Reserve storage for the data of a file associated with FD. This function
++ is Linux-specific. For the portable version, use posix_fallocate().
++ Unlike the latter, fallocate can operate in different modes. The default
++ mode = 0 is equivalent to posix_fallocate().
++
++ Note: These declarations are used in posix_fallocate.c and
++ posix_fallocate64.c, so we expose them internally.
++ */
++
++/* Flags for fallocate's mode. */
++# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file
++ even if offset + len is
++ greater than file size. */
++# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */
++
++# ifndef __USE_FILE_OFFSET64
++extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
++# else
++# ifdef __REDIRECT
++extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
++ __off64_t __len),
++ fallocate64);
++# else
++# define fallocate fallocate64
++# endif
++# endif
++# ifdef __USE_LARGEFILE64
++extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
++# endif
++#endif
++
+ __END_DECLS
+
+ #endif /* fcntl.h */
+--- a/libc/sysdeps/linux/common/Makefile.in
++++ b/libc/sysdeps/linux/common/Makefile.in
+@@ -61,6 +61,10 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
+ vmsplice.c
+ CSRC-$(if $(findstring yy,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_LFS)),y) += \
+ sendfile64.c
++# posix_fallocate() needs __libc_fallocate() from fallocate.c
++# posix_fallocate64() needs __libc_fallocate64() from fallocate64.c
++CSRC-$(if $(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_ADVANCED_REALTIME),y,) += \
++ fallocate.c $(filter fallocate64.c,$(CSRC-y))
+ # NPTL needs these internally: madvise.c
+ CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c
+ ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+--- /dev/null
++++ b/libc/sysdeps/linux/common/fallocate.c
+@@ -0,0 +1,48 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * fallocate() for uClibc - Based off of posix_fallocate() by Erik Andersen
++ * 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
++extern __typeof(fallocate) __libc_fallocate attribute_hidden;
++int attribute_hidden __libc_fallocate(int fd, int mode, __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, mode,
++ __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, mode, 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_LINUX_SPECIFIC__ && defined __USE_GNU
++strong_alias(__libc_fallocate,fallocate)
++# if __WORDSIZE == 64
++strong_alias(__libc_fallocate,fallocate64)
++# endif
++# endif
++#endif
+--- /dev/null
++++ b/libc/sysdeps/linux/common/fallocate64.c
+@@ -0,0 +1,42 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * fallocate() for uClibc - based off posix_fallocate() by Erik Andersen
++ * 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 fallocate() */
++# elif __WORDSIZE == 32
++extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
++int attribute_hidden __libc_fallocate64(int fd, int mode, __off64_t offset,
++ __off64_t len)
++{
++ int ret;
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
++ OFF64_HI_LO (offset), OFF64_HI_LO (len)));
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++}
++
++# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
++strong_alias(__libc_fallocate64,fallocate64)
++# endif
++
++# else
++# error your machine is neither 32 bit or 64 bit ... it must be magical
++# endif
++#endif
+--- a/libc/sysdeps/linux/common/posix_fallocate.c
++++ b/libc/sysdeps/linux/common/posix_fallocate.c
+@@ -14,28 +14,10 @@
+ #include <stdint.h>
+
+ #if defined __NR_fallocate
++extern __typeof(fallocate) __libc_fallocate attribute_hidden;
+ 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;
++ return __libc_fallocate(fd, 0, offset, len);
+ }
+ # if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
+ strong_alias(posix_fallocate,posix_fallocate64)
+--- a/libc/sysdeps/linux/common/posix_fallocate64.c
++++ b/libc/sysdeps/linux/common/posix_fallocate64.c
+@@ -18,22 +18,12 @@
+ # if __WORDSIZE == 64
+ /* Can use normal posix_fallocate() */
+ # elif __WORDSIZE == 32
++extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
+ 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;
++ return __libc_fallocate64(fd, 0, offset, len);
+ }
+ # else
+-# error your machine is neither 32 bit or 64 bit ... it must be magical
++# error your machine is neither 32 bit or 64 bit ... it must be magical
+ # endif
+ #endif
+--- a/test/.gitignore
++++ b/test/.gitignore
+@@ -302,6 +302,8 @@ unistd/getcwd
+ unistd/getopt
+ unistd/getopt_long
+ unistd/tstgetopt
++unistd/tst-fallocate
++unistd/tst-fallocate64
+ unistd/tst-posix_fallocate
+ unistd/tst-posix_fallocate64
+ unistd/tst-preadwrite
+--- /dev/null
++++ b/test/unistd/tst-fallocate.c
+@@ -0,0 +1,166 @@
++#include <fcntl.h>
++#include <sys/stat.h>
++
++#ifndef TST_FALLOCATE64
++# define stat64 stat
++# define fstat64 fstat
++# else
++# ifndef O_LARGEFILE
++# error no O_LARGEFILE but you want to test with LFS enabled
++# endif
++#endif
++
++static void do_prepare(void);
++static int do_test(void);
++#define PREPARE(argc, argv) do_prepare ()
++#define TEST_FUNCTION do_test ()
++#include <test-skeleton.c>
++
++static int fd;
++static void
++do_prepare (void)
++{
++ fd = create_temp_file ("tst-fallocate.", NULL);
++ if (fd == -1)
++ {
++ printf ("cannot create temporary file: %m\n");
++ exit (1);
++ }
++}
++
++
++static int
++do_test (void)
++{
++ struct stat64 st;
++ int c;
++ char garbage[4096];
++ blkcnt_t blksb4;
++
++ 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;
++ }
++
++ /* This is the default mode which is identical to posix_fallocate().
++ Note: we need a few extra blocks for FALLOC_FL_PUNCH_HOLE below.
++ While block sizes vary, we'll assume eight 4K blocks for good measure. */
++ if (fallocate (fd, 0, 8 * 4096, 128) != 0)
++ {
++ puts ("1st fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("2nd fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 8 * 4096 + 128)
++ {
++ printf ("file size after 1st fallocate call is %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
++ return 1;
++ }
++
++ /* Without FALLOC_FL_KEEP_SIZE, this would increaste the size of the file. */
++ if (fallocate (fd, FALLOC_FL_KEEP_SIZE, 0, 16 * 4096) != 0)
++ {
++ puts ("2nd fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("3rd fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 8 * 4096 + 128)
++ {
++ printf ("file size changed in 2nd fallocate call to %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
++ return 1;
++ }
++
++ /* Let's fill up the first eight 4k blocks with 'x' to force some allocations. */
++
++ memset(garbage, 'x', 4096);
++ for(c=0; c < 8; c++)
++ if(write(fd, garbage, 4096) == -1)
++ {
++ puts ("write failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("4th fstat failed");
++ return 1;
++ }
++
++ blksb4 = st.st_blocks;
++
++ /* Let's punch a hole in the entire file, turning it effectively into a sparse file. */
++ if (fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 8 * 4096 + 128) != 0)
++ {
++ puts ("3rd fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("5th fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 8 * 4096 + 128)
++ {
++ printf ("file size after 3rd fallocate call is %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
++ return 1;
++ }
++
++ /* The number of allocated blocks should decrease. I hope this works on
++ all filesystems! */
++ if (st.st_blocks >= blksb4)
++ {
++ printf ("number of blocks after 3rd fallocate call is %lu, expected less than %lu\n",
++ (unsigned long int) st.st_blocks, blksb4);
++ return 1;
++ }
++
++#ifdef TST_FALLOCATE64
++ /* We'll just do a mode = 0 test for fallocate64() */
++ if (fallocate64 (fd, 0, 4097ULL, 4294967295ULL + 2ULL) != 0)
++ {
++ puts ("1st fallocate64 call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("6th fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
++ {
++ printf ("file size after 1st fallocate64 call is %llu, expected %llu\n",
++ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
++ return 1;
++ }
++#endif
++ close (fd);
++
++ return 0;
++}
++
+--- /dev/null
++++ b/test/unistd/tst-fallocate64.c
+@@ -0,0 +1,2 @@
++#define TST_FALLOCATE64
++#include "tst-fallocate.c"
+--- a/test/unistd/Makefile.in
++++ b/test/unistd/Makefile.in
+@@ -2,10 +2,13 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ ifeq ($(UCLIBC_HAS_LFS),)
+-TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
++TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64 tst-fallocate64
+ endif
+ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
+-TESTS_DISABLED := tst-posix_fallocate
++TESTS_DISABLED := tst-posix_fallocate tst-fallocate64
++endif
++ifeq ($(UCLIBC_LINUX_SPECIFIC),)
++TESTS_DISABLED += tst-fallocate
+ endif
+ OPTS_getopt := -abcXXX -9
+ OPTS_getopt_long := --add XXX --delete YYY --verbose
diff --git a/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch b/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch
index 0bf89e89bb..390e06ddb7 100644
--- a/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch
+++ b/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch
@@ -1,6 +1,6 @@
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
-@@ -317,6 +317,7 @@
+@@ -317,6 +317,7 @@ Domain name in a message can be represen
#include <sys/utsname.h>
#include <sys/un.h>
#include <sys/stat.h>
@@ -8,7 +8,7 @@
#include <bits/uClibc_mutex.h>
#include "internal/parse_config.h"
-@@ -1861,7 +1862,6 @@
+@@ -1861,7 +1862,6 @@ int getnameinfo(const struct sockaddr *s
c = inet_ntop(AF_INET6,
(const void *) &sin6p->sin6_addr,
host, hostlen);
@@ -16,7 +16,7 @@
/* Does scope id need to be supported? */
uint32_t scopeid;
scopeid = sin6p->sin6_scope_id;
-@@ -1898,7 +1898,6 @@
+@@ -1898,7 +1898,6 @@ int getnameinfo(const struct sockaddr *s
return EAI_SYSTEM;
memcpy(host + real_hostlen, scopebuf, scopelen + 1);
}
diff --git a/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch b/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch
index 4c23141ea3..6732d54d3e 100644
--- a/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch
+++ b/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch
@@ -1,6 +1,6 @@
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
-@@ -3536,6 +3536,61 @@
+@@ -3536,6 +3536,61 @@ __res_vinit(res_state rp, int preinit)
return 0;
}
@@ -62,7 +62,7 @@
static void
__res_iclose(void)
{
-@@ -3608,61 +3663,6 @@
+@@ -3608,61 +3663,6 @@ struct __res_state *__resp = &_res;
# endif
#endif /* !__UCLIBC_HAS_THREADS__ */
diff --git a/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch b/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch
index e23b0839ad..06278898f9 100644
--- a/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch
+++ b/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch
@@ -24,7 +24,7 @@
return 0;
}
-@@ -3582,11 +3582,11 @@ res_init(void)
+@@ -3582,11 +3581,11 @@ res_init(void)
if (!_res.id)
_res.id = res_randomid();
@@ -38,7 +38,7 @@
return 0;
}
libc_hidden_def(res_init)
-@@ -3687,7 +3687,11 @@ struct __res_state *__resp = &_res;
+@@ -3687,7 +3686,11 @@ struct __res_state *__resp = &_res;
int
res_ninit(res_state statp)
{
@@ -51,5 +51,3 @@
}
#endif /* L_res_init */
---
-cgit v0.9.1
diff --git a/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch b/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch
index d40f28df38..ce8448ab49 100644
--- a/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch
+++ b/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch
@@ -8,5 +8,3 @@
__res_vinit(&_res, 1);
__res_sync = res_sync_func;
---
-cgit v0.9.1
diff --git a/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch b/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch
index b3db8cf5da..e85d6d4522 100644
--- a/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch
+++ b/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch
@@ -1,6 +1,6 @@
--- a/extra/locale/gen_wctype.c
+++ b/extra/locale/gen_wctype.c
-@@ -227,11 +227,12 @@
+@@ -227,11 +227,12 @@ int main(int argc, char **argv)
++verbose;
continue;
}
@@ -15,7 +15,7 @@
if (!(totitle = wctrans("totitle"))) {
verbose_msg("no totitle transformation.\n");
}
-@@ -306,43 +307,43 @@
+@@ -306,43 +307,43 @@ int main(int argc, char **argv)
#endif
#if 0
if (c < 256) {
@@ -88,7 +88,7 @@
mine = 0;
if (mywalnum(d,c)) ++mine; mine <<= 1;
-@@ -358,15 +359,15 @@
+@@ -358,15 +359,15 @@ int main(int argc, char **argv)
if (mywupper(d,c)) ++mine; mine <<= 1;
if (mywxdigit(d,c)) ++mine;
@@ -107,7 +107,7 @@
/* } */
}
#endif
-@@ -553,7 +554,7 @@
+@@ -553,7 +554,7 @@ int main(int argc, char **argv)
for (c = 0; c <= 0x10ffffUL; c++)
#endif
{
@@ -116,7 +116,7 @@
unsigned int mine;
unsigned int upper, lower;
-@@ -568,19 +569,19 @@
+@@ -568,19 +569,19 @@ int main(int argc, char **argv)
}
#endif
#endif
@@ -149,7 +149,7 @@
{
unsigned int u;
-@@ -630,8 +631,8 @@
+@@ -630,8 +631,8 @@ int main(int argc, char **argv)
if (mywupper(d,c)) ++mine; mine <<= 1;
if (mywxdigit(d,c)) ++mine;
@@ -160,7 +160,7 @@
if (c < 0x30000UL) {
verbose_msg("sc=%#x u=%#x n=%#x i0=%#x i1=%#x\n", sc, u, n, i0, i1);
}
-@@ -655,17 +656,17 @@
+@@ -655,17 +656,17 @@ int main(int argc, char **argv)
}
if (towupper(c) != upper) {
diff --git a/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch b/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
index f57b8af5af..0551290710 100644
--- a/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
+++ b/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
@@ -16,11 +16,9 @@ enabled.
Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
-diff --git a/Makefile.in b/Makefile.in
-index 3d3ba3d..da865db 100644
--- a/Makefile.in
+++ b/Makefile.in
-@@ -272,6 +272,7 @@ HEADERS_RM-$(UCLIBC_HAS_XATTR) += sys/xattr.h
+@@ -272,6 +272,7 @@ HEADERS_RM-$(UCLIBC_HAS_XATTR)
HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h
HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/eventfd.h sys/fsuid.h \
bits/inotify.h \
@@ -28,9 +26,6 @@ index 3d3ba3d..da865db 100644
sys/inotify.h \
sys/kdaemon.h \
sys/perm.h \
-diff --git a/libc/sysdeps/linux/alpha/bits/eventfd.h b/libc/sysdeps/linux/alpha/bits/eventfd.h
-new file mode 100644
-index 0000000..b5a7e41
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
@@ -0,0 +1,31 @@
@@ -65,9 +60,6 @@ index 0000000..b5a7e41
+ EFD_NONBLOCK = 000000004
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
-diff --git a/libc/sysdeps/linux/common/bits/eventfd.h b/libc/sysdeps/linux/common/bits/eventfd.h
-new file mode 100644
-index 0000000..ef49c61
--- /dev/null
+++ b/libc/sysdeps/linux/common/bits/eventfd.h
@@ -0,0 +1,31 @@
@@ -102,8 +94,6 @@ index 0000000..ef49c61
+ EFD_NONBLOCK = 00004000
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
-diff --git a/libc/sysdeps/linux/common/sys/eventfd.h b/libc/sysdeps/linux/common/sys/eventfd.h
-index c46c2a5..1bf785f 100644
--- a/libc/sysdeps/linux/common/sys/eventfd.h
+++ b/libc/sysdeps/linux/common/sys/eventfd.h
@@ -1,4 +1,4 @@
@@ -153,9 +143,6 @@ index c46c2a5..1bf785f 100644
__END_DECLS
#endif /* sys/eventfd.h */
-diff --git a/libc/sysdeps/linux/hppa/bits/eventfd.h b/libc/sysdeps/linux/hppa/bits/eventfd.h
-new file mode 100644
-index 0000000..6182c07
--- /dev/null
+++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
@@ -0,0 +1,32 @@
@@ -191,9 +178,6 @@ index 0000000..6182c07
+ EFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
-diff --git a/libc/sysdeps/linux/mips/bits/eventfd.h b/libc/sysdeps/linux/mips/bits/eventfd.h
-new file mode 100644
-index 0000000..17b2f46
--- /dev/null
+++ b/libc/sysdeps/linux/mips/bits/eventfd.h
@@ -0,0 +1,31 @@
@@ -228,9 +212,6 @@ index 0000000..17b2f46
+ EFD_NONBLOCK = 00000200
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
-diff --git a/libc/sysdeps/linux/sparc/bits/eventfd.h b/libc/sysdeps/linux/sparc/bits/eventfd.h
-new file mode 100644
-index 0000000..bed9f09
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
@@ -0,0 +1,31 @@
@@ -265,5 +246,3 @@ index 0000000..bed9f09
+ EFD_NONBLOCK = 0x004000
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
---
-cgit v0.9.1