xattr-0.6.2: Haskell extended file attributes interface

Copyright(c) Evan Klitzke 2009 (c) Deian Stefan 2012
LicenseBSD3
MaintainerEvan Klitzke <evan@eklitzke.org> Deian Stefan <deian@cs.stanford.edu>
Stabilityexperimental
PortabilityGHC only
Safe HaskellTrustworthy
LanguageHaskell98

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 Source

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 () Source

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 () Source

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

Get Functions

getxattr :: FilePath -> AttrName -> IO AttrValue Source

Get extended attribute of an object.

lgetxattr :: FilePath -> AttrName -> IO AttrValue Source

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 Source

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

List Functions

listxattr :: FilePath -> IO [AttrName] Source

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

llistxattr :: FilePath -> IO [AttrName] Source

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] Source

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

Data Types

type AttrName = String Source

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 Source

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 Source

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.