]> Cypherpunks repositories - gostls13.git/commitdiff
internal/syscall/unix: change Ioctl arg type to unsafe.Pointer on AIX
authorMatt Layher <mdlayher@gmail.com>
Mon, 9 Aug 2021 21:12:37 +0000 (17:12 -0400)
committerMatt Layher <mdlayher@gmail.com>
Mon, 16 Aug 2021 16:58:24 +0000 (16:58 +0000)
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>
src/internal/syscall/unix/ioctl_aix.go
src/net/interface_aix.go

index 19d56c36a13156563115d5bbdf248a08ccbf1627..d361533b5c4a43bdf3789f7711077d74278560bd 100644 (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
index 49f78c2abbcbfa78eba1c57e3f8755842dc4a095..7ad45d11756a0646096121fdcf200a0e61ecd5e9 100644 (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
                                }