proc

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSet  = errors.New("environment variable not set")
	ErrInvalid = errors.New("bad file descriptor")
)
View Source
var (
	ErrStatFault = errors.New("generic stat fd fault")
	ErrStatRead  = errors.New("unexpected stat behaviour")
)
View Source
var FulfillmentTimeout = 2 * time.Second

Functions

func ExtraFile

func ExtraFile(cmd *exec.Cmd, f *os.File) (fd uintptr)

func ExtraFileSlice

func ExtraFileSlice(extraFiles *[]*os.File, f *os.File) (fd uintptr)

func Fulfill

func Fulfill(ctx context.Context, cmd *exec.Cmd, files []File, extraFiles *ExtraFilesPre) (err error)

Fulfill calls the [File.Fulfill] method on all files, starts cmd and blocks until all fulfillment completes.

func InitFile

func InitFile(f File, extraFiles *ExtraFilesPre) (fd uintptr)

InitFile initialises f as part of the slice extraFiles points to, and returns its final fd value.

func Receive

func Receive(key string, e any) (func() error, error)

Receive retrieves payload pipe fd from the environment, receives its payload and returns the Close method of the pipe.

func Setup

func Setup(extraFiles *[]*os.File) (int, *gob.Encoder, error)

Setup appends the read end of a pipe for payload transmission and returns its fd.

Types

type BaseFile

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

BaseFile implements the Init method of the File interface and provides indirect access to extra file state.

func (*BaseFile) Fd

func (f *BaseFile) Fd() uintptr

func (*BaseFile) Init

func (f *BaseFile) Init(fd uintptr, v **os.File) uintptr

func (*BaseFile) Set

func (f *BaseFile) Set(v *os.File)

type ExtraFilesPre

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

ExtraFilesPre is a linked list storing addresses of os.File.

func (*ExtraFilesPre) Append

func (f *ExtraFilesPre) Append() (uintptr, **os.File)

Append grows the list by one entry and returns an address of the address of os.File stored in the new entry.

func (*ExtraFilesPre) Files

func (f *ExtraFilesPre) Files() []*os.File

Files returns a slice pointing to a continuous segment of memory containing all addresses stored in f in order.

type File

type File interface {
	// Init initialises File state. Init must not be called more than once.
	Init(fd uintptr, v **os.File) uintptr
	// Fd returns the fd value set on initialisation.
	Fd() uintptr
	// ErrCount returns count of error values emitted during fulfillment.
	ErrCount() int
	// Fulfill is called prior to process creation and must populate its corresponding file address.
	// Calls to dispatchErr must match the return value of ErrCount.
	// Fulfill must not be called more than once.
	Fulfill(ctx context.Context, dispatchErr func(error)) error
}

A File is an extra file with deferred initialisation.

func NewStat

func NewStat(s *io.Closer) File

NewStat returns a File implementing the behaviour of the receiving end of xdg-dbus-proxy stat fd.

func NewWriterTo

func NewWriterTo(wt io.WriterTo) File

NewWriterTo returns a File that receives content from wt on fulfillment.

Jump to

Keyboard shortcuts

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