2015-11-06 20:15:45 +01:00
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2016-08-06 02:36:33 +02:00
|
|
|
// +build darwin dragonfly freebsd netbsd openbsd solaris
|
|
|
|
|
2015-11-06 20:15:45 +01:00
|
|
|
// BSD library calls.
|
|
|
|
|
|
|
|
package syscall
|
|
|
|
|
2016-02-03 22:58:02 +01:00
|
|
|
import (
|
|
|
|
"internal/race"
|
|
|
|
"unsafe"
|
|
|
|
)
|
2015-11-06 20:15:45 +01:00
|
|
|
|
|
|
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
2016-02-03 22:58:02 +01:00
|
|
|
if race.Enabled {
|
|
|
|
race.ReleaseMerge(unsafe.Pointer(&ioSync))
|
2015-11-06 20:15:45 +01:00
|
|
|
}
|
|
|
|
var soff Offset_t
|
|
|
|
var psoff *Offset_t
|
|
|
|
if offset != nil {
|
2015-11-21 05:43:50 +01:00
|
|
|
soff = Offset_t(*offset)
|
2015-11-06 20:15:45 +01:00
|
|
|
psoff = &soff
|
|
|
|
}
|
|
|
|
written, err = sendfile(outfd, infd, psoff, count)
|
|
|
|
if offset != nil {
|
|
|
|
*offset = int64(soff)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|