Пример #1
0
// returns attribute names in bytes, nul char delimitted.
func (this FileXattribsNS) list() ([]byte, error) {
	if size, err := syscall.Listxattr(this.File.Name(), nil); err == nil {
		buf := make([]byte, size)
		if read, err := syscall.Listxattr(this.File.Name(), buf); err == nil {
			return buf[0:read], nil
		} else {
			return nil, err
		}
	} else {
		return nil, err
	}
}
Пример #2
0
// Retrieves a list of names of extended attributes associated with the
// given path in the file system.
func Listxattr(path string) ([]string, error) {
	// find size.
	size, err := syscall.Listxattr(path, nil)
	if err != nil {
		return nil, &XAttrError{"listxattr", path, "", err}
	}
	buf := make([]byte, size)
	// Read into buffer of that size.
	read, err := syscall.Listxattr(path, buf)
	if err != nil {
		return nil, &XAttrError{"listxattr", path, "", err}
	}
	return stripUserPrefix(nullTermToStrings(buf[:read])), nil
}
Пример #3
0
func Listxattr(path string, dest []byte) (sz int, err error) {
	return syscall.Listxattr(path, dest)
}