Debian Codegraph @

libgo/go/syscall/libcall_bsd_sendfile.go

raw
1 // Copyright 2015 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 darwin || dragonfly || freebsd || openbsd || solaris
6 // +build darwin dragonfly freebsd openbsd solaris
7
8 // BSD sendfile support.
9
10 package syscall
11
12 import (
13 "internal/race"
14 "unsafe"
15 )
16
17 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
18 if race.Enabled {
19 race.ReleaseMerge(unsafe.Pointer(&ioSync))
20 }
21 var soff Offset_t
22 var psoff *Offset_t
23 if offset != nil {
24 soff = Offset_t(*offset)
25 psoff = &soff
26 }
27 written, err = sendfile(outfd, infd, psoff, count)
28 if offset != nil {
29 *offset = int64(soff)
30 }
31 return
32 }