mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 07:07:33 -04:00
unix: add IoctlGetUint32 on Linux
Because the size of int varies on different architectures, IoctlGetInt is unsuitable for ioctl APIs which explicitly deal with fixed size integers, such as uint32. Change-Id: I5a8dc397b713027c4ef9f9a91490f177ac8342e2 Reviewed-on: https://go-review.googlesource.com/c/sys/+/175982 Run-TryBot: Matt Layher <mdlayher@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
@@ -109,6 +109,12 @@ func IoctlGetInt(fd int, req uint) (int, error) {
|
|||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IoctlGetUint32(fd int, req uint) (uint32, error) {
|
||||||
|
var value uint32
|
||||||
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|
||||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
||||||
var value Winsize
|
var value Winsize
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||||
|
|||||||
Reference in New Issue
Block a user