linux-xattr-0.1.0.0: Read, set and list extended attributes

Safe HaskellNone

System.Linux.XAttr

Contents

Description

XAttr provides bindings to the glibc functions for reading and manipulating extended attributes (setxattr, getxattr, listxattr, ...). Each function in this module has two variants: the one with the name prefixed by "l" and "fd". Both of these are identical to the original version except that the "l"-variant does not follow symbolic link but acts on the link itself, and the "fd"-variant take a file descriptor as argument rather than a FilePath.

Synopsis

Set extended attributes

setXAttrSource

Arguments

:: FilePath

target file

-> String

name of attribute to set

-> ByteString

value of attribute

-> IO () 

Set the value of an extended attribute.

lSetXAttr :: FilePath -> String -> ByteString -> IO ()Source

Set the value of an extended attribute (do not follow symbolic links).

fdSetXAttr :: Fd -> String -> ByteString -> IO ()Source

Set the value of an extended attribute.

Create extended attributes

createXAttr :: FilePath -> String -> ByteString -> IO ()Source

Identical to setXAttr, but if the attribute already exists fail and set errno to EEXIST.

lCreateXAttr :: FilePath -> String -> ByteString -> IO ()Source

Identical to lSetXAttr, but if the attribute already exists fail and set errno to EEXIST.

fdCreateXAttr :: Fd -> String -> ByteString -> IO ()Source

Identical to fdSetXAttr, but if the attribute already exists fail and set errno to EEXIST.

Replace extended attributes

replaceXAttr :: FilePath -> String -> ByteString -> IO ()Source

Identical to setXAttr, but if the attribute does not exist fail and set errno to ENOATTR.

lReplaceXAttr :: FilePath -> String -> ByteString -> IO ()Source

Identical to lSetXAttr, but if the attribute does not exist fail and set errno to ENOATTR.

fdReplaceXAttr :: Fd -> String -> ByteString -> IO ()Source

Identical to fdSetXAttr, but if the attribute does not exist fail and set errno to ENOATTR.

Retrive extended attributes

getXAttrSource

Arguments

:: FilePath

target file

-> String

name of the attribute

-> IO ByteString

value of the attribute

Get the value of an extended attribute.

lGetXAttr :: FilePath -> String -> IO ByteStringSource

Get the value of an extended attribute (do not follow symbolic links).

fdGetXAttr :: Fd -> String -> IO ByteStringSource

Get the value of an extended attribute.

List extended attributes

listXAttrSource

Arguments

:: FilePath

target file

-> IO [String]

list of attribute names

Get the list of attribute names associated with the given FilePath.

lListXAttr :: FilePath -> IO [String]Source

Get the list of attribute names associated with the given FilePath (do not follow symbolic links).

fdListXAttr :: Fd -> IO [String]Source

Get the list of attribute names associated with the given file descriptor.

Remove extended attributes

removeXAttrSource

Arguments

:: FilePath

target file

-> String

name of the attribute

-> IO () 

Remove an extended attribute from the given FilePath.

lRemoveXAttr :: FilePath -> String -> IO ()Source

Remove an extended attribute from the given FilePath (do not follow symbolic links).

fdRemoveXAttr :: Fd -> String -> IO ()Source

Remove an extended attribute from the given file descriptor.