system

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2017 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// MS_PROPAGATION flags are special operations and cannot be combined
	// with each other or any flags other than MS_REC.
	MS_PROPAGATION = syscall.MS_SHARED | syscall.MS_SLAVE | syscall.MS_UNBINDABLE | syscall.MS_PRIVATE
	// MS_OPERATION flags can be mapped to high level operation names.
	MS_OPERATION = MS_PROPAGATION | syscall.MS_BIND | syscall.MS_MOVE | syscall.MS_REC
)

Variables

This section is empty.

Functions

func AnonymousFile added in v0.2.0

func AnonymousFile(dir string) (*os.File, error)

AnonymousFile creates an unlinked temporary file in the given directory or the default temporary directory if unspecified. Since the file has no name, the file's Name method does not return a real path. The file may be later linked into the filesystem for safe keeping using LinkFile.

func Bind

func Bind(source, target string) error

Bind creates a bind mount from source to target.

func CopyRegularFile

func CopyRegularFile(src, dest string) (err error)

CopyRegularFile copies a file in place, updates are not atomic. If the destination doesn't exist it will be created with the same permissions as the original but umask is respected. If the destination already exists the permissions will remain as-is.

func FullHostname

func FullHostname() string

FullHostname is a best effort attempt to resolve the canonical FQDN of the host. On failure it will fall back to a reasonable looking default such as 'localhost.' or 'hostname.invalid.'

func InstallRegularFile

func InstallRegularFile(src, dest string) error

InstallRegularFile copies a file, creating any parent directories.

func IsOpNotSupported added in v0.2.0

func IsOpNotSupported(err error) bool

IsOpNotSupported reports true if the underlying error was EOPNOTSUPP. Useful for checking if the host or filesystem lacks O_TMPFILE support.

func IsSymlink(path string) bool

IsSymlink checks if a path is a symbolic link.

func LinkFile added in v0.2.0

func LinkFile(file *os.File, name string) error

LinkFile creates a new link to an open File instead of an existing name as os.Link and friends do. Particularly useful for making a file created by AnonymousFile accessible in the filesystem. As with Link the caller should ensure the new name is on the same filesystem.

func Mount

func Mount(source, target, fstype, options string) error

Mount wraps mount(2) in a similar way to mount(8), accepting both flags and filesystem options as a string. Any option not recognized as a flag will be passed as a filesystem option. Note that option parsing here is simpler than mount(8) and quotes are not considered.

func MountPrivate

func MountPrivate(target string) error

MountPrivate changes a mount point's propagation type to "private"

func MountShared

func MountShared(target string) error

MountShared changes a mount point's propagation type to "shared"

func MountSlave

func MountSlave(target string) error

MountSlave changes a mount point's propagation type to "slave"

func Move

func Move(source, target string) error

Move moves an entire tree under the source mountpoint to target.

func PortageArch

func PortageArch() string

func PrivateFile added in v0.2.0

func PrivateFile(dir string) (*os.File, error)

PrivateFile creates an unlinked temporary file in the given directory or the default temporary directory if unspecified. Unlike AnonymousFile, the opened file cannot be linked into the filesystem later.

func ReadOnlyBind

func ReadOnlyBind(source, target string) error

ReadOnlyBind creates a read-only bind mount. Note that this must be performed in two operations so it is possible for a read-write bind to be left behind if the second operation fails.

func RecursiveBind

func RecursiveBind(source, target string) error

RecursiveBind bind mounts an entire tree under source to target.

func RecursivePrivate

func RecursivePrivate(target string) error

RecursivePrivate changes an entire tree's propagation type to "private"

func RecursiveShared

func RecursiveShared(target string) error

RecursiveShared changes an entire tree's propagation type to "shared"

func RecursiveSlave

func RecursiveSlave(target string) error

RecursiveSlave changes an entire tree's propagation type to "slave"

Types

type MountError

type MountError struct {
	Source string
	Target string
	FsType string
	Flags  uintptr
	Extra  string
	Err    error
}

MountError records a mount operation failure, similar to os.PathError

func (*MountError) Error

func (e *MountError) Error() string

Directories

Path Synopsis
exec is extension of the standard os.exec package.
exec is extension of the standard os.exec package.
user provides an extended User struct to simplify usage
user provides an extended User struct to simplify usage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL