aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2014-09-21 18:09:48 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2014-09-21 18:12:05 +0200
commit83bbb8b1c0a5259a2ecee39050da44378055c171 (patch)
tree0583e8621764cee3d6d28c12640fc44ce40708fc /testing
parentea9df32c7720f059b7665cd48c5a18c3e4daea1f (diff)
downloadaports-83bbb8b1c0a5259a2ecee39050da44378055c171.tar.bz2
aports-83bbb8b1c0a5259a2ecee39050da44378055c171.tar.xz
testing/zfs-grsec: fix build on musl
thanks to stef: https://github.com/zfsonlinux/zfs/pull/2699
Diffstat (limited to 'testing')
-rw-r--r--testing/zfs-grsec/APKBUILD25
-rw-r--r--testing/zfs-grsec/musl-fixes.patch620
-rw-r--r--testing/zfs-grsec/timestamp.patch16
-rw-r--r--testing/zfs-grsec/timestruct.patch32
4 files changed, 289 insertions, 404 deletions
diff --git a/testing/zfs-grsec/APKBUILD b/testing/zfs-grsec/APKBUILD
index 32df557481..3eefa90803 100644
--- a/testing/zfs-grsec/APKBUILD
+++ b/testing/zfs-grsec/APKBUILD
@@ -27,20 +27,17 @@ pkgver=$_kver
pkgrel=$(($_kpkgrel + $_mypkgrel))
pkgdesc="ZFS for Linux"
url="http://zfsonlinux.org"
-#arch="x86 x86_64"
-arch=
+arch="x86 x86_64"
license="CDDL"
depends="spl-$_flavor"
-depends_dev="glib-dev e2fsprogs-dev util-linux-dev
+depends_dev="glib-dev e2fsprogs-dev util-linux-dev libtirpc-dev
linux-$_flavor-dev=$_kernelver spl-$_flavor-dev"
makedepends="$depends_dev automake autoconf libtool"
install=""
subpackages="$pkgname-dev $pkgname-utils"
source="http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-$_realver.tar.gz
- musl-fixes.patch
- timestamp.patch
- timestruct.patch
- "
+ musl-fixes.patch
+ "
_builddir="$srcdir/$_realname-$_realver"
@@ -57,7 +54,9 @@ prepare() {
build() {
cd "$_builddir"
./autogen.sh || return 1
+ export LIBS="$LIBS -lintl"
./configure --prefix=/usr \
+ --enable-musl \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
@@ -103,14 +102,8 @@ utils() {
}
md5sums="5bcc32c122934d421eba68e16826637d zfs-0.6.3.tar.gz
-58992bd34b25f894f2da802d4000b07d musl-fixes.patch
-9621735b802e34d792b03ef89727f6ea timestamp.patch
-178af5841df53424ca0539028f318ad7 timestruct.patch"
+4404dbff2e698de684b15f9f532f96ad musl-fixes.patch"
sha256sums="29bcfdd4161521692d2ca2515ad27a9edd9491c9cb5c6fb1e923d8eed28d391b zfs-0.6.3.tar.gz
-524cd01790837c025b1caf0fa7706bb7925723128649771f5e0bc2a0ebc1775b musl-fixes.patch
-74924b471c2a83831f274b876c1d4f293f1e142089f34fccd19ae60b59066661 timestamp.patch
-f70680c25f78e501d676af7260f024fba02847c6176d4e00cc9659c9e3a4c1a5 timestruct.patch"
+aff6fd65b486a9a58239c4afcf0f07d07085778cc7f9eb04e6c390e1e21019f5 musl-fixes.patch"
sha512sums="fdeaa6ad4a899196b165473eb3b33b30f1a6020ab112331a3f92ff2f15fd3438b1ef3908b2c445ba2c114be0f96e73797f8985c9c6738f49980410e7e2a4d2cd zfs-0.6.3.tar.gz
-5a940776ba2a69ba072d9a2d223b9ac09fe7e5fd0a6356ecf1cb384e7f91943cdbdd095ec3ca9951e3c20e9eb92f65a1398883324d4544e115f18c8506bd53aa musl-fixes.patch
-2cb675e4603ea4aa951c7da2c57374bb404d52ee4fd04c719479ff07a3cf50c1d6f4b7cd2398c20327127fe81d47fcfa2ed95d18f05acd59f1ee8115334aabd2 timestamp.patch
-32346cdce1f52db36c469682718368c47b3f5b9acf40d3a27444f9dc69b29f512a385881bb92f8fade670eb71ce4d55fe914f33c025534a0e31773905229d019 timestruct.patch"
+1ab57b69e0c07fa8adc5b18f0d0400d1016c4debc2eebb734a31eb4c6b86f51376fa796e92d845c958987f328cc085a8ed2c4b499213b6b62d5e7f5f445f2d4b musl-fixes.patch"
diff --git a/testing/zfs-grsec/musl-fixes.patch b/testing/zfs-grsec/musl-fixes.patch
index 702741beeb..538274ee5b 100644
--- a/testing/zfs-grsec/musl-fixes.patch
+++ b/testing/zfs-grsec/musl-fixes.patch
@@ -1,7 +1,16 @@
-diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
-index 6cb23d1..cf92b86 100644
---- a/cmd/mount_zfs/mount_zfs.c
-+++ b/cmd/mount_zfs/mount_zfs.c
+diff -urw src/zfs-0.6.3/cmd/mount_zfs/Makefile.am src.new/cmd/mount_zfs/Makefile.am
+--- src/zfs-0.6.3/cmd/mount_zfs/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/mount_zfs/Makefile.am 2014-09-13 18:40:03.625178898 +0000
+@@ -19,4 +19,5 @@
+ $(top_builddir)/lib/libuutil/libuutil.la \
+ $(top_builddir)/lib/libzpool/libzpool.la \
+ $(top_builddir)/lib/libzfs/libzfs.la \
+- $(top_builddir)/lib/libzfs_core/libzfs_core.la
++ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
++ $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/cmd/mount_zfs/mount_zfs.c src.new/cmd/mount_zfs/mount_zfs.c
+--- src/zfs-0.6.3/cmd/mount_zfs/mount_zfs.c 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/mount_zfs/mount_zfs.c 2014-09-13 18:40:03.625178898 +0000
@@ -31,6 +31,7 @@
#include <sys/stat.h>
#include <libzfs.h>
@@ -10,88 +19,189 @@ index 6cb23d1..cf92b86 100644
libzfs_handle_t *g_zfs;
-diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
-index ec2a7de..6424ae5 100644
---- a/include/sys/zfs_context.h
-+++ b/include/sys/zfs_context.h
-@@ -1,31 +1,30 @@
- /*
- * CDDL HEADER START
- *
-- * The contents of this file are subject to the terms of the
-- * Common Development and Distribution License (the "License").
-- * You may not use this file except in compliance with the License.
-+ * The contents of this file are subject to the terms of the Common Development
-+ * and Distribution License (the "License"). You may not use this file except
-+ * in compliance with the License.
- *
-- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-- * or http://www.opensolaris.org/os/licensing.
-- * See the License for the specific language governing permissions
-- * and limitations under the License.
-+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or
-+ * http://www.opensolaris.org/os/licensing. See the License for the specific
-+ * language governing permissions and limitations under the License.
- *
-- * When distributing Covered Code, include this CDDL HEADER in each
-- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-- * If applicable, add the following below this CDDL HEADER, with the
-- * fields enclosed by brackets "[]" replaced with your own identifying
-- * information: Portions Copyright [yyyy] [name of copyright owner]
-+ * When distributing Covered Code, include this CDDL HEADER in each file and
-+ * include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add
-+ * the following below this CDDL HEADER, with the fields enclosed by brackets
-+ * "[]" replaced with your own identifying information: Portions Copyright
-+ * [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
- /*
-- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-- * Use is subject to license terms.
-+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject
-+ * to license terms.
- */
+diff -urw src/zfs-0.6.3/cmd/zdb/Makefile.am src.new/cmd/zdb/Makefile.am
+--- src/zfs-0.6.3/cmd/zdb/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zdb/Makefile.am 2014-09-13 18:40:03.679346705 +0000
+@@ -17,4 +17,4 @@
+ $(top_builddir)/lib/libzfs/libzfs.la \
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la
+
+-zdb_LDADD += $(ZLIB)
++zdb_LDADD += $(ZLIB) $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/cmd/zed/Makefile.am src.new/cmd/zed/Makefile.am
+--- src/zfs-0.6.3/cmd/zed/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zed/Makefile.am 2014-09-13 18:40:03.585455839 +0000
+@@ -26,7 +26,8 @@
+ $(top_builddir)/lib/libavl/libavl.la \
+ $(top_builddir)/lib/libnvpair/libnvpair.la \
+ $(top_builddir)/lib/libspl/libspl.la \
+- $(top_builddir)/lib/libzfs/libzfs.la
++ $(top_builddir)/lib/libzfs/libzfs.la \
++ $(TIRPC_LIBS)
+
+ zedconfdir = $(sysconfdir)/zfs/zed.d
+
+diff -urw src/zfs-0.6.3/cmd/zfs/Makefile.am src.new/cmd/zfs/Makefile.am
+--- src/zfs-0.6.3/cmd/zfs/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zfs/Makefile.am 2014-09-13 18:40:03.701013827 +0000
+@@ -19,5 +19,5 @@
+ $(top_builddir)/lib/libzfs/libzfs.la \
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la
+
+-zfs_LDADD += $(ZLIB)
++zfs_LDADD += $(ZLIB) $(TIRPC_LIBS)
+ zfs_LDFLAGS = -pthread
+diff -urw src/zfs-0.6.3/cmd/zhack/Makefile.am src.new/cmd/zhack/Makefile.am
+--- src/zfs-0.6.3/cmd/zhack/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zhack/Makefile.am 2014-09-13 18:40:03.679346705 +0000
+@@ -16,4 +16,4 @@
+ $(top_builddir)/lib/libzfs/libzfs.la \
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la
+
+-zhack_LDADD += $(ZLIB)
++zhack_LDADD += $(ZLIB) $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/cmd/zinject/Makefile.am src.new/cmd/zinject/Makefile.am
+--- src/zfs-0.6.3/cmd/zinject/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zinject/Makefile.am 2014-09-13 18:40:03.679346705 +0000
+@@ -16,4 +16,5 @@
+ $(top_builddir)/lib/libuutil/libuutil.la \
+ $(top_builddir)/lib/libzpool/libzpool.la \
+ $(top_builddir)/lib/libzfs/libzfs.la \
+- $(top_builddir)/lib/libzfs_core/libzfs_core.la
++ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
++ $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/cmd/zpool/Makefile.am src.new/cmd/zpool/Makefile.am
+--- src/zfs-0.6.3/cmd/zpool/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zpool/Makefile.am 2014-09-13 18:40:03.679346705 +0000
+@@ -19,4 +19,4 @@
+ $(top_builddir)/lib/libzpool/libzpool.la \
+ $(top_builddir)/lib/libzfs/libzfs.la \
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la \
+- $(LIBBLKID)
++ $(LIBBLKID) $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/cmd/zstreamdump/Makefile.am src.new/cmd/zstreamdump/Makefile.am
+--- src/zfs-0.6.3/cmd/zstreamdump/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/zstreamdump/Makefile.am 2014-09-13 18:40:03.581844652 +0000
+@@ -16,4 +16,4 @@
+ $(top_builddir)/lib/libzfs/libzfs.la \
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la
+
+-zstreamdump_LDADD += $(ZLIB)
++zstreamdump_LDADD += $(ZLIB) $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/cmd/ztest/Makefile.am src.new/cmd/ztest/Makefile.am
+--- src/zfs-0.6.3/cmd/ztest/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/cmd/ztest/Makefile.am 2014-09-13 18:40:03.679346705 +0000
+@@ -18,4 +18,4 @@
+ $(top_builddir)/lib/libzfs/libzfs.la \
+ $(top_builddir)/lib/libzfs_core/libzfs_core.la
+
+-ztest_LDADD += -lm -ldl
++ztest_LDADD += -lm -ldl $(TIRPC_LIBS)
+diff -urw src/zfs-0.6.3/config/user.m4 src.new/config/user.m4
+--- src/zfs-0.6.3/config/user.m4 2014-06-12 20:58:09.000000000 +0000
++++ src.new/config/user.m4 2014-09-13 18:40:03.766015196 +0000
+@@ -13,6 +13,7 @@
+ ZFS_AC_CONFIG_USER_LIBBLKID
+ ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
+ ZFS_AC_CONFIG_USER_RUNSTATEDIR
++ ZFS_AC_CONFIG_USER_MUSL
+ dnl #
+ dnl # Checks for library functions
+ AC_CHECK_FUNCS([mlockall])
+diff -urw src/zfs-0.6.3/include/sys/nvpair.h src.new/include/sys/nvpair.h
+--- src/zfs-0.6.3/include/sys/nvpair.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/include/sys/nvpair.h 2014-09-13 18:40:03.802127067 +0000
+@@ -132,7 +132,7 @@
+ } nv_alloc_t;
+
+ struct nv_alloc_ops {
+- int (*nv_ao_init)(nv_alloc_t *, __va_list);
++ int (*nv_ao_init)(nv_alloc_t *, va_list);
+ void (*nv_ao_fini)(nv_alloc_t *);
+ void *(*nv_ao_alloc)(nv_alloc_t *, size_t);
+ void (*nv_ao_free)(nv_alloc_t *, void *, size_t);
+diff -urw src/zfs-0.6.3/include/sys/zfs_context.h src.new/include/sys/zfs_context.h
+--- src/zfs-0.6.3/include/sys/zfs_context.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/include/sys/zfs_context.h 2014-09-13 18:40:03.809349441 +0000
+@@ -118,6 +118,10 @@
+ #include <sys/sunddi.h>
+ #include <sys/debug.h>
+
++#ifndef RLIM64_INFINITY
++#define RLIM64_INFINITY (~0ULL)
++#endif
++
/*
-- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
-- * Copyright (c) 2013 by Delphix. All rights reserved.
-+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. Copyright (c)
-+ * 2012, Joyent, Inc. All rights reserved. Copyright (c) 2013 by Delphix. All
-+ * rights reserved.
+ * Stack
*/
-
- #ifndef _SYS_ZFS_CONTEXT_H
-@@ -614,12 +613,12 @@ extern void delay(clock_t ticks);
+@@ -148,9 +152,9 @@
+ extern void __dprintf(const char *file, const char *func,
+ int line, const char *fmt, ...);
+ extern void cmn_err(int, const char *, ...);
+-extern void vcmn_err(int, const char *, __va_list);
++extern void vcmn_err(int, const char *, va_list);
+ extern void panic(const char *, ...);
+-extern void vpanic(const char *, __va_list);
++extern void vpanic(const char *, va_list);
+
+ #define fm_panic panic
+
+@@ -614,7 +618,11 @@
#define minclsyspri 60
#define maxclsyspri 99
--#define CPU_SEQID (pthread_self() & (max_ncpus - 1))
-+#define CPU_SEQID ((long long)pthread_self() & (max_ncpus - 1))
++#ifdef HAVE_MUSL
++#define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1))
++#else
+ #define CPU_SEQID (pthread_self() & (max_ncpus - 1))
++#endif
#define kcred NULL
#define CRED() NULL
-
--#define ptob(x) ((x) * PAGESIZE)
-+#define ptob(x) ((x) * SPL_PAGESIZE)
-
- extern uint64_t physmem;
-
-diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h
-index d749d1e..4791dcf 100644
---- a/lib/libspl/include/assert.h
-+++ b/lib/libspl/include/assert.h
-@@ -42,6 +42,17 @@ __assert_c99(const char *expr, const char *file, int line, const char *func)
+diff -urw src/zfs-0.6.3/lib/libnvpair/Makefile.am src.new/lib/libnvpair/Makefile.am
+--- src/zfs-0.6.3/lib/libnvpair/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libnvpair/Makefile.am 2014-09-13 18:40:03.711847389 +0000
+@@ -1,6 +1,6 @@
+ include $(top_srcdir)/config/Rules.am
+
+-AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
++AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) $(TIRPC_CFLAGS)
+
+ DEFAULT_INCLUDES += \
+ -I$(top_srcdir)/include \
+diff -urw src/zfs-0.6.3/lib/libspl/Makefile.am src.new/lib/libspl/Makefile.am
+--- src/zfs-0.6.3/lib/libspl/Makefile.am 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/Makefile.am 2014-09-13 18:40:03.722680950 +0000
+@@ -1,12 +1,12 @@
+ include $(top_srcdir)/config/Rules.am
+
+-AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
++AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN) $(TIRPC_CFLAGS)
+
+ SUBDIRS = include $(TARGET_ASM_DIR)
+ DIST_SUBDIRS = include asm-generic asm-i386 asm-x86_64
+
+ DEFAULT_INCLUDES += \
+- -I$(top_srcdir)/lib/libspl/include
++ -I$(top_srcdir)/lib/libspl/include $(TIRPC_CFLAGS)
+
+ AM_CCASFLAGS = \
+ -I$(top_srcdir)/lib/libspl/include
+@@ -30,4 +30,4 @@
+ $(top_srcdir)/lib/libspl/include/sys/list.h \
+ $(top_srcdir)/lib/libspl/include/sys/list_impl.h
+
+-libspl_la_LIBADD = -lrt
++libspl_la_LIBADD = -lrt $(TIRPC_LDFLAGS)
+diff -urw src/zfs-0.6.3/lib/libspl/include/assert.h src.new/lib/libspl/include/assert.h
+--- src/zfs-0.6.3/lib/libspl/include/assert.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/assert.h 2014-09-13 18:40:03.755181634 +0000
+@@ -42,6 +42,12 @@
}
#endif /* __assert_c99 */
+#ifndef __assert
-+static inline void
-+__assert(const char *expr, const char *file, int line)
-+{
-+ fprintf(stderr, "%s:%i: %s: Assertion failed.\n", file, line, expr);
-+ abort();
-+}
++#define __assert(expr, file, line) abort()
+#else
+extern void __assert(const char *, const char *, int);
+#endif
@@ -99,7 +209,7 @@ index d749d1e..4791dcf 100644
#ifndef verify
#if defined(__STDC__)
#if __STDC_VERSION__ - 0 >= 199901L
-@@ -61,8 +72,6 @@ __assert_c99(const char *expr, const char *file, int line, const char *func)
+@@ -61,8 +67,6 @@
#define VERIFY verify
#define ASSERT assert
@@ -108,27 +218,21 @@ index d749d1e..4791dcf 100644
/* BEGIN CSTYLED */
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
const TYPE __left = (TYPE)(LEFT); \
-diff --git a/lib/libspl/include/devid.h b/lib/libspl/include/devid.h
-index 5406c33..1675cfd 100644
---- a/lib/libspl/include/devid.h
-+++ b/lib/libspl/include/devid.h
-@@ -29,6 +29,11 @@
+diff -urw src/zfs-0.6.3/lib/libspl/include/devid.h src.new/lib/libspl/include/devid.h
+--- src/zfs-0.6.3/lib/libspl/include/devid.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/devid.h 2014-09-13 18:40:03.722680950 +0000
+@@ -28,6 +28,7 @@
+ #define _LIBSPL_DEVID_H
#include <stdlib.h>
++#include <sys/types.h>
-+#if !defined(__DEFINED_dev_t)
-+#define __NEED_dev_t
-+#include <bits/alltypes.h>
-+#endif
-+
typedef int ddi_devid_t;
- typedef struct devid_nmlist {
-diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h
-index 99500d6..27e7590 100644
---- a/lib/libspl/include/rpc/xdr.h
-+++ b/lib/libspl/include/rpc/xdr.h
-@@ -60,6 +60,8 @@ typedef struct xdr_bytesrec {
+diff -urw src/zfs-0.6.3/lib/libspl/include/rpc/xdr.h src.new/lib/libspl/include/rpc/xdr.h
+--- src/zfs-0.6.3/lib/libspl/include/rpc/xdr.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/rpc/xdr.h 2014-09-13 18:40:03.737125699 +0000
+@@ -60,6 +60,8 @@
#define XDR_RDMAGET 4
#define XDR_RDMASET 5
@@ -137,55 +241,38 @@ index 99500d6..27e7590 100644
+#endif
#endif
-diff --git a/lib/libspl/include/sys/inttypes.h b/lib/libspl/include/sys/inttypes.h
-index d7d0639..9707fa2 100644
---- a/lib/libspl/include/sys/inttypes.h
-+++ b/lib/libspl/include/sys/inttypes.h
-@@ -30,5 +30,9 @@
- #include <inttypes.h>
+diff -urw src/zfs-0.6.3/lib/libspl/include/sys/inttypes.h src.new/lib/libspl/include/sys/inttypes.h
+--- src/zfs-0.6.3/lib/libspl/include/sys/inttypes.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/sys/inttypes.h 2014-09-13 18:40:03.751570447 +0000
+@@ -31,4 +31,8 @@
#define _INT64_TYPE
+
+#ifndef RLIM64_INFINITY
+#define RLIM64_INFINITY (~0ULL)
+#endif
+
-
#endif
-diff --git a/lib/libspl/include/sys/param.h b/lib/libspl/include/sys/param.h
-index 4090cef..de408e2 100644
---- a/lib/libspl/include/sys/param.h
-+++ b/lib/libspl/include/sys/param.h
-@@ -57,6 +57,6 @@
+diff -urw src/zfs-0.6.3/lib/libspl/include/sys/param.h src.new/lib/libspl/include/sys/param.h
+--- src/zfs-0.6.3/lib/libspl/include/sys/param.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/sys/param.h 2014-09-13 18:40:03.755181634 +0000
+@@ -57,6 +57,12 @@
#define MAXUID UINT32_MAX /* max user id */
#define MAXPROJID MAXUID /* max project id */
-#define PAGESIZE (sysconf(_SC_PAGESIZE))
-+#define SPL_PAGESIZE (sysconf(_SC_PAGESIZE))
++#ifndef PAGESIZE
++#define PAGESIZE PAGE_SIZE
++#endif
++
++#ifndef HZ
++#define HZ 100
++#endif
#endif
-diff --git a/lib/libspl/include/sys/sysmacros.h b/lib/libspl/include/sys/sysmacros.h
-index 698b0a7..1530177 100644
---- a/lib/libspl/include/sys/sysmacros.h
-+++ b/lib/libspl/include/sys/sysmacros.h
-@@ -66,11 +66,11 @@
- * that the result is correctly calculated based on the data type of (x),
- * which is passed in as the last argument, regardless of the data
- * type of the alignment. For example, if (x) is of type uint64_t,
-- * and we want to round it up to a page boundary using "PAGESIZE" as
-+ * and we want to round it up to a page boundary using "SPL_PAGESIZE" as
- * the alignment, we can do either
-- * P2ROUNDUP(x, (uint64_t)PAGESIZE)
-+ * P2ROUNDUP(x, (uint64_t)SPL_PAGESIZE)
- * or
-- * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
-+ * P2ROUNDUP_TYPED(x, SPL_PAGESIZE, uint64_t)
- */
- #define P2ALIGN_TYPED(x, align, type) \
- ((type)(x) & -(type)(align))
-diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
-index f0da440..aa96c39 100644
---- a/lib/libspl/include/sys/time.h
-+++ b/lib/libspl/include/sys/time.h
+diff -urw src/zfs-0.6.3/lib/libspl/include/sys/time.h src.new/lib/libspl/include/sys/time.h
+--- src/zfs-0.6.3/lib/libspl/include/sys/time.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/sys/time.h 2014-09-13 18:40:03.755181634 +0000
@@ -58,6 +58,11 @@
#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
#endif
@@ -198,11 +285,18 @@ index f0da440..aa96c39 100644
extern hrtime_t gethrtime(void);
extern void gethrestime(timestruc_t *);
-diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h
-index bd34dec..e7e1e13 100644
---- a/lib/libspl/include/sys/types.h
-+++ b/lib/libspl/include/sys/types.h
-@@ -60,6 +60,7 @@ typedef long spgcnt_t; /* signed number of pages */
+diff -urw src/zfs-0.6.3/lib/libspl/include/sys/types.h src.new/lib/libspl/include/sys/types.h
+--- src/zfs-0.6.3/lib/libspl/include/sys/types.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/sys/types.h 2014-09-13 18:40:03.751570447 +0000
+@@ -30,7 +30,6 @@
+ #include <sys/isa_defs.h>
+ #include <sys/feature_tests.h>
+ #include_next <sys/types.h>
+-#include <sys/param.h> /* for NBBY */
+ #include <sys/types32.h>
+ #include <sys/va_list.h>
+
+@@ -60,6 +59,7 @@
typedef longlong_t hrtime_t;
typedef struct timespec timestruc_t;
typedef struct timespec timespec_t;
@@ -210,40 +304,42 @@ index bd34dec..e7e1e13 100644
typedef short pri_t;
-diff --git a/lib/libspl/include/sys/va_list.h b/lib/libspl/include/sys/va_list.h
-index 04ad148..bb011ba 100644
---- a/lib/libspl/include/sys/va_list.h
-+++ b/lib/libspl/include/sys/va_list.h
-@@ -29,7 +29,9 @@
+@@ -96,4 +96,6 @@
+ } lloff_t;
+ #endif
+
++#include <sys/param.h> /* for NBBY */
++
+ #endif
+diff -urw src/zfs-0.6.3/lib/libspl/include/sys/va_list.h src.new/lib/libspl/include/sys/va_list.h
+--- src/zfs-0.6.3/lib/libspl/include/sys/va_list.h 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/include/sys/va_list.h 2014-09-13 18:40:03.751570447 +0000
+@@ -29,8 +29,4 @@
#include <stdarg.h>
-#ifndef __va_list
-+#ifdef HAVE_MUSL
-+typedef void* __va_list;
-+#else
- typedef __gnuc_va_list __va_list;
+-typedef __gnuc_va_list __va_list;
+-#endif
+-
#endif
-
-diff --git a/lib/libspl/timestamp.c b/lib/libspl/timestamp.c
-index a4f4cf4..a177270 100644
---- a/lib/libspl/timestamp.c
-+++ b/lib/libspl/timestamp.c
+diff -urw src/zfs-0.6.3/lib/libspl/timestamp.c src.new/lib/libspl/timestamp.c
+--- src/zfs-0.6.3/lib/libspl/timestamp.c 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/timestamp.c 2014-09-13 18:40:03.722680950 +0000
@@ -28,6 +28,10 @@
#include <langinfo.h>
#include "statcommon.h"
+#ifndef _DATE_FMT
-+#define _DATE_FMT D_FMT
++#define _DATE_FMT "%+"
+#endif
+
/*
* Print timestamp as decimal reprentation of time_t value (-T u was specified)
* or in date(1) format (-T d was specified).
-diff --git a/lib/libspl/xdr.c b/lib/libspl/xdr.c
-index 288a338..c8a6fe3 100644
---- a/lib/libspl/xdr.c
-+++ b/lib/libspl/xdr.c
+diff -urw src/zfs-0.6.3/lib/libspl/xdr.c src.new/lib/libspl/xdr.c
+--- src/zfs-0.6.3/lib/libspl/xdr.c 2014-06-12 20:58:09.000000000 +0000
++++ src.new/lib/libspl/xdr.c 2014-09-13 18:40:03.722680950 +0000
@@ -29,6 +29,7 @@
* under license from the Regents of the University of California.
*/
@@ -252,47 +348,15 @@ index 288a338..c8a6fe3 100644
#include <rpc/xdr.h>
/*
-@@ -76,3 +77,4 @@ xdr_control(XDR *xdrs, int request, void *info)
+@@ -76,3 +77,4 @@
}
return (FALSE);
}
+#endif
-diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
-index 05bbd06..32e9607 100644
---- a/lib/libzpool/kernel.c
-+++ b/lib/libzpool/kernel.c
-@@ -180,7 +180,7 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
-
- VERIFY3S(pthread_attr_init(&attr), ==, 0);
- VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);
-- VERIFY3S(pthread_attr_setguardsize(&attr, PAGESIZE), ==, 0);
-+ VERIFY3S(pthread_attr_setguardsize(&attr, SPL_PAGESIZE), ==, 0);
- VERIFY3S(pthread_attr_setdetachstate(&attr, detachstate), ==, 0);
-
- VERIFY3S(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt),
-@@ -901,7 +901,7 @@ static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
- static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
-
- void
--vpanic(const char *fmt, va_list adx)
-+vpanic(const char *fmt, __va_list adx)
- {
- (void) fprintf(stderr, "error: ");
- (void) vfprintf(stderr, fmt, adx);
-@@ -921,7 +921,7 @@ panic(const char *fmt, ...)
- }
-
- void
--vcmn_err(int ce, const char *fmt, va_list adx)
-+vcmn_err(int ce, const char *fmt, __va_list adx)
- {
- if (ce == CE_PANIC)
- vpanic(fmt, adx);
-diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
-index f5c3166..750556b 100644
---- a/module/nvpair/nvpair.c
-+++ b/module/nvpair/nvpair.c
-@@ -3251,8 +3251,12 @@ nvs_xdr_nvpair(nvstream_t *nvs, nvpair_t *nvp, size_t *size)
+diff -urw src/zfs-0.6.3/module/nvpair/nvpair.c src.new/module/nvpair/nvpair.c
+--- src/zfs-0.6.3/module/nvpair/nvpair.c 2014-06-12 20:58:09.000000000 +0000
++++ src.new/module/nvpair/nvpair.c 2014-09-13 18:40:03.491564974 +0000
+@@ -3251,8 +3251,12 @@
return (0);
/* sanity check the size parameter */
@@ -305,10 +369,9 @@ index f5c3166..750556b 100644
if (*size > NVS_XDR_MAX_LEN(bytesrec.xc_num_avail))
return (EFAULT);
-diff --git a/module/zcommon/zfs_uio.c b/module/zcommon/zfs_uio.c
-index 90376f2..6eabecf 100644
---- a/module/zcommon/zfs_uio.c
-+++ b/module/zcommon/zfs_uio.c
+diff -urw src/zfs-0.6.3/module/zcommon/zfs_uio.c src.new/module/zcommon/zfs_uio.c
+--- src/zfs-0.6.3/module/zcommon/zfs_uio.c 2014-06-12 20:58:09.000000000 +0000
++++ src.new/module/zcommon/zfs_uio.c 2014-09-13 18:40:03.509620910 +0000
@@ -44,6 +44,7 @@
*/
#ifdef _KERNEL
@@ -317,151 +380,28 @@ index 90376f2..6eabecf 100644
#include <sys/types.h>
#include <sys/uio_impl.h>
-@@ -144,7 +145,7 @@ uio_prefaultpages(ssize_t n, struct uio *uio)
- bcopy(p, &tmp, 1);
- break;
- }
-- incr = MIN(cnt, PAGESIZE);
-+ incr = MIN(cnt, SPL_PAGESIZE);
- p += incr;
- cnt -= incr;
- }
-diff --git a/module/zfs/arc.c b/module/zfs/arc.c
-index 387faaf..e2aa10d 100644
---- a/module/zfs/arc.c
-+++ b/module/zfs/arc.c
-@@ -135,6 +135,7 @@
- #include <sys/vdev.h>
- #include <sys/vdev_impl.h>
- #include <sys/dsl_pool.h>
-+#include <linux/param.h>
- #ifdef _KERNEL
- #include <sys/vmsystm.h>
- #include <vm/anon.h>
-@@ -1002,7 +1003,7 @@ buf_init(void)
- * with an average 64K block size. The table will take up
- * totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers).
- */
-- while (hsize * 65536 < physmem * PAGESIZE)
-+ while (hsize * 65536 < physmem * SPL_PAGESIZE)
- hsize <<= 1;
- retry:
- buf_hash_table.ht_mask = hsize - 1;
-@@ -2500,7 +2501,7 @@ arc_adapt_thread(void)
-
- /* Allow the module options to be changed */
- if (zfs_arc_max > 64 << 20 &&
-- zfs_arc_max < physmem * PAGESIZE &&
-+ zfs_arc_max < physmem * SPL_PAGESIZE &&
- zfs_arc_max != arc_c_max)
- arc_c_max = zfs_arc_max;
-
-@@ -4087,7 +4088,7 @@ arc_init(void)
- zfs_arc_min_prefetch_lifespan = 1 * hz;
-
- /* Start out with 1/8 of all memory */
-- arc_c = physmem * PAGESIZE / 8;
-+ arc_c = physmem * SPL_PAGESIZE / 8;
-
- #ifdef _KERNEL
- /*
-@@ -4113,7 +4114,7 @@ arc_init(void)
- * Allow the tunables to override our calculations if they are
- * reasonable (ie. over 64MB)
- */
-- if (zfs_arc_max > 64<<20 && zfs_arc_max < physmem * PAGESIZE)
-+ if (zfs_arc_max > 64<<20 && zfs_arc_max < physmem * SPL_PAGESIZE)
- arc_c_max = zfs_arc_max;
- if (zfs_arc_min > 0 && zfs_arc_min <= arc_c_max)
- arc_c_min = zfs_arc_min;
-@@ -4212,11 +4213,11 @@ arc_init(void)
- * zfs_dirty_data_max_max (default 25% of physical memory).
- */
- if (zfs_dirty_data_max_max == 0)
-- zfs_dirty_data_max_max = physmem * PAGESIZE *
-+ zfs_dirty_data_max_max = physmem * SPL_PAGESIZE *
- zfs_dirty_data_max_max_percent / 100;
-
- if (zfs_dirty_data_max == 0) {
-- zfs_dirty_data_max = physmem * PAGESIZE *
-+ zfs_dirty_data_max = physmem * SPL_PAGESIZE *
- zfs_dirty_data_max_percent / 100;
- zfs_dirty_data_max = MIN(zfs_dirty_data_max,
- zfs_dirty_data_max_max);
-diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c
-index 4f17506..ef5fac6 100644
---- a/module/zfs/dbuf.c
-+++ b/module/zfs/dbuf.c
-@@ -302,7 +302,7 @@ dbuf_init(void)
- * with an average 4K block size. The table will take up
- * totalmem*sizeof(void*)/4K (i.e. 2MB/GB with 8-byte pointers).
- */
-- while (hsize * 4096 < physmem * PAGESIZE)
-+ while (hsize * 4096 < physmem * SPL_PAGESIZE)
- hsize <<= 1;
-
- retry:
-diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
-index 91f743a..d45aeda 100644
---- a/module/zfs/zfs_vnops.c
-+++ b/module/zfs/zfs_vnops.c
-@@ -364,7 +364,7 @@ update_pages(struct inode *ip, int64_t start, int len,
- * On Read: We "read" preferentially from memory mapped pages,
- * else we default from the dmu buffer.
- *
-- * NOTE: We will always "break up" the IO into PAGESIZE uiomoves when
-+ * NOTE: We will always "break up" the IO into SPL_PAGESIZE uiomoves when
- * the file is memory mapped.
- */
- static int
-@@ -4118,11 +4118,11 @@ zfs_fillpage(struct inode *ip, struct page *pl[], int nr_pages)
- */
- page_idx = 0;
- cur_pp = pl[0];
-- for (total = io_off + io_len; io_off < total; io_off += PAGESIZE) {
-+ for (total = io_off + io_len; io_off < total; io_off += SPL_PAGESIZE) {
- caddr_t va;
-
- va = kmap(cur_pp);
-- err = dmu_read(os, zp->z_id, io_off, PAGESIZE, va,
-+ err = dmu_read(os, zp->z_id, io_off, SPL_PAGESIZE, va,
- DMU_READ_PREFETCH);
- kunmap(cur_pp);
- if (err) {
-diff --git a/module/zfs/zio.c b/module/zfs/zio.c
-index 332d50c..8f9b0e7 100644
---- a/module/zfs/zio.c
-+++ b/module/zfs/zio.c
-@@ -133,13 +133,13 @@ zio_init(void)
- zio_link_cache = kmem_cache_create("zio_link_cache",
- sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
- zio_vdev_cache = kmem_cache_create("zio_vdev_cache", sizeof (vdev_io_t),
-- PAGESIZE, NULL, NULL, NULL, NULL, NULL, 0);
-+ SPL_PAGESIZE, NULL, NULL, NULL, NULL, NULL, 0);
-
- /*
- * For small buffers, we want a cache for each multiple of
- * SPA_MINBLOCKSIZE. For medium-size buffers, we want a cache
- * for each quarter-power of 2. For large buffers, we want
-- * a cache for each multiple of PAGESIZE.
-+ * a cache for each multiple of SPL_PAGESIZE.
- */
- for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) {
- size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
-@@ -156,13 +156,13 @@ zio_init(void)
- * kernel when modifying a non-watched buffer that shares the
- * page with a watched buffer.
- */
-- if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE))
-+ if (arc_watch && !IS_P2ALIGNED(size, SPL_PAGESIZE))
- continue;
- #endif
- if (size <= 4 * SPA_MINBLOCKSIZE) {
- align = SPA_MINBLOCKSIZE;
-- } else if (IS_P2ALIGNED(size, PAGESIZE)) {
-- align = PAGESIZE;
-+ } else if (IS_P2ALIGNED(size, SPL_PAGESIZE)) {
-+ align = SPL_PAGESIZE;
- } else if (IS_P2ALIGNED(size, p2 >> 2)) {
- align = p2 >> 2;
- }
+diff --git a/config/musl.m4 b/config/musl.m4
+new file mode 100644
+index 0000000..fb4d2c4
+--- /dev/null 2014-06-12 20:58:09.000000000 +0000
++++ src.new/config/musl.m4 2014-08-16 14:27:37.866666884 +0000
+@@ -0,0 +1,19 @@
++dnl
++dnl musl support
++dnl
++
++AC_DEFUN([ZFS_AC_CONFIG_USER_MUSL], [
++AH_TEMPLATE([HAVE_MUSL],
++ [Define to 1 if musl is being used as the C library])
++AH_TEMPLATE([HAVE_TIRPC],
++ [Define to 1 if libtirpc is being used as the RPC library])
++AC_ARG_ENABLE(musl,
++AC_HELP_STRING([--enable-musl], [compile with musl as the C library]),
++[if test x$enableval = xyes; then
++ AC_DEFINE([HAVE_MUSL], 1, [Define if you have musl])
++ PKG_CHECK_MODULES([TIRPC],[libtirpc])
++ AC_DEFINE([HAVE_TIRPC], 1, [Define if you have libtirpc])
++ AC_SUBST(TIRPC_CFLAGS)
++ AC_SUBST(TIRPC_LIBS)
++fi])
++])
diff --git a/testing/zfs-grsec/timestamp.patch b/testing/zfs-grsec/timestamp.patch
deleted file mode 100644
index 68a612faaf..0000000000
--- a/testing/zfs-grsec/timestamp.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-uclibc does not support _DATE_FMT, it seems to be a libc only thing
-not sure this will work, will need to take a closer look.
-http://pubs.opengroup.org/onlinepubs/007904975/basedefs/langinfo.h.html
-http://sources.redhat.com/ml/libc-alpha/2000-10/msg00298.html
-
---- ./lib/libspl/timestamp.c.orig
-+++ ./lib/libspl/timestamp.c
-@@ -40,7 +40,7 @@
-
- /* We only need to retrieve this once per invocation */
- if (fmt == NULL)
-- fmt = nl_langinfo(_DATE_FMT);
-+ fmt = nl_langinfo(D_FMT);
-
- if (timestamp_fmt == UDATE) {
- (void) printf("%ld\n", t);
diff --git a/testing/zfs-grsec/timestruct.patch b/testing/zfs-grsec/timestruct.patch
deleted file mode 100644
index a25b41b484..0000000000
--- a/testing/zfs-grsec/timestruct.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 6296d14f69d42e30fff089cc865f9f1b3c13b6c3 Mon Sep 17 00:00:00 2001
-From: stf <s@ctrlc.hu>
-Date: Tue, 10 Jun 2014 03:37:51 +0200
-Subject: [PATCH] sys/param.h depends on types defined in
- sys/types.h\n(hrtime_t & timestruc_t)
-
----
- lib/libspl/include/sys/types.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h
-index bd34dec..08cd0b4 100644
---- a/lib/libspl/include/sys/types.h
-+++ b/lib/libspl/include/sys/types.h
-@@ -30,7 +30,6 @@
- #include <sys/isa_defs.h>
- #include <sys/feature_tests.h>
- #include_next <sys/types.h>
--#include <sys/param.h> /* for NBBY */
- #include <sys/types32.h>
- #include <sys/va_list.h>
-
-@@ -96,4 +95,6 @@ typedef union {
- } lloff_t;
- #endif
-
-+#include <sys/param.h> /* for NBBY */
-+
- #endif
---
-1.9.3
-