Commit 4ed4d404 authored by Tobias Klauser's avatar Tobias Klauser Committed by Brad Fitzpatrick

unix: add ioctl functions for termios on Linux

Add IoctlGetTermios and IoctlGetTermios to retreive and manipulate
Termios structures on Linux, akin to the already existing implementation
or Solaris.

If desired, functions conforming to POSIX tcgetattr/tcsetattr could be
implemented on top of these.

Change-Id: I2a71061bad2e632c597b6f6184ad6374c46a43ee
Reviewed-on: https://go-review.googlesource.com/47330Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 90796e5a
......@@ -61,6 +61,10 @@ func IoctlSetInt(fd int, req uint, value int) (err error) {
return ioctl(fd, req, uintptr(value))
}
func IoctlSetTermios(fd int, req uint, value *Termios) (err error) {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
// IoctlGetInt performs an ioctl operation which gets an integer value
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
......@@ -69,6 +73,12 @@ func IoctlGetInt(fd int, req uint) (int, error) {
return value, err
}
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
var value Termios
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
func Link(oldpath string, newpath string) (err error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment