Source file src/cmd/link/internal/ld/outbuf_freebsd.go
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 "internal/syscall/unix" 11 "syscall" 12 ) 13 14 func (out *OutBuf) fallocate(size uint64) error { 15 err := unix.PosixFallocate(int(out.f.Fd()), 0, int64(size)) 16 // ZFS on FreeBSD does not support posix_fallocate and returns EINVAL in that case. 17 if err == syscall.EINVAL { 18 return errNoFallocate 19 } 20 return err 21 } 22