forked from sneak/bsdaily
Add a detailed README, WTFPL LICENSE, and build/CI tooling modeled on the vaultik repo (Makefile, multi-stage digest-pinned Dockerfile, .gitea/workflows/check.yml). Bump Go to 1.26.4 and pin golangci-lint to v2.12.2. gofmt existing sources so the new fmt-check gate passes.
17 lines
305 B
Go
17 lines
305 B
Go
//go:build linux
|
|
|
|
package bsdaily
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
"os"
|
|
)
|
|
|
|
func applyFileAdvice(file *os.File, size int64) {
|
|
fd := int(file.Fd())
|
|
// POSIX_FADV_SEQUENTIAL = 2
|
|
_ = unix.Fadvise(fd, 0, size, 2)
|
|
// POSIX_FADV_WILLNEED = 3 - prefetch file into cache
|
|
_ = unix.Fadvise(fd, 0, size, 3)
|
|
}
|