diff options
Diffstat (limited to 'container/params.go')
| -rw-r--r-- | container/params.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/container/params.go b/container/params.go deleted file mode 100644 index e6cd26f8..00000000 --- a/container/params.go +++ /dev/null @@ -1,36 +0,0 @@ -package container - -import ( - "encoding/gob" - "errors" - "os" - "strconv" - "syscall" -) - -var ( - ErrReceiveEnv = errors.New("environment variable not set") -) - -// Receive retrieves setup fd from the environment and receives params. -func Receive(key string, e any, fdp *uintptr) (func() error, error) { - var setup *os.File - - if s, ok := os.LookupEnv(key); !ok { - return nil, ErrReceiveEnv - } else { - if fd, err := strconv.Atoi(s); err != nil { - return nil, optionalErrorUnwrap(err) - } else { - setup = os.NewFile(uintptr(fd), "setup") - if setup == nil { - return nil, syscall.EDOM - } - if fdp != nil { - *fdp = setup.Fd() - } - } - } - - return setup.Close, gob.NewDecoder(setup).Decode(e) -} |
