unixutils

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: BSD-3-Clause Imports: 4 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FDResultSets

type FDResultSets struct {
	// contains filtered or unexported fields
}

FDResultSets contains the result of a Select operation.

func Select

func Select(rd, wr, er *FDSet, timeout time.Duration) (*FDResultSets, error)

Select performs a select system call, file descriptors in the rd set are tested for read-events, file descriptors in the wd set are tested for write-events and file descriptors in the er set are tested for error-events. The function will block until an event happens or the timeout expires. The function return an FDResultSets that contains all the file descriptor that have a pending read/write/error event.

func (*FDResultSets) IsError

func (r *FDResultSets) IsError(fd int) bool

IsError test if a file descriptor is in error state.

func (*FDResultSets) IsReadable

func (r *FDResultSets) IsReadable(fd int) bool

IsReadable test if a file descriptor is ready to be read.

func (*FDResultSets) IsWritable

func (r *FDResultSets) IsWritable(fd int) bool

IsWritable test if a file descriptor is ready to be written.

type FDSet

type FDSet struct {
	// contains filtered or unexported fields
}

FDSet is a set of file descriptors suitable for a select call

func NewFDSet

func NewFDSet(fds ...int) *FDSet

NewFDSet creates a set of file descriptors suitable for a Select call.

func (*FDSet) Add

func (s *FDSet) Add(fds ...int)

Add adds the file descriptors passed as parameter to the FDSet.

type Pipe

type Pipe struct {
	// contains filtered or unexported fields
}

Pipe represents a unix-pipe

func (*Pipe) Close

func (p *Pipe) Close() error

Close the pipe

func (*Pipe) Open

func (p *Pipe) Open() error

Open creates a new pipe

func (*Pipe) Read

func (p *Pipe) Read(data []byte) (int, error)

Read from the pipe into the data array. Returns the number of bytes read.

func (*Pipe) ReadFD

func (p *Pipe) ReadFD() int

ReadFD returns the file handle for the read side of the pipe.

func (*Pipe) Write

func (p *Pipe) Write(data []byte) (int, error)

Write to the pipe the content of data. Returns the numbre of bytes written.

func (*Pipe) WriteFD

func (p *Pipe) WriteFD() int

WriteFD returns the flie handle for the write side of the pipe.

Jump to

Keyboard shortcuts

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