[Lldb-commits] [lldb] r247115 - NetBSD doesn't provide struct statfs, make use of struct statvfs

Stephane Sezer via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 8 18:19:06 PDT 2015


Author: sas
Date: Tue Sep  8 20:19:05 2015
New Revision: 247115

URL: http://llvm.org/viewvc/llvm-project?rev=247115&view=rev
Log:
NetBSD doesn't provide struct statfs, make use of struct statvfs

Reviewers: joerg, sas

Subscribers: labath, lldb-commits

Differential Revision: http://reviews.llvm.org/D12661

Change by Kamil Rytarowski <n54 at gmx.com>

Modified:
    lldb/trunk/source/Host/posix/FileSystem.cpp

Modified: lldb/trunk/source/Host/posix/FileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=247115&r1=247114&r2=247115&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/posix/FileSystem.cpp Tue Sep  8 20:19:05 2015
@@ -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 @@ FileSystem::Readlink(const FileSpec &src
     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 @@ static bool IsLocal(const struct statfs&
     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 @@ FileSystem::IsLocal(const FileSpec &spec
         return ::IsLocal(statfs_info);
     return false;
 }
+#endif




More information about the lldb-commits mailing list