xattr-0.6.1: Haskell extended file attributes interface

PortabilityGHC only
Stabilityexperimental
MaintainerEvan Klitzke <evan@eklitzke.org> Deian Stefan <deian@cs.stanford.edu>
Safe HaskellTrustworthy

System.Xattr

Contents

Description

Relatively low-level interface to work with extended attributes on Unix systems. This is a fairly straightforward port of the API exposed by SGI's libattr.

Synopsis

Functions

Set Functions

setxattr

Arguments

:: FilePath

Object path

-> AttrName

Attribute name

-> AttrValue

Value

-> XattrMode

Mode

-> IO () 

Set extended attribute of a filesystem object.

lsetxattr :: FilePath -> AttrName -> AttrValue -> XattrMode -> IO ()

Same as setxattr, but if the object is a symbolic link the attribute is set on the symbolic link itself, not the object refered to by the link.

fsetxattr :: Handle -> AttrName -> AttrValue -> XattrMode -> IO ()

Same as setxattr, but set the attribute of an open handle.

Get Functions

getxattr :: FilePath -> AttrName -> IO AttrValue

Get extended attribute of an object.

lgetxattr :: FilePath -> AttrName -> IO AttrValue

Same as getxattr, but if the object is a symbolic link, the attribute is retrieved from the link itself and not the referenced object.

fgetxattr :: Handle -> AttrName -> IO AttrValue

Same as getxattr, but get the attribute of an open handle.

List Functions

listxattr :: FilePath -> IO [AttrName]

Get a list of all of the extended attributes of an object.

llistxattr :: FilePath -> IO [AttrName]

Same as listxattr, but if the object is a symbolic link, the attributes of the link itself are returned, not on the referenced object.

flistxattr :: Handle -> IO [AttrName]

Same as listxattr, but get the attributes of an open handle.

Data Types

type AttrName = String

The name of an attribute. Some filesystems support arbitrarily long names, but for portability it is recommended to use relatively short names (less than 256 bytes).

type AttrValue = ByteString

Thevalue of an attribute. Most filesystems allow for arbitrary binary data with relatively. It is recommended that the length of the value be at most 64KB.

data XattrMode

Mode for setting attributes.

Constructors

RegularMode

The attribute will be created if it does not yet exist, and replace the existing named attribute otherwise.

CreateMode

Specifies a pure create, which fails if the named attribute exists already.

ReplaceMode

Specifies a pure replace operation, which fails if the named attribute does not already exist.