xattr-0.5.2: Haskell bindings to libattr

PortabilityGHC only
Stabilityexperimental
MaintainerEvan Klitzke <evan@eklitzke.org>

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 :: FilePath -> AttrName -> ByteString -> XattrMode -> IO ()Source

Set an attribute on a regular file, by path

lsetxattr :: FilePath -> AttrName -> ByteString -> XattrMode -> IO ()Source

Like setxattr, but if the path is a symbolic link set the attribute on the link itself (not the file pointed to by the link)

fsetxattr :: Handle -> AttrName -> ByteString -> XattrMode -> IO ()Source

Like setxattr, but use the handle specified rather than a file path

Get Functions

getxattr :: FilePath -> AttrName -> IO ByteStringSource

Get an attribute on a regular file, by path

lgetxattr :: FilePath -> AttrName -> IO ByteStringSource

Like getxattr, but if the path is a symbolic link get the attribute on the link itself (not the file pointed to by the link)

fgetxattr :: Handle -> AttrName -> IO ByteStringSource

Like getxattr, but use the handle specified rather than a file path

List Functions

listxattr :: FilePath -> IO [AttrName]Source

Get a list of all of the attributes set on a path

llistxattr :: FilePath -> IO [AttrName]Source

Like listxattr, but if the path is a symbolic link get the attributes on the link itself (not the file pointed to by the link)

flistxattr :: Handle -> IO [AttrName]Source

Like listxattr, but use the handle specified rather than a file path

Data Types

type AttrName = StringSource

The name of an attribute. Some filesystems support arbitrarily long names, but for portability you're recommended to limit this to 255 bytes.

data XattrMode Source

Represents the mode for an update (i.e. set) operation

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.