Documentation
¶
Index ¶
- Variables
- func ExtraFile(cmd *exec.Cmd, f *os.File) (fd uintptr)
- func ExtraFileSlice(extraFiles *[]*os.File, f *os.File) (fd uintptr)
- func Fulfill(ctx context.Context, cmd *exec.Cmd, files []File, extraFiles *ExtraFilesPre) (err error)
- func InitFile(f File, extraFiles *ExtraFilesPre) (fd uintptr)
- func Receive(key string, e any) (func() error, error)
- func Setup(extraFiles *[]*os.File) (int, *gob.Encoder, error)
- type BaseFile
- type ExtraFilesPre
- type File
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 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.
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.
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.
Click to show internal directories.
Click to hide internal directories.