Documentation ¶
Index ¶
- Constants
- func AvailableStorageDrivers(path string, supportedDrivers []api.ServerStorageDriverInfo, ...) []string
- func CloseRange(FirstFd uint32, LastFd uint32, Flags uint32) error
- func DetectFilesystem(path string) (string, error)
- func DeviceTotalMemory() (int64, error)
- func ExitStatus(err error) (int, error)
- func FSTypeToName(fsType int32) (string, error)
- func GetAllXattr(path string) (map[string]string, error)
- func GetErrno(err error) (errno error, iserrno bool)
- func GetMeminfo(field string) (int64, error)
- func GetPollRevents(fd int, timeout int, flags int) (int, int, error)
- func GetSystemdListeners(start int) []net.Listener
- func GetUcred(conn *net.UnixConn) (*unix.Ucred, error)
- func IsBlockdev(fm os.FileMode) bool
- func IsBlockdevPath(pathName string) bool
- func IsMountPoint(path string) bool
- func LoadModule(module string) error
- func NewExecWrapper(ctx context.Context, f *os.File) io.ReadWriteCloser
- func OpenPty(uid, gid int64) (*os.File, *os.File, error)
- func OpenPtyInDevpts(devpts_fd int, uid, gid int64) (*os.File, *os.File, error)
- func PathNameDecode(text string) string
- func PathNameEncode(text string) string
- func PidFdOpen(Pid int, Flags uint32) (*os.File, error)
- func PidfdSendSignal(Pidfd int, Signal int, Flags uint32) error
- func ReadPid(r *os.File) int
- func ResolveMountOptions(options []string) (uintptr, string)
- func RunningInUserNS() bool
- func SetPtySize(fd int, width int, height int) (err error)
- func StatVFS(path string) (*unix.Statfs_t, error)
- func SyncFS(path string) error
- type Utsname
Constants ¶
const ABSTRACT_UNIX_SOCK_LEN int = C.ABSTRACT_UNIX_SOCK_LEN
const CLOSE_RANGE_CLOEXEC uint32 = C.CLOSE_RANGE_CLOEXEC
const CLOSE_RANGE_UNSHARE uint32 = C.CLOSE_RANGE_UNSHARE
const (
FilesystemSuperMagicZfs = 0x2fc12fc1
)
Filesystem magic numbers.
const SystemdListenFDsStart = 3
SystemdListenFDsStart is the number of the first file descriptor that might have been opened by systemd when socket activation is enabled. It's always 3 in real-world usage (i.e. the first file descriptor opened after stdin, stdout and stderr), so this constant should always be the value passed to GetListeners, except for unit tests.
Variables ¶
This section is empty.
Functions ¶
func AvailableStorageDrivers ¶
func AvailableStorageDrivers(path string, supportedDrivers []api.ServerStorageDriverInfo, poolType util.PoolType) []string
AvailableStorageDrivers returns a list of storage drivers that are available.
func DetectFilesystem ¶
DetectFilesystem returns the filesystem on which the passed-in path sits.
func DeviceTotalMemory ¶
DeviceTotalMemory returns the total amount of memory on the system (in bytes).
func ExitStatus ¶
ExitStatus extracts the exit status from the error returned by exec.Cmd. If a nil err is provided then an exit status of 0 is returned along with the nil error. If a valid exit status can be extracted from err then it is returned along with a nil error. If no valid exit status can be extracted then a -1 exit status is returned along with the err provided.
func FSTypeToName ¶
FSTypeToName returns the name of the given fs type. The fsType is from the Type field of unix.Statfs_t. We use int32 so that this function behaves the same on both 32bit and 64bit platforms by requiring any 64bit FS types to be overflowed before being passed in. They will then be compared with equally overflowed FS type constant values.
func GetAllXattr ¶
GetAllXattr retrieves all extended attributes associated with a file, directory or symbolic link.
func GetMeminfo ¶
GetMeminfo parses /proc/meminfo for the specified field.
func GetPollRevents ¶ added in v0.2.0
GetPollRevents poll for events on provided fd.
func GetSystemdListeners ¶
GetSystemdListeners returns the socket-activated network listeners, if any.
The 'start' parameter must be SystemdListenFDsStart, except in unit tests, see the docstring of SystemdListenFDsStart below.
func IsBlockdev ¶
IsBlockdev checks if the provided file is a block device.
func IsBlockdevPath ¶
IsBlockdevPath checks if the provided path is a block device.
func IsMountPoint ¶
IsMountPoint returns true if path is a mount point.
func LoadModule ¶
LoadModule loads the kernel module with the given name, by invoking modprobe. This respects any modprobe configuration on the system.
func NewExecWrapper ¶ added in v0.2.0
NewExecWrapper returns a new ReadWriteCloser wrapper for an os.File. The ctx is used to indicate when the executed process has ended, at which point any further Read calls will return io.EOF rather than potentially blocking on the poll syscall if the process is a shell that still has background processes running that are not producing any output.
func OpenPtyInDevpts ¶
OpenPtyInDevpts creates a new PTS pair, configures them and returns them.
func PathNameDecode ¶
PathNameDecode decodes a string containing an encoded path back to its original form. The decoding scheme converts "-" back to "/" and "--" back to "-".
func PathNameEncode ¶
PathNameEncode encodes a path string to be used as part of a file name. The encoding scheme replaces "-" with "--" and then "/" with "-".
func ResolveMountOptions ¶
ResolveMountOptions resolves the provided mount options.
func RunningInUserNS ¶
func RunningInUserNS() bool
func SetPtySize ¶
SetPtySize issues the correct ioctl to resize a pty.