Copyright | (c) Evan Klitzke 2009 (c) Deian Stefan 2012 |
---|---|
License | BSD3 |
Maintainer | Evan Klitzke <evan@eklitzke.org> Deian Stefan <deian@cs.stanford.edu> |
Stability | experimental |
Portability | GHC only |
Safe Haskell | Trustworthy |
Language | Haskell98 |
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.
- setxattr :: FilePath -> AttrName -> AttrValue -> XattrMode -> IO ()
- lsetxattr :: FilePath -> AttrName -> AttrValue -> XattrMode -> IO ()
- fsetxattr :: Handle -> AttrName -> AttrValue -> XattrMode -> IO ()
- getxattr :: FilePath -> AttrName -> IO AttrValue
- lgetxattr :: FilePath -> AttrName -> IO AttrValue
- fgetxattr :: Handle -> AttrName -> IO AttrValue
- listxattr :: FilePath -> IO [AttrName]
- llistxattr :: FilePath -> IO [AttrName]
- flistxattr :: Handle -> IO [AttrName]
- type AttrName = String
- type AttrValue = ByteString
- data XattrMode
Functions
Set Functions
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
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
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.
Mode for setting attributes.
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. |