mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-23 23:18:10 +08:00
25 lines
418 B
Go
25 lines
418 B
Go
// +build linux,!appengine
|
|
|
|
package msgp
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
func adviseRead(mem []byte) {
|
|
syscall.Madvise(mem, syscall.MADV_SEQUENTIAL|syscall.MADV_WILLNEED)
|
|
}
|
|
|
|
func adviseWrite(mem []byte) {
|
|
syscall.Madvise(mem, syscall.MADV_SEQUENTIAL)
|
|
}
|
|
|
|
func fallocate(f *os.File, sz int64) error {
|
|
err := syscall.Fallocate(int(f.Fd()), 0, 0, sz)
|
|
if err == syscall.ENOTSUP {
|
|
return f.Truncate(sz)
|
|
}
|
|
return err
|
|
}
|