vendor/golang.org/x/sys/unix/ioctl.go
changeset 256 6d9efbef00a9
parent 251 1c52a0eeb952
child 265 05c40b36d3b2
equal deleted inserted replaced
255:4f153a23adab 256:6d9efbef00a9
     1 // Copyright 2018 The Go Authors. All rights reserved.
     1 // Copyright 2018 The Go Authors. All rights reserved.
     2 // Use of this source code is governed by a BSD-style
     2 // Use of this source code is governed by a BSD-style
     3 // license that can be found in the LICENSE file.
     3 // license that can be found in the LICENSE file.
     4 
     4 
       
     5 //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
     5 // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
     6 // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
     6 
     7 
     7 package unix
     8 package unix
     8 
     9 
     9 import (
    10 import (
    16 
    17 
    17 // IoctlSetInt performs an ioctl operation which sets an integer value
    18 // IoctlSetInt performs an ioctl operation which sets an integer value
    18 // on fd, using the specified request number.
    19 // on fd, using the specified request number.
    19 func IoctlSetInt(fd int, req uint, value int) error {
    20 func IoctlSetInt(fd int, req uint, value int) error {
    20 	return ioctl(fd, req, uintptr(value))
    21 	return ioctl(fd, req, uintptr(value))
       
    22 }
       
    23 
       
    24 // IoctlSetPointerInt performs an ioctl operation which sets an
       
    25 // integer value on fd, using the specified request number. The ioctl
       
    26 // argument is called with a pointer to the integer value, rather than
       
    27 // passing the integer value directly.
       
    28 func IoctlSetPointerInt(fd int, req uint, value int) error {
       
    29 	v := int32(value)
       
    30 	return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
    21 }
    31 }
    22 
    32 
    23 // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
    33 // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
    24 //
    34 //
    25 // To change fd's window size, the req argument should be TIOCSWINSZ.
    35 // To change fd's window size, the req argument should be TIOCSWINSZ.