Documentation ¶
Overview ¶
Package donation tracks files that are being donated to a child process and using flags to notified the child process where the FDs are.
Index ¶
- func DonateAndTransferCustomFiles(cmd *exec.Cmd, nextFD int, files map[int]*os.File) int
- func LogDonations(cmd *exec.Cmd)
- type Agency
- func (f *Agency) Close()
- func (f *Agency) Donate(flag string, files ...*os.File)
- func (f *Agency) DonateAndClose(flag string, files ...*os.File)
- func (f *Agency) DonateDebugLogFile(flag, logPattern, command, test string, timestamp time.Time) error
- func (f *Agency) OpenAndDonate(flag, path string, flags int) error
- func (f *Agency) Transfer(cmd *exec.Cmd, nextFD int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DonateAndTransferCustomFiles ¶
DonateAndTransferCustomFiles sets up the flags for passing file descriptors from the host to the sandbox. Making use of the agency is not necessary,
func LogDonations ¶
LogDonations logs the FDs we are donating in the command.
Types ¶
type Agency ¶
type Agency struct {
// contains filtered or unexported fields
}
Agency keeps track of files that need to be donated to a child process.
func (*Agency) Close ¶
func (f *Agency) Close()
Close closes any files the agency has taken ownership over.
func (*Agency) Donate ¶
Donate sets up the given files to be donated to another process. The FD in which the new file will appear in the child process is added as a flag to the child process, e.g. --flag=3. In case the file is nil, -1 is used for the flag value and no file is donated to the next process.
func (*Agency) DonateAndClose ¶
DonateAndClose does the same as Donate, but takes ownership of the files passed in.
func (*Agency) DonateDebugLogFile ¶
func (f *Agency) DonateDebugLogFile(flag, logPattern, command, test string, timestamp time.Time) error
DonateDebugLogFile is similar to DonateAndClose but handles the opening of the file using specutils.DebugLogFile() for convenience. It's a noop, if path is empty.
func (*Agency) OpenAndDonate ¶
OpenAndDonate is similar to DonateAndClose but handles the opening of the file for convenience. It's a noop, if path is empty.