Skip to content

Commit c748c8b

Browse files
committed
build with 64-bit fsblkcnt_t on 32-bit glibc platforms
It is possible to build with 64-bit file offsets on 32-bit platforms such as armv7, and indeed this is the default for some build environments such as Yocto. Use fsblkcnt_t, which is an alias to a type of the correct width, when computing blockSize.
1 parent 7a0e78f commit c748c8b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/FoundationEssentials/FileManager/FileManager+Files.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,12 @@ extension _FileManagerImpl {
741741
let blockSize = UInt64(result.f_bsize)
742742
#else
743743
let fsNumber = result.f_fsid
744+
#if canImport(Glibc)
745+
let blockSize = fsblkcnt_t(result.f_frsize) // support 64-bit block sizes on 32-bit platforms
746+
#else
744747
let blockSize = UInt(result.f_frsize)
745748
#endif
749+
#endif
746750
var totalSizeBytes = result.f_blocks * blockSize
747751
var availSizeBytes = result.f_bavail * blockSize
748752
var totalFiles = result.f_files

0 commit comments

Comments
 (0)