Skip to content

Commit dfef416

Browse files
committed
Fix statx syscall for arm32
1 parent 53cf96b commit dfef416

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

okio/src/linuxMain/kotlin/okio/LinuxPosixVariant.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package okio
1717

1818
import kotlinx.cinterop.UnsafeNumber
1919
import kotlinx.cinterop.alloc
20+
import kotlinx.cinterop.convert
2021
import kotlinx.cinterop.memScoped
2122
import kotlinx.cinterop.ptr
2223
import okio.internal.linux.AT_FDCWD
@@ -40,18 +41,19 @@ import platform.posix.syscall
4041
* Prefer `statx()` if it's available. Fall back to `stat()` which doesn't have a field for
4142
* `createdAt`.
4243
*/
44+
@OptIn(UnsafeNumber::class)
4345
internal actual fun PosixFileSystem.variantMetadataOrNull(path: Path): FileMetadata? {
4446
memScoped {
4547
val statx = alloc<statx>()
4648
val result = syscall(
47-
__NR_statx.toLong(),
49+
__NR_statx.convert(),
4850
AT_FDCWD,
4951
path.toString(),
5052
AT_SYMLINK_NOFOLLOW,
5153
STATX_BASIC_STATS or STATX_BTIME,
5254
statx.ptr,
53-
)
54-
if (result == 0L) {
55+
).convert<Int>()
56+
if (result == 0) {
5557
return FileMetadata(
5658
isRegularFile = statx.stx_mode.toInt() and S_IFMT == S_IFREG,
5759
isDirectory = statx.stx_mode.toInt() and S_IFMT == S_IFDIR,

0 commit comments

Comments
 (0)