Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/posix/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* You should have received a copy of the license along with this
* program.
*/
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && \
!defined(__NetBSD__) && !defined(__DragonFly__)
#include <mntent.h>
#endif // ! __APPLE__

Expand All @@ -32,6 +33,9 @@
#include <sys/ioctl.h>
#include <sys/resource.h>
#include <sys/statvfs.h>
#if defined(__NetBSD__)
#define statfs statvfs
#endif
#include <sys/types.h>
#include <sys/utsname.h>
#ifdef TARGET_OS_MAC
Expand Down Expand Up @@ -1783,8 +1787,8 @@ class UnixStreamAccess
// open with O_NOATIME if possible
int open(const char *path)
{
#ifdef TARGET_OS_IPHONE
// building for iOS, there is no O_NOATIME flag
#ifndef O_NOATIME
// building for iOS and BSDs, there is no O_NOATIME flag
int fd = ::open(path, O_RDONLY) ;
#else
// for sync in particular, try to open without setting access-time
Expand Down Expand Up @@ -2034,6 +2038,7 @@ ScanResult PosixFileSystemAccess::directoryScan(const LocalPath& targetPath,
}

#ifndef __APPLE__
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)

// Determine which device contains the specified path.
static std::string deviceOf(const std::string& database,
Expand Down Expand Up @@ -2202,6 +2207,7 @@ static std::string deviceOf(const std::string& path)
// No database has a mapping for this path.
return std::string();
}
#endif

// Compute legacy filesystem fingerprint.
static std::uint64_t fingerprintOf(const std::string& path)
Expand Down Expand Up @@ -2230,6 +2236,7 @@ static std::uint64_t fingerprintOf(const std::string& path)
return ++value;
}

#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
// Determine the UUID of the specified device.
static std::string uuidOf(const std::string& device)
{
Expand Down Expand Up @@ -2306,6 +2313,7 @@ static std::string uuidOf(const std::string& device)
// Couldn't determine device's UUID.
return std::string();
}
#endif

fsfp_t FileSystemAccess::fsFingerprint(const LocalPath& path) const
{
Expand All @@ -2316,6 +2324,7 @@ fsfp_t FileSystemAccess::fsFingerprint(const LocalPath& path) const
if (!fingerprint)
return fsfp_t();

#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
// What device contains the specified path?
auto device = deviceOf(path.toPath(false));

Expand All @@ -2329,6 +2338,7 @@ fsfp_t FileSystemAccess::fsFingerprint(const LocalPath& path) const
if (!uuid.empty())
return fsfp_t(fingerprint, std::move(uuid));
}
#endif

// Couldn't determine filesystem UUID.
return fsfp_t(fingerprint, std::string());
Expand Down