removexattr.2   [plain text]


.\"
.\" Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
.\"
.\" @APPLE_LICENSE_HEADER_START@
.\"
.\" This file contains Original Code and/or Modifications of Original Code
.\" as defined in and that are subject to the Apple Public Source License
.\" Version 2.0 (the 'License'). You may not use this file except in
.\" compliance with the License. Please obtain a copy of the License at
.\" http://www.opensource.apple.com/apsl/ and read it before using this
.\" file.
.\"
.\" The Original Code and all software distributed under the License are
.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
.\" Please see the License for the specific language governing rights and
.\" limitations under the License.
.\"
.\" @APPLE_LICENSE_HEADER_END@
.\"
.Dd Oct 19, 2004
.Dt REMOVEXATTR 2
.Os "Mac OS X"
.Sh NAME
.Nm removexattr,
.Nm fremovexattr
.Nd remove an extended attribute value
.Sh SYNOPSIS
.Fd #include <sys/xattr.h>
.Ft int
.Fn removexattr "const char *path" "const char *name" "int options"
.Ft int
.Fn fremovexattr "int fd" "const char *name" "int options"
.Sh DESCRIPTION
Extended attributes extend the basic attributes associated with files and
directories in the file system.  They are stored as name:data pairs
associated with file system objects (files, directories, symlinks, etc).
.Pp
.Fn Removexattr
deletes the extended attribute
.Fa name
associated with
.Fa path .
.Pp
An extended attribute's
.Fa name
is a simple NULL-terminated UTF-8 string.
.Fa Options
is a bit mask specifying various options:
.Pp
.Bl -tag -width XATTR_NOFOLLOW
.It Dv XATTR_NOFOLLOW
do not follow symbolic links.  Normally,
.Fn removexattr
acts on the target of
.Fa path
if it is a symbolic link.  With this option,
.Fn removexattr
will act on the link itself.
.It Dv XATTR_SHOWCOMPRESSION
.Fn removexattr
and 
.Fn fremovexattr
will remove HFS Plus Compression extended attribute
.Fa name
(if present) for the file referred to by
.Fa path
or
.Fa fd .
.El
.Pp
.Fn fremovexattr
is identical to
.Fn removexattr ,
except that it removes an extended attribute from an open file referenced
by file descriptor
.Fa fd .
.Sh RETURN VALUES
On success, 0 is returned.  On failure, -1 is returned and the global
variable
.Va errno
is set as follows.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er ENOATTR
The specified extended attribute does not exist.
.It Bq Er ENOTSUP
The file system does not support extended attributes or has the feature
disabled.
.It Bq Er EROFS
The file system is mounted read-only.
.It Bq Er EPERM
This type of object does not support extended attributes.
.It Bq Er EINVAL
.Fa name
or
.Fa options
is invalid.
.Fa name
must be valid UTF-8
.Fa options
must make sense.
.It Bq Er ENOTDIR
A component of the
.Fa path 's
prefix is not a directory.
.It Bq Er ENAMETOOLONG
.Fa Name
exceeded
.Dv XATTR_MAXNAMELEN
UTF-8 bytes, or a component of
.Fa path
exceeded
.Dv NAME_MAX
characters, or the entire
.Fa path
exceeded
.Dv PATH_MAX
characters.
.It Bq Er EACCES
Search permission is denied for a component
.Fa path
or permission to remove the attribute is denied.
.It Bq Er ELOOP
Too many symbolic links were encountered in
.Fa path .
.It Bq Er EFAULT
.Fa path
or
.Fa name
points to an invalid address.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.El
.Sh SEE ALSO
.Xr getxattr 2 ,
.Xr listxattr 2 ,
.Xr setxattr 2
.Sh HISTORY
.Fn removexattr
and
.Fn fremovexattr
first appeared in Mac OS X 10.4.