sys

package
v0.0.0-...-ba47a78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package sys provide convenient wrappers around syscalls.

Index

Constants

View Source
const SIGWINCH = unix.SIGWINCH

SIGWINCH is the Window size change signal.

Variables

This section is empty.

Functions

func DumpStack

func DumpStack() string

func FlushInput

func FlushInput(fd int) error

FlushInput discards data written to a file descriptor but not read.

func GetWinsize

func GetWinsize(file *os.File) (row, col int)

GetWinsize queries the size of the terminal referenced by the given file.

func Ioctl

func Ioctl(fd int, req uintptr, arg uintptr) error

Ioctl wraps the ioctl syscall.

func IsATTY

func IsATTY(file *os.File) bool

IsATTY returns true if the given file is a terminal.

func Select

func Select(nfd int, r *FdSet, w *FdSet, e *FdSet) error

func Tcgetpgrp

func Tcgetpgrp(fd int) (int, error)

func Tcsetpgrp

func Tcsetpgrp(fd int, pid int) error

func WaitForRead

func WaitForRead(files ...*os.File) (ready []bool, err error)

WaitForRead blocks until any of the given files is ready to be read. It returns a boolean array indicating which files are ready to be read and possible errors.

It is implemented with select(2) on Unix and WaitForMultipleObjects on Windows.

Types

type FdSet

type FdSet unix.FdSet

func NewFdSet

func NewFdSet(fds ...int) *FdSet

func (*FdSet) Clear

func (fs *FdSet) Clear(fds ...int)

func (*FdSet) IsSet

func (fs *FdSet) IsSet(fd int) bool

func (*FdSet) Set

func (fs *FdSet) Set(fds ...int)

func (*FdSet) Zero

func (fs *FdSet) Zero()

type Termios

type Termios unix.Termios

Termios represents terminal attributes.

func NewTermiosFromFd

func NewTermiosFromFd(fd int) (*Termios, error)

NewTermiosFromFd extracts the terminal attribute of the given file descriptor.

func (*Termios) ApplyToFd

func (term *Termios) ApplyToFd(fd int) error

ApplyToFd applies term to the given file descriptor.

func (*Termios) Copy

func (term *Termios) Copy() *Termios

Copy returns a copy of term.

func (*Termios) SetEcho

func (term *Termios) SetEcho(v bool)

SetEcho sets the echo flag.

func (*Termios) SetICRNL

func (term *Termios) SetICRNL(v bool)

SetICRNL sets the CRNL iflag bit

func (*Termios) SetICanon

func (term *Termios) SetICanon(v bool)

SetICanon sets the canonical flag.

func (*Termios) SetVMin

func (term *Termios) SetVMin(v uint8)

SetVMin sets the minimal number of characters for noncanonical read.

func (*Termios) SetVTime

func (term *Termios) SetVTime(v uint8)

SetVTime sets the timeout in deciseconds for noncanonical read.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL