summaryrefslogtreecommitdiff
path: root/filesystems/glusterfs
diff options
context:
space:
mode:
authormanu <manu>2010-08-26 14:26:18 +0000
committermanu <manu>2010-08-26 14:26:18 +0000
commit0e67b6066132074420b413a28815548e0d5002ab (patch)
treed5c567d833d90f892d3d73d48108f779cf87d437 /filesystems/glusterfs
parent6bfe2f6001734ba28b387bc1d3db6d8b30c45a07 (diff)
downloadpkgsrc-0e67b6066132074420b413a28815548e0d5002ab.tar.gz
This is an experimental port of glusterfs on NetBSD. Don't do this at home!
Diffstat (limited to 'filesystems/glusterfs')
-rw-r--r--filesystems/glusterfs/DESCR11
-rw-r--r--filesystems/glusterfs/MESSAGE.NetBSD7
-rw-r--r--filesystems/glusterfs/Makefile49
-rw-r--r--filesystems/glusterfs/PLIST72
-rw-r--r--filesystems/glusterfs/distinfo24
-rw-r--r--filesystems/glusterfs/patches/patch-aa16
-rw-r--r--filesystems/glusterfs/patches/patch-ab20
-rw-r--r--filesystems/glusterfs/patches/patch-ac19
-rw-r--r--filesystems/glusterfs/patches/patch-ad16
-rw-r--r--filesystems/glusterfs/patches/patch-ae52
-rw-r--r--filesystems/glusterfs/patches/patch-af16
-rw-r--r--filesystems/glusterfs/patches/patch-ag20
-rw-r--r--filesystems/glusterfs/patches/patch-an27
-rw-r--r--filesystems/glusterfs/patches/patch-ao27
-rw-r--r--filesystems/glusterfs/patches/patch-aq42
-rw-r--r--filesystems/glusterfs/patches/patch-ar17
-rw-r--r--filesystems/glusterfs/patches/patch-as17
-rw-r--r--filesystems/glusterfs/patches/patch-ax16
-rw-r--r--filesystems/glusterfs/patches/patch-ba46
-rw-r--r--filesystems/glusterfs/patches/patch-bb19
-rw-r--r--filesystems/glusterfs/patches/patch-bc60
-rw-r--r--filesystems/glusterfs/patches/patch-bd60
-rw-r--r--filesystems/glusterfs/patches/patch-be239
-rw-r--r--filesystems/glusterfs/patches/patch-bf32
24 files changed, 924 insertions, 0 deletions
diff --git a/filesystems/glusterfs/DESCR b/filesystems/glusterfs/DESCR
new file mode 100644
index 00000000000..34183e0b14c
--- /dev/null
+++ b/filesystems/glusterfs/DESCR
@@ -0,0 +1,11 @@
+GlusterFS is a flexible, powerful, POSIX-compliant cluster filesystem
+that can scale to several petabytes.
+
+GlusterFS works over either TCP/IP or high-performance Infiniband
+RDMA interconnect.
+
+GlusterFS provides striping and on-the-fly synchronous replication
+of files. GlusterFS has a fully distributed design, with no single
+point of failure.
+
+Please visit http://www.gluster.org/glusterfs.php for more info.
diff --git a/filesystems/glusterfs/MESSAGE.NetBSD b/filesystems/glusterfs/MESSAGE.NetBSD
new file mode 100644
index 00000000000..3bb90996f02
--- /dev/null
+++ b/filesystems/glusterfs/MESSAGE.NetBSD
@@ -0,0 +1,7 @@
+===========================================================================
+$NetBSD: MESSAGE.NetBSD,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+glusterfs on NetBSD is extremely experimental. Do not feed it with
+important data right now.
+
+===========================================================================
diff --git a/filesystems/glusterfs/Makefile b/filesystems/glusterfs/Makefile
new file mode 100644
index 00000000000..49d282d0edb
--- /dev/null
+++ b/filesystems/glusterfs/Makefile
@@ -0,0 +1,49 @@
+# $NetBSD: Makefile,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+#
+
+DISTNAME= glusterfs-3.0.5
+CATEGORIES= filesystems
+MASTER_SITES= http://ftp.gluster.com/pub/gluster/glusterfs/3.0/LATEST/
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://www.gluster.org/glusterfs.php
+COMMENT= Cluster filesystem
+LICENSE= gnu-gpl-v3
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+GNU_CONFIGURE= yes
+USE_LIBTOOL= yes
+PYTHON_VERSIONS_ACCEPTED= 26 25
+CONFIGURE_ARGS+= --localstatedir=${VARBASE}
+
+SUBST_CLASSES+= py
+SUBST_STAGE.py= post-build
+SUBST_FILES.py= extras/volgen/glusterfs-volgen
+SUBST_SED.py= -e "s,/usr/bin/python,${PYTHONBIN},g"
+
+SUBST_CLASSES+= bash
+SUBST_STAGE.bash= post-build
+SUBST_FILES.bash= xlators/mount/fuse/utils/mount.glusterfs
+SUBST_SED.bash= -e "s,/bin/bash,/bin/sh,g"
+
+
+REPLACE_PYTHON+= ${WRKSRC}/extras/volgen/glusterfs-volgen
+
+EGDIR= ${PREFIX}/etc/glusterfs
+CONF_FILES+= ${EGDIR}/glusterfs.vol.sample ${EGDIR}/glusterfs.vol
+CONF_FILES+= ${EGDIR}/glusterfsd.vol.sample ${EGDIR}/glusterfsd.vol
+OWN_DIRS+= ${VARBASE}/glusterfs
+BUILD_DEFS+= VARBASE
+
+post-install:
+ cp ${DESTDIR}/sbin/mount.glusterfs ${DESTDIR}/${PREFIX}/sbin/
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../lang/python/application.mk"
+.include "../../devel/flex/buildlink3.mk"
+.if ${OPSYS} == "NetBSD"
+.include "../../filesystems/perfuse/buildlink3.mk"
+.endif
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/filesystems/glusterfs/PLIST b/filesystems/glusterfs/PLIST
new file mode 100644
index 00000000000..f629a28256e
--- /dev/null
+++ b/filesystems/glusterfs/PLIST
@@ -0,0 +1,72 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+bin/glusterfs-volgen
+etc/glusterfs/glusterfs.vol.sample
+etc/glusterfs/glusterfsd.vol.sample
+lib/glusterfs/3.0.5/auth/addr.la
+lib/glusterfs/3.0.5/auth/login.la
+lib/glusterfs/3.0.5/scheduler/alu.la
+lib/glusterfs/3.0.5/scheduler/nufa.la
+lib/glusterfs/3.0.5/scheduler/random.la
+lib/glusterfs/3.0.5/scheduler/rr.la
+lib/glusterfs/3.0.5/scheduler/switch.la
+lib/glusterfs/3.0.5/transport/socket.la
+lib/glusterfs/3.0.5/xlator/cluster/afr.la
+lib/glusterfs/3.0.5/xlator/cluster/dht.la
+lib/glusterfs/3.0.5/xlator/cluster/distribute.so
+lib/glusterfs/3.0.5/xlator/cluster/nufa.la
+lib/glusterfs/3.0.5/xlator/cluster/replicate.so
+lib/glusterfs/3.0.5/xlator/cluster/stripe.la
+lib/glusterfs/3.0.5/xlator/cluster/switch.la
+lib/glusterfs/3.0.5/xlator/debug/error-gen.la
+lib/glusterfs/3.0.5/xlator/debug/io-stats.la
+lib/glusterfs/3.0.5/xlator/debug/trace.la
+lib/glusterfs/3.0.5/xlator/encryption/rot-13.la
+lib/glusterfs/3.0.5/xlator/features/locks.la
+lib/glusterfs/3.0.5/xlator/features/posix-locks.so
+lib/glusterfs/3.0.5/xlator/features/quota.la
+lib/glusterfs/3.0.5/xlator/legacy/cluster/unify.la
+lib/glusterfs/3.0.5/xlator/mount/fuse.la
+lib/glusterfs/3.0.5/xlator/performance/io-cache.la
+lib/glusterfs/3.0.5/xlator/performance/io-threads.la
+lib/glusterfs/3.0.5/xlator/performance/quick-read.la
+lib/glusterfs/3.0.5/xlator/performance/read-ahead.la
+lib/glusterfs/3.0.5/xlator/performance/stat-prefetch.la
+lib/glusterfs/3.0.5/xlator/performance/write-behind.la
+lib/glusterfs/3.0.5/xlator/protocol/client.la
+lib/glusterfs/3.0.5/xlator/protocol/server.la
+lib/glusterfs/3.0.5/xlator/storage/posix.la
+lib/glusterfs/3.0.5/xlator/testing/cluster/ha.la
+lib/glusterfs/3.0.5/xlator/testing/cluster/map.la
+lib/glusterfs/3.0.5/xlator/testing/features/filter.la
+lib/glusterfs/3.0.5/xlator/testing/features/path-converter.la
+lib/glusterfs/3.0.5/xlator/testing/features/trash.la
+lib/glusterfs/3.0.5/xlator/testing/performance/symlink-cache.la
+lib/libglusterfs.la
+man/man8/glusterfs.8
+man/man8/mount.glusterfs.8
+sbin/glusterfs
+sbin/glusterfsd
+sbin/mount.glusterfs
+share/doc/glusterfs/benchmarking/README
+share/doc/glusterfs/benchmarking/glfs-bm.c
+share/doc/glusterfs/benchmarking/launch-script.sh
+share/doc/glusterfs/benchmarking/local-script.sh
+share/doc/glusterfs/benchmarking/rdd.c
+share/doc/glusterfs/examples/README
+share/doc/glusterfs/examples/filter.vol
+share/doc/glusterfs/examples/io-cache.vol
+share/doc/glusterfs/examples/io-threads.vol
+share/doc/glusterfs/examples/posix-locks.vol
+share/doc/glusterfs/examples/protocol-client.vol
+share/doc/glusterfs/examples/protocol-server.vol
+share/doc/glusterfs/examples/read-ahead.vol
+share/doc/glusterfs/examples/replicate.vol
+share/doc/glusterfs/examples/stripe.vol
+share/doc/glusterfs/examples/trace.vol
+share/doc/glusterfs/examples/trash.vol
+share/doc/glusterfs/examples/unify.vol
+share/doc/glusterfs/examples/write-behind.vol
+share/doc/glusterfs/glusterfs-mode.el
+share/doc/glusterfs/glusterfs.vim
+share/glusterfs/CreateBooster.py
+share/glusterfs/CreateVolfile.py
diff --git a/filesystems/glusterfs/distinfo b/filesystems/glusterfs/distinfo
new file mode 100644
index 00000000000..dd8b8526947
--- /dev/null
+++ b/filesystems/glusterfs/distinfo
@@ -0,0 +1,24 @@
+$NetBSD: distinfo,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+SHA1 (glusterfs-3.0.5.tar.gz) = 15ff9777cc23afa61f253bcbea2ebdd7a65ef82a
+RMD160 (glusterfs-3.0.5.tar.gz) = 2316dd43e7d4db98a8a619414cbe3d0546e678b4
+Size (glusterfs-3.0.5.tar.gz) = 1698376 bytes
+SHA1 (patch-aa) = 35e85637d0779d24a7c51cf2084c37d2abf57033
+SHA1 (patch-ab) = d929f88563f503323fb9f29e981cebe0deb6df34
+SHA1 (patch-ac) = f130a850238f3e0b1b7f906cc2b37242249ef9f2
+SHA1 (patch-ad) = 18860e03627d679a8a1f05f68b0688c82ddaea57
+SHA1 (patch-ae) = 0ec5cd1f251a016ba4f36093c6bdc5b17112ce06
+SHA1 (patch-af) = 7a19a965768cb923629cc50d4791e9934750078d
+SHA1 (patch-ag) = 8de8f242d6aca13b6a04b1affc6af6376877392d
+SHA1 (patch-an) = d76f131bca8e1f6b2d0cf00fec2f5390222811c0
+SHA1 (patch-ao) = 72198b13482bc0653b473ee98830bb05b44bd330
+SHA1 (patch-aq) = 57a25ef86a14c144553c3357fd69b9ab008f798e
+SHA1 (patch-ar) = 56217f95b689d6872d777fed2350366fdb3c3e66
+SHA1 (patch-as) = 3f303a80389b6ddf91e828836581af04d973c7f7
+SHA1 (patch-ax) = 89e42127b49d70cc0071c0ce32641d3cdf59fae9
+SHA1 (patch-ba) = f384e775bd99622790c7bceef22525e2d92a5519
+SHA1 (patch-bb) = 03afe977ab7b80332de4a1014bc7032a37b677ab
+SHA1 (patch-bc) = 2109d45002dea0cc9546135f333c93f5c2c17d19
+SHA1 (patch-bd) = 2a9b7492af964410f156fbe521b35b1d2ec46d84
+SHA1 (patch-be) = a0ff5c2a9f856055328925ac3cf227f7bcfdf3e2
+SHA1 (patch-bf) = 9ea8057d03de080b42da649ea66a892a07df8f6d
diff --git a/filesystems/glusterfs/patches/patch-aa b/filesystems/glusterfs/patches/patch-aa
new file mode 100644
index 00000000000..1fa5c13929f
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-aa
@@ -0,0 +1,16 @@
+$NetBSD: patch-aa,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+The == operator is a non-standard bash extension. = should be used instead
+--- xlators/mount/fuse/utils/mount_glusterfs.in.orig 2010-07-16 11:32:53.000000000 +0200
++++ xlators/mount/fuse/utils/mount_glusterfs.in 2010-07-16 11:33:04.000000000 +0200
+@@ -166,9 +166,9 @@
+ }
+
+ # TODO: use getopt. This is very much darwin specific
+ volfile_loc="$1";
+- while [ "$volfile_loc" == "-o" ] ; do
++ while [ "$volfile_loc" = "-o" ] ; do
+ shift ;
+ shift ;
+ volfile_loc="$1";
+ done
diff --git a/filesystems/glusterfs/patches/patch-ab b/filesystems/glusterfs/patches/patch-ab
new file mode 100644
index 00000000000..75bdc1a8e16
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ab
@@ -0,0 +1,20 @@
+$NetBSD: patch-ab,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+NetBSD does not have AI_ADDRCONFIG. This patch has a side effect: glusterfsd
+listens on IPv6 adresses only by default. Option transport.socket.bind-address
+in volume server-tcp must be used to listen on an IPv4 address.
+--- libglusterfs/src/common-utils.c.orig 2010-07-16 11:38:26.000000000 +0200
++++ libglusterfs/src/common-utils.c 2010-07-16 11:41:03.000000000 +0200
+@@ -45,8 +45,12 @@
+ #include "revision.h"
+ #include "glusterfs.h"
+ #include "stack.h"
+
++#ifndef AI_ADDRCONFIG
++#define AI_ADDRCONFIG 0
++#endif /* AI_ADDRCONFIG */
++
+ typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size);
+ typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size);
+ static glusterfs_ctx_t *gf_global_ctx;
+
diff --git a/filesystems/glusterfs/patches/patch-ac b/filesystems/glusterfs/patches/patch-ac
new file mode 100644
index 00000000000..3d0b9465ad6
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ac
@@ -0,0 +1,19 @@
+$NetBSD: patch-ac,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+NetBSD does not have EDOOFUS.
+--- libglusterfs/src/compat-errno.c.orig 2010-07-16 11:44:51.000000000 +0200
++++ libglusterfs/src/compat-errno.c 2010-07-16 11:50:55.000000000 +0200
+@@ -857,11 +857,13 @@
+ /* ENOATTR 87 / * Attribute not found */
+ gf_error_to_errno_array[GF_ERROR_CODE_NOATTR] = ENOATTR;
+ gf_errno_to_error_array[ENOATTR] = GF_ERROR_CODE_NOATTR;
+
++#ifdef EDOOFUS /* Undefined on NetBSD */
+ /* EDOOFUS 88 / * Programming error */
+ gf_error_to_errno_array[GF_ERROR_CODE_DOOFUS] = EDOOFUS;
+ gf_errno_to_error_array[EDOOFUS] = GF_ERROR_CODE_DOOFUS;
++#endif /* EDOOFUS */
+
+ /* EBADMSG 89 / * Bad message */
+ gf_error_to_errno_array[GF_ERROR_CODE_BADMSG] = EBADMSG;
+ gf_errno_to_error_array[EBADMSG] = GF_ERROR_CODE_BADMSG;
diff --git a/filesystems/glusterfs/patches/patch-ad b/filesystems/glusterfs/patches/patch-ad
new file mode 100644
index 00000000000..36c83a4309f
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ad
@@ -0,0 +1,16 @@
+$NetBSD: patch-ad,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+Works around "error: 'EBADFD' undeclared" on NetBSD
+--- xlators/protocol/server/src/server-resolve.c.orig 2010-07-16 11:54:50.000000000 +0200
++++ xlators/protocol/server/src/server-resolve.c 2010-07-16 12:00:29.000000000 +0200
+@@ -23,9 +23,9 @@
+ #endif
+
+ #include "server-protocol.h"
+ #include "server-helpers.h"
+-
++#include "compat-errno.h"
+
+ int
+ server_resolve_all (call_frame_t *frame);
+ int
diff --git a/filesystems/glusterfs/patches/patch-ae b/filesystems/glusterfs/patches/patch-ae
new file mode 100644
index 00000000000..21ffe63b945
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ae
@@ -0,0 +1,52 @@
+$NetBSD: patch-ae,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+On NetBSD use libperfuse(3), rename umount2(2) as unmount(2), and skip
+inexistant /etc/mtab management.
+--- contrib/fuse-lib/mount.c.orig 2010-08-23 09:56:52.000000000 +0200
++++ contrib/fuse-lib/mount.c 2010-08-23 10:29:03.000000000 +0200
+@@ -19,16 +19,23 @@
+ #include <limits.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <dirent.h>
++#ifndef __NetBSD__
+ #include <mntent.h>
++#endif
+ #include <sys/stat.h>
+ #include <sys/poll.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
+ #include <sys/wait.h>
+ #include <sys/mount.h>
+
++#ifdef __NetBSD__
++#include <perfuse.h>
++#define umount2(dir, flags) unmount(dir, ((flags) != 0) ? MNT_FORCE : 0)
++#endif
++
+ #ifdef FUSE_UTIL
+ #define MALLOC(size) malloc (size)
+ #define FREE(ptr) free (ptr)
+ #define GFFUSE_LOGERR(...) fprintf (stderr, ## __VA_ARGS__)
+@@ -57,8 +64,9 @@
+ * - s/free/FREE/, s/malloc/MALLOC/
+ * - there are some other minor things
+ */
+
++#ifndef __NetBSD__
+ static int
+ mtab_needs_update (const char *mnt)
+ {
+ int res;
+@@ -90,8 +98,11 @@
+ }
+
+ return 1;
+ }
++#else /* __NetBSD__ */
++#define mtab_needs_update(x) 1
++#endif
+
+ #ifndef FUSE_UTIL
+ static
+ #endif
diff --git a/filesystems/glusterfs/patches/patch-af b/filesystems/glusterfs/patches/patch-af
new file mode 100644
index 00000000000..cc60cb2d894
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-af
@@ -0,0 +1,16 @@
+$NetBSD: patch-af,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+Works around "error: 'TCP_KEEPALIVE' undeclared" on NetBSD
+--- transport/socket/src/socket.c.orig 2010-07-16 12:18:27.000000000 +0200
++++ transport/socket/src/socket.c 2010-07-16 12:19:46.000000000 +0200
+@@ -258,9 +258,9 @@
+
+ if (keepalive_intvl == GF_USE_DEFAULT_KEEPALIVE)
+ goto done;
+
+-#ifndef GF_LINUX_HOST_OS
++#if !defined(GF_LINUX_HOST_OS) && !defined(__NetBSD__)
+ ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPALIVE, &keepalive_intvl,
+ sizeof (keepalive_intvl));
+ if (ret == -1)
+ goto err;
diff --git a/filesystems/glusterfs/patches/patch-ag b/filesystems/glusterfs/patches/patch-ag
new file mode 100644
index 00000000000..5e81d4a0174
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ag
@@ -0,0 +1,20 @@
+$NetBSD: patch-ag,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+NetBSD does not have AI_ADDRCONFIG. This patch has a side effect: glusterfsd
+listens on IPv6 adresses only by default. Option transport.socket.bind-address
+in volume server-tcp must be used to listen on an IPv4 address.
+--- transport/socket/src/name.c.orig 2010-07-16 12:20:28.000000000 +0200
++++ transport/socket/src/name.c 2010-07-16 12:20:59.000000000 +0200
+@@ -33,8 +33,12 @@
+ #ifndef AF_INET_SDP
+ #define AF_INET_SDP 27
+ #endif
+
++#ifndef AI_ADDRCONFIG
++#define AI_ADDRCONFIG 0
++#endif /* AI_ADDRCONFIG */
++
+ static int gf_name_addr_enotspec_log;
+
+ #include "transport.h"
+ #include "socket.h"
diff --git a/filesystems/glusterfs/patches/patch-an b/filesystems/glusterfs/patches/patch-an
new file mode 100644
index 00000000000..60bd292eb57
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-an
@@ -0,0 +1,27 @@
+$NetBSD: patch-an,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+NetBSD uses libperfuse(3). Also enable debugging (-g) for now.
+--- configure.ac.orig 2010-08-23 15:31:49.000000000 +0200
++++ configure.ac 2010-08-23 16:39:32.000000000 +0200
+@@ -378,8 +378,21 @@
+ GF_BOOSTER_SUBDIR=""
+ BUILD_FUSE_CLIENT=no
+ FUSE_CLIENT_SUBDIR=""
+ ;;
++ *netbsd*)
++ GF_HOST_OS="GF_BSD_HOST_OS"
++ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
++ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
++ GF_LDADD="${ARGP_STANDALONE_LDADD}"
++ if test "x$ac_cv_header_execinfo_h" = "xyes"; then
++ GF_GLUSTERFS_LDFLAGS="-lexecinfo"
++ fi
++ GF_FUSE_LDADD="-liconv -lperfuse"
++ BUILD_LIBGLUSTERFSCLIENT=no
++ LIBGLUSTERFSCLIENT_SUBDIR=""
++ GF_BOOSTER_SUBDIR=""
++ ;;
+ *bsd*)
+ GF_HOST_OS="GF_BSD_HOST_OS"
+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
+ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
diff --git a/filesystems/glusterfs/patches/patch-ao b/filesystems/glusterfs/patches/patch-ao
new file mode 100644
index 00000000000..53f4598b91c
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ao
@@ -0,0 +1,27 @@
+$NetBSD: patch-ao,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+NetBSD uses libperfuse(3). Also enable debugging (-g) for now.
+--- configure.orig 2010-08-23 15:32:00.000000000 +0200
++++ configure 2010-08-23 16:39:44.000000000 +0200
+@@ -13828,8 +13828,21 @@
+ GF_BOOSTER_SUBDIR=""
+ BUILD_FUSE_CLIENT=no
+ FUSE_CLIENT_SUBDIR=""
+ ;;
++ *netbsd*)
++ GF_HOST_OS="GF_BSD_HOST_OS"
++ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -g"
++ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS} -g"
++ GF_LDADD="${ARGP_STANDALONE_LDADD}"
++ if test "x$ac_cv_header_execinfo_h" = "xyes"; then
++ GF_GLUSTERFS_LDFLAGS="-lexecinfo"
++ fi
++ GF_FUSE_LDADD="-liconv -lperfuse"
++ BUILD_LIBGLUSTERFSCLIENT=no
++ LIBGLUSTERFSCLIENT_SUBDIR=""
++ GF_BOOSTER_SUBDIR=""
++ ;;
+ *bsd*)
+ GF_HOST_OS="GF_BSD_HOST_OS"
+ GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}"
+ GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
diff --git a/filesystems/glusterfs/patches/patch-aq b/filesystems/glusterfs/patches/patch-aq
new file mode 100644
index 00000000000..e9018fa5698
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-aq
@@ -0,0 +1,42 @@
+$NetBSD: patch-aq,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+Emulate missing sem_timedwait(3) on NetBSD
+--- xlators/performance/io-threads/src/io-threads.c.orig 2010-08-23 17:49:40.000000000 +0200
++++ xlators/performance/io-threads/src/io-threads.c 2010-08-23 18:43:35.000000000 +0200
+@@ -32,8 +32,36 @@
+ #include <sys/time.h>
+ #include <time.h>
+ #include "locking.h"
+
++#ifdef __NetBSD__
++static inline int sem_timedwait(sem_t *sem, struct timespec *ts) {
++ struct timespec onems = { 0, 1000000 };
++ struct timespec total = { 0, 0 };
++ struct timespec unslept;
++ struct timespec elapsed;
++ struct timespec tmp;
++
++ while (timespeccmp(ts, &total, >)) {
++ if (sem_trywait(sem) == 0)
++ return 0;
++
++ if (errno != EAGAIN)
++ return -1;
++
++ (void)nanosleep(&onems, &unslept);
++
++ timespecsub(&onems, &unslept, &elapsed);
++ timespecadd(&total, &elapsed, &tmp);
++ total.tv_sec = tmp.tv_sec;
++ total.tv_nsec = tmp.tv_nsec;
++ }
++
++ errno = ETIMEDOUT;
++ return -1;
++}
++#endif /* __NetBSD__ */
++
+ typedef void *(*iot_worker_fn)(void*);
+
+ void
+ iot_stop_worker (iot_worker_t *worker);
diff --git a/filesystems/glusterfs/patches/patch-ar b/filesystems/glusterfs/patches/patch-ar
new file mode 100644
index 00000000000..3fb24c67e0c
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ar
@@ -0,0 +1,17 @@
+$NetBSD: patch-ar,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+Add @GF_FUSE_LDADD@ to fuse.so library dependecies so that -lperfuse is
+added at configure time for NetBSD.
+--- xlators/mount/fuse/src/Makefile.am.orig 2010-08-23 15:57:10.000000000 +0200
++++ xlators/mount/fuse/src/Makefile.am 2010-08-23 16:38:50.000000000 +0200
+@@ -5,9 +5,9 @@
+ xlator_LTLIBRARIES = fuse.la
+ xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mount
+ fuse_la_SOURCES = fuse-bridge.c $(CONTRIBDIR)/fuse-lib/misc.c \
+ $(CONTRIBDIR)/fuse-lib/mount.c
+-fuse_la_LDFLAGS = -module -avoidversion -shared -nostartfiles
++fuse_la_LIBADD = @GF_FUSE_LDADD@
+
+ AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS) -Wall \
+ -I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/fuse-include \
+ $(GF_CFLAGS) -DFUSERMOUNT_DIR=\"$(bindir)\"
diff --git a/filesystems/glusterfs/patches/patch-as b/filesystems/glusterfs/patches/patch-as
new file mode 100644
index 00000000000..a792ff8045e
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-as
@@ -0,0 +1,17 @@
+$NetBSD: patch-as,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+Add @GF_FUSE_LDADD@ to fuse.so library dependecies so that -lperfuse is
+added at configure time for NetBSD.
+--- xlators/mount/fuse/src/Makefile.in.orig 2010-08-23 15:57:15.000000000 +0200
++++ xlators/mount/fuse/src/Makefile.in 2010-08-23 16:39:14.000000000 +0200
+@@ -55,9 +55,9 @@
+ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+ am__installdirs = "$(DESTDIR)$(xlatordir)"
+ xlatorLTLIBRARIES_INSTALL = $(INSTALL)
+ LTLIBRARIES = $(xlator_LTLIBRARIES)
+-fuse_la_LIBADD =
++fuse_la_LIBADD = @GF_FUSE_LDADD@
+ am_fuse_la_OBJECTS = fuse-bridge.lo misc.lo mount.lo
+ fuse_la_OBJECTS = $(am_fuse_la_OBJECTS)
+ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+ depcomp = $(SHELL) $(top_srcdir)/depcomp
diff --git a/filesystems/glusterfs/patches/patch-ax b/filesystems/glusterfs/patches/patch-ax
new file mode 100644
index 00000000000..ba860c60c3b
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ax
@@ -0,0 +1,16 @@
+$NetBSD: patch-ax,v 1.1.1.1 2010/08/26 14:26:18 manu Exp $
+
+Do not strip binaries so that we have debug for now.
+--- install-sh.orig 2010-08-23 16:56:17.000000000 +0200
++++ install-sh 2010-08-23 16:56:40.000000000 +0200
+@@ -120,9 +120,9 @@
+ shift
+ shift
+ continue;;
+
+- -s) stripcmd=$stripprog
++ -s) #stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
diff --git a/filesystems/glusterfs/patches/patch-ba b/filesystems/glusterfs/patches/patch-ba
new file mode 100644
index 00000000000..1c86bea106b
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-ba
@@ -0,0 +1,46 @@
+$NetBSD: patch-ba,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+glibc dirname() modify the string it is given and returns it.
+glusterfs takes this behavior for granted, and assume that if it
+gives a malloc'ed string to dirname(), then it can free()) the
+return value.
+
+Here is what SUSv2 says:
+http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
+"The dirname() function may modify the string pointed to by path,
+and may return a pointer to static storage"
+
+At least NetBSD returns a static storage. glusterfs will return it to
+a calling function that has the responsability to free it, causing
+a SIGSEGV.
+
+--- ./xlators/performance/stat-prefetch/src/stat-prefetch.c.orig 2010-08-24 14:06:54.000000000 +0200
++++ ./xlators/performance/stat-prefetch/src/stat-prefetch.c 2010-08-24 14:20:10.000000000 +0200
+@@ -815,18 +815,25 @@
+ path = dirname (cpy);
+ switch (i)
+ {
+ case 0:
+- *parent = path;
++ *parent = strdup(path);
++ if (*parent == NULL)
++ goto out;
+ break;
+ case 1:
+- *grand_parent = path;
++ *grand_parent = strdup(path);
++ if (*grand_parent == NULL)
++ goto out;
+ break;
+ }
+ }
+
+ ret = 0;
+ out:
++ if (cpy != NULL)
++ free(cpy);
++
+ return ret;
+ }
+
+
diff --git a/filesystems/glusterfs/patches/patch-bb b/filesystems/glusterfs/patches/patch-bb
new file mode 100644
index 00000000000..d9c4689d961
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bb
@@ -0,0 +1,19 @@
+$NetBSD: patch-bb,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+On NetBSD and FreeBSD, O_DIRECTORY does not exists and is defined as 0
+by glusterfs. ((flags & O_DIRECTORY) == O_DIRECTORY) always evaluate
+to true, and this is a bug.
+
+--- ./xlators/performance/quick-read/src/quick-read.c.orig 2010-08-24 17:31:30.000000000 +0200
++++ ./xlators/performance/quick-read/src/quick-read.c 2010-08-24 17:32:13.000000000 +0200
+@@ -642,9 +642,9 @@
+ }
+ }
+ UNLOCK (&table->lock);
+
+- if (content_cached && ((flags & O_DIRECTORY) == O_DIRECTORY)) {
++ if (content_cached && (flags & O_DIRECTORY)) {
+ op_ret = -1;
+ op_errno = ENOTDIR;
+ goto unwind;
+ }
diff --git a/filesystems/glusterfs/patches/patch-bc b/filesystems/glusterfs/patches/patch-bc
new file mode 100644
index 00000000000..e93491e5a65
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bc
@@ -0,0 +1,60 @@
+$NetBSD: patch-bc,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+glibc dirname() modify the string it is given and returns it.
+glusterfs takes this behavior for granted, and assume that if it
+gives a malloc'ed string to dirname(), then it can free()) the
+return value.
+
+Here is what SUSv2 says:
+http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
+"The dirname() function may modify the string pointed to by path,
+and may return a pointer to static storage"
+
+At least NetBSD returns a static storage. glusterfs will return it to
+a calling function that has the responsability to free it, causing
+a SIGSEGV.
+
+--- ./xlators/performance/quick-read/src/quick-read.c.orig 2010-08-24 18:01:15.000000000 +0200
++++ ./xlators/performance/quick-read/src/quick-read.c 2010-08-24 18:04:22.000000000 +0200
+@@ -80,8 +80,9 @@
+ qr_loc_fill (loc_t *loc, inode_t *inode, char *path)
+ {
+ int32_t ret = -1;
+ char *parent = NULL;
++ char *path_copy = NULL;
+
+ if ((loc == NULL) || (inode == NULL) || (path == NULL)) {
+ ret = -1;
+ errno = EINVAL;
+@@ -91,15 +92,15 @@
+ loc->inode = inode_ref (inode);
+ loc->path = strdup (path);
+ loc->ino = inode->ino;
+
+- parent = strdup (path);
+- if (parent == NULL) {
++ path_copy = strdup (path);
++ if (path_copy == NULL) {
+ ret = -1;
+ goto out;
+ }
+
+- parent = dirname (parent);
++ parent = dirname (path_copy);
+
+ loc->parent = inode_from_path (inode->table, parent);
+ if (loc->parent == NULL) {
+ ret = -1;
+@@ -114,10 +115,10 @@
+ qr_loc_wipe (loc);
+
+ }
+
+- if (parent) {
+- FREE (parent);
++ if (path_copy) {
++ FREE (path_copy);
+ }
+
+ return ret;
+ }
diff --git a/filesystems/glusterfs/patches/patch-bd b/filesystems/glusterfs/patches/patch-bd
new file mode 100644
index 00000000000..aed29d6aba6
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bd
@@ -0,0 +1,60 @@
+$NetBSD: patch-bd,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+glibc dirname() modify the string it is given and returns it.
+glusterfs takes this behavior for granted, and assume that if it
+gives a malloc'ed string to dirname(), then it can free()) the
+return value.
+
+Here is what SUSv2 says:
+http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
+"The dirname() function may modify the string pointed to by path,
+and may return a pointer to static storage"
+
+At least NetBSD returns a static storage. glusterfs will return it to
+a calling function that has the responsability to free it, causing
+a SIGSEGV.
+
+--- libglusterfsclient/src/libglusterfsclient-dentry.c.orig 2010-08-24 18:36:08.000000000 +0200
++++ libglusterfsclient/src/libglusterfsclient-dentry.c 2010-08-24 18:41:09.000000000 +0200
+@@ -231,8 +231,9 @@
+ char lookup_basename)
+ {
+ int32_t op_ret = -1;
+ char *resolved = NULL;
++ char *restmp = NULL;
+ inode_t *parent = NULL, *inode = NULL;
+ dentry_t *dentry = NULL;
+ loc_t new_loc = {0, };
+ char *pathname = NULL, *directory = NULL;
+@@ -244,10 +245,10 @@
+ gf_log ("libglusterfsclient-dentry", GF_LOG_DEBUG,
+ "loc->parent(%"PRId64") already present. sending "
+ "lookup for %"PRId64"/%s", parent->ino, parent->ino,
+ loc->path);
+- resolved = strdup (loc->path);
+- resolved = dirname (resolved);
++ restmp = strdup (loc->path);
++ resolved = dirname (restmp);
+ } else {
+ parent = __libgf_client_path_to_parenti (ctx, ctx->itable,
+ loc->path, &resolved);
+ }
+@@ -342,17 +343,13 @@
+ out:
+ loc->inode = inode;
+ loc->parent = parent;
+
+- FREE (resolved);
++ FREE (restmp);
+ if (pathname) {
+ FREE (pathname);
+ }
+
+- if (directory) {
+- FREE (directory);
+- }
+-
+ return op_ret;
+ }
+
+
diff --git a/filesystems/glusterfs/patches/patch-be b/filesystems/glusterfs/patches/patch-be
new file mode 100644
index 00000000000..8e2e4fe26e7
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-be
@@ -0,0 +1,239 @@
+$NetBSD: patch-be,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+basename() and dirname() are not supposed to be thread-safe, and NetBSD's
+implementation is not. glusterfs assume the functions are thread-safe.
+Borrow basename() and rdirname() form glibc and make NetBSD use them.
+
+--- libglusterfs/src/compat.c.orig 2010-08-25 03:58:44.000000000 +0200
++++ libglusterfs/src/compat.c 2010-08-25 10:42:37.000000000 +0200
+@@ -509,4 +509,230 @@
+ len++;
+ return len;
+ }
+ #endif /* STRNLEN */
++
++#ifdef __NetBSD__
++/*
++ * basename() and dirname() are not supposed to be thread-safe.
++ * SUSv2 states it can return a static pointer, and * NetBSD does that.
++ * glusterfs heavily assume basename() and * dirname() thread-safety,
++ * hence these replacement from glibc.
++ * compat.h defines basename() and dirname() as macro so that
++ * the replacement are used.
++ */
++
++/*
++ * borrowed from glibc-2.12.1/string/basename.c (GPL 2.1 or later)
++ * Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
++ * Modified to return "." for NULL or "", as required for SUSv2.
++ */
++char *
++basename_r (filename)
++ const char *filename;
++{
++ char *p;
++
++ if ((filename == NULL) || (*filename == '\0'))
++ return ".";
++
++ p = strrchr (filename, '/');
++ return p ? p + 1 : (char *) filename;
++}
++
++/*
++ * Borrowed from blibc-2.12.1/string/memrchr.c (GPL 2.1 or later)
++ * Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
++ * Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
++ * Removed code for long bigger than 32 bytes, renamed __ptr_t as void *
++ * changed reg_char type to char.
++ */
++void *
++__memrchr (s, c_in, n)
++ const void * s;
++ int c_in;
++ size_t n;
++{
++ const unsigned char *char_ptr;
++ const unsigned long int *longword_ptr;
++ unsigned long int longword, magic_bits, charmask;
++ unsigned char c;
++
++ c = (unsigned char) c_in;
++
++ /* Handle the last few characters by reading one character at a time.
++ Do this until CHAR_PTR is aligned on a longword boundary. */
++ for (char_ptr = (const unsigned char *) s + n;
++ n > 0 && ((unsigned long int) char_ptr
++ & (sizeof (longword) - 1)) != 0;
++ --n)
++ if (*--char_ptr == c)
++ return (void *) char_ptr;
++
++ /* All these elucidatory comments refer to 4-byte longwords,
++ but the theory applies equally well to 8-byte longwords. */
++
++ longword_ptr = (const unsigned long int *) char_ptr;
++
++ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
++ the "holes." Note that there is a hole just to the left of
++ each byte, with an extra at the end:
++
++ bits: 01111110 11111110 11111110 11111111
++ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
++
++ The 1-bits make sure that carries propagate to the next 0-bit.
++ The 0-bits provide holes for carries to fall into. */
++
++ if (sizeof (longword) != 4 && sizeof (longword) != 8)
++ abort ();
++
++ magic_bits = 0x7efefeff;
++
++ /* Set up a longword, each of whose bytes is C. */
++ charmask = c | (c << 8);
++ charmask |= charmask << 16;
++
++ /* Instead of the traditional loop which tests each character,
++ we will test a longword at a time. The tricky part is testing
++ if *any of the four* bytes in the longword in question are zero. */
++ while (n >= sizeof (longword))
++ {
++ /* We tentatively exit the loop if adding MAGIC_BITS to
++ LONGWORD fails to change any of the hole bits of LONGWORD.
++
++ 1) Is this safe? Will it catch all the zero bytes?
++ Suppose there is a byte with all zeros. Any carry bits
++ propagating from its left will fall into the hole at its
++ least significant bit and stop. Since there will be no
++ carry from its most significant bit, the LSB of the
++ byte to the left will be unchanged, and the zero will be
++ detected.
++
++ 2) Is this worthwhile? Will it ignore everything except
++ zero bytes? Suppose every byte of LONGWORD has a bit set
++ somewhere. There will be a carry into bit 8. If bit 8
++ is set, this will carry into bit 16. If bit 8 is clear,
++ one of bits 9-15 must be set, so there will be a carry
++ into bit 16. Similarly, there will be a carry into bit
++ 24. If one of bits 24-30 is set, there will be a carry
++ into bit 31, so all of the hole bits will be changed.
++
++ The one misfire occurs when bits 24-30 are clear and bit
++ 31 is set; in this case, the hole at bit 31 is not
++ changed. If we had access to the processor carry flag,
++ we could close this loophole by putting the fourth hole
++ at bit 32!
++
++ So it ignores everything except 128's, when they're aligned
++ properly.
++
++ 3) But wait! Aren't we looking for C, not zero?
++ Good point. So what we do is XOR LONGWORD with a longword,
++ each of whose bytes is C. This turns each byte that is C
++ into a zero. */
++
++ longword = *--longword_ptr ^ charmask;
++
++ /* Add MAGIC_BITS to LONGWORD. */
++ if ((((longword + magic_bits)
++
++ /* Set those bits that were unchanged by the addition. */
++ ^ ~longword)
++
++ /* Look at only the hole bits. If any of the hole bits
++ are unchanged, most likely one of the bytes was a
++ zero. */
++ & ~magic_bits) != 0)
++ {
++ /* Which of the bytes was C? If none of them were, it was
++ a misfire; continue the search. */
++
++ const unsigned char *cp = (const unsigned char *) longword_ptr;
++
++ if (cp[3] == c)
++ return (void *) &cp[3];
++ if (cp[2] == c)
++ return (void *) &cp[2];
++ if (cp[1] == c)
++ return (void *) &cp[1];
++ if (cp[0] == c)
++ return (void *) cp;
++ }
++
++ n -= sizeof (longword);
++ }
++
++ char_ptr = (const unsigned char *) longword_ptr;
++
++ while (n-- > 0)
++ {
++ if (*--char_ptr == c)
++ return (void *) char_ptr;
++ }
++
++ return 0;
++}
++
++/*
++ * Borrowed from glibc-2.12.1/misc/dirname.c (GPL 2.1 or later)
++ * Copyright (C) 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
++ * Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
++ */
++char *
++dirname_r (char *path)
++{
++ static const char dot[] = ".";
++ char *last_slash;
++
++ /* Find last '/'. */
++ last_slash = path != NULL ? strrchr (path, '/') : NULL;
++
++ if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
++ {
++ /* Determine whether all remaining characters are slashes. */
++ char *runp;
++
++ for (runp = last_slash; runp != path; --runp)
++ if (runp[-1] != '/')
++ break;
++
++ /* The '/' is the last character, we have to look further. */
++ if (runp != path)
++ last_slash = __memrchr (path, '/', runp - path);
++ }
++
++ if (last_slash != NULL)
++ {
++ /* Determine whether all remaining characters are slashes. */
++ char *runp;
++
++ for (runp = last_slash; runp != path; --runp)
++ if (runp[-1] != '/')
++ break;
++
++ /* Terminate the path. */
++ if (runp == path)
++ {
++ /* The last slash is the first character in the string. We have to
++ return "/". As a special case we have to return "//" if there
++ are exactly two slashes at the beginning of the string. See
++ XBD 4.10 Path Name Resolution for more information. */
++ if (last_slash == path + 1)
++ ++last_slash;
++ else
++ last_slash = path + 1;
++ }
++ else
++ last_slash = runp;
++
++ last_slash[0] = '\0';
++ }
++ else
++ /* This assignment is ill-designed but the XPG specs require to
++ return a string containing "." in any case no directory part is
++ found and so a static and constant string is required. */
++ path = (char *) dot;
++
++ return path;
++}
++#endif /* __NetBSD__ */
diff --git a/filesystems/glusterfs/patches/patch-bf b/filesystems/glusterfs/patches/patch-bf
new file mode 100644
index 00000000000..62cfab0c738
--- /dev/null
+++ b/filesystems/glusterfs/patches/patch-bf
@@ -0,0 +1,32 @@
+$NetBSD: patch-bf,v 1.1.1.1 2010/08/26 14:26:19 manu Exp $
+
+basename() and dirname() are not supposed to be thread-safe, and NetBSD's
+implementation is not. glusterfs assume the functions are thread-safe.
+Borrow basename() and rdirname() form glibc and make NetBSD use them.
+
+--- libglusterfs/src/compat.h.orig 2010-08-25 10:18:27.000000000 +0200
++++ libglusterfs/src/compat.h 2010-08-25 10:23:19.000000000 +0200
+@@ -57,9 +57,9 @@
+ #endif /* HAVE_LLISTXATTR */
+ #endif /* GF_LINUX_HOST_OS */
+
+ #ifdef GF_BSD_HOST_OS
+-/* In case of FreeBSD */
++/* In case of FreeBSD and NetBSD */
+
+ #define UNIX_PATH_MAX 104
+ #include <sys/types.h>
+
+@@ -110,8 +110,12 @@
+ #define F_GETLK64 F_GETLK
+ #define F_SETLK64 F_SETLK
+ #define F_SETLKW64 F_SETLKW
+
++#ifdef __NetBSD__
++#define basename(path) basename_r(path)
++#define dirname(path) dirname_r(path)
++#endif /* __NetBSD__ */
+ #endif /* GF_BSD_HOST_OS */
+
+ #ifdef GF_DARWIN_HOST_OS
+