[Lldb-commits] [PATCH] D12661: NetBSD doesn't provide struct statfs, make use of struct statvfs

Kamil Rytarowski via lldb-commits lldb-commits at lists.llvm.org
Sat Sep 5 06:57:59 PDT 2015


krytarowski created this revision.
krytarowski added a reviewer: joerg.
krytarowski added a subscriber: lldb-commits.
krytarowski set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

http://reviews.llvm.org/D12661

Files:
  source/Host/posix/FileSystem.cpp

Index: source/Host/posix/FileSystem.cpp
===================================================================
--- source/Host/posix/FileSystem.cpp
+++ source/Host/posix/FileSystem.cpp
@@ -20,6 +20,9 @@
 #include <sys/mount.h>
 #include <linux/magic.h>
 #endif
+#if defined(__NetBSD__)
+#include <sys/statvfs.h>
+#endif
 
 // lldb Includes
 #include "lldb/Core/Error.h"
@@ -213,6 +216,12 @@
     return error;
 }
 
+#if defined(__NetBSD__)
+static bool IsLocal(const struct statvfs& info)
+{
+    return (info.f_flag & MNT_LOCAL) != 0;
+}
+#else
 static bool IsLocal(const struct statfs& info)
 {
 #ifdef __linux__
@@ -230,7 +239,19 @@
     return (info.f_flags & MNT_LOCAL) != 0;
 #endif
 }
+#endif
 
+#if defined(__NetBSD__)
+bool
+FileSystem::IsLocal(const FileSpec &spec)
+{
+    struct statvfs statfs_info;
+    std::string path (spec.GetPath());
+    if (statvfs(path.c_str(), &statfs_info) == 0)
+        return ::IsLocal(statfs_info);
+    return false;
+}
+#else
 bool
 FileSystem::IsLocal(const FileSpec &spec)
 {
@@ -240,3 +261,4 @@
         return ::IsLocal(statfs_info);
     return false;
 }
+#endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12661.34108.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150905/70c89a91/attachment.bin>


More information about the lldb-commits mailing list