This function sets the value of an extended attribute of a file.
拡張属性には二種類の異なる名前空間、つまり、ユーザとルートがあります。 ユーザ名前空間は、全てのユーザで利用可能ですが、ルート名前空間は、ルート権限を有するユーザのみ利用可能です。 xattrはデフォルトでユーザ名前空間で処理を行いますが、 flags 引数によりこれを変更することができます。
The file in which we set the attribute.
The name of the extended attribute. This attribute will be created if it doesn't exist or replaced otherwise. You can change this behaviour by using the flags parameter.
The value of the attribute.
表 1. Supported xattr flags
XATTR_CREATE | Function will fail if extended attribute already exists. |
XATTR_REPLACE | Function will fail if extended attribute doesn't exist. |
XATTR_DONTFOLLOW | Do not follow the symbolic link but operate on symbolic link itself. |
XATTR_ROOT | Set attribute in root (trusted) namespace. Requires root privileges. |