"Fossies" - the Fresh Open Source Software Archive

Member "mattermost-server-6.0.1/vendor/github.com/tinylib/msgp/msgp/advise_linux.go" (18 Oct 2021, 418 Bytes) of package /linux/www/mattermost-server-6.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // +build linux,!appengine
    2 
    3 package msgp
    4 
    5 import (
    6     "os"
    7     "syscall"
    8 )
    9 
   10 func adviseRead(mem []byte) {
   11     syscall.Madvise(mem, syscall.MADV_SEQUENTIAL|syscall.MADV_WILLNEED)
   12 }
   13 
   14 func adviseWrite(mem []byte) {
   15     syscall.Madvise(mem, syscall.MADV_SEQUENTIAL)
   16 }
   17 
   18 func fallocate(f *os.File, sz int64) error {
   19     err := syscall.Fallocate(int(f.Fd()), 0, 0, sz)
   20     if err == syscall.ENOTSUP {
   21         return f.Truncate(sz)
   22     }
   23     return err
   24 }