mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
unix: add sendfile support on Solaris
Same was done in CL 7940 for the syscall package. Fixes golang/go#10838 Change-Id: I98efa99f57f21bdcdbfb117af66f673e37767fec Reviewed-on: https://go-review.googlesource.com/103335 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
13d03a9a82
commit
2de2067aa5
@@ -128,6 +128,7 @@ import (
|
||||
//go:cgo_import_dynamic libc___xnet_connect __xnet_connect "libsocket.so"
|
||||
//go:cgo_import_dynamic libc_mmap mmap "libc.so"
|
||||
//go:cgo_import_dynamic libc_munmap munmap "libc.so"
|
||||
//go:cgo_import_dynamic libc_sendfile sendfile "libsendfile.so"
|
||||
//go:cgo_import_dynamic libc___xnet_sendto __xnet_sendto "libsocket.so"
|
||||
//go:cgo_import_dynamic libc___xnet_socket __xnet_socket "libsocket.so"
|
||||
//go:cgo_import_dynamic libc___xnet_socketpair __xnet_socketpair "libsocket.so"
|
||||
@@ -255,6 +256,7 @@ import (
|
||||
//go:linkname proc__xnet_connect libc___xnet_connect
|
||||
//go:linkname procmmap libc_mmap
|
||||
//go:linkname procmunmap libc_munmap
|
||||
//go:linkname procsendfile libc_sendfile
|
||||
//go:linkname proc__xnet_sendto libc___xnet_sendto
|
||||
//go:linkname proc__xnet_socket libc___xnet_socket
|
||||
//go:linkname proc__xnet_socketpair libc___xnet_socketpair
|
||||
@@ -383,6 +385,7 @@ var (
|
||||
proc__xnet_connect,
|
||||
procmmap,
|
||||
procmunmap,
|
||||
procsendfile,
|
||||
proc__xnet_sendto,
|
||||
proc__xnet_socket,
|
||||
proc__xnet_socketpair,
|
||||
@@ -1589,6 +1592,15 @@ func munmap(addr uintptr, length uintptr) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendfile)), 4, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
|
||||
written = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
|
||||
var _p0 *byte
|
||||
if len(buf) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user