зеркало из https://github.com/golang/sys.git
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:
Родитель
12bbe5a7a5
Коммит
2d0786266e
|
@ -109,6 +109,12 @@ func IoctlGetInt(fd int, req uint) (int, error) {
|
|||
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) {
|
||||
var value Winsize
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
|
|
Загрузка…
Ссылка в новой задаче