fallocate_linux.go 317 B

123456789101112131415161718192021
  1. // License: GPLv3 Copyright: 2023, Kovid Goyal, <kovid at kovidgoyal.net>
  2. package shm
  3. import (
  4. "errors"
  5. "fmt"
  6. "golang.org/x/sys/unix"
  7. )
  8. var _ = fmt.Print
  9. func Fallocate_simple(fd int, size int64) (err error) {
  10. for {
  11. if err = unix.Fallocate(fd, 0, 0, size); !errors.Is(err, unix.EINTR) {
  12. return
  13. }
  14. }
  15. }