$NetBSD: patch-as,v 1.2 2009/05/09 18:43:41 hira Exp $

--- sal/osl/unx/file.cxx.orig	2009-02-18 16:18:51.000000000 +0100
+++ sal/osl/unx/file.cxx	2011-04-01 15:54:28.000000000 +0200
@@ -93,7 +93,17 @@
 #include <ctype.h>
 static const sal_Char* MOUNTTAB="/etc/mtab";
 
-#elif defined(NETBSD) || defined(FREEBSD)
+#elif defined(NETBSD)
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#include <ctype.h>
+#define  HAVE_STATFS_H
+/* No mounting table on *BSD
+ * This information is stored only in the kernel. */
+/* static const sal_Char* MOUNTTAB="/etc/mtab"; */
+
+#elif defined(FREEBSD)
 #include <sys/param.h>
 #include <sys/ucred.h>
 #include <sys/mount.h>
@@ -1447,7 +1457,7 @@
 
 #ifdef HAVE_STATFS_H
 
-#if defined(FREEBSD) || defined(NETBSD) || defined(MACOSX)
+#if defined(FREEBSD) || defined(MACOSX)
 #   define __OSL_STATFS_STRUCT      			struct statfs
 #   define __OSL_STATFS(dir, sfs)   			statfs((dir), (sfs))
 #   define __OSL_STATFS_BLKSIZ(a)   			((sal_uInt64)((a).f_bsize))
@@ -1459,7 +1469,33 @@
    of the target platforms fix it!!!! */
 #	define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a)	 (1)
 #	define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1)
-#endif /* FREEBSD || NETBSD || MACOSX */
+#endif /* FREEBSD || MACOSX */
+
+#if defined(NETBSD)
+
+#include <sys/param.h>
+
+/* statvfs() replaced statfs() in 2.99.9 */
+# if __NetBSD_Version__ >= 299000900
+       /* 2.0D or later */
+#   define __OSL_STATFS_STRUCT				struct statvfs
+#   define __OSL_STATFS(dir, sfs)			statvfs((dir), (sfs))
+#   define __OSL_STATFS_ISREMOTE(a)			(((a).f_flag & ST_LOCAL) == 0)
+
+# else
+       /* version before 2.0D */
+#   define __OSL_STATFS_STRUCT				struct statfs
+#   define __OSL_STATFS(dir, sfs)			statfs((dir), (sfs))
+#   define __OSL_STATFS_ISREMOTE(a)			(((a).f_type & MNT_LOCAL) == 0)
+
+# endif /* >2.0D */
+
+#   define __OSL_STATFS_BLKSIZ(a)			((sal_uInt64)((a).f_bsize))
+#   define __OSL_STATFS_TYPENAME(a)			((a).f_fstypename)
+
+#	define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a)	(strcmp((a).f_fstypename, "msdos") != 0 && strcmp((a).f_fstypename, "ntfs") != 0 && strcmp((a).f_fstypename, "smbfs") != 0)
+#	define __OSL_STATFS_IS_CASE_PRESERVING_FS(a)	(strcmp((a).f_fstypename, "msdos") != 0)
+#endif /* NETBSD */
 
 #if defined(LINUX)
 #	define __OSL_NFS_SUPER_MAGIC				 0x6969
