<html>
<head>
<meta name="Content-Style" content="text/css">
</head>
<body>
<a href="#NAME">NAME</a><br>
<a href="#C SYNOPSIS">C SYNOPSIS</a><br>
<a href="##include <sys/attributes.h>">#include <sys/attributes.h></a><br>
<a href="#OVERVIEW">OVERVIEW</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<!-- Creator : groff version 1.15 -->
<!-- CreationDate: Tue Sep 26 23:59:40 2000
-->
<!-- Total number of pages: 2 -->
<!-- Page: 1 -->
<!-- left margin: 100 -->
<!-- right margin: 750 -->
<a name="NAME"></a><h2>NAME</h2><p><font size=3>attr_set, attr_setf - set the value of a user attribute of a filesystem object</p>
<a name="C SYNOPSIS"></a><h2>C SYNOPSIS</h2><a name="#include <sys/attributes.h>"></a><h2>#include <sys/attributes.h></h2><p><font size=3><B>int attr_set (const char</B> <font size=3>*<font size=3><B>path, const char</B> <font size=3>*<font size=3><B>attrname,<br>
<span style=" text-indent: 0.4200in;"></span>const char</B> <font size=3>*<font size=3><B>attrvalue, const int valuelength,</p>
</B>
<table width="100%" rules="none" frame="none" cols="2">
<tr valign="top" align="left">
<td valign="top" align="left" width="46.7692%">
<p><font size=3><B><span style=" text-indent: 0.4200in;"></span>int flags);</p>
</B><p><font size=3><B>int attr_setf (int fd, const char</B> <font size=3>*<font size=3><B>attrname,<br>
<span style=" text-indent: 0.4500in;"></span>const char</B> <font size=3>*<font size=3><B>attrvalue, const int valuelength,<br>
<span style=" text-indent: 0.4500in;"></span>int flags);</p>
</B></td>
<td valign="top" align="left" width="53.2308%">
</td>
</tr>
</table>
<br>
<a name="OVERVIEW"></a><h2>OVERVIEW</h2><p><font size=3>The <font size=3><I>attr</I> <font size=3>group of system calls implement the ability for a user to attach name/value pairs to objects within the filesystem.</p>
<p><font size=3>They could be used to store meta-information about the file. For example "character-set=kanji" could tell a docu- ment browser to use the Kanji character set when displaying that document and "thumbnail=..." could provide a reduced resolution overview of a high resolution graphic image.</p>
<p><font size=3>The <font size=3><I>names</I> <font size=3>can be up to MAXNAMELEN bytes in length, terminated by the first 0 byte. The intent is that they be printable ASCII (or other character set) names for the attribute.</p>
<p><font size=3>The <font size=3><I>values</I> <font size=3>can be up to ATTR_MAX_VALUELEN (currently 64KB) of arbitrary binary data.</p>
<p><font size=3>Attributes can be attached to all types of inodes: regular files, directories, symbolic links, device nodes, etc.</p>
<p><font size=3>There are 2 disjoint attribute name spaces associated with every filesystem object. They are the <font size=3><B>root</B> <font size=3>and <font size=3><B>user</B> <font size=3>address spaces. The <font size=3><B>root</B> <font size=3>address space is accessable only to the super-user, and then only by specifying a flag argument to the function call. Other users will not see or be able to modify attributes in the <font size=3><B>root</B> <font size=3>address space. The <font size=3><B>user</B> <font size=3>address space is protected by the normal file permissions mechanism, so the owner of the file can decide who is able to see and/or modify the value of attributes on any particular file.</p>
<p><font size=3>Attributes are currently supported only in the XFS filesystem type.</p>
<a name="DESCRIPTION"></a><h2>DESCRIPTION</h2><p><font size=3>The <font size=3><I>attr_set</I> <font size=3>and <font size=3><I>attr_setf</I> <font size=3>functions provide a way to create attributes and set/change their values.</p>
<p><font size=3><I>Path</I> <font size=3>points to a path name for a filesystem object, and <font size=3><I>fd</I> <font size=3>refers to the file descriptor associated with a file. If the attribute <font size=3><I>attrname</I> <font size=3>does not exist, an attribute with the given name and value will be created and associated with that indicated filesystem object. If an attribute with that name already exists on that filesystem object, the existing value is replaced with the new value given in this call. The new attribute value is copied from the <font size=3><I>attrvalue</I> <font size=3>buffer for a total of <font size=3><I>valuelength</I> <font size=3>bytes. The <font size=3><I>flags</I> <font size=3>argument can contain the following symbols bitwise ORŽed together:</p>
<table width="100%" rules="none" frame="none" cols="3">
<tr valign="top" align="left">
<td valign="top" align="left" width="86.7692%">
<p><font size=2>ATTR_ROOT <font size=3>Look for <font size=3><I>attrname</I> <font size=3>in the <font size=3><B>root</B> <font size=3>address space, not in the <font size=3><B>user</B> <font size=3>address space.</p>
</td>
<td valign="top" align="left" width="1.0000%">
</td>
<td valign="top" align="left" width="12.3077%">
<p><font size=3>(limited to use</p>
</td>
</tr>
<tr valign="top" align="left">
<td valign="top" align="left" width="66.7692%">
<p><font size=3> by super-user only)</p>
</td>
<td valign="top" align="left" width="1.0000%">
</td>
<td valign="top" align="left" width="12.3077%">
</td>
</tr>
</table>
<br>
<p><font size=2>ATTR_DONTFOLLOW <font size=3>Do not follow symbolic links when resolving a <font size=3><I>path</I> <font size=3>on an <font size=3><I>attr_set</I> <font size=3>function call. The default<br>
<span style=" text-indent: 1.3000in;"></span>is to follow symbolic links.</p>
<table width="100%" rules="none" frame="none" cols="3">
<tr valign="top" align="left">
<td valign="top" align="left" width="13.3846%">
<p><font size=2>ATTR_CREATE</p>
<p><font size=2>ATTR_REPLACE</p>
</td>
<td valign="top" align="left" width="6.6154%">
</td>
<td valign="top" align="left" width="80.0000%">
<p><font size=3>Return an error (EEXIST) if an attribute of the given name already exists on the indicated filesystem object, otherwise create an attribute with the given name and value. This flag is used to implement a pure create operation, without this flag <font size=3><I>attr_set</I> <font size=3>will create the attribute if it does not already exist. An error (EINVAL) will be returned if both ATTR_CREATE and ATTR_REPLACE are set in the same call.</p>
<p><font size=3>Return an error (ENOATTR) if an attribute of the given name does not already exist on the indicated filesystem object, otherwise replace the existing attributeŽs value with the given value. This flag is used to implement a pure replacement operation, without this flag <font size=3><I>attr_set</I> <font size=3>will create the attribute if it does not already exist. An error (EINVAL) will be returned if both ATTR_CREATE and ATTR_REPLACE are set in the same call.</p>
</td>
</tr>
</table>
<table width="100%" rules="none" frame="none" cols="3">
<tr valign="top" align="left">
<td valign="top" align="left" width="96.9231%">
<p><font size=3><I>attr_set</I> <font size=3>will fail if one or more of the following are true:</p>
<p><font size=2>[ENOATTR] <font size=3>The attribute name given is not associated with the indicated filesystem object and</p>
</td>
<td valign="top" align="left" width="1.0000%">
</td>
<td valign="top" align="left" width="2.7692%">
<p><font size=3>the</p>
</td>
</tr>
<tr valign="top" align="left">
<td valign="top" align="left" width="96.9231%">
<p><font size=3><span style=" text-indent: 1.0200in;"></span>ATTR_REPLACE flag bit was set.</p>
<p><font size=2>[E2BIG] <font size=3>The value of the given attribute is too large, it exceeds the maximum allowable size of</p>
</td>
<td valign="top" align="left" width="1.0000%">
</td>
<td valign="top" align="left" width="2.7692%">
<p><span style=" text-indent: 0.0400in;"></span><font size=3>an</p>
</td>
</tr>
<tr valign="top" align="left">
<td valign="top" align="left" width="96.9231%">
<p><font size=3><span style=" text-indent: 1.0200in;"></span>attribute value.</p>
<p><font size=2>[EEXIST] <font size=3>The attribute name given is already associated with the indicated filesystem object and</p>
</td>
<td valign="top" align="left" width="1.0000%">
</td>
<td valign="top" align="left" width="2.7692%">
<p><font size=3>the</p>
</td>
</tr>
<tr valign="top" align="left">
<td valign="top" align="left" width="81.2308%">
<p><font size=3> ATTR_CREATE flag bit was set.</p>
</td>
<td valign="top" align="left" width="1.0000%">
</td>
<td valign="top" align="left" width="2.7692%">
</td>
</tr>
</table>
<br>
<!-- Page: 2 -->
<!-- left margin: 100 -->
<!-- right margin: 750 -->
<table width="100%" rules="none" frame="none" cols="3">
<tr valign="top" align="left">
<td valign="top" align="left" width="8.9231%">
</td>
<td valign="top" align="left" width="6.7692%">
</td>
<td valign="top" align="left" width="84.3077%">
</td>
</tr>
</table>
<br></body>
</html>