// has not modified the source or destination,
// and the caller should perform the copy using a fallback implementation.
func SendFile(dstFD *FD, src int, size int64) (n int64, err error, handled bool) {
- if runtime.GOOS == "linux" {
+ if goos := runtime.GOOS; goos == "linux" || goos == "android" {
// Linux's sendfile doesn't require any setup:
// It sends from the current position of the source file and
// updates the position of the source after sending.
func sendFileChunk(dst, src int, offset *int64, size int, written int64) (n int, err error) {
switch runtime.GOOS {
- case "linux":
+ case "linux", "android":
// The offset is always nil on Linux.
n, err = syscall.Sendfile(dst, src, offset, size)
case "solaris", "illumos":