Portability | GHC only |
---|---|
Stability | experimental |
Maintainer | Evan Klitzke <evan@eklitzke.org> Deian Stefan <deian@cs.stanford.edu> |
Safe Haskell | Trustworthy |
System.Xattr
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.
- 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
- = RegularMode
- | CreateMode
- | ReplaceMode
Functions
Set Functions
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
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
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
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. |