mirror of
https://github.com/hanzoai/go-fuse.git
synced 2026-10-30 14:46:18 +00:00
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
16 lines
299 B
Go
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
|
|
}
|