summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/uclibc/uclibc-git.inc5
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-i386-sysdep.h-Remove-STABS_-macros.patch71
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch8
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch408
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/uclibc-execvpe.patch163
5 files changed, 77 insertions, 578 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
index ed9b5fd1c4..db00ee6243 100644
--- a/meta/recipes-core/uclibc/uclibc-git.inc
+++ b/meta/recipes-core/uclibc/uclibc-git.inc
@@ -1,4 +1,4 @@
1SRCREV="9591091f150e8a86c47efbea5def21fa67fffb07" 1SRCREV="946799cd0ce0c6c803c9cb173a84f4d607bde350"
2 2
3DEFAULT_PREFERENCE = "-1" 3DEFAULT_PREFERENCE = "-1"
4 4
@@ -16,13 +16,12 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master;protocol=git \
16 file://argp-headers.patch \ 16 file://argp-headers.patch \
17 file://remove_attribute_optimize_Os.patch \ 17 file://remove_attribute_optimize_Os.patch \
18 file://compile-arm-fork-with-O2.patch \ 18 file://compile-arm-fork-with-O2.patch \
19 file://uclibc-execvpe.patch \
20 file://orign_path.patch \ 19 file://orign_path.patch \
21 file://posix_fallocate.patch \
22 file://0001-atexit_old-Do-not-add-it-to-shared-libc.patch \ 20 file://0001-atexit_old-Do-not-add-it-to-shared-libc.patch \
23 file://0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch \ 21 file://0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch \
24 file://0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \ 22 file://0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \
25 file://0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch \ 23 file://0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch \
26 file://0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch \ 24 file://0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch \
25 file://0001-i386-sysdep.h-Remove-STABS_-macros.patch \
27 " 26 "
28S = "${WORKDIR}/git" 27S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-i386-sysdep.h-Remove-STABS_-macros.patch b/meta/recipes-core/uclibc/uclibc-git/0001-i386-sysdep.h-Remove-STABS_-macros.patch
new file mode 100644
index 0000000000..8512c456a5
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-i386-sysdep.h-Remove-STABS_-macros.patch
@@ -0,0 +1,71 @@
1Upstream-Status: Submitted
2
3-Khem
4
5From e20fd2c2427be981c16cb936cc6866d08520de9b Mon Sep 17 00:00:00 2001
6From: Khem Raj <raj.khem@gmail.com>
7Date: Mon, 25 Mar 2013 19:34:39 -0700
8Subject: [PATCH] i386/sysdep.h: Remove STABS_* macros
9
10uclibc is compiled with elf/dwarf and secondly HAVE_CPP_ASM_DEBUGINFO
11is not defined so we generate bogus .stab sections needlessly
12
13Some of post processing tools get confused when they see both
14dwarf and stab sections
15
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 libc/sysdeps/linux/i386/sysdep.h | 27 ---------------------------
19 1 file changed, 27 deletions(-)
20
21diff --git a/libc/sysdeps/linux/i386/sysdep.h b/libc/sysdeps/linux/i386/sysdep.h
22index 983c4f5..7a8d2e2 100644
23--- a/libc/sysdeps/linux/i386/sysdep.h
24+++ b/libc/sysdeps/linux/i386/sysdep.h
25@@ -43,12 +43,9 @@
26 incomplete stabs information. Fake some entries here which specify
27 the current source file. */
28 #define ENTRY(name) \
29- STABS_CURRENT_FILE1("") \
30- STABS_CURRENT_FILE(name) \
31 ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \
32 ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \
33 .align ALIGNARG(4); \
34- STABS_FUN(name) \
35 C_LABEL(name) \
36 cfi_startproc; \
37 CALL_MCOUNT
38@@ -57,30 +54,6 @@
39 #define END(name) \
40 cfi_endproc; \
41 ASM_SIZE_DIRECTIVE(name) \
42- STABS_FUN_END(name)
43-
44-#ifdef HAVE_CPP_ASM_DEBUGINFO
45-/* Disable that goop, because we just pass -g through to the assembler
46- and it generates proper line number information directly. */
47-# define STABS_CURRENT_FILE1(name)
48-# define STABS_CURRENT_FILE(name)
49-# define STABS_FUN(name)
50-# define STABS_FUN_END(name)
51-#else
52-/* Remove the following two lines once the gdb bug is fixed. */
53-#define STABS_CURRENT_FILE(name) \
54- STABS_CURRENT_FILE1 (#name)
55-#define STABS_CURRENT_FILE1(name) \
56- 1: .stabs name,100,0,0,1b;
57-/* Emit stabs definition lines. We use F(0,1) and define t(0,1) as `int',
58- the same way gcc does it. */
59-#define STABS_FUN(name) STABS_FUN2(name, name##:F(0,1))
60-#define STABS_FUN2(name, namestr) \
61- .stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",128,0,0,0; \
62- .stabs #namestr,36,0,0,name;
63-#define STABS_FUN_END(name) \
64- 1: .stabs "",36,0,0,1b-name;
65-#endif
66
67 /* If compiled for profiling, call `mcount' at the start of each function. */
68 #ifdef PROF
69--
701.7.9.5
71
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch
index 407beb657b..7fc5bd3d74 100644
--- a/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch
@@ -13,12 +13,12 @@ Upstream-Status: Pending
13 13
14Index: git/libc/sysdeps/linux/arm/Makefile.arch 14Index: git/libc/sysdeps/linux/arm/Makefile.arch
15=================================================================== 15===================================================================
16--- git.orig/libc/sysdeps/linux/arm/Makefile.arch 2013-01-21 16:29:25.000000000 -0800 16--- git.orig/libc/sysdeps/linux/arm/Makefile.arch 2013-03-25 19:48:48.000000000 -0700
17+++ git/libc/sysdeps/linux/arm/Makefile.arch 2013-01-21 16:33:11.575571091 -0800 17+++ git/libc/sysdeps/linux/arm/Makefile.arch 2013-03-25 19:51:57.496677771 -0700
18@@ -12,7 +12,10 @@ 18@@ -13,7 +13,10 @@
19 bsd-_setjmp.S sigrestorer.S mmap64.S \
20 vfork.S clone.S 19 vfork.S clone.S
21 20
21 SSRC-$(UCLIBC_HAS_LFS) += mmap64.S
22-SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-aeabi_read_tp.S libc-thumb_atomics.S 22-SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-aeabi_read_tp.S libc-thumb_atomics.S
23+SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S 23+SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S
24+libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os 24+libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os
diff --git a/meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch b/meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch
deleted file mode 100644
index 46448babcb..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch
+++ /dev/null
@@ -1,408 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.152.129.134 with SMTP id nw6csp47712lab;
3 Tue, 17 Apr 2012 00:30:48 -0700 (PDT)
4Received: by 10.68.216.167 with SMTP id or7mr34112133pbc.140.1334647840512;
5 Tue, 17 Apr 2012 00:30:40 -0700 (PDT)
6Return-Path: <uclibc-bounces@uclibc.org>
7Received: from hemlock.osuosl.org (hemlock.osuosl.org. [140.211.166.133])
8 by mx.google.com with ESMTP id gr10si13305623pbc.339.2012.04.17.00.30.39;
9 Tue, 17 Apr 2012 00:30:40 -0700 (PDT)
10Received-SPF: neutral (google.com: 140.211.166.133 is neither permitted nor denied by best guess record for domain of uclibc-bounces@uclibc.org) client-ip=140.211.166.133;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 140.211.166.133 is neither permitted nor denied by best guess record for domain of uclibc-bounces@uclibc.org) smtp.mail=uclibc-bounces@uclibc.org; dkim=neutral (body hash did not verify) header.i=@gmail.com
12Received: from localhost (localhost [127.0.0.1])
13 by hemlock.osuosl.org (Postfix) with ESMTP id 7C494A0277;
14 Tue, 17 Apr 2012 07:30:39 +0000 (UTC)
15X-Virus-Scanned: amavisd-new at osuosl.org
16Received: from hemlock.osuosl.org ([127.0.0.1])
17 by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
18 with ESMTP id ZsSp5xE48GwC; Tue, 17 Apr 2012 07:30:34 +0000 (UTC)
19Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34])
20 by hemlock.osuosl.org (Postfix) with ESMTP id 1C4F5A0274;
21 Tue, 17 Apr 2012 07:30:33 +0000 (UTC)
22X-Original-To: uclibc@lists.busybox.net
23Delivered-To: uclibc@osuosl.org
24Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137])
25 by ash.osuosl.org (Postfix) with ESMTP id 17FDE8F75B
26 for <uclibc@lists.busybox.net>; Tue, 17 Apr 2012 07:30:32 +0000 (UTC)
27Received: from localhost (localhost [127.0.0.1])
28 by fraxinus.osuosl.org (Postfix) with ESMTP id 07B491016A1
29 for <uclibc@lists.busybox.net>; Tue, 17 Apr 2012 07:30:32 +0000 (UTC)
30X-Virus-Scanned: amavisd-new at osuosl.org
31Received: from fraxinus.osuosl.org ([127.0.0.1])
32 by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
33 with ESMTP id XKP7jhcUijp4 for <uclibc@lists.busybox.net>;
34 Tue, 17 Apr 2012 07:30:27 +0000 (UTC)
35X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
36Received: from mail-we0-f174.google.com (mail-we0-f174.google.com
37 [74.125.82.174])
38 by fraxinus.osuosl.org (Postfix) with ESMTPS id 2CC0B100190
39 for <uclibc@uclibc.org>; Tue, 17 Apr 2012 07:30:26 +0000 (UTC)
40Received: by wejx9 with SMTP id x9so5218587wej.33
41 for <uclibc@uclibc.org>; Tue, 17 Apr 2012 00:30:25 -0700 (PDT)
42DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
43 h=from:to:cc:subject:date:message-id:x-mailer;
44 bh=vadTQ1GL81XLDadHLtwCrcdL0YvVNNbIuISfTaQphgg=;
45 b=KkyW95PC1TUTmwGt+iBJ8p0FfGtTPAsTlXmul/1iH2p21itEpWkU+WcVd2jBH+jc6L
46 gzf4d6K1pmmfscdbPY3OkpFfvO/v/E4KYN7JmeI+fX1NY+gLBSHhExAVhM1Opue9z09V
47 54MrEMtlIA9Wo/5QPd1+W7o9gXHYEnMkoqYYZLmfPlG3+pCXZ6RP36fOZnSV44BQgOFz
48 KBqn7XLo6nxgP5X/+JuEe4stvCrI9/66nX30u/Sh77a9poj5pp8hQZmtIpbbm3xRKGnM
49 Fi72jNCq/0nHh3M7eMqn+rvwi1JQjk/90zWNv8v5ShAKqSJVrfqLVN72KjTJtXfLOqbL
50 e2qA==
51Received: by 10.216.133.72 with SMTP id p50mr8903959wei.78.1334647825412;
52 Tue, 17 Apr 2012 00:30:25 -0700 (PDT)
53Received: from s42.loc (85-127-86-115.dynamic.xdsl-line.inode.at.
54 [85.127.86.115])
55 by mx.google.com with ESMTPS id n20sm40466274wiw.5.2012.04.17.00.30.23
56 (version=TLSv1/SSLv3 cipher=OTHER);
57 Tue, 17 Apr 2012 00:30:24 -0700 (PDT)
58Received: from cow by s42.loc with local (Exim 4.77)
59 (envelope-from <rep.dot.nop@gmail.com>)
60 id 1SK2rm-0008Pl-V3; Tue, 17 Apr 2012 09:30:23 +0200
61From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
62To: uclibc@uclibc.org
63Subject: [PATCH,CFT] libc: add posix_fallocate()
64Date: Tue, 17 Apr 2012 09:30:15 +0200
65Message-Id: <1334647815-32315-1-git-send-email-rep.dot.nop@gmail.com>
66X-Mailer: git-send-email 1.7.9.1
67X-BeenThere: uclibc@uclibc.org
68X-Mailman-Version: 2.1.14
69Precedence: list
70List-Id: "Discussion and development of uClibc \(the embedded C library\)"
71 <uclibc.uclibc.org>
72List-Unsubscribe: <http://lists.busybox.net/mailman/options/uclibc>,
73 <mailto:uclibc-request@uclibc.org?subject=unsubscribe>
74List-Archive: <http://lists.busybox.net/pipermail/uclibc>
75List-Post: <mailto:uclibc@uclibc.org>
76List-Help: <mailto:uclibc-request@uclibc.org?subject=help>
77List-Subscribe: <http://lists.busybox.net/mailman/listinfo/uclibc>,
78 <mailto:uclibc-request@uclibc.org?subject=subscribe>
79MIME-Version: 1.0
80Content-Type: text/plain; charset="us-ascii"
81Content-Transfer-Encoding: 7bit
82Errors-To: uclibc-bounces@uclibc.org
83Sender: uclibc-bounces@uclibc.org
84
85Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
86Upstream-Status: Pending
87---
88 include/fcntl.h | 4 +-
89 libc/sysdeps/linux/common/Makefile.in | 3 +-
90 libc/sysdeps/linux/common/bits/kernel-features.h | 8 ++
91 libc/sysdeps/linux/common/posix_fallocate.c | 43 ++++++++
92 libc/sysdeps/linux/common/posix_fallocate64.c | 39 +++++++
93 libc/sysdeps/linux/common/stubs.c | 4 +
94 test/.gitignore | 1 +
95 test/unistd/Makefile.in | 3 +
96 test/unistd/tst-posix_fallocate.c | 121 ++++++++++++++++++++++
97 9 files changed, 222 insertions(+), 4 deletions(-)
98 create mode 100644 libc/sysdeps/linux/common/posix_fallocate.c
99 create mode 100644 libc/sysdeps/linux/common/posix_fallocate64.c
100 create mode 100644 test/unistd/tst-posix_fallocate.c
101
102Index: git/include/fcntl.h
103===================================================================
104--- git.orig/include/fcntl.h 2012-06-23 18:47:18.000000000 -0700
105+++ git/include/fcntl.h 2012-06-23 18:48:54.805911794 -0700
106@@ -218,9 +218,7 @@
107
108 #endif
109
110-#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
111-
112-/* FIXME -- uClibc should probably implement these... */
113+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
114
115 /* Reserve storage for the data of the file associated with FD.
116
117Index: git/libc/sysdeps/linux/common/Makefile.in
118===================================================================
119--- git.orig/libc/sysdeps/linux/common/Makefile.in 2012-06-23 18:47:18.000000000 -0700
120+++ git/libc/sysdeps/linux/common/Makefile.in 2012-06-23 18:50:14.033915572 -0700
121@@ -81,7 +81,8 @@
122 sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
123 sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
124 # 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
125-CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
126+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
127+ posix_fallocate.c posix_fallocate64.c
128 CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
129 CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
130 CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
131Index: git/libc/sysdeps/linux/common/bits/kernel-features.h
132===================================================================
133--- git.orig/libc/sysdeps/linux/common/bits/kernel-features.h 2012-06-23 18:47:18.000000000 -0700
134+++ git/libc/sysdeps/linux/common/bits/kernel-features.h 2012-06-23 18:48:54.805911794 -0700
135@@ -494,6 +494,14 @@
136 # define __ASSUME_PRIVATE_FUTEX 1
137 #endif
138
139+/* Support for fallocate was added in 2.6.23,
140+ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
141+#if __LINUX_KERNEL_VERSION >= 0x020617 \
142+ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
143+ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
144+# define __ASSUME_FALLOCATE 1
145+#endif
146+
147 /* getcpu is a syscall for x86-64 since 3.1. */
148 #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
149 # define __ASSUME_GETCPU_SYSCALL 1
150Index: git/libc/sysdeps/linux/common/posix_fallocate.c
151===================================================================
152--- /dev/null 1970-01-01 00:00:00.000000000 +0000
153+++ git/libc/sysdeps/linux/common/posix_fallocate.c 2012-06-23 18:48:54.825911795 -0700
154@@ -0,0 +1,43 @@
155+/* vi: set sw=4 ts=4: */
156+/*
157+ * posix_fallocate() for uClibc
158+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
159+ *
160+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
161+ *
162+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
163+ */
164+
165+#include <sys/syscall.h>
166+#include <fcntl.h>
167+#include <bits/kernel-features.h>
168+#include <stdint.h>
169+
170+#if defined __NR_fallocate
171+int posix_fallocate(int fd, __off_t offset, __off_t len)
172+{
173+ int ret;
174+
175+# if __WORDSIZE == 32
176+ uint32_t off_low = offset;
177+ uint32_t len_low = len;
178+ /* may assert that these >>31 are 0 */
179+ uint32_t zero = 0;
180+ INTERNAL_SYSCALL_DECL(err);
181+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
182+ __LONG_LONG_PAIR (zero, off_low),
183+ __LONG_LONG_PAIR (zero, len_low)));
184+# elif __WORDSIZE == 64
185+ INTERNAL_SYSCALL_DECL(err);
186+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
187+# else
188+# error your machine is neither 32 bit or 64 bit ... it must be magical
189+#endif
190+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
191+ return INTERNAL_SYSCALL_ERRNO (ret, err);
192+ return 0;
193+}
194+# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
195+strong_alias(posix_fallocate,posix_fallocate64)
196+# endif
197+#endif
198Index: git/libc/sysdeps/linux/common/posix_fallocate64.c
199===================================================================
200--- /dev/null 1970-01-01 00:00:00.000000000 +0000
201+++ git/libc/sysdeps/linux/common/posix_fallocate64.c 2012-06-23 18:48:54.825911795 -0700
202@@ -0,0 +1,39 @@
203+/* vi: set sw=4 ts=4: */
204+/*
205+ * posix_fallocate() for uClibc
206+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
207+ *
208+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
209+ *
210+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
211+ */
212+
213+#include <sys/syscall.h>
214+#include <fcntl.h>
215+#include <bits/kernel-features.h>
216+#include <stdint.h>
217+
218+#if defined __NR_fallocate
219+
220+# if __WORDSIZE == 64
221+/* Can use normal posix_fallocate() */
222+# elif __WORDSIZE == 32
223+int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
224+{
225+ int ret;
226+ uint32_t off_low = offset & 0xffffffff;
227+ uint32_t off_high = offset >> 32;
228+ uint32_t len_low = len & 0xffffffff;
229+ uint32_t len_high = len >> 32;
230+ INTERNAL_SYSCALL_DECL(err);
231+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
232+ __LONG_LONG_PAIR (off_high, off_low),
233+ __LONG_LONG_PAIR (len_high, len_low)));
234+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
235+ return INTERNAL_SYSCALL_ERRNO (ret, err);
236+ return 0;
237+}
238+# else
239+# error your machine is neither 32 bit or 64 bit ... it must be magical
240+# endif
241+#endif
242Index: git/libc/sysdeps/linux/common/stubs.c
243===================================================================
244--- git.orig/libc/sysdeps/linux/common/stubs.c 2012-06-23 18:47:18.000000000 -0700
245+++ git/libc/sysdeps/linux/common/stubs.c 2012-06-23 18:48:54.825911795 -0700
246@@ -253,6 +253,10 @@
247 make_ret_stub(posix_fadvise64)
248 #endif
249
250+#if !defined __NR_fallocate && defined __UCLIBC_HAS_ADVANCED_REALTIME__
251+make_ret_stub(posix_fallocate)
252+#endif
253+
254 #ifndef __NR_madvise
255 make_ret_stub(posix_madvise)
256 #endif
257Index: git/test/.gitignore
258===================================================================
259--- git.orig/test/.gitignore 2012-06-23 18:47:18.000000000 -0700
260+++ git/test/.gitignore 2012-06-23 18:48:54.825911795 -0700
261@@ -316,6 +316,7 @@
262 unistd/getopt
263 unistd/getopt_long
264 unistd/tstgetopt
265+unistd/tst-posix_fallocate
266 unistd/tst-preadwrite
267 unistd/tst-preadwrite64
268 unistd/vfork
269Index: git/test/unistd/Makefile.in
270===================================================================
271--- git.orig/test/unistd/Makefile.in 2012-06-23 18:47:18.000000000 -0700
272+++ git/test/unistd/Makefile.in 2012-06-23 18:48:54.829911795 -0700
273@@ -4,6 +4,9 @@
274 ifeq ($(UCLIBC_HAS_LFS),)
275 TESTS_DISABLED := tst-preadwrite64
276 endif
277+ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
278+TESTS_DISABLED := tst-posix_fallocate
279+endif
280 OPTS_getopt := -abcXXX -9
281 OPTS_getopt_long := --add XXX --delete YYY --verbose
282 ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
283Index: git/test/unistd/tst-posix_fallocate.c
284===================================================================
285--- /dev/null 1970-01-01 00:00:00.000000000 +0000
286+++ git/test/unistd/tst-posix_fallocate.c 2012-06-23 18:48:54.829911795 -0700
287@@ -0,0 +1,121 @@
288+#include <fcntl.h>
289+#include <sys/stat.h>
290+
291+static void do_prepare (void);
292+#define PREPARE(argc, argv) do_prepare ()
293+static int do_test (void);
294+#define TEST_FUNCTION do_test ()
295+#include <test-skeleton.c>
296+
297+static int fd;
298+#ifndef O_LARGEFILE
299+# error no O_LARGEFILE
300+#endif
301+static void
302+do_prepare (void)
303+{
304+ fd = create_temp_file ("tst-posix_fallocate.", NULL);
305+ if (fd == -1)
306+ {
307+ printf ("cannot create temporary file: %m\n");
308+ exit (1);
309+ }
310+}
311+
312+
313+static int
314+do_test (void)
315+{
316+ struct stat64 st;
317+
318+ if (fstat64 (fd, &st) != 0)
319+ {
320+ puts ("1st fstat failed");
321+ return 1;
322+ }
323+
324+ if (st.st_size != 0)
325+ {
326+ puts ("file not created with size 0");
327+ return 1;
328+ }
329+
330+ if (posix_fallocate (fd, 512, 768) != 0)
331+ {
332+ puts ("1st posix_fallocate call failed");
333+ return 1;
334+ }
335+
336+ if (fstat64 (fd, &st) != 0)
337+ {
338+ puts ("2nd fstat failed");
339+ return 1;
340+ }
341+
342+ if (st.st_size != 512 + 768)
343+ {
344+ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
345+ (unsigned long long int) st.st_size, 512u + 768u);
346+ return 1;
347+ }
348+
349+ if (posix_fallocate (fd, 0, 1024) != 0)
350+ {
351+ puts ("2nd posix_fallocate call failed");
352+ return 1;
353+ }
354+
355+ if (fstat64 (fd, &st) != 0)
356+ {
357+ puts ("3rd fstat failed");
358+ return 1;
359+ }
360+
361+ if (st.st_size != 512 + 768)
362+ {
363+ puts ("file size changed in 2nd posix_fallocate");
364+ return 1;
365+ }
366+
367+ if (posix_fallocate (fd, 2048, 64) != 0)
368+ {
369+ puts ("3rd posix_fallocate call failed");
370+ return 1;
371+ }
372+
373+ if (fstat64 (fd, &st) != 0)
374+ {
375+ puts ("4th fstat failed");
376+ return 1;
377+ }
378+
379+ if (st.st_size != 2048 + 64)
380+ {
381+ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
382+ (unsigned long long int) st.st_size, 2048u + 64u);
383+ return 1;
384+ }
385+
386+ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
387+ {
388+ puts ("4th posix_fallocate call failed");
389+ return 1;
390+ }
391+
392+ if (fstat64 (fd, &st) != 0)
393+ {
394+ puts ("5th fstat failed");
395+ return 1;
396+ }
397+
398+ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
399+ {
400+ printf ("file size after 4th posix_fallocate call is %llu, expected %u\n",
401+ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
402+ return 1;
403+ }
404+
405+ close (fd);
406+
407+ return 0;
408+}
diff --git a/meta/recipes-core/uclibc/uclibc-git/uclibc-execvpe.patch b/meta/recipes-core/uclibc/uclibc-git/uclibc-execvpe.patch
deleted file mode 100644
index fe191fc496..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/uclibc-execvpe.patch
+++ /dev/null
@@ -1,163 +0,0 @@
1From d20556adadea03bff0bba051172caf0314a35471 Mon Sep 17 00:00:00 2001
2From: Henning Heinold <heinold@inf.fu-berlin.de>
3Date: Sat, 4 Jun 2011 21:23:15 +0200
4Subject: [PATCH 2/2] libc: add non standard execvpe function
5
6
7Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
8---
9 include/unistd.h | 6 ++++++
10 libc/unistd/exec.c | 38 +++++++++++++++++++++++++++++++++-----
11 libc/unistd/execvpe.c | 7 +++++++
12 3 files changed, 46 insertions(+), 5 deletions(-)
13 create mode 100644 libc/unistd/execvpe.c
14
15
16Upstream-Status: Pending
17
18diff --git a/include/unistd.h b/include/unistd.h
19index 9568790..070e4f2 100644
20--- a/include/unistd.h
21+++ b/include/unistd.h
22@@ -557,6 +557,12 @@ extern int execvp (__const char *__file, char *__const __argv[])
23 __THROW __nonnull ((1));
24 libc_hidden_proto(execvp)
25
26+/* Execute FILE, searching in the `PATH' environment variable if it contains
27+ no slashes, with arguments ARGV and environment from a pointer */
28+extern int execvpe (__const char *__file, char *__const __argv[], char *__const __envp[])
29+ __THROW __nonnull ((1));
30+libc_hidden_proto(execvpe)
31+
32 /* Execute FILE, searching in the `PATH' environment variable if
33 it contains no slashes, with all arguments after FILE until a
34 NULL pointer and environment from `environ'. */
35diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c
36index 7d24072..802a174 100644
37--- a/libc/unistd/exec.c
38+++ b/libc/unistd/exec.c
39@@ -32,6 +32,8 @@
40 /**********************************************************************/
41 #define EXEC_FUNC_COMMON 0
42 #define EXEC_FUNC_EXECVP 1
43+#define EXEC_FUNC_EXECVPE 2
44+
45 #if defined(__ARCH_USE_MMU__)
46
47 /* We have an MMU, so use alloca() to grab space for buffers and arg lists. */
48@@ -58,6 +60,7 @@
49 * execle(a) -> execve(-)
50 * execv(-) -> execve(-)
51 * execvp(a) -> execve(-)
52+ * execvpe(a) -> execve(-)
53 */
54
55 # define EXEC_ALLOC_SIZE(VAR) /* nothing to do */
56@@ -219,15 +222,18 @@ libc_hidden_def(execlp)
57
58 #endif
59 /**********************************************************************/
60-#ifdef L_execvp
61+#if defined (L_execvp) || defined(L_execvpe)
62
63
64 /* Use a default path that matches glibc behavior, since SUSv3 says
65 * this is implementation-defined. The default is current working dir,
66 * /bin, and then /usr/bin. */
67 static const char default_path[] = ":/bin:/usr/bin";
68-
69+#if defined (L_execvp)
70 int execvp(const char *path, char *const argv[])
71+#elif defined (L_execvpe)
72+int execvpe(const char *path, char *const argv[], char *const envp[])
73+#endif
74 {
75 char *buf = NULL;
76 char *p;
77@@ -245,7 +251,11 @@ int execvp(const char *path, char *const argv[])
78 }
79
80 if (strchr(path, '/')) {
81+#if defined (L_execvp)
82 execve(path, argv, __environ);
83+#elif defined (L_execvpe)
84+ execve(path, argv, envp);
85+#endif
86 if (errno == ENOEXEC) {
87 char **nargv;
88 EXEC_ALLOC_SIZE(size2) /* Do NOT add a semicolon! */
89@@ -254,11 +264,19 @@ int execvp(const char *path, char *const argv[])
90 /* Need the dimension - 1. We omit counting the trailing
91 * NULL but we actually omit the first entry. */
92 for (n=0 ; argv[n] ; n++) {}
93+#if defined (L_execvp)
94 nargv = (char **) EXEC_ALLOC((n+2) * sizeof(char *), size2, EXEC_FUNC_EXECVP);
95+#elif defined (L_execvpe)
96+ nargv = (char **) EXEC_ALLOC((n+2) * sizeof(char *), size2, EXEC_FUNC_EXECVPE);
97+#endif
98 nargv[0] = argv[0];
99 nargv[1] = (char *)path;
100 memcpy(nargv+2, argv+1, n*sizeof(char *));
101+#if defined (L_execvp)
102 execve("/bin/sh", nargv, __environ);
103+#elif defined (L_execvpe)
104+ execve("/bin/sh", nargv, envp);
105+#endif
106 EXEC_FREE(nargv, size2);
107 }
108 } else {
109@@ -277,8 +295,11 @@ int execvp(const char *path, char *const argv[])
110 return -1;
111 }
112 len = (FILENAME_MAX - 1) - plen;
113-
114+#if defined (L_execvp)
115 buf = EXEC_ALLOC(FILENAME_MAX, size, EXEC_FUNC_EXECVP);
116+#elif defined (L_execvpe)
117+ buf = EXEC_ALLOC(FILENAME_MAX, size, EXEC_FUNC_EXECVPE);
118+#endif
119 {
120 int seen_small = 0;
121 s0 = buf + len;
122@@ -300,8 +321,11 @@ int execvp(const char *path, char *const argv[])
123 s[plen-1] = '/';
124 }
125
126+#if defined (L_execvp)
127 execve(s, argv, __environ);
128-
129+#elif defined (L_execvpe)
130+ execve(s, argv, envp);
131+#endif
132 seen_small = 1;
133
134 if (errno == ENOEXEC) {
135@@ -325,7 +349,11 @@ int execvp(const char *path, char *const argv[])
136
137 return -1;
138 }
139+#if defined (L_execvp)
140 libc_hidden_def(execvp)
141-
142+#elif defined (L_execvpe)
143+libc_hidden_def(execvpe)
144 #endif
145+
146+#endif /* #if defined (L_execvp) || defined(L_execvpe) */
147 /**********************************************************************/
148diff --git a/libc/unistd/execvpe.c b/libc/unistd/execvpe.c
149new file mode 100644
150index 0000000..5c1ce06
151--- /dev/null
152+++ b/libc/unistd/execvpe.c
153@@ -0,0 +1,7 @@
154+/* Copyright (C) 2011 Hennning Heinold <heinold@inf.fu-berlin.de>
155+ *
156+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
157+ */
158+
159+#define L_execvpe
160+#include "exec.c"
161--
1621.7.5.3
163