sysutil

package
v0.0.0-...-3756133 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetXattr

func GetXattr(path, attr string) ([]byte, error)

GetXattr gets the value of the specified attr for the file at the given path.

Types

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

Lock represents a file lock.

func NewLock

func NewLock(f *os.File) *Lock

NewLock creates a new file lock using the given file.

func (*Lock) ExclusiveLock

func (l *Lock) ExclusiveLock() error

ExclusiveLock acquires the file lock for exclusive use. If blocking is disabled and an incompatible lock is held by another process, the returned error will indicate EWOULDBLOCK.

func (*Lock) SetBlocking

func (l *Lock) SetBlocking(blocking bool)

SetBlocking sets whether or not to wait when an incompatible lock is held by another process. Defaults to false.

func (*Lock) SharedLock

func (l *Lock) SharedLock() error

SharedLock acquires the file lock for shared use. If blocking is disabled and an incompatible lock is held by another process, the returned error will indicate EWOULDBLOCK.

func (*Lock) Unlock

func (l *Lock) Unlock() error

Unlock releases the file lock held by this process.

type Xattr

type Xattr struct {
	Key string
	Val []byte
}

Xattr is an extended attribute key-value pair.

type Xattrs

type Xattrs []Xattr

Xattrs is a list of extended attributes. Implements sort.Interface.

func GetXattrs

func GetXattrs(path string) (Xattrs, error)

GetXattrs gets all of the xattrs for the file at the given path.

func NewXattrs

func NewXattrs(m map[string][]byte) Xattrs

NewXattrs creates an ordered list of extended attributes from the given map.

func UnmarshalXattrs

func UnmarshalXattrs(r io.Reader) (Xattrs, error)

UnmarshalXattrs unmarshals the binary encoding (little-endian) of a list of extended attributes from the given reader.

func (Xattrs) Len

func (x Xattrs) Len() int

func (Xattrs) Less

func (x Xattrs) Less(i, j int) bool

func (Xattrs) Map

func (x Xattrs) Map() map[string][]byte

Map creates a map from this list of extended attributes.

func (Xattrs) Marshal

func (x Xattrs) Marshal(w io.Writer) error

Marshal marshals the binary encoding (little-endian) of this list of extended attributes into the given writer.

func (Xattrs) Swap

func (x Xattrs) Swap(i, j int)

Jump to

Keyboard shortcuts

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