summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/uclibc/uclibc-git.inc10
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch44
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch33
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch31
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch74
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/define-MSG_CMSG_CLOEXEC.patch25
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/dup3.patch37
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch408
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch106
9 files changed, 660 insertions, 108 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
index eac7e75277..60d36f4b5e 100644
--- a/meta/recipes-core/uclibc/uclibc-git.inc
+++ b/meta/recipes-core/uclibc/uclibc-git.inc
@@ -3,7 +3,7 @@ SRCREV="0dcc13bf7a61b1d0708e5dd103d5515e0ffec79a"
3DEFAULT_PREFERENCE = "-1" 3DEFAULT_PREFERENCE = "-1"
4 4
5PV = "0.9.33+git${SRCPV}" 5PV = "0.9.33+git${SRCPV}"
6PR = "${INC_PR}.1" 6PR = "${INC_PR}.2"
7 7
8FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/uclibc-git' ], d)}" 8FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/uclibc-git' ], d)}"
9 9
@@ -18,6 +18,12 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master;protocol=git \
18 file://compile-arm-fork-with-O2.patch \ 18 file://compile-arm-fork-with-O2.patch \
19 file://uclibc-execvpe.patch \ 19 file://uclibc-execvpe.patch \
20 file://orign_path.patch \ 20 file://orign_path.patch \
21 file://dup3.patch \
22 file://define-MSG_CMSG_CLOEXEC.patch \
23 file://posix_fallocate.patch \
24 file://0001-atexit_old-Do-not-add-it-to-shared-libc.patch \
25 file://0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch \
26 file://0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \
27 file://0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch \
21 " 28 "
22
23S = "${WORKDIR}/git" 29S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch b/meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch
new file mode 100644
index 0000000000..b6dfce483e
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch
@@ -0,0 +1,44 @@
1From 74667582526b39a1906228574d73a6528f4587eb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 13:26:30 -0700
4Subject: [PATCH] atexit_old: Do not add it to shared libc
5
6atexit should only be in either uclibc_nonshared.a
7shared libc case or libc.a in static build case
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Pending
12---
13 libc/stdlib/Makefile.in | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
17index 3166b8e..3d686d9 100644
18--- a/libc/stdlib/Makefile.in
19+++ b/libc/stdlib/Makefile.in
20@@ -60,7 +60,6 @@ CSRC-$(if $(findstring yyy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_X
21
22 # multi source _atexit.c
23 CSRC-y += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
24-CSRC-$(COMPAT_ATEXIT) += old_atexit.c
25
26 STDLIB_DIR := $(top_srcdir)libc/stdlib
27 STDLIB_OUT := $(top_builddir)libc/stdlib
28@@ -70,11 +69,12 @@ STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC-y))
29
30 libc-y += $(STDLIB_OBJ)
31 libc-static-y += $(STDLIB_OUT)/atexit.o $(STDLIB_OUT)/system.o
32+libc-static-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.o
33 libc-shared-y += $(STDLIB_OUT)/system.oS
34
35 # this should always be the PIC version, because it could be used in shared libs
36 libc-nonshared-y += $(STDLIB_OUT)/atexit.os
37-
38+libc-nonshared-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.os
39 libc-nomulti-y += $(STDLIB_OUT)/labs.o $(STDLIB_OUT)/atol.o $(STDLIB_OUT)/_stdlib_strto_l.o $(STDLIB_OUT)/_stdlib_strto_ll.o
40 libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STDLIB_OUT)/_stdlib_strto_l_l.o $(STDLIB_OUT)/_stdlib_strto_ll_l.o
41
42--
431.7.9.5
44
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch b/meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch
new file mode 100644
index 0000000000..ecb9d31645
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch
@@ -0,0 +1,33 @@
1From 95f9b6f37152b8316735d3c86c0db963ff59e22d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 16:51:52 -0700
4Subject: [PATCH] librt: Use -nodefaultlibs instead of -nostdlib
5
6nostdlib disables linking in startup files too which is not
7what we want here since it needs to resolve __dso_handle
8which comes from crtbeginS.o, otherwise librt has this
9undefined reference to a weak undefined __dso_handle that
10shows up as error (with gold linker)
11when shared libraries are being built which are
12linking in librt
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Upstream-Status: Pending
16---
17 librt/Makefile.in | 1 +
18 1 file changed, 1 insertion(+)
19
20Index: git/librt/Makefile.in
21===================================================================
22--- git.orig/librt/Makefile.in 2012-06-24 10:32:59.512653237 -0700
23+++ git/librt/Makefile.in 2012-06-24 11:31:00.660821666 -0700
24@@ -15,6 +15,9 @@
25 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
26 LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so
27 endif
28+START_FILE-librt.so := $(SHARED_START_FILES)
29+END_FILE-librt.so := $(SHARED_END_FILES)
30+
31
32 librt_FULL_NAME := librt-$(VERSION).so
33
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
new file mode 100644
index 0000000000..bf6f2c8dbf
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch
@@ -0,0 +1,31 @@
1From 714f543f4fa8fb3911449b6ce1517481359e0cff Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 14:21:17 -0700
4Subject: [PATCH] nptl/arm: Move aeabi_read_tp to uclibc_nonshared.a
5
6Otherwise it creates wrong references from shared libs
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9Upstream-Status: Pending
10---
11 libc/sysdeps/linux/arm/Makefile.arch | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
15index 5fc3e54..8285b9b 100644
16--- a/libc/sysdeps/linux/arm/Makefile.arch
17+++ b/libc/sysdeps/linux/arm/Makefile.arch
18@@ -13,7 +13,9 @@ SSRC := \
19 vfork.S clone.S
20
21 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
22-SSRC += libc-aeabi_read_tp.S libc-thumb_atomics.S
23+SSRC += libc-thumb_atomics.S
24+libc-nonshared-y += $(ARCH_OUT)/libc-aeabi_read_tp.os
25+libc-static-y += $(ARCH_OUT)/libc-aeabi_read_tp.o
26 endif
27
28 ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
29--
301.7.9.5
31
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
new file mode 100644
index 0000000000..297a40bd04
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
@@ -0,0 +1,74 @@
1From d021e6252b33e779857846714fb1899a25c9965d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 15:59:01 -0700
4Subject: [PATCH] nptl/atfork: Hide pthread_atfork in shared versions
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8---
9 libpthread/nptl/Makefile.in | 4 +++-
10 libpthread/nptl/pthread_atfork.c | 12 ++++++++++--
11 2 files changed, 13 insertions(+), 3 deletions(-)
12
13diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
14index 158bcae..3ef7175 100644
15--- a/libpthread/nptl/Makefile.in
16+++ b/libpthread/nptl/Makefile.in
17@@ -16,6 +16,7 @@ libc-shared-routines-y = forward.c libc-cancellation.c
18 libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
19 libpthread-shared-only-routines-y = version.c
20 libpthread-static-only-routines-y = pthread_atfork.c
21+
22 libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
23 libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
24 libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
25@@ -208,7 +209,7 @@ CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
26 CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
27
28 CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
29-
30+CFLAGS-pthread_atfork.c = -DNOT_IN_libc
31 #
32 # The rest of this file is uClibc specific.
33 #
34@@ -224,3 +225,4 @@ CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-nptl)
35 CFLAGS-OMIT-forward.c = $(CFLAGS-nptl)
36 CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-nptl)
37 CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-nptl)
38+
39diff --git a/libpthread/nptl/pthread_atfork.c b/libpthread/nptl/pthread_atfork.c
40index e607d49..6224c17 100644
41--- a/libpthread/nptl/pthread_atfork.c
42+++ b/libpthread/nptl/pthread_atfork.c
43@@ -38,13 +38,17 @@
44 #include <fork.h>
45
46 /* This is defined by newer gcc version unique for each module. */
47-extern void *__dso_handle __attribute__ ((__weak__));
48- //,__visibility__ ("hidden")));
49+extern void *__dso_handle __attribute__ ((__weak__,
50+ __visibility__ ("hidden")));
51
52
53 /* Hide the symbol so that no definition but the one locally in the
54 executable or DSO is used. */
55 int
56+#ifndef __pthread_atfork
57+/* Don't mark the compatibility function as hidden. */
58+attribute_hidden
59+#endif
60 __pthread_atfork (
61 void (*prepare) (void),
62 void (*parent) (void),
63@@ -53,4 +57,8 @@ __pthread_atfork (
64 return __register_atfork (prepare, parent, child,
65 &__dso_handle == NULL ? NULL : __dso_handle);
66 }
67+#ifndef __pthread_atfork
68+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
69+ void (*child) (void)) attribute_hidden;
70 strong_alias (__pthread_atfork, pthread_atfork)
71+#endif
72--
731.7.9.5
74
diff --git a/meta/recipes-core/uclibc/uclibc-git/define-MSG_CMSG_CLOEXEC.patch b/meta/recipes-core/uclibc/uclibc-git/define-MSG_CMSG_CLOEXEC.patch
new file mode 100644
index 0000000000..4e900f3931
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/define-MSG_CMSG_CLOEXEC.patch
@@ -0,0 +1,25 @@
1Add definition of MSG_WAITFORONE and MSG_CMSG_CLOEXEC
2
3Upstream-Status: Pending
4
5Index: git/libc/sysdeps/linux/common/bits/socket.h
6===================================================================
7--- git.orig/libc/sysdeps/linux/common/bits/socket.h 2012-01-26 23:23:21.537456132 -0800
8+++ git/libc/sysdeps/linux/common/bits/socket.h 2012-01-26 23:25:10.125461388 -0800
9@@ -235,8 +235,15 @@
10 #define MSG_ERRQUEUE MSG_ERRQUEUE
11 MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
12 #define MSG_NOSIGNAL MSG_NOSIGNAL
13- MSG_MORE = 0x8000 /* Sender will send more. */
14+ MSG_MORE = 0x8000, /* Sender will send more. */
15 #define MSG_MORE MSG_MORE
16+ MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/
17+#define MSG_WAITFORONE MSG_WAITFORONE
18+
19+ MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file
20+ descriptor received through
21+ SCM_RIGHTS. */
22+#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
23 };
24
25
diff --git a/meta/recipes-core/uclibc/uclibc-git/dup3.patch b/meta/recipes-core/uclibc/uclibc-git/dup3.patch
new file mode 100644
index 0000000000..481f23b2c4
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/dup3.patch
@@ -0,0 +1,37 @@
1Implement dup3()
2
3Upstream-Status: Pending
4
5Index: git/libc/sysdeps/linux/common/dup3.c
6===================================================================
7--- /dev/null 1970-01-01 00:00:00.000000000 +0000
8+++ git/libc/sysdeps/linux/common/dup3.c 2012-01-27 07:40:52.802900849 -0800
9@@ -0,0 +1,15 @@
10+/* vi: set sw=4 ts=4: */
11+/*
12+ * dup3() for uClibc
13+ *
14+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
15+ *
16+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
17+ */
18+
19+#include <sys/syscall.h>
20+#include <unistd.h>
21+
22+
23+_syscall3(int, dup3, int, oldfd, int, newfd, int, flags)
24+libc_hidden_def(dup3)
25Index: git/include/unistd.h
26===================================================================
27--- git.orig/include/unistd.h 2012-01-27 01:19:17.521792781 -0800
28+++ git/include/unistd.h 2012-01-27 07:40:03.106898447 -0800
29@@ -512,6 +512,8 @@
30 /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
31 extern int dup2 (int __fd, int __fd2) __THROW;
32 libc_hidden_proto(dup2)
33+extern int dup3 (int __fd, int __fd2, int __flags) __THROW;
34+libc_hidden_proto(dup3)
35
36 /* NULL-terminated array of "NAME=VALUE" environment variables. */
37 extern char **__environ;
diff --git a/meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch b/meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch
new file mode 100644
index 0000000000..46448babcb
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/posix_fallocate.patch
@@ -0,0 +1,408 @@
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/utmp-locking.patch b/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch
deleted file mode 100644
index 85efaf2260..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch
+++ /dev/null
@@ -1,106 +0,0 @@
1diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
2index 136ac69..a35bb2b 100644
3--- a/libc/misc/utmp/utent.c
4+++ b/libc/misc/utmp/utent.c
5@@ -34,7 +34,7 @@ static const char default_file_name[] = _PATH_UTMP;
6 static const char *static_ut_name = default_file_name;
7
8 /* This function must be called with the LOCK held */
9-static void __setutent_nolock(void)
10+static void __setutent_unlocked(void)
11 {
12 if (static_fd < 0) {
13 static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
14@@ -56,12 +56,12 @@ static void __setutent_nolock(void)
15 static void __setutent(void)
16 {
17 __UCLIBC_MUTEX_LOCK(utmplock);
18- __setutent_nolock();
19+ __setutent_unlocked();
20 __UCLIBC_MUTEX_UNLOCK(utmplock);
21 }
22 #else
23 static void __setutent(void);
24-strong_alias(__setutent_nolock,__setutent)
25+strong_alias(__setutent_unlocked,__setutent)
26 #endif
27 strong_alias(__setutent,setutent)
28
29@@ -70,7 +70,7 @@ strong_alias(__setutent,setutxent)
30 #endif
31
32 /* This function must be called with the LOCK held */
33-static struct utmp *__getutent_lock(void)
34+static struct utmp *__getutent_unlocked(void)
35 {
36 if (static_fd < 0) {
37 __setutent();
38@@ -91,13 +91,13 @@ static struct utmp *__getutent(void)
39 struct utmp *ret;
40
41 __UCLIBC_MUTEX_LOCK(utmplock);
42- ret = __getutent_lock();
43+ ret = __getutent_unlocked();
44 __UCLIBC_MUTEX_UNLOCK(utmplock);
45 return ret;
46 }
47 #else
48 static struct utmp *__getutent(void);
49-strong_alias(__getutent_lock,__getutent)
50+strong_alias(__getutent_unlocked,__getutent)
51 #endif
52 strong_alias(__getutent,getutent)
53
54@@ -123,7 +123,7 @@ strong_alias(__endutent,endutxent)
55 #endif
56
57 /* This function must be called with the LOCK held */
58-static struct utmp *__getutid_lock(const struct utmp *utmp_entry)
59+static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
60 {
61 struct utmp *lutmp;
62 unsigned type;
63@@ -133,7 +133,7 @@ static struct utmp *__getutid_lock(const struct utmp *utmp_entry)
64 type = utmp_entry->ut_type - 1;
65 type /= 4;
66
67- while ((lutmp = __getutent()) != NULL) {
68+ while ((lutmp = __getutent_unlocked()) != NULL) {
69 if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
70 /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
71 return lutmp;
72@@ -152,13 +152,13 @@ static struct utmp *__getutid(const struct utmp *utmp_entry)
73 struct utmp *ret;
74
75 __UCLIBC_MUTEX_LOCK(utmplock);
76- ret = __getutid_lock(utmp_entry);
77+ ret = __getutid_unlocked(utmp_entry);
78 __UCLIBC_MUTEX_UNLOCK(utmplock);
79 return ret;
80 }
81 #else
82 static struct utmp *__getutid(const struct utmp *utmp_entry);
83-strong_alias(__getutid_lock,__getutid)
84+strong_alias(__getutid_unlocked,__getutid)
85 #endif
86 strong_alias(__getutid,getutid)
87
88@@ -174,7 +174,7 @@ static struct utmp *__getutline(const struct utmp *utmp_entry)
89 struct utmp *lutmp;
90
91 __UCLIBC_MUTEX_LOCK(utmplock);
92- while ((lutmp = __getutent()) != NULL) {
93+ while ((lutmp = __getutent_unlocked()) != NULL) {
94 if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
95 if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
96 break;
97@@ -200,7 +200,7 @@ static struct utmp *__pututline(const struct utmp *utmp_entry)
98 the file pointer where they want it, everything will work out. */
99 lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
100
101- if (__getutid(utmp_entry) != NULL)
102+ if (__getutid_unlocked(utmp_entry) != NULL)
103 lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
104 else
105 lseek(static_fd, (off_t) 0, SEEK_END);
106