mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Fix build of fallocate_darwin.go
This commit is contained in:
@@ -3,9 +3,12 @@
|
|||||||
package shm
|
package shm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = fmt.Print
|
var _ = fmt.Print
|
||||||
@@ -15,15 +18,12 @@ func Fallocate_simple(fd int, size int64) (err error) {
|
|||||||
Flags: syscall.F_ALLOCATEALL,
|
Flags: syscall.F_ALLOCATEALL,
|
||||||
Posmode: syscall.F_PEOFPOSMODE,
|
Posmode: syscall.F_PEOFPOSMODE,
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
Length: int64(size),
|
Length: size,
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if _, _, err = syscall.Syscall(syscall.SYS_FCNTL, uintptr(out.f.Fd()), syscall.F_PREALLOCATE, uintptr(unsafe.Pointer(store))); !errors.Is(err, unix.EINTR) {
|
if _, _, err = syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_PREALLOCATE, uintptr(unsafe.Pointer(store))); !errors.Is(err, unix.EINTR) {
|
||||||
if err != 0 {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user