1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:17:57 -07:00

internal/syscall/unix: change Ioctl arg type to unsafe.Pointer on AIX

Without this change, this code is technically in violation of the
unsafe.Pointer rules since the conversion from unsafe.Pointer to uintptr has
to happen when calling into the syscall6 assembly implementation.

Change-Id: I4821f5bf9788c8fa2efeb041f811ed092e07ae74
Reviewed-on: https://go-review.googlesource.com/c/go/+/340949
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Matt Layher 2021-08-09 17:12:37 -04:00
parent 5a40100141
commit a0adf91d85
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ var libc_ioctl uintptr
// Implemented in syscall/syscall_aix.go.
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
func Ioctl(fd int, cmd int, args uintptr) (err error) {
func Ioctl(fd int, cmd int, args unsafe.Pointer) (err error) {
_, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_ioctl)), 3, uintptr(fd), uintptr(cmd), uintptr(args), 0, 0, 0)
if e1 != 0 {
err = e1

View File

@ -78,7 +78,7 @@ func interfaceTable(ifindex int) ([]Interface, error) {
// Retrieve MTU
ifr := &ifreq{}
copy(ifr.Name[:], ifi.Name)
err = unix.Ioctl(sock, syscall.SIOCGIFMTU, uintptr(unsafe.Pointer(ifr)))
err = unix.Ioctl(sock, syscall.SIOCGIFMTU, unsafe.Pointer(ifr))
if err != nil {
return nil, err
}