rawfile

package
v0.0.0-...-4bf4b70 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rawfile contains utilities for using the netstack with raw host files on Linux hosts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockingPoll

func BlockingPoll(fds *PollEvent, nfds int, timeout *syscall.Timespec) (int, syscall.Errno)

BlockingPoll on amd64/arm64 makes the ppoll() syscall while calling the version of entersyscall that relinquishes the P so that other Gs can run. This is meant to be called in cases when the syscall is expected to block. On non amd64/arm64 platforms it just forwards to the ppoll() system call.

func BlockingRead

func BlockingRead(fd int, b []byte) (int, *tcpip.Error)

BlockingRead reads from a file descriptor that is set up as non-blocking. If no data is available, it will block in a poll() syscall until the file descriptor becomes readable.

func BlockingReadv

func BlockingReadv(fd int, iovecs []syscall.Iovec) (int, *tcpip.Error)

BlockingReadv reads from a file descriptor that is set up as non-blocking and stores the data in a list of iovecs buffers. If no data is available, it will block in a poll() syscall until the file descriptor becomes readable.

func BlockingRecvMMsg

func BlockingRecvMMsg(fd int, msgHdrs []MMsgHdr) (int, *tcpip.Error)

BlockingRecvMMsg reads from a file descriptor that is set up as non-blocking and stores the received messages in a slice of MMsgHdr structures. If no data is available, it will block in a poll() syscall until the file descriptor becomes readable.

func GetMTU

func GetMTU(name string) (uint32, error)

GetMTU determines the MTU of a network interface device.

func NonBlockingSendMMsg

func NonBlockingSendMMsg(fd int, msgHdrs []MMsgHdr) (int, *tcpip.Error)

NonBlockingSendMMsg sends multiple messages on a socket.

func NonBlockingWrite

func NonBlockingWrite(fd int, buf []byte) *tcpip.Error

NonBlockingWrite writes the given buffer to a file descriptor. It fails if partial data is written.

func NonBlockingWriteIovec

func NonBlockingWriteIovec(fd int, iovec []syscall.Iovec) *tcpip.Error

NonBlockingWriteIovec writes iovec to a file descriptor in a single syscall. It fails if partial data is written.

func TranslateErrno

func TranslateErrno(e syscall.Errno) *tcpip.Error

TranslateErrno translate an errno from the syscall package into a *tcpip.Error.

Valid, but unrecognized errnos will be translated to tcpip.ErrInvalidEndpointState (EINVAL).

Types

type MMsgHdr

type MMsgHdr struct {
	Msg syscall.Msghdr
	Len uint32
	// contains filtered or unexported fields
}

MMsgHdr represents the mmsg_hdr structure required by recvmmsg() on linux.

type PollEvent

type PollEvent struct {
	FD      int32
	Events  int16
	Revents int16
}

PollEvent represents the pollfd structure passed to a poll() system call.

Jump to

Keyboard shortcuts

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