Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

16. Extended Attributes > System Calls for Manipulating Extended Attributes

System Calls for Manipulating Extended Attributes

In this section, we look at the system calls used to update, retrieve, and remove EAs.

Creating and modifying EAs

The setxattr(), lsetxattr(), and fsetxattr() system calls set the value of one of a file’s EAs.

#include <sys/xattr.h>

int setxattr(const char *pathname, const char *name, const void *value,
              size_t size, int f lags);
int lsetxattr(const char *pathname, const char *name, const void *value,
              size_t size, int f lags);
int fsetxattr(int fd, const char *name, const void *value,
              size_t size, int f lags);

Note

All return 0 on success, or -1 on error

The differences between these three calls are analogous to those between stat(), lstat(), and fstat() (Retrieving File Information: stat() ):


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint