ioctl

package module
v0.0.0-...-4fdd418 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

ioctl

Go implementation of the Linux userland (UAPI) ioctl interface.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// Direction returns what the kernel does to the arg parameter for Do():
	// Nothing, read, write or read and write.
	Direction() Direction

	// Type identifies a specific subsystem or driver.
	Type() uintptr

	// Number identifies the specific command and is unique for a
	// given type.
	Number() uintptr

	// Size of the underlying type of the command arg parameter.
	Size() uintptr

	// Do executes the command on the given fd passing the given arg to the
	// underlying ioctl call. The arg parameter must be a pointer type.
	Do(fd uintptr, arg interface{}) error
}

Command is a higher level abstraction of a command definition that is also able to execute it.

func NewNoneCommand

func NewNoneCommand(typ, nr uintptr) Command

NewNoneCommand returns a Command that does not have any arguments.

func NewReadCommand

func NewReadCommand(typ, nr, size uintptr) Command

NewReadCommand returns a Command that reads data from the kernel.

func NewReadWriteCommand

func NewReadWriteCommand(typ, nr, size uintptr) Command

NewReadWriteCommand returns a Command that both reads and writes (sends) data to the kernel.

func NewWriteCommand

func NewWriteCommand(typ, nr, size uintptr) Command

NewWriteCommand returns a Command that writes (sends) data to the kernel.

type Direction

type Direction uintptr
const (
	// DirectionNone means that the kernel does not read or write anything.
	DirectionNone Direction = 0

	// DirectionRead means that the kernel reads data from the command arg
	// parameter.
	DirectionRead Direction = 1

	// DirectionWrite means that the kernel writes data to the command arg
	// parameter.
	DirectionWrite Direction = 2

	// DirectionReadWrite means that the kernel reads and writes data to the
	// command arg parameter.
	DirectionReadWrite Direction = 3
)

Directories

Path Synopsis
Package uapi implements the Linux userland ioctl interface for generating and parsing ioctl command definitions.
Package uapi implements the Linux userland ioctl interface for generating and parsing ioctl command definitions.

Jump to

Keyboard shortcuts

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