Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/releng:master commit in: tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/, ...
Date: Wed, 05 Jun 2013 17:45:49
Message-Id: 1370454359.3748e4529759c0720443f8c4ff699d3154be994f.blueness@gentoo
1 commit: 3748e4529759c0720443f8c4ff699d3154be994f
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 5 17:45:59 2013 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 5 17:45:59 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/releng.git;a=commit;h=3748e452
7
8 tools-uclibc: bump uclibc to 0.9.33.2-r4 for {amd64,i686}-{hardened,vanilla}
9
10 ---
11 .../package.accept_keywords/uclibc | 1 +
12 .../sys-libs/uclibc/01_add-posix_fallocate.patch | 321 ---------------------
13 .../{uclibc-0.9.33.2-r3 => uclibc-0.9.33.2-r4} | 0
14 .../package.accept_keywords/uclibc | 1 +
15 .../sys-libs/uclibc/01_add-posix_fallocate.patch | 321 ---------------------
16 .../{uclibc-0.9.33.2-r3 => uclibc-0.9.33.2-r4} | 0
17 .../package.accept_keywords/uclibc | 1 +
18 .../sys-libs/uclibc/01_add-posix_fallocate.patch | 321 ---------------------
19 .../{uclibc-0.9.33.2-r3 => uclibc-0.9.33.2-r4} | 0
20 .../package.accept_keywords/uclibc | 1 +
21 .../sys-libs/uclibc/01_add-posix_fallocate.patch | 321 ---------------------
22 .../{uclibc-0.9.33.2-r3 => uclibc-0.9.33.2-r4} | 0
23 12 files changed, 4 insertions(+), 1284 deletions(-)
24
25 diff --git a/tools-uclibc/portage.amd64.hardened/package.accept_keywords/uclibc b/tools-uclibc/portage.amd64.hardened/package.accept_keywords/uclibc
26 new file mode 100644
27 index 0000000..2487e96
28 --- /dev/null
29 +++ b/tools-uclibc/portage.amd64.hardened/package.accept_keywords/uclibc
30 @@ -0,0 +1 @@
31 +=sys-libs/uclibc-0.9.33.2-r4 ~amd64
32
33 diff --git a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/01_add-posix_fallocate.patch b/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
34 deleted file mode 100644
35 index dc7bbd7..0000000
36 --- a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
37 +++ /dev/null
38 @@ -1,321 +0,0 @@
39 -From 5643900913f64c00f1c2958914586708efa5a473 Mon Sep 17 00:00:00 2001
40 -From: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
41 -Date: Tue, 17 Apr 2012 07:30:15 +0000
42 -Subject: libc: add posix_fallocate()
43 -
44 -Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
45 ----
46 -diff --git a/include/fcntl.h b/include/fcntl.h
47 -index ed009dd..c749ad5 100644
48 ---- a/include/fcntl.h
49 -+++ b/include/fcntl.h
50 -@@ -217,9 +217,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
51 -
52 - #endif
53 -
54 --#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
55 --
56 --/* FIXME -- uClibc should probably implement these... */
57 -+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
58 -
59 - /* Reserve storage for the data of the file associated with FD.
60 -
61 -diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
62 -index 566722d..29566dd 100644
63 ---- a/libc/sysdeps/linux/common/Makefile.in
64 -+++ b/libc/sysdeps/linux/common/Makefile.in
65 -@@ -82,7 +82,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
66 - sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
67 - sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
68 - # 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_
69 get_info|pthread_mutex_timedlock|sem_timedwait
70 --CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
71 -+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
72 -+ posix_fallocate.c posix_fallocate64.c
73 - CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
74 - CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
75 - CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
76 -diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
77 -index 4d1e0cb..6184c2b 100644
78 ---- a/libc/sysdeps/linux/common/bits/kernel-features.h
79 -+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
80 -@@ -495,6 +495,14 @@
81 - # define __ASSUME_PRIVATE_FUTEX 1
82 - #endif
83 -
84 -+/* Support for fallocate was added in 2.6.23,
85 -+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
86 -+#if __LINUX_KERNEL_VERSION >= 0x020617 \
87 -+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
88 -+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
89 -+# define __ASSUME_FALLOCATE 1
90 -+#endif
91 -+
92 - /* getcpu is a syscall for x86-64 since 3.1. */
93 - #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
94 - # define __ASSUME_GETCPU_SYSCALL 1
95 -diff --git a/libc/sysdeps/linux/common/posix_fallocate.c b/libc/sysdeps/linux/common/posix_fallocate.c
96 -new file mode 100644
97 -index 0000000..9aaa6ce
98 ---- /dev/null
99 -+++ b/libc/sysdeps/linux/common/posix_fallocate.c
100 -@@ -0,0 +1,43 @@
101 -+/* vi: set sw=4 ts=4: */
102 -+/*
103 -+ * posix_fallocate() for uClibc
104 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
105 -+ *
106 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
107 -+ *
108 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
109 -+ */
110 -+
111 -+#include <sys/syscall.h>
112 -+#include <fcntl.h>
113 -+#include <bits/kernel-features.h>
114 -+#include <stdint.h>
115 -+
116 -+#if defined __NR_fallocate
117 -+int posix_fallocate(int fd, __off_t offset, __off_t len)
118 -+{
119 -+ int ret;
120 -+
121 -+# if __WORDSIZE == 32
122 -+ uint32_t off_low = offset;
123 -+ uint32_t len_low = len;
124 -+ /* may assert that these >>31 are 0 */
125 -+ uint32_t zero = 0;
126 -+ INTERNAL_SYSCALL_DECL(err);
127 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
128 -+ __LONG_LONG_PAIR (zero, off_low),
129 -+ __LONG_LONG_PAIR (zero, len_low)));
130 -+# elif __WORDSIZE == 64
131 -+ INTERNAL_SYSCALL_DECL(err);
132 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
133 -+# else
134 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
135 -+#endif
136 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
137 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
138 -+ return 0;
139 -+}
140 -+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
141 -+strong_alias(posix_fallocate,posix_fallocate64)
142 -+# endif
143 -+#endif
144 -diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c
145 -new file mode 100644
146 -index 0000000..818d868
147 ---- /dev/null
148 -+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
149 -@@ -0,0 +1,39 @@
150 -+/* vi: set sw=4 ts=4: */
151 -+/*
152 -+ * posix_fallocate() for uClibc
153 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
154 -+ *
155 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
156 -+ *
157 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
158 -+ */
159 -+
160 -+#include <sys/syscall.h>
161 -+#include <fcntl.h>
162 -+#include <bits/kernel-features.h>
163 -+#include <stdint.h>
164 -+
165 -+#if defined __NR_fallocate
166 -+
167 -+# if __WORDSIZE == 64
168 -+/* Can use normal posix_fallocate() */
169 -+# elif __WORDSIZE == 32
170 -+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
171 -+{
172 -+ int ret;
173 -+ uint32_t off_low = offset & 0xffffffff;
174 -+ uint32_t off_high = offset >> 32;
175 -+ uint32_t len_low = len & 0xffffffff;
176 -+ uint32_t len_high = len >> 32;
177 -+ INTERNAL_SYSCALL_DECL(err);
178 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
179 -+ __LONG_LONG_PAIR (off_high, off_low),
180 -+ __LONG_LONG_PAIR (len_high, len_low)));
181 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
182 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
183 -+ return 0;
184 -+}
185 -+# else
186 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
187 -+# endif
188 -+#endif
189 -diff --git a/test/.gitignore b/test/.gitignore
190 -index c068f89..ec04628 100644
191 ---- a/test/.gitignore
192 -+++ b/test/.gitignore
193 -@@ -319,6 +319,8 @@ unistd/getcwd
194 - unistd/getopt
195 - unistd/getopt_long
196 - unistd/tstgetopt
197 -+unistd/tst-posix_fallocate
198 -+unistd/tst-posix_fallocate64
199 - unistd/tst-preadwrite
200 - unistd/tst-preadwrite64
201 - unistd/vfork
202 -diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
203 -index c542f98..24b9a37 100644
204 ---- a/test/unistd/Makefile.in
205 -+++ b/test/unistd/Makefile.in
206 -@@ -2,7 +2,10 @@
207 - # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
208 -
209 - ifeq ($(UCLIBC_HAS_LFS),)
210 --TESTS_DISABLED := tst-preadwrite64
211 -+TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
212 -+endif
213 -+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
214 -+TESTS_DISABLED := tst-posix_fallocate
215 - endif
216 - OPTS_getopt := -abcXXX -9
217 - OPTS_getopt_long := --add XXX --delete YYY --verbose
218 -diff --git a/test/unistd/tst-posix_fallocate.c b/test/unistd/tst-posix_fallocate.c
219 -new file mode 100644
220 -index 0000000..d41c604
221 ---- /dev/null
222 -+++ b/test/unistd/tst-posix_fallocate.c
223 -@@ -0,0 +1,127 @@
224 -+#include <fcntl.h>
225 -+#include <sys/stat.h>
226 -+
227 -+#ifndef TST_POSIX_FALLOCATE64
228 -+# define stat64 stat
229 -+# define fstat64 fstat
230 -+# else
231 -+# ifndef O_LARGEFILE
232 -+# error no O_LARGEFILE but you want to test with LFS enabled
233 -+# endif
234 -+#endif
235 -+
236 -+static void do_prepare (void);
237 -+#define PREPARE(argc, argv) do_prepare ()
238 -+static int do_test (void);
239 -+#define TEST_FUNCTION do_test ()
240 -+#include <test-skeleton.c>
241 -+
242 -+static int fd;
243 -+static void
244 -+do_prepare (void)
245 -+{
246 -+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
247 -+ if (fd == -1)
248 -+ {
249 -+ printf ("cannot create temporary file: %m\n");
250 -+ exit (1);
251 -+ }
252 -+}
253 -+
254 -+
255 -+static int
256 -+do_test (void)
257 -+{
258 -+ struct stat64 st;
259 -+
260 -+ if (fstat64 (fd, &st) != 0)
261 -+ {
262 -+ puts ("1st fstat failed");
263 -+ return 1;
264 -+ }
265 -+
266 -+ if (st.st_size != 0)
267 -+ {
268 -+ puts ("file not created with size 0");
269 -+ return 1;
270 -+ }
271 -+
272 -+ if (posix_fallocate (fd, 512, 768) != 0)
273 -+ {
274 -+ puts ("1st posix_fallocate call failed");
275 -+ return 1;
276 -+ }
277 -+
278 -+ if (fstat64 (fd, &st) != 0)
279 -+ {
280 -+ puts ("2nd fstat failed");
281 -+ return 1;
282 -+ }
283 -+
284 -+ if (st.st_size != 512 + 768)
285 -+ {
286 -+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
287 -+ (unsigned long long int) st.st_size, 512u + 768u);
288 -+ return 1;
289 -+ }
290 -+
291 -+ if (posix_fallocate (fd, 0, 1024) != 0)
292 -+ {
293 -+ puts ("2nd posix_fallocate call failed");
294 -+ return 1;
295 -+ }
296 -+
297 -+ if (fstat64 (fd, &st) != 0)
298 -+ {
299 -+ puts ("3rd fstat failed");
300 -+ return 1;
301 -+ }
302 -+
303 -+ if (st.st_size != 512 + 768)
304 -+ {
305 -+ puts ("file size changed in 2nd posix_fallocate");
306 -+ return 1;
307 -+ }
308 -+
309 -+ if (posix_fallocate (fd, 2048, 64) != 0)
310 -+ {
311 -+ puts ("3rd posix_fallocate call failed");
312 -+ return 1;
313 -+ }
314 -+
315 -+ if (fstat64 (fd, &st) != 0)
316 -+ {
317 -+ puts ("4th fstat failed");
318 -+ return 1;
319 -+ }
320 -+
321 -+ if (st.st_size != 2048 + 64)
322 -+ {
323 -+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
324 -+ (unsigned long long int) st.st_size, 2048u + 64u);
325 -+ return 1;
326 -+ }
327 -+#ifdef TST_POSIX_FALLOCATE64
328 -+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
329 -+ {
330 -+ puts ("4th posix_fallocate call failed");
331 -+ return 1;
332 -+ }
333 -+
334 -+ if (fstat64 (fd, &st) != 0)
335 -+ {
336 -+ puts ("5th fstat failed");
337 -+ return 1;
338 -+ }
339 -+
340 -+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
341 -+ {
342 -+ printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n",
343 -+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
344 -+ return 1;
345 -+ }
346 -+#endif
347 -+ close (fd);
348 -+
349 -+ return 0;
350 -+}
351 -diff --git a/test/unistd/tst-posix_fallocate64.c b/test/unistd/tst-posix_fallocate64.c
352 -new file mode 100644
353 -index 0000000..b1ee0ff
354 ---- /dev/null
355 -+++ b/test/unistd/tst-posix_fallocate64.c
356 -@@ -0,0 +1,2 @@
357 -+#define TST_POSIX_FALLOCATE64
358 -+#include "tst-posix_fallocate.c"
359 ---
360 -cgit v0.9.1
361
362 diff --git a/tools-uclibc/portage.amd64.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r3 b/tools-uclibc/portage.amd64.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r4
363 similarity index 100%
364 rename from tools-uclibc/portage.amd64.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r3
365 rename to tools-uclibc/portage.amd64.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r4
366
367 diff --git a/tools-uclibc/portage.amd64.vanilla/package.accept_keywords/uclibc b/tools-uclibc/portage.amd64.vanilla/package.accept_keywords/uclibc
368 new file mode 100644
369 index 0000000..2487e96
370 --- /dev/null
371 +++ b/tools-uclibc/portage.amd64.vanilla/package.accept_keywords/uclibc
372 @@ -0,0 +1 @@
373 +=sys-libs/uclibc-0.9.33.2-r4 ~amd64
374
375 diff --git a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/01_add-posix_fallocate.patch b/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
376 deleted file mode 100644
377 index dc7bbd7..0000000
378 --- a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
379 +++ /dev/null
380 @@ -1,321 +0,0 @@
381 -From 5643900913f64c00f1c2958914586708efa5a473 Mon Sep 17 00:00:00 2001
382 -From: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
383 -Date: Tue, 17 Apr 2012 07:30:15 +0000
384 -Subject: libc: add posix_fallocate()
385 -
386 -Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
387 ----
388 -diff --git a/include/fcntl.h b/include/fcntl.h
389 -index ed009dd..c749ad5 100644
390 ---- a/include/fcntl.h
391 -+++ b/include/fcntl.h
392 -@@ -217,9 +217,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
393 -
394 - #endif
395 -
396 --#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
397 --
398 --/* FIXME -- uClibc should probably implement these... */
399 -+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
400 -
401 - /* Reserve storage for the data of the file associated with FD.
402 -
403 -diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
404 -index 566722d..29566dd 100644
405 ---- a/libc/sysdeps/linux/common/Makefile.in
406 -+++ b/libc/sysdeps/linux/common/Makefile.in
407 -@@ -82,7 +82,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
408 - sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
409 - sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
410 - # 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_
411 get_info|pthread_mutex_timedlock|sem_timedwait
412 --CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
413 -+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
414 -+ posix_fallocate.c posix_fallocate64.c
415 - CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
416 - CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
417 - CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
418 -diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
419 -index 4d1e0cb..6184c2b 100644
420 ---- a/libc/sysdeps/linux/common/bits/kernel-features.h
421 -+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
422 -@@ -495,6 +495,14 @@
423 - # define __ASSUME_PRIVATE_FUTEX 1
424 - #endif
425 -
426 -+/* Support for fallocate was added in 2.6.23,
427 -+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
428 -+#if __LINUX_KERNEL_VERSION >= 0x020617 \
429 -+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
430 -+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
431 -+# define __ASSUME_FALLOCATE 1
432 -+#endif
433 -+
434 - /* getcpu is a syscall for x86-64 since 3.1. */
435 - #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
436 - # define __ASSUME_GETCPU_SYSCALL 1
437 -diff --git a/libc/sysdeps/linux/common/posix_fallocate.c b/libc/sysdeps/linux/common/posix_fallocate.c
438 -new file mode 100644
439 -index 0000000..9aaa6ce
440 ---- /dev/null
441 -+++ b/libc/sysdeps/linux/common/posix_fallocate.c
442 -@@ -0,0 +1,43 @@
443 -+/* vi: set sw=4 ts=4: */
444 -+/*
445 -+ * posix_fallocate() for uClibc
446 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
447 -+ *
448 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
449 -+ *
450 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
451 -+ */
452 -+
453 -+#include <sys/syscall.h>
454 -+#include <fcntl.h>
455 -+#include <bits/kernel-features.h>
456 -+#include <stdint.h>
457 -+
458 -+#if defined __NR_fallocate
459 -+int posix_fallocate(int fd, __off_t offset, __off_t len)
460 -+{
461 -+ int ret;
462 -+
463 -+# if __WORDSIZE == 32
464 -+ uint32_t off_low = offset;
465 -+ uint32_t len_low = len;
466 -+ /* may assert that these >>31 are 0 */
467 -+ uint32_t zero = 0;
468 -+ INTERNAL_SYSCALL_DECL(err);
469 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
470 -+ __LONG_LONG_PAIR (zero, off_low),
471 -+ __LONG_LONG_PAIR (zero, len_low)));
472 -+# elif __WORDSIZE == 64
473 -+ INTERNAL_SYSCALL_DECL(err);
474 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
475 -+# else
476 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
477 -+#endif
478 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
479 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
480 -+ return 0;
481 -+}
482 -+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
483 -+strong_alias(posix_fallocate,posix_fallocate64)
484 -+# endif
485 -+#endif
486 -diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c
487 -new file mode 100644
488 -index 0000000..818d868
489 ---- /dev/null
490 -+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
491 -@@ -0,0 +1,39 @@
492 -+/* vi: set sw=4 ts=4: */
493 -+/*
494 -+ * posix_fallocate() for uClibc
495 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
496 -+ *
497 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
498 -+ *
499 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
500 -+ */
501 -+
502 -+#include <sys/syscall.h>
503 -+#include <fcntl.h>
504 -+#include <bits/kernel-features.h>
505 -+#include <stdint.h>
506 -+
507 -+#if defined __NR_fallocate
508 -+
509 -+# if __WORDSIZE == 64
510 -+/* Can use normal posix_fallocate() */
511 -+# elif __WORDSIZE == 32
512 -+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
513 -+{
514 -+ int ret;
515 -+ uint32_t off_low = offset & 0xffffffff;
516 -+ uint32_t off_high = offset >> 32;
517 -+ uint32_t len_low = len & 0xffffffff;
518 -+ uint32_t len_high = len >> 32;
519 -+ INTERNAL_SYSCALL_DECL(err);
520 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
521 -+ __LONG_LONG_PAIR (off_high, off_low),
522 -+ __LONG_LONG_PAIR (len_high, len_low)));
523 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
524 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
525 -+ return 0;
526 -+}
527 -+# else
528 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
529 -+# endif
530 -+#endif
531 -diff --git a/test/.gitignore b/test/.gitignore
532 -index c068f89..ec04628 100644
533 ---- a/test/.gitignore
534 -+++ b/test/.gitignore
535 -@@ -319,6 +319,8 @@ unistd/getcwd
536 - unistd/getopt
537 - unistd/getopt_long
538 - unistd/tstgetopt
539 -+unistd/tst-posix_fallocate
540 -+unistd/tst-posix_fallocate64
541 - unistd/tst-preadwrite
542 - unistd/tst-preadwrite64
543 - unistd/vfork
544 -diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
545 -index c542f98..24b9a37 100644
546 ---- a/test/unistd/Makefile.in
547 -+++ b/test/unistd/Makefile.in
548 -@@ -2,7 +2,10 @@
549 - # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
550 -
551 - ifeq ($(UCLIBC_HAS_LFS),)
552 --TESTS_DISABLED := tst-preadwrite64
553 -+TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
554 -+endif
555 -+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
556 -+TESTS_DISABLED := tst-posix_fallocate
557 - endif
558 - OPTS_getopt := -abcXXX -9
559 - OPTS_getopt_long := --add XXX --delete YYY --verbose
560 -diff --git a/test/unistd/tst-posix_fallocate.c b/test/unistd/tst-posix_fallocate.c
561 -new file mode 100644
562 -index 0000000..d41c604
563 ---- /dev/null
564 -+++ b/test/unistd/tst-posix_fallocate.c
565 -@@ -0,0 +1,127 @@
566 -+#include <fcntl.h>
567 -+#include <sys/stat.h>
568 -+
569 -+#ifndef TST_POSIX_FALLOCATE64
570 -+# define stat64 stat
571 -+# define fstat64 fstat
572 -+# else
573 -+# ifndef O_LARGEFILE
574 -+# error no O_LARGEFILE but you want to test with LFS enabled
575 -+# endif
576 -+#endif
577 -+
578 -+static void do_prepare (void);
579 -+#define PREPARE(argc, argv) do_prepare ()
580 -+static int do_test (void);
581 -+#define TEST_FUNCTION do_test ()
582 -+#include <test-skeleton.c>
583 -+
584 -+static int fd;
585 -+static void
586 -+do_prepare (void)
587 -+{
588 -+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
589 -+ if (fd == -1)
590 -+ {
591 -+ printf ("cannot create temporary file: %m\n");
592 -+ exit (1);
593 -+ }
594 -+}
595 -+
596 -+
597 -+static int
598 -+do_test (void)
599 -+{
600 -+ struct stat64 st;
601 -+
602 -+ if (fstat64 (fd, &st) != 0)
603 -+ {
604 -+ puts ("1st fstat failed");
605 -+ return 1;
606 -+ }
607 -+
608 -+ if (st.st_size != 0)
609 -+ {
610 -+ puts ("file not created with size 0");
611 -+ return 1;
612 -+ }
613 -+
614 -+ if (posix_fallocate (fd, 512, 768) != 0)
615 -+ {
616 -+ puts ("1st posix_fallocate call failed");
617 -+ return 1;
618 -+ }
619 -+
620 -+ if (fstat64 (fd, &st) != 0)
621 -+ {
622 -+ puts ("2nd fstat failed");
623 -+ return 1;
624 -+ }
625 -+
626 -+ if (st.st_size != 512 + 768)
627 -+ {
628 -+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
629 -+ (unsigned long long int) st.st_size, 512u + 768u);
630 -+ return 1;
631 -+ }
632 -+
633 -+ if (posix_fallocate (fd, 0, 1024) != 0)
634 -+ {
635 -+ puts ("2nd posix_fallocate call failed");
636 -+ return 1;
637 -+ }
638 -+
639 -+ if (fstat64 (fd, &st) != 0)
640 -+ {
641 -+ puts ("3rd fstat failed");
642 -+ return 1;
643 -+ }
644 -+
645 -+ if (st.st_size != 512 + 768)
646 -+ {
647 -+ puts ("file size changed in 2nd posix_fallocate");
648 -+ return 1;
649 -+ }
650 -+
651 -+ if (posix_fallocate (fd, 2048, 64) != 0)
652 -+ {
653 -+ puts ("3rd posix_fallocate call failed");
654 -+ return 1;
655 -+ }
656 -+
657 -+ if (fstat64 (fd, &st) != 0)
658 -+ {
659 -+ puts ("4th fstat failed");
660 -+ return 1;
661 -+ }
662 -+
663 -+ if (st.st_size != 2048 + 64)
664 -+ {
665 -+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
666 -+ (unsigned long long int) st.st_size, 2048u + 64u);
667 -+ return 1;
668 -+ }
669 -+#ifdef TST_POSIX_FALLOCATE64
670 -+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
671 -+ {
672 -+ puts ("4th posix_fallocate call failed");
673 -+ return 1;
674 -+ }
675 -+
676 -+ if (fstat64 (fd, &st) != 0)
677 -+ {
678 -+ puts ("5th fstat failed");
679 -+ return 1;
680 -+ }
681 -+
682 -+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
683 -+ {
684 -+ printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n",
685 -+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
686 -+ return 1;
687 -+ }
688 -+#endif
689 -+ close (fd);
690 -+
691 -+ return 0;
692 -+}
693 -diff --git a/test/unistd/tst-posix_fallocate64.c b/test/unistd/tst-posix_fallocate64.c
694 -new file mode 100644
695 -index 0000000..b1ee0ff
696 ---- /dev/null
697 -+++ b/test/unistd/tst-posix_fallocate64.c
698 -@@ -0,0 +1,2 @@
699 -+#define TST_POSIX_FALLOCATE64
700 -+#include "tst-posix_fallocate.c"
701 ---
702 -cgit v0.9.1
703
704 diff --git a/tools-uclibc/portage.amd64.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r3 b/tools-uclibc/portage.amd64.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r4
705 similarity index 100%
706 rename from tools-uclibc/portage.amd64.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r3
707 rename to tools-uclibc/portage.amd64.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r4
708
709 diff --git a/tools-uclibc/portage.i686.hardened/package.accept_keywords/uclibc b/tools-uclibc/portage.i686.hardened/package.accept_keywords/uclibc
710 new file mode 100644
711 index 0000000..c209898
712 --- /dev/null
713 +++ b/tools-uclibc/portage.i686.hardened/package.accept_keywords/uclibc
714 @@ -0,0 +1 @@
715 +=sys-libs/uclibc-0.9.33.2-r4 ~x86
716
717 diff --git a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/01_add-posix_fallocate.patch b/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
718 deleted file mode 100644
719 index dc7bbd7..0000000
720 --- a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
721 +++ /dev/null
722 @@ -1,321 +0,0 @@
723 -From 5643900913f64c00f1c2958914586708efa5a473 Mon Sep 17 00:00:00 2001
724 -From: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
725 -Date: Tue, 17 Apr 2012 07:30:15 +0000
726 -Subject: libc: add posix_fallocate()
727 -
728 -Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
729 ----
730 -diff --git a/include/fcntl.h b/include/fcntl.h
731 -index ed009dd..c749ad5 100644
732 ---- a/include/fcntl.h
733 -+++ b/include/fcntl.h
734 -@@ -217,9 +217,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
735 -
736 - #endif
737 -
738 --#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
739 --
740 --/* FIXME -- uClibc should probably implement these... */
741 -+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
742 -
743 - /* Reserve storage for the data of the file associated with FD.
744 -
745 -diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
746 -index 566722d..29566dd 100644
747 ---- a/libc/sysdeps/linux/common/Makefile.in
748 -+++ b/libc/sysdeps/linux/common/Makefile.in
749 -@@ -82,7 +82,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
750 - sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
751 - sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
752 - # 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_
753 get_info|pthread_mutex_timedlock|sem_timedwait
754 --CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
755 -+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
756 -+ posix_fallocate.c posix_fallocate64.c
757 - CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
758 - CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
759 - CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
760 -diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
761 -index 4d1e0cb..6184c2b 100644
762 ---- a/libc/sysdeps/linux/common/bits/kernel-features.h
763 -+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
764 -@@ -495,6 +495,14 @@
765 - # define __ASSUME_PRIVATE_FUTEX 1
766 - #endif
767 -
768 -+/* Support for fallocate was added in 2.6.23,
769 -+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
770 -+#if __LINUX_KERNEL_VERSION >= 0x020617 \
771 -+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
772 -+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
773 -+# define __ASSUME_FALLOCATE 1
774 -+#endif
775 -+
776 - /* getcpu is a syscall for x86-64 since 3.1. */
777 - #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
778 - # define __ASSUME_GETCPU_SYSCALL 1
779 -diff --git a/libc/sysdeps/linux/common/posix_fallocate.c b/libc/sysdeps/linux/common/posix_fallocate.c
780 -new file mode 100644
781 -index 0000000..9aaa6ce
782 ---- /dev/null
783 -+++ b/libc/sysdeps/linux/common/posix_fallocate.c
784 -@@ -0,0 +1,43 @@
785 -+/* vi: set sw=4 ts=4: */
786 -+/*
787 -+ * posix_fallocate() for uClibc
788 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
789 -+ *
790 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
791 -+ *
792 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
793 -+ */
794 -+
795 -+#include <sys/syscall.h>
796 -+#include <fcntl.h>
797 -+#include <bits/kernel-features.h>
798 -+#include <stdint.h>
799 -+
800 -+#if defined __NR_fallocate
801 -+int posix_fallocate(int fd, __off_t offset, __off_t len)
802 -+{
803 -+ int ret;
804 -+
805 -+# if __WORDSIZE == 32
806 -+ uint32_t off_low = offset;
807 -+ uint32_t len_low = len;
808 -+ /* may assert that these >>31 are 0 */
809 -+ uint32_t zero = 0;
810 -+ INTERNAL_SYSCALL_DECL(err);
811 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
812 -+ __LONG_LONG_PAIR (zero, off_low),
813 -+ __LONG_LONG_PAIR (zero, len_low)));
814 -+# elif __WORDSIZE == 64
815 -+ INTERNAL_SYSCALL_DECL(err);
816 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
817 -+# else
818 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
819 -+#endif
820 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
821 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
822 -+ return 0;
823 -+}
824 -+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
825 -+strong_alias(posix_fallocate,posix_fallocate64)
826 -+# endif
827 -+#endif
828 -diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c
829 -new file mode 100644
830 -index 0000000..818d868
831 ---- /dev/null
832 -+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
833 -@@ -0,0 +1,39 @@
834 -+/* vi: set sw=4 ts=4: */
835 -+/*
836 -+ * posix_fallocate() for uClibc
837 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
838 -+ *
839 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
840 -+ *
841 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
842 -+ */
843 -+
844 -+#include <sys/syscall.h>
845 -+#include <fcntl.h>
846 -+#include <bits/kernel-features.h>
847 -+#include <stdint.h>
848 -+
849 -+#if defined __NR_fallocate
850 -+
851 -+# if __WORDSIZE == 64
852 -+/* Can use normal posix_fallocate() */
853 -+# elif __WORDSIZE == 32
854 -+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
855 -+{
856 -+ int ret;
857 -+ uint32_t off_low = offset & 0xffffffff;
858 -+ uint32_t off_high = offset >> 32;
859 -+ uint32_t len_low = len & 0xffffffff;
860 -+ uint32_t len_high = len >> 32;
861 -+ INTERNAL_SYSCALL_DECL(err);
862 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
863 -+ __LONG_LONG_PAIR (off_high, off_low),
864 -+ __LONG_LONG_PAIR (len_high, len_low)));
865 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
866 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
867 -+ return 0;
868 -+}
869 -+# else
870 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
871 -+# endif
872 -+#endif
873 -diff --git a/test/.gitignore b/test/.gitignore
874 -index c068f89..ec04628 100644
875 ---- a/test/.gitignore
876 -+++ b/test/.gitignore
877 -@@ -319,6 +319,8 @@ unistd/getcwd
878 - unistd/getopt
879 - unistd/getopt_long
880 - unistd/tstgetopt
881 -+unistd/tst-posix_fallocate
882 -+unistd/tst-posix_fallocate64
883 - unistd/tst-preadwrite
884 - unistd/tst-preadwrite64
885 - unistd/vfork
886 -diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
887 -index c542f98..24b9a37 100644
888 ---- a/test/unistd/Makefile.in
889 -+++ b/test/unistd/Makefile.in
890 -@@ -2,7 +2,10 @@
891 - # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
892 -
893 - ifeq ($(UCLIBC_HAS_LFS),)
894 --TESTS_DISABLED := tst-preadwrite64
895 -+TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
896 -+endif
897 -+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
898 -+TESTS_DISABLED := tst-posix_fallocate
899 - endif
900 - OPTS_getopt := -abcXXX -9
901 - OPTS_getopt_long := --add XXX --delete YYY --verbose
902 -diff --git a/test/unistd/tst-posix_fallocate.c b/test/unistd/tst-posix_fallocate.c
903 -new file mode 100644
904 -index 0000000..d41c604
905 ---- /dev/null
906 -+++ b/test/unistd/tst-posix_fallocate.c
907 -@@ -0,0 +1,127 @@
908 -+#include <fcntl.h>
909 -+#include <sys/stat.h>
910 -+
911 -+#ifndef TST_POSIX_FALLOCATE64
912 -+# define stat64 stat
913 -+# define fstat64 fstat
914 -+# else
915 -+# ifndef O_LARGEFILE
916 -+# error no O_LARGEFILE but you want to test with LFS enabled
917 -+# endif
918 -+#endif
919 -+
920 -+static void do_prepare (void);
921 -+#define PREPARE(argc, argv) do_prepare ()
922 -+static int do_test (void);
923 -+#define TEST_FUNCTION do_test ()
924 -+#include <test-skeleton.c>
925 -+
926 -+static int fd;
927 -+static void
928 -+do_prepare (void)
929 -+{
930 -+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
931 -+ if (fd == -1)
932 -+ {
933 -+ printf ("cannot create temporary file: %m\n");
934 -+ exit (1);
935 -+ }
936 -+}
937 -+
938 -+
939 -+static int
940 -+do_test (void)
941 -+{
942 -+ struct stat64 st;
943 -+
944 -+ if (fstat64 (fd, &st) != 0)
945 -+ {
946 -+ puts ("1st fstat failed");
947 -+ return 1;
948 -+ }
949 -+
950 -+ if (st.st_size != 0)
951 -+ {
952 -+ puts ("file not created with size 0");
953 -+ return 1;
954 -+ }
955 -+
956 -+ if (posix_fallocate (fd, 512, 768) != 0)
957 -+ {
958 -+ puts ("1st posix_fallocate call failed");
959 -+ return 1;
960 -+ }
961 -+
962 -+ if (fstat64 (fd, &st) != 0)
963 -+ {
964 -+ puts ("2nd fstat failed");
965 -+ return 1;
966 -+ }
967 -+
968 -+ if (st.st_size != 512 + 768)
969 -+ {
970 -+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
971 -+ (unsigned long long int) st.st_size, 512u + 768u);
972 -+ return 1;
973 -+ }
974 -+
975 -+ if (posix_fallocate (fd, 0, 1024) != 0)
976 -+ {
977 -+ puts ("2nd posix_fallocate call failed");
978 -+ return 1;
979 -+ }
980 -+
981 -+ if (fstat64 (fd, &st) != 0)
982 -+ {
983 -+ puts ("3rd fstat failed");
984 -+ return 1;
985 -+ }
986 -+
987 -+ if (st.st_size != 512 + 768)
988 -+ {
989 -+ puts ("file size changed in 2nd posix_fallocate");
990 -+ return 1;
991 -+ }
992 -+
993 -+ if (posix_fallocate (fd, 2048, 64) != 0)
994 -+ {
995 -+ puts ("3rd posix_fallocate call failed");
996 -+ return 1;
997 -+ }
998 -+
999 -+ if (fstat64 (fd, &st) != 0)
1000 -+ {
1001 -+ puts ("4th fstat failed");
1002 -+ return 1;
1003 -+ }
1004 -+
1005 -+ if (st.st_size != 2048 + 64)
1006 -+ {
1007 -+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
1008 -+ (unsigned long long int) st.st_size, 2048u + 64u);
1009 -+ return 1;
1010 -+ }
1011 -+#ifdef TST_POSIX_FALLOCATE64
1012 -+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
1013 -+ {
1014 -+ puts ("4th posix_fallocate call failed");
1015 -+ return 1;
1016 -+ }
1017 -+
1018 -+ if (fstat64 (fd, &st) != 0)
1019 -+ {
1020 -+ puts ("5th fstat failed");
1021 -+ return 1;
1022 -+ }
1023 -+
1024 -+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
1025 -+ {
1026 -+ printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n",
1027 -+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
1028 -+ return 1;
1029 -+ }
1030 -+#endif
1031 -+ close (fd);
1032 -+
1033 -+ return 0;
1034 -+}
1035 -diff --git a/test/unistd/tst-posix_fallocate64.c b/test/unistd/tst-posix_fallocate64.c
1036 -new file mode 100644
1037 -index 0000000..b1ee0ff
1038 ---- /dev/null
1039 -+++ b/test/unistd/tst-posix_fallocate64.c
1040 -@@ -0,0 +1,2 @@
1041 -+#define TST_POSIX_FALLOCATE64
1042 -+#include "tst-posix_fallocate.c"
1043 ---
1044 -cgit v0.9.1
1045
1046 diff --git a/tools-uclibc/portage.i686.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r3 b/tools-uclibc/portage.i686.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r4
1047 similarity index 100%
1048 rename from tools-uclibc/portage.i686.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r3
1049 rename to tools-uclibc/portage.i686.hardened/savedconfig/sys-libs/uclibc-0.9.33.2-r4
1050
1051 diff --git a/tools-uclibc/portage.i686.vanilla/package.accept_keywords/uclibc b/tools-uclibc/portage.i686.vanilla/package.accept_keywords/uclibc
1052 new file mode 100644
1053 index 0000000..c209898
1054 --- /dev/null
1055 +++ b/tools-uclibc/portage.i686.vanilla/package.accept_keywords/uclibc
1056 @@ -0,0 +1 @@
1057 +=sys-libs/uclibc-0.9.33.2-r4 ~x86
1058
1059 diff --git a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/01_add-posix_fallocate.patch b/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
1060 deleted file mode 100644
1061 index dc7bbd7..0000000
1062 --- a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/01_add-posix_fallocate.patch
1063 +++ /dev/null
1064 @@ -1,321 +0,0 @@
1065 -From 5643900913f64c00f1c2958914586708efa5a473 Mon Sep 17 00:00:00 2001
1066 -From: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
1067 -Date: Tue, 17 Apr 2012 07:30:15 +0000
1068 -Subject: libc: add posix_fallocate()
1069 -
1070 -Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com>
1071 ----
1072 -diff --git a/include/fcntl.h b/include/fcntl.h
1073 -index ed009dd..c749ad5 100644
1074 ---- a/include/fcntl.h
1075 -+++ b/include/fcntl.h
1076 -@@ -217,9 +217,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
1077 -
1078 - #endif
1079 -
1080 --#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
1081 --
1082 --/* FIXME -- uClibc should probably implement these... */
1083 -+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
1084 -
1085 - /* Reserve storage for the data of the file associated with FD.
1086 -
1087 -diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
1088 -index 566722d..29566dd 100644
1089 ---- a/libc/sysdeps/linux/common/Makefile.in
1090 -+++ b/libc/sysdeps/linux/common/Makefile.in
1091 -@@ -82,7 +82,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
1092 - sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
1093 - sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
1094 - # 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_
1095 get_info|pthread_mutex_timedlock|sem_timedwait
1096 --CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
1097 -+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
1098 -+ posix_fallocate.c posix_fallocate64.c
1099 - CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
1100 - CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
1101 - CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
1102 -diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
1103 -index 4d1e0cb..6184c2b 100644
1104 ---- a/libc/sysdeps/linux/common/bits/kernel-features.h
1105 -+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
1106 -@@ -495,6 +495,14 @@
1107 - # define __ASSUME_PRIVATE_FUTEX 1
1108 - #endif
1109 -
1110 -+/* Support for fallocate was added in 2.6.23,
1111 -+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
1112 -+#if __LINUX_KERNEL_VERSION >= 0x020617 \
1113 -+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
1114 -+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
1115 -+# define __ASSUME_FALLOCATE 1
1116 -+#endif
1117 -+
1118 - /* getcpu is a syscall for x86-64 since 3.1. */
1119 - #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
1120 - # define __ASSUME_GETCPU_SYSCALL 1
1121 -diff --git a/libc/sysdeps/linux/common/posix_fallocate.c b/libc/sysdeps/linux/common/posix_fallocate.c
1122 -new file mode 100644
1123 -index 0000000..9aaa6ce
1124 ---- /dev/null
1125 -+++ b/libc/sysdeps/linux/common/posix_fallocate.c
1126 -@@ -0,0 +1,43 @@
1127 -+/* vi: set sw=4 ts=4: */
1128 -+/*
1129 -+ * posix_fallocate() for uClibc
1130 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
1131 -+ *
1132 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
1133 -+ *
1134 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
1135 -+ */
1136 -+
1137 -+#include <sys/syscall.h>
1138 -+#include <fcntl.h>
1139 -+#include <bits/kernel-features.h>
1140 -+#include <stdint.h>
1141 -+
1142 -+#if defined __NR_fallocate
1143 -+int posix_fallocate(int fd, __off_t offset, __off_t len)
1144 -+{
1145 -+ int ret;
1146 -+
1147 -+# if __WORDSIZE == 32
1148 -+ uint32_t off_low = offset;
1149 -+ uint32_t len_low = len;
1150 -+ /* may assert that these >>31 are 0 */
1151 -+ uint32_t zero = 0;
1152 -+ INTERNAL_SYSCALL_DECL(err);
1153 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
1154 -+ __LONG_LONG_PAIR (zero, off_low),
1155 -+ __LONG_LONG_PAIR (zero, len_low)));
1156 -+# elif __WORDSIZE == 64
1157 -+ INTERNAL_SYSCALL_DECL(err);
1158 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
1159 -+# else
1160 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
1161 -+#endif
1162 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
1163 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
1164 -+ return 0;
1165 -+}
1166 -+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
1167 -+strong_alias(posix_fallocate,posix_fallocate64)
1168 -+# endif
1169 -+#endif
1170 -diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c
1171 -new file mode 100644
1172 -index 0000000..818d868
1173 ---- /dev/null
1174 -+++ b/libc/sysdeps/linux/common/posix_fallocate64.c
1175 -@@ -0,0 +1,39 @@
1176 -+/* vi: set sw=4 ts=4: */
1177 -+/*
1178 -+ * posix_fallocate() for uClibc
1179 -+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
1180 -+ *
1181 -+ * Copyright (C) 2000-2006 Erik Andersen <andersen@××××××.org>
1182 -+ *
1183 -+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
1184 -+ */
1185 -+
1186 -+#include <sys/syscall.h>
1187 -+#include <fcntl.h>
1188 -+#include <bits/kernel-features.h>
1189 -+#include <stdint.h>
1190 -+
1191 -+#if defined __NR_fallocate
1192 -+
1193 -+# if __WORDSIZE == 64
1194 -+/* Can use normal posix_fallocate() */
1195 -+# elif __WORDSIZE == 32
1196 -+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
1197 -+{
1198 -+ int ret;
1199 -+ uint32_t off_low = offset & 0xffffffff;
1200 -+ uint32_t off_high = offset >> 32;
1201 -+ uint32_t len_low = len & 0xffffffff;
1202 -+ uint32_t len_high = len >> 32;
1203 -+ INTERNAL_SYSCALL_DECL(err);
1204 -+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
1205 -+ __LONG_LONG_PAIR (off_high, off_low),
1206 -+ __LONG_LONG_PAIR (len_high, len_low)));
1207 -+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
1208 -+ return INTERNAL_SYSCALL_ERRNO (ret, err);
1209 -+ return 0;
1210 -+}
1211 -+# else
1212 -+# error your machine is neither 32 bit or 64 bit ... it must be magical
1213 -+# endif
1214 -+#endif
1215 -diff --git a/test/.gitignore b/test/.gitignore
1216 -index c068f89..ec04628 100644
1217 ---- a/test/.gitignore
1218 -+++ b/test/.gitignore
1219 -@@ -319,6 +319,8 @@ unistd/getcwd
1220 - unistd/getopt
1221 - unistd/getopt_long
1222 - unistd/tstgetopt
1223 -+unistd/tst-posix_fallocate
1224 -+unistd/tst-posix_fallocate64
1225 - unistd/tst-preadwrite
1226 - unistd/tst-preadwrite64
1227 - unistd/vfork
1228 -diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
1229 -index c542f98..24b9a37 100644
1230 ---- a/test/unistd/Makefile.in
1231 -+++ b/test/unistd/Makefile.in
1232 -@@ -2,7 +2,10 @@
1233 - # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
1234 -
1235 - ifeq ($(UCLIBC_HAS_LFS),)
1236 --TESTS_DISABLED := tst-preadwrite64
1237 -+TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
1238 -+endif
1239 -+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
1240 -+TESTS_DISABLED := tst-posix_fallocate
1241 - endif
1242 - OPTS_getopt := -abcXXX -9
1243 - OPTS_getopt_long := --add XXX --delete YYY --verbose
1244 -diff --git a/test/unistd/tst-posix_fallocate.c b/test/unistd/tst-posix_fallocate.c
1245 -new file mode 100644
1246 -index 0000000..d41c604
1247 ---- /dev/null
1248 -+++ b/test/unistd/tst-posix_fallocate.c
1249 -@@ -0,0 +1,127 @@
1250 -+#include <fcntl.h>
1251 -+#include <sys/stat.h>
1252 -+
1253 -+#ifndef TST_POSIX_FALLOCATE64
1254 -+# define stat64 stat
1255 -+# define fstat64 fstat
1256 -+# else
1257 -+# ifndef O_LARGEFILE
1258 -+# error no O_LARGEFILE but you want to test with LFS enabled
1259 -+# endif
1260 -+#endif
1261 -+
1262 -+static void do_prepare (void);
1263 -+#define PREPARE(argc, argv) do_prepare ()
1264 -+static int do_test (void);
1265 -+#define TEST_FUNCTION do_test ()
1266 -+#include <test-skeleton.c>
1267 -+
1268 -+static int fd;
1269 -+static void
1270 -+do_prepare (void)
1271 -+{
1272 -+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
1273 -+ if (fd == -1)
1274 -+ {
1275 -+ printf ("cannot create temporary file: %m\n");
1276 -+ exit (1);
1277 -+ }
1278 -+}
1279 -+
1280 -+
1281 -+static int
1282 -+do_test (void)
1283 -+{
1284 -+ struct stat64 st;
1285 -+
1286 -+ if (fstat64 (fd, &st) != 0)
1287 -+ {
1288 -+ puts ("1st fstat failed");
1289 -+ return 1;
1290 -+ }
1291 -+
1292 -+ if (st.st_size != 0)
1293 -+ {
1294 -+ puts ("file not created with size 0");
1295 -+ return 1;
1296 -+ }
1297 -+
1298 -+ if (posix_fallocate (fd, 512, 768) != 0)
1299 -+ {
1300 -+ puts ("1st posix_fallocate call failed");
1301 -+ return 1;
1302 -+ }
1303 -+
1304 -+ if (fstat64 (fd, &st) != 0)
1305 -+ {
1306 -+ puts ("2nd fstat failed");
1307 -+ return 1;
1308 -+ }
1309 -+
1310 -+ if (st.st_size != 512 + 768)
1311 -+ {
1312 -+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
1313 -+ (unsigned long long int) st.st_size, 512u + 768u);
1314 -+ return 1;
1315 -+ }
1316 -+
1317 -+ if (posix_fallocate (fd, 0, 1024) != 0)
1318 -+ {
1319 -+ puts ("2nd posix_fallocate call failed");
1320 -+ return 1;
1321 -+ }
1322 -+
1323 -+ if (fstat64 (fd, &st) != 0)
1324 -+ {
1325 -+ puts ("3rd fstat failed");
1326 -+ return 1;
1327 -+ }
1328 -+
1329 -+ if (st.st_size != 512 + 768)
1330 -+ {
1331 -+ puts ("file size changed in 2nd posix_fallocate");
1332 -+ return 1;
1333 -+ }
1334 -+
1335 -+ if (posix_fallocate (fd, 2048, 64) != 0)
1336 -+ {
1337 -+ puts ("3rd posix_fallocate call failed");
1338 -+ return 1;
1339 -+ }
1340 -+
1341 -+ if (fstat64 (fd, &st) != 0)
1342 -+ {
1343 -+ puts ("4th fstat failed");
1344 -+ return 1;
1345 -+ }
1346 -+
1347 -+ if (st.st_size != 2048 + 64)
1348 -+ {
1349 -+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
1350 -+ (unsigned long long int) st.st_size, 2048u + 64u);
1351 -+ return 1;
1352 -+ }
1353 -+#ifdef TST_POSIX_FALLOCATE64
1354 -+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
1355 -+ {
1356 -+ puts ("4th posix_fallocate call failed");
1357 -+ return 1;
1358 -+ }
1359 -+
1360 -+ if (fstat64 (fd, &st) != 0)
1361 -+ {
1362 -+ puts ("5th fstat failed");
1363 -+ return 1;
1364 -+ }
1365 -+
1366 -+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
1367 -+ {
1368 -+ printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n",
1369 -+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
1370 -+ return 1;
1371 -+ }
1372 -+#endif
1373 -+ close (fd);
1374 -+
1375 -+ return 0;
1376 -+}
1377 -diff --git a/test/unistd/tst-posix_fallocate64.c b/test/unistd/tst-posix_fallocate64.c
1378 -new file mode 100644
1379 -index 0000000..b1ee0ff
1380 ---- /dev/null
1381 -+++ b/test/unistd/tst-posix_fallocate64.c
1382 -@@ -0,0 +1,2 @@
1383 -+#define TST_POSIX_FALLOCATE64
1384 -+#include "tst-posix_fallocate.c"
1385 ---
1386 -cgit v0.9.1
1387
1388 diff --git a/tools-uclibc/portage.i686.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r3 b/tools-uclibc/portage.i686.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r4
1389 similarity index 100%
1390 rename from tools-uclibc/portage.i686.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r3
1391 rename to tools-uclibc/portage.i686.vanilla/savedconfig/sys-libs/uclibc-0.9.33.2-r4