diff options
| author | Vince Harron <vharron@google.com> | 2015-02-24 05:14:49 +0000 |
|---|---|---|
| committer | Vince Harron <vharron@google.com> | 2015-02-24 05:14:49 +0000 |
| commit | 294aeb9a408d32298fbc18d1d91653cfc954309b (patch) | |
| tree | 15bd0fa9cc30dce4f6cdd5d3a139718cbebd0ea2 | |
| parent | 77553c72dc00ed57d87b6d0788ac602ab353dc33 (diff) | |
| download | bcm5719-llvm-294aeb9a408d32298fbc18d1d91653cfc954309b.tar.gz bcm5719-llvm-294aeb9a408d32298fbc18d1d91653cfc954309b.zip | |
Compile fix for FileSystem::IsLocal on Linux
llvm-svn: 230311
| -rw-r--r-- | lldb/source/Host/posix/FileSystem.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp index b8a455727ae..ee41b0cfba0 100644 --- a/lldb/source/Host/posix/FileSystem.cpp +++ b/lldb/source/Host/posix/FileSystem.cpp @@ -14,6 +14,11 @@ #include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> +#ifdef __linux__ +#include <sys/statfs.h> +#include <sys/mount.h> +#include <linux/magic.h> +#endif // lldb Includes #include "lldb/Core/Error.h" @@ -175,12 +180,30 @@ FileSystem::Readlink(const char *path, char *buf, size_t buf_len) return error; } +static bool IsLocal(const struct statfs& info) +{ +#ifdef __linux__ + #define CIFS_MAGIC_NUMBER 0xFF534D42 + switch (info.f_type) + { + case NFS_SUPER_MAGIC: + case SMB_SUPER_MAGIC: + case CIFS_MAGIC_NUMBER: + return false; + default: + return true; + } +#else + return (info.f_flags & MNT_LOCAL) != 0; +#endif +} + bool FileSystem::IsLocal(const FileSpec &spec) { struct statfs statfs_info; std::string path (spec.GetPath()); - if (statfs(path.c_str(), &statfs_info) == 0) - return (statfs_info.f_flags & MNT_LOCAL) != 0; + if (statfs(path.c_str(), &statfs_info) != 0) + return ::IsLocal(statfs_info); return false; } |

