diff --git a/unix/syscall_illumos.go b/unix/syscall_illumos.go index 8d5f294c..e48244a9 100644 --- a/unix/syscall_illumos.go +++ b/unix/syscall_illumos.go @@ -20,10 +20,9 @@ func bytes2iovec(bs [][]byte) []Iovec { for i, b := range bs { iovecs[i].SetLen(len(b)) if len(b) > 0 { - // somehow Iovec.Base on illumos is (*int8), not (*byte) - iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0])) + iovecs[i].Base = &b[0] } else { - iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero)) + iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero)) } } return iovecs diff --git a/unix/syscall_solaris.go b/unix/syscall_solaris.go index 932996c7..cd492d7a 100644 --- a/unix/syscall_solaris.go +++ b/unix/syscall_solaris.go @@ -457,10 +457,10 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn msg.Namelen = uint32(SizeofSockaddrAny) var iov Iovec if len(p) > 0 { - iov.Base = (*int8)(unsafe.Pointer(&p[0])) + iov.Base = &p[0] iov.SetLen(len(p)) } - var dummy int8 + var dummy byte if len(oob) > 0 { // receive at least one normal byte if len(p) == 0 { @@ -486,10 +486,10 @@ func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags i msg.Namelen = uint32(salen) var iov Iovec if len(p) > 0 { - iov.Base = (*int8)(unsafe.Pointer(&p[0])) + iov.Base = &p[0] iov.SetLen(len(p)) } - var dummy int8 + var dummy byte if len(oob) > 0 { // send at least one normal byte if len(p) == 0 { diff --git a/unix/types_solaris.go b/unix/types_solaris.go index 5360e5d3..7d79700d 100644 --- a/unix/types_solaris.go +++ b/unix/types_solaris.go @@ -74,6 +74,12 @@ struct sockaddr_any { char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; }; +// go_iovec is used to get *byte as the base address for Iovec. +struct goIovec { + void* iov_base; + size_t iov_len; +}; + */ import "C" @@ -150,7 +156,7 @@ type _Socklen C.socklen_t type Linger C.struct_linger -type Iovec C.struct_iovec +type Iovec C.struct_goIovec type IPMreq C.struct_ip_mreq diff --git a/unix/ztypes_solaris_amd64.go b/unix/ztypes_solaris_amd64.go index ad4aad27..c1a9b83a 100644 --- a/unix/ztypes_solaris_amd64.go +++ b/unix/ztypes_solaris_amd64.go @@ -178,7 +178,7 @@ type Linger struct { } type Iovec struct { - Base *int8 + Base *byte Len uint64 }