// Copyright 2011 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.package netimport ()const supportsSendfile = true// sendFile copies the contents of r to c using the sendfile// system call to minimize copies.//// if handled == true, sendFile returns the number (potentially zero) of bytes// copied and any non-EOF error.//// if handled == false, sendFile performed no work.func sendFile( *netFD, io.Reader) ( int64, error, bool) {varint64 = 0// 0 indicates sending until EOF , := .(*io.LimitedReader)if { , = .N, .Rif <= 0 {return0, nil, true } } , := .(*os.File)if ! {return0, nil, false } , := .SyscallConn()if != nil {return0, nil, false }varerror = .Read(func( uintptr) bool { , , = poll.SendFile(&.pfd, int(), )returntrue })if == nil { = }if != nil { .N = - }return , wrapSyscallError("sendfile", ), }
The pages are generated with Goldsv0.7.3-preview. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.