Portability | GHC only |
---|---|
Stability | experimental |
Maintainer | Evan Klitzke <evan@eklitzke.org> |
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 -> ByteString -> XattrMode -> IO ()
- lsetxattr :: FilePath -> AttrName -> ByteString -> XattrMode -> IO ()
- fsetxattr :: Handle -> AttrName -> ByteString -> XattrMode -> IO ()
- getxattr :: FilePath -> AttrName -> IO ByteString
- lgetxattr :: FilePath -> AttrName -> IO ByteString
- fgetxattr :: Handle -> AttrName -> IO ByteString
- listxattr :: FilePath -> IO [AttrName]
- llistxattr :: FilePath -> IO [AttrName]
- flistxattr :: Handle -> IO [AttrName]
- type AttrName = String
- data XattrMode
- = RegularMode
- | CreateMode
- | ReplaceMode
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
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
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
The name of an attribute. Some filesystems support arbitrarily long names, but for portability you're recommended to limit this to 255 bytes.
Represents the mode for an update (i.e. set) operation
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. |