fix Linux build: use golang.org/x/sys/unix for Fadvise

Replace syscall.Fadvise with unix.Fadvise from golang.org/x/sys/unix
which is the correct portable way to access fadvise on Linux
This commit is contained in:
Jeffrey Paul 2026-02-12 13:15:39 -08:00
parent 156217043e
commit 56c3fe7804

View File

@ -4,13 +4,13 @@ package bsdaily
import ( import (
"os" "os"
"syscall" "golang.org/x/sys/unix"
) )
func applyFileAdvice(file *os.File, size int64) { func applyFileAdvice(file *os.File, size int64) {
fd := int(file.Fd()) fd := int(file.Fd())
// POSIX_FADV_SEQUENTIAL = 2 // POSIX_FADV_SEQUENTIAL = 2
_ = syscall.Fadvise(fd, 0, size, 2) _ = unix.Fadvise(fd, 0, size, 2)
// POSIX_FADV_WILLNEED = 3 - prefetch file into cache // POSIX_FADV_WILLNEED = 3 - prefetch file into cache
_ = syscall.Fadvise(fd, 0, size, 3) _ = unix.Fadvise(fd, 0, size, 3)
} }