Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use regular stat() instead of non-standard __xstat64 abi #362

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ val io = (project in file("io"))
exclude[MissingClassProblem]("sbt.internal.io.FreeBSD64FileStat"),
exclude[MissingClassProblem]("sbt.internal.io.FreeBSD64Milli"),
exclude[MissingClassProblem]("sbt.internal.io.FreeBSD64Milli$"),
// Replaced non-standard __xstat64() with conformant stat() calls
exclude[DirectMissingMethodProblem]("sbt.internal.io.Linux32.*"),
exclude[ReversedMissingMethodProblem]("sbt.internal.io.Linux32.*"),
exclude[DirectMissingMethodProblem]("sbt.internal.io.Linux64.*"),
exclude[ReversedMissingMethodProblem]("sbt.internal.io.Linux64.*"),
// protected[this]
exclude[DirectMissingMethodProblem]("sbt.io.CopyOptions.copy*"),
// private class
Expand Down
8 changes: 4 additions & 4 deletions io/src/main/scala/sbt/internal/io/Milli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,28 @@ private abstract class PosixMilliIntUtim[Interface <: Utimensat[Int]: ClassTag]

private class Linux64FileStat extends StatLong(144, 88, 96)
private trait Linux64 extends Library with Utimensat[Long] {
def __xstat64(version: Int, filePath: String, buf: Linux64FileStat): Int
def stat(filePath: String, buf: Linux64FileStat): Int
}
private object Linux64Milli extends PosixMilliLongUtim[Linux64] {
protected final val AT_FDCWD: Int = -100
protected final val UTIME_OMIT: Long = (1L << 30) - 2
protected def getModifiedTimeNative(filePath: String) = {
val stat = new Linux64FileStat
checkedIO(filePath) { libc.__xstat64(1, filePath, stat) }
checkedIO(filePath) { libc.stat(filePath, stat) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

stat.getModifiedTimeNative
}
}

private class Linux32FileStat extends StatInt(88, 64, 68)
private trait Linux32 extends Library with Utimensat[Int] {
def __xstat(version: Int, filePath: String, buf: Linux32FileStat): Int
def stat(filePath: String, buf: Linux32FileStat): Int
}
private object Linux32Milli extends PosixMilliIntUtim[Linux32] {
protected final val AT_FDCWD: Int = -100
protected final val UTIME_OMIT: Int = ((1 << 30) - 2)
protected def getModifiedTimeNative(filePath: String) = {
val stat = new Linux32FileStat
checkedIO(filePath) { libc.__xstat(3, filePath, stat) }
checkedIO(filePath) { libc.stat(filePath, stat) }
stat.getModifiedTimeNative
}
}
Expand Down