getxattr


Description:

[ CCode ( array_length_pos = 2.1 , array_length_type = "gsize" ) ]
[ Version ( since = "1.7.24" ) ]
public uint8[] getxattr (string path, string name) throws Error

get a single extended attribute

Get a single extended attribute from file path named name. This call follows symlinks. If you want to lookup an extended attribute for the symlink itself, use lgetxattr.

Normally it is better to get all extended attributes from a file in one go by calling getxattrs. However some Linux filesystem implementations are buggy and do not provide a way to list out attributes. For these filesystems (notably ntfs-3g) you have to know the names of the extended attributes you want in advance and call this function.

Extended attribute values are blobs of binary data. If there is no extended attribute named name, this returns an error.

See also: getxattrs, lgetxattr, attr(5).

This function depends on the feature "linuxxattrs". See also feature_available.

Parameters:

this

A GuestfsSession object

size_r

The size of the returned buffer, in bytes

Returns:

an array of binary data, or NULL on error