package reexec
import "github.com/dotcloud/docker/pkg/reexec"
Package reexec facilitates the busybox style reexec of a binary.
Handlers can be registered with a name and the argv 0 of the exec of the binary will be used to find and execute custom init paths.
It is used in dockerd to work around forking limitations when using Go.
Index ¶
- func Command(args ...string) *exec.Cmd
- func Init() bool
- func Register(name string, initializer func())
- func Self() string
Functions ¶
func Command ¶
Command returns *exec.Cmd with its Path set to the path of the current binary using the result of Self. For example if current binary is "my-binary" at "/usr/bin/" (or "my-binary.exe" at "C:\" on Windows), then cmd.Path is set to "/usr/bin/my-binary" and "C:\my-binary.exe" respectively.
func Init ¶
func Init() bool
Init is called as the first part of the exec process and returns true if an initialization function was called.
func Register ¶
func Register(name string, initializer func())
Register adds an initialization func under the specified name. It panics if the given name is already registered.
func Self ¶
func Self() string
Self returns the path to the current process's binary. On Linux, it returns "/proc/self/exe", which provides the in-memory version of the current binary, whereas on other platforms it attempts to looks up the absolute path for os.Args[0], or otherwise returns os.Args[0] as-is.
Source Files ¶
- Version
- v27.0.3+incompatible
- Published
- Jun 28, 2024
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 1 hour ago –
Tools for package owners.