unix: add IoctlGetInt and IoctlSetInt on Linux

This CL adds basic integer get/set functions which wrap a generic
ioctl call.  The API is similar the one introduced for solaris/amd64
in CL 14587, but the request parameter has been changed to a uint
instead of an int.  This makes requests with a number larger than the
maximum signed 32-bit integer work on linux/386.

For consistency, the solaris/amd64 API has also been updated to make
use of a uint instead of an int for the request number.

Fixes golang/go#20474

Change-Id: Iaae1ee2e4bb4bfcc420dcec252fe53c8d90ce81d
Reviewed-on: https://go-review.googlesource.com/44009
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matt Layher
2017-05-24 19:12:47 +00:00
parent dbc2be9168
commit a55a760868
27 changed files with 179 additions and 11 deletions
+3
View File
@@ -59,6 +59,7 @@ package unix
#include <linux/if_alg.h>
#include <linux/fs.h>
#include <linux/vm_sockets.h>
#include <linux/random.h>
// On mips64, the glibc stat and kernel stat do not agree
#if (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64)
@@ -530,6 +531,8 @@ const (
type Sigset_t C.sigset_t
const RNDGETENTCNT = C.RNDGETENTCNT
// sysconf information
const _SC_PAGESIZE = C._SC_PAGESIZE