File tree 1 file changed +6
-3
lines changed
src/native/libs/System.Native
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1575,7 +1575,7 @@ static int16_t ConvertLockType(int16_t managedLockType)
1575
1575
}
1576
1576
}
1577
1577
1578
- #if !HAVE_NON_LEGACY_STATFS || defined(__APPLE__ )
1578
+ #if !HAVE_NON_LEGACY_STATFS || defined(TARGET_APPLE ) || defined( TARGET_FREEBSD )
1579
1579
static uint32_t MapFileSystemNameToEnum (const char * fileSystemName )
1580
1580
{
1581
1581
uint32_t result = 0 ;
@@ -1722,8 +1722,11 @@ uint32_t SystemNative_GetFileSystemType(intptr_t fd)
1722
1722
while ((statfsRes = fstatfs (ToFileDescriptor (fd ), & statfsArgs )) == -1 && errno == EINTR ) ;
1723
1723
if (statfsRes == -1 ) return 0 ;
1724
1724
1725
- #if defined(__APPLE__ )
1726
- // On OSX-like systems, f_type is version-specific. Don't use it, just map the name.
1725
+ #if defined(TARGET_APPLE ) || defined(TARGET_FREEBSD )
1726
+ // * On OSX-like systems, f_type is version-specific. Don't use it, just map the name.
1727
+ // * Specifically, on FreeBSD with ZFS, f_type may return a value like 0xDE when emulating
1728
+ // FreeBSD on macOS (e.g., FreeBSD-x64 on macOS ARM64). Therefore, we use f_fstypename to
1729
+ // get the correct filesystem type.
1727
1730
return MapFileSystemNameToEnum (statfsArgs .f_fstypename );
1728
1731
#else
1729
1732
// On Linux, f_type is signed. This causes some filesystem types to be represented as
You can’t perform that action at this time.
0 commit comments