From 193893d61a6e61386b16a2ca84eba381e0e61170 Mon Sep 17 00:00:00 2001 From: Nahum Shalman Date: Thu, 18 Mar 2021 01:16:38 +0000 Subject: [PATCH] unix: expose ioctl returns with ioctlRet on solaris and illumos Change-Id: Ide2beea5182b3ef35f1f04f429dc8f9327457c8d Reviewed-on: https://go-review.googlesource.com/c/sys/+/302829 Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Tobias Klauser Reviewed-by: David Anderson Trust: Ian Lance Taylor --- unix/syscall_solaris.go | 7 ++++++- unix/zsyscall_solaris_amd64.go | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/unix/syscall_solaris.go b/unix/syscall_solaris.go index 169497f0..77fcde7c 100644 --- a/unix/syscall_solaris.go +++ b/unix/syscall_solaris.go @@ -565,7 +565,12 @@ func Minor(dev uint64) uint32 { * Expose the ioctl function */ -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) = libc.ioctl + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, err = ioctlRet(fd, req, arg) + return err +} func IoctlSetTermio(fd int, req uint, value *Termio) error { err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) diff --git a/unix/zsyscall_solaris_amd64.go b/unix/zsyscall_solaris_amd64.go index 7099f555..4e18d5c9 100644 --- a/unix/zsyscall_solaris_amd64.go +++ b/unix/zsyscall_solaris_amd64.go @@ -619,8 +619,9 @@ func __minor(version int, dev uint64) (val uint) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) +func ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) + ret = int(r0) if e1 != 0 { err = e1 }