TOC   Previous   Next

Extended Attributes

EA System Calls

Basic system calls:

Each of the above accepts a pathname argument.

There are alternate forms for working on symbolic links or open file descriptors, e.g., lsetxattr(), fsetxattr() (cf. stat(), lstat(), fstat()).





int setxattr(const char *pathname, const char *name,
      const void *value, size_t size, int flags)

Set an EA for pathname, using name and value.

    char *value;

    value = "The past is not dead.";
    setxattr(pathname, "user.x", value, strlen(value), 0);


ssize_t getxattr(const char *pathname, const char *name,
      void *value, size_t size)

Retrieves current value of name for pathname, and places it in value.


int removexattr(const char *pathname, const char *name)

Remove EA name from pathname.


ssize_t listxattr(const char *pathname, char *list, size_t size)

Returns a list containing names of all EAs associated with pathname.

(C) 2006, Michael Kerrisk