Jelajahi Sumber

unix: remove raw syscall from Sendfile

Update golang/go#17490

Change-Id: Iaec54b8ffda1a24d4c8b5671185d570fb8683155
Reviewed-on: https://go-review.googlesource.com/c/154663
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall 7 tahun lalu
induk
melakukan
7c4c994c65

+ 7 - 0
unix/syscall_aix.go

@@ -268,6 +268,13 @@ func Gettimeofday(tv *Timeval) (err error) {
 	return
 	return
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 // TODO
 // TODO
 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 	return -1, ENOSYS
 	return -1, ENOSYS

+ 12 - 0
unix/syscall_darwin.go

@@ -394,6 +394,18 @@ func Uname(uname *Utsname) error {
 	return nil
 	return nil
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	var length = int64(count)
+	err = sendfile(infd, outfd, *offset, &length, nil, 0)
+	written = int(length)
+	return
+}
+
+//sys	sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
+
 /*
 /*
  * Exposed directly
  * Exposed directly
  */
  */

+ 0 - 13
unix/syscall_darwin_386.go

@@ -48,19 +48,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 	cmsg.Len = uint32(length)
 	cmsg.Len = uint32(length)
 }
 }
 
 
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
-	var length = uint64(count)
-
-	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
-
-	written = int(length)
-
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 
 
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions

+ 0 - 14
unix/syscall_darwin_amd64.go

@@ -8,7 +8,6 @@ package unix
 
 
 import (
 import (
 	"syscall"
 	"syscall"
-	"unsafe"
 )
 )
 
 
 func setTimespec(sec, nsec int64) Timespec {
 func setTimespec(sec, nsec int64) Timespec {
@@ -48,19 +47,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 	cmsg.Len = uint32(length)
 	cmsg.Len = uint32(length)
 }
 }
 
 
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
-	var length = uint64(count)
-
-	_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
-
-	written = int(length)
-
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 
 
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions

+ 0 - 14
unix/syscall_darwin_arm.go

@@ -6,7 +6,6 @@ package unix
 
 
 import (
 import (
 	"syscall"
 	"syscall"
-	"unsafe"
 )
 )
 
 
 func setTimespec(sec, nsec int64) Timespec {
 func setTimespec(sec, nsec int64) Timespec {
@@ -46,19 +45,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 	cmsg.Len = uint32(length)
 	cmsg.Len = uint32(length)
 }
 }
 
 
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
-	var length = uint64(count)
-
-	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
-
-	written = int(length)
-
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
 
 
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions

+ 0 - 14
unix/syscall_darwin_arm64.go

@@ -8,7 +8,6 @@ package unix
 
 
 import (
 import (
 	"syscall"
 	"syscall"
-	"unsafe"
 )
 )
 
 
 func setTimespec(sec, nsec int64) Timespec {
 func setTimespec(sec, nsec int64) Timespec {
@@ -48,19 +47,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 	cmsg.Len = uint32(length)
 	cmsg.Len = uint32(length)
 }
 }
 
 
-func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
-	var length = uint64(count)
-
-	_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
-
-	written = int(length)
-
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
 
 
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions

+ 7 - 0
unix/syscall_dragonfly.go

@@ -234,6 +234,13 @@ func Uname(uname *Utsname) error {
 	return nil
 	return nil
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 /*
 /*
  * Exposed directly
  * Exposed directly
  */
  */

+ 7 - 0
unix/syscall_freebsd.go

@@ -500,6 +500,13 @@ func convertFromDirents11(buf []byte, old []byte) int {
 	return dstPos
 	return dstPos
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 /*
 /*
  * Exposed directly
  * Exposed directly
  */
  */

+ 7 - 0
unix/syscall_linux.go

@@ -1360,6 +1360,13 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
 	return mount(source, target, fstype, flags, datap)
 	return mount(source, target, fstype, flags, datap)
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 // Sendto
 // Sendto
 // Recvfrom
 // Recvfrom
 // Socketpair
 // Socketpair

+ 7 - 0
unix/syscall_netbsd.go

@@ -244,6 +244,13 @@ func Uname(uname *Utsname) error {
 	return nil
 	return nil
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 /*
 /*
  * Exposed directly
  * Exposed directly
  */
  */

+ 7 - 0
unix/syscall_openbsd.go

@@ -94,6 +94,13 @@ func Getwd() (string, error) {
 	return string(buf[:n]), nil
 	return string(buf[:n]), nil
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 // TODO
 // TODO
 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 	return -1, ENOSYS
 	return -1, ENOSYS

+ 7 - 0
unix/syscall_solaris.go

@@ -585,6 +585,13 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
 	return poll(&fds[0], len(fds), timeout)
 	return poll(&fds[0], len(fds), timeout)
 }
 }
 
 
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+	if raceenabled {
+		raceReleaseMerge(unsafe.Pointer(&ioSync))
+	}
+	return sendfile(outfd, infd, offset, count)
+}
+
 /*
 /*
  * Exposed directly
  * Exposed directly
  */
  */

+ 0 - 7
unix/syscall_unix.go

@@ -351,13 +351,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
 	return
 	return
 }
 }
 
 
-func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
-	if raceenabled {
-		raceReleaseMerge(unsafe.Pointer(&ioSync))
-	}
-	return sendfile(outfd, infd, offset, count)
-}
-
 var ioSync int64
 var ioSync int64
 
 
 func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
 func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }

+ 14 - 0
unix/zsyscall_darwin_386.1_12.go

@@ -749,6 +749,20 @@ func libc_ioctl_trampoline()
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0)
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+func libc_sendfile_trampoline()
+
+//go:linkname libc_sendfile libc_sendfile
+//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 10 - 0
unix/zsyscall_darwin_386.go

@@ -573,6 +573,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
 
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0)
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 2 - 0
unix/zsyscall_darwin_386.s

@@ -92,6 +92,8 @@ TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_kill(SB)
 	JMP	libc_kill(SB)
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_ioctl(SB)
 	JMP	libc_ioctl(SB)
+TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
+	JMP	libc_sendfile(SB)
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_access(SB)
 	JMP	libc_access(SB)
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0

+ 14 - 0
unix/zsyscall_darwin_amd64.1_12.go

@@ -749,6 +749,20 @@ func libc_ioctl_trampoline()
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+func libc_sendfile_trampoline()
+
+//go:linkname libc_sendfile libc_sendfile
+//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 10 - 0
unix/zsyscall_darwin_amd64.go

@@ -573,6 +573,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
 
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 2 - 0
unix/zsyscall_darwin_amd64.s

@@ -92,6 +92,8 @@ TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_kill(SB)
 	JMP	libc_kill(SB)
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_ioctl(SB)
 	JMP	libc_ioctl(SB)
+TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
+	JMP	libc_sendfile(SB)
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_access(SB)
 	JMP	libc_access(SB)
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0

+ 14 - 0
unix/zsyscall_darwin_arm.1_12.go

@@ -749,6 +749,20 @@ func libc_ioctl_trampoline()
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0)
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+func libc_sendfile_trampoline()
+
+//go:linkname libc_sendfile libc_sendfile
+//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 10 - 0
unix/zsyscall_darwin_arm.go

@@ -573,6 +573,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
 
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0)
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 2 - 0
unix/zsyscall_darwin_arm.s

@@ -92,6 +92,8 @@ TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_kill(SB)
 	JMP	libc_kill(SB)
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_ioctl(SB)
 	JMP	libc_ioctl(SB)
+TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
+	JMP	libc_sendfile(SB)
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_access(SB)
 	JMP	libc_access(SB)
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0

+ 14 - 0
unix/zsyscall_darwin_arm64.1_12.go

@@ -749,6 +749,20 @@ func libc_ioctl_trampoline()
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+func libc_sendfile_trampoline()
+
+//go:linkname libc_sendfile libc_sendfile
+//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 10 - 0
unix/zsyscall_darwin_arm64.go

@@ -573,6 +573,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
 
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
 
+func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
+	_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Access(path string, mode uint32) (err error) {
 func Access(path string, mode uint32) (err error) {
 	var _p0 *byte
 	var _p0 *byte
 	_p0, err = BytePtrFromString(path)
 	_p0, err = BytePtrFromString(path)

+ 2 - 0
unix/zsyscall_darwin_arm64.s

@@ -92,6 +92,8 @@ TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_kill(SB)
 	JMP	libc_kill(SB)
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_ioctl(SB)
 	JMP	libc_ioctl(SB)
+TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
+	JMP	libc_sendfile(SB)
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_access(SB)
 	JMP	libc_access(SB)
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
 TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0