Files
go-fuse/internal/fallocate/fallocate_freebsd.go
lch 6dcda77710 internal: fix fallocate return value on FreeBSD
posix_fallocate(2) returns error directly without setting errno[1]

[1]: https://man.freebsd.org/cgi/man.cgi?query=posix_fallocate&sektion=2

Change-Id: I90ac60ecab6f8814a579cc96d11d4d6660408e88
2024-05-16 00:02:34 +08:00

16 lines
299 B
Go

package fallocate
import (
"golang.org/x/sys/unix"
)
func fallocate(fd int, mode uint32, off int64, len int64) error {
// Ignore mode
_ = mode
ret, _, _ := unix.Syscall(unix.SYS_POSIX_FALLOCATE, uintptr(fd), uintptr(off), uintptr(len))
if ret != 0 {
return unix.Errno(ret)
}
return nil
}