mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-22 18:41:36 +01:00
d5058b3b20
update go min version Update Vendors: * code.gitea.io/gitea-vet v0.2.0 -> v0.2.1 * code.gitea.io/sdk/gitea v0.13.0 -> v0.13.1 * github.com/AlecAivazis/survey v2.1.1 -> v2.2.2 * github.com/adrg/xdg v0.2.1 -> v0.2.2 * github.com/araddon/dateparse d820a6159ab1 -> 8aadafed4dc4 * github.com/go-git/go-git v5.1.0 -> v5.2.0 * github.com/muesli/termenv v0.7.2 -> v0.7.4 * github.com/stretchr/testify v1.5.1 -> v1.6.1 * github.com/urfave/cli v2.2.0 -> v2.3.0 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/250 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: mrsdizzie <info@mrsdizzie.com> Co-Authored-By: 6543 <6543@noreply.gitea.io> Co-Committed-By: 6543 <6543@noreply.gitea.io>
75 lines
2.4 KiB
Go
75 lines
2.4 KiB
Go
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
|
|
package unix
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
// ioctl itself should not be exposed directly, but additional get/set
|
|
// functions for specific types are permissible.
|
|
|
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
|
// on fd, using the specified request number.
|
|
func IoctlSetInt(fd int, req uint, value int) error {
|
|
return ioctl(fd, req, uintptr(value))
|
|
}
|
|
|
|
// IoctlSetPointerInt performs an ioctl operation which sets an
|
|
// integer value on fd, using the specified request number. The ioctl
|
|
// argument is called with a pointer to the integer value, rather than
|
|
// passing the integer value directly.
|
|
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
|
v := int32(value)
|
|
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
|
}
|
|
|
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
|
//
|
|
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
|
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
|
// TODO: if we get the chance, remove the req parameter and
|
|
// hardcode TIOCSWINSZ.
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
|
runtime.KeepAlive(value)
|
|
return err
|
|
}
|
|
|
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
|
//
|
|
// The req value will usually be TCSETA or TIOCSETA.
|
|
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
|
// TODO: if we get the chance, remove the req parameter.
|
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
|
runtime.KeepAlive(value)
|
|
return err
|
|
}
|
|
|
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
|
// from fd, using the specified request number.
|
|
//
|
|
// A few ioctl requests use the return value as an output parameter;
|
|
// for those, IoctlRetInt should be used instead of this function.
|
|
func IoctlGetInt(fd int, req uint) (int, error) {
|
|
var value int
|
|
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)))
|
|
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
|
|
}
|