xref: /xnu-11215/bsd/man/man2/removexattr.2 (revision 8d741a5d)
1.\"
2.\" Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3.\"
4.\" @APPLE_LICENSE_HEADER_START@
5.\"
6.\" This file contains Original Code and/or Modifications of Original Code
7.\" as defined in and that are subject to the Apple Public Source License
8.\" Version 2.0 (the 'License'). You may not use this file except in
9.\" compliance with the License. Please obtain a copy of the License at
10.\" http://www.opensource.apple.com/apsl/ and read it before using this
11.\" file.
12.\"
13.\" The Original Code and all software distributed under the License are
14.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18.\" Please see the License for the specific language governing rights and
19.\" limitations under the License.
20.\"
21.\" @APPLE_LICENSE_HEADER_END@
22.\"
23.Dd Oct 19, 2004
24.Dt REMOVEXATTR 2
25.Os "Mac OS X"
26.Sh NAME
27.Nm removexattr,
28.Nm fremovexattr
29.Nd remove an extended attribute value
30.Sh SYNOPSIS
31.Fd #include <sys/xattr.h>
32.Ft int
33.Fn removexattr "const char *path" "const char *name" "int options"
34.Ft int
35.Fn fremovexattr "int fd" "const char *name" "int options"
36.Sh DESCRIPTION
37Extended attributes extend the basic attributes associated with files and
38directories in the file system.  They are stored as name:data pairs
39associated with file system objects (files, directories, symlinks, etc).
40.Pp
41.Fn removexattr
42deletes the extended attribute
43.Fa name
44associated with
45.Fa path .
46.Pp
47An extended attribute's
48.Fa name
49is a simple NULL-terminated UTF-8 string.
50.Fa Options
51is a bit mask specifying various options:
52.Pp
53.Bl -tag -width XATTR_NOFOLLOW
54.It Dv XATTR_NOFOLLOW
55do not follow symbolic links.  Normally,
56.Fn removexattr
57acts on the target of
58.Fa path
59if it is a symbolic link.  With this option,
60.Fn removexattr
61will act on the link itself.
62.It Dv XATTR_NOFOLLOW_ANY
63do not follow any symbolic links encountered during pathname resolution. An
64error is returned if a symlink is encountered before the last component of path.
65.It Dv XATTR_SHOWCOMPRESSION
66.Fn removexattr
67and
68.Fn fremovexattr
69will remove HFS Plus Compression extended attribute
70.Fa name
71(if present) for the file referred to by
72.Fa path
73or
74.Fa fd .
75.El
76.Pp
77.Fn fremovexattr
78is identical to
79.Fn removexattr ,
80except that it removes an extended attribute from an open file referenced
81by file descriptor
82.Fa fd .
83.Sh RETURN VALUES
84On success, 0 is returned.  On failure, -1 is returned and the global
85variable
86.Va errno
87is set as follows.
88.Sh ERRORS
89.Bl -tag -width Er
90.It Bq Er ENOATTR
91The specified extended attribute does not exist.
92.It Bq Er ENOTSUP
93The file system does not support extended attributes or has the feature
94disabled.
95.It Bq Er EROFS
96The file system is mounted read-only.
97.It Bq Er EPERM
98This type of object does not support extended attributes.
99.It Bq Er EINVAL
100.Fa name
101or
102.Fa options
103is invalid.
104.Fa name
105must be valid UTF-8
106.Fa options
107must make sense.
108.It Bq Er EINVAL
109XATTR_NOFOLLOW or XATTR_NOFOLLOW_ANY option was passed in
110.Fn fremovexattr .
111.It Bq Er ENOTDIR
112A component of the
113.Fa path 's
114prefix is not a directory.
115.It Bq Er ENAMETOOLONG
116.Fa Name
117exceeded
118.Dv XATTR_MAXNAMELEN
119UTF-8 bytes, or a component of
120.Fa path
121exceeded
122.Dv NAME_MAX
123characters, or the entire
124.Fa path
125exceeded
126.Dv PATH_MAX
127characters.
128.It Bq Er EACCES
129Search permission is denied for a component
130.Fa path
131or permission to remove the attribute is denied.
132.It Bq Er ELOOP
133Too many symbolic links were encountered in
134.Fa path .
135.It Bq Er ELOOP
136If XATTR_NOFOLLOW_ANY option was passed and a symbolic link was encountered in
137translating the pathname.
138.It Bq Er EFAULT
139.Fa path
140or
141.Fa name
142points to an invalid address.
143.It Bq Er EIO
144An I/O error occurred while reading from or writing to the file system.
145.El
146.Sh SEE ALSO
147.Xr getxattr 2 ,
148.Xr listxattr 2 ,
149.Xr setxattr 2
150.Sh HISTORY
151.Fn removexattr
152and
153.Fn fremovexattr
154first appeared in Mac OS X 10.4.
155