mirror of
https://github.com/golang/go
synced 2024-11-26 08:17:59 -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:
parent
5a40100141
commit
a0adf91d85
@ -16,7 +16,7 @@ var libc_ioctl uintptr
|
|||||||
// Implemented in syscall/syscall_aix.go.
|
// Implemented in syscall/syscall_aix.go.
|
||||||
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
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)
|
_, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_ioctl)), 3, uintptr(fd), uintptr(cmd), uintptr(args), 0, 0, 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = e1
|
err = e1
|
||||||
|
@ -78,7 +78,7 @@ func interfaceTable(ifindex int) ([]Interface, error) {
|
|||||||
// Retrieve MTU
|
// Retrieve MTU
|
||||||
ifr := &ifreq{}
|
ifr := &ifreq{}
|
||||||
copy(ifr.Name[:], ifi.Name)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user