github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/link/ld/outbuf_freebsd.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build freebsd && go1.21 6 7 package ld 8 9 import ( 10 "syscall" 11 12 "github.com/go-asm/go/syscall/unix" 13 ) 14 15 func (out *OutBuf) fallocate(size uint64) error { 16 err := unix.PosixFallocate(int(out.f.Fd()), 0, int64(size)) 17 // ZFS on FreeBSD does not support posix_fallocate and returns EINVAL in that case. 18 if err == syscall.EINVAL { 19 return errNoFallocate 20 } 21 return err 22 }