xref: /freebsd/lib/libc/posix1e/acl_add_perm.3 (revision 7aa383846770374466b1dcb2cefd71bde9acf463)
1.\"-
2.\" Copyright (c) 2001 Chris D. Faulhaber
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd June 25, 2009
29.Dt ACL_ADD_PERM 3
30.Os
31.Sh NAME
32.Nm acl_add_perm
33.Nd add permissions to a permission set
34.Sh LIBRARY
35.Lb libc
36.Sh SYNOPSIS
37.In sys/types.h
38.In sys/acl.h
39.Ft int
40.Fn acl_add_perm "acl_permset_t permset_d" "acl_perm_t perm"
41.Sh DESCRIPTION
42The
43.Fn acl_add_perm
44function
45is a POSIX.1e call that adds the permission contained in
46.Fa perm
47to the permission set
48.Fa permset_d .
49.Pp
50Note: it is not considered an error to attempt to add permissions
51that already exist in the permission set.
52.Pp
53For POSIX.1e ACLs, valid values are:
54.Pp
55.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
56.It ACL_EXECUTE	Execute permission
57.It ACL_WRITE	Write permission
58.It ACL_READ	Read permission
59.El
60.Pp
61For NFSv4 ACLs, valid values are:
62.Pp
63.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
64.It ACL_READ_DATA		Read permission
65.It ACL_LIST_DIRECTORY		Same as ACL_READ_DATA
66.It ACL_WRITE_DATA		Write permission, or permission to create files
67.It ACL_ADD_FILE		Same as ACL_READ_DATA
68.It ACL_APPEND_DATA		Permission to create directories.  Ignored for files
69.It ACL_ADD_SUBDIRECTORY	Same as ACL_APPEND_DATA
70.It ACL_READ_NAMED_ATTRS	Ignored
71.It ACL_WRITE_NAMED_ATTRS	Ignored
72.It ACL_EXECUTE			Execute permission
73.It ACL_DELETE_CHILD		Permission to delete files and subdirectories
74.It ACL_READ_ATTRIBUTES		Permission to read basic attributes
75.It ACL_WRITE_ATTRIBUTES	Permission to change basic attributes
76.It ACL_DELETE			Permission to delete the object this ACL is placed on
77.It ACL_READ_ACL		Permission to read ACL
78.It ACL_WRITE_ACL		Permission to change the ACL and file mode
79.It ACL_SYNCHRONIZE		Ignored
80.El
81.Pp
82Calling
83.Fn acl_add_perm
84with
85.Fa perm
86equal to ACL_WRITE or ACL_READ brands the ACL as POSIX.
87Calling it with ACL_READ_DATA, ACL_LIST_DIRECTORY, ACL_WRITE_DATA,
88ACL_ADD_FILE, ACL_APPEND_DATA, ACL_ADD_SUBDIRECTORY, ACL_READ_NAMED_ATTRS,
89ACL_WRITE_NAMED_ATTRS, ACL_DELETE_CHILD, ACL_READ_ATTRIBUTES,
90ACL_WRITE_ATTRIBUTES, ACL_DELETE, ACL_READ_ACL, ACL_WRITE_ACL
91or ACL_SYNCHRONIZE brands the ACL as NFSv4.
92.Sh RETURN VALUES
93.Rv -std acl_add_perm
94.Sh ERRORS
95The
96.Fn acl_add_perm
97function fails if:
98.Bl -tag -width Er
99.It Bq Er EINVAL
100Argument
101.Fa permset_d
102is not a valid descriptor for a permission set within an ACL entry.
103Argument
104.Fa perm
105does not contain a valid
106.Vt acl_perm_t
107value.
108ACL is already branded differently.
109.El
110.Sh SEE ALSO
111.Xr acl 3 ,
112.Xr acl_clear_perms 3 ,
113.Xr acl_delete_perm 3 ,
114.Xr acl_get_brand_np 3 ,
115.Xr acl_get_permset 3 ,
116.Xr acl_set_permset 3 ,
117.Xr posix1e 3
118.Sh STANDARDS
119POSIX.1e is described in IEEE POSIX.1e draft 17.
120.Sh HISTORY
121POSIX.1e support was introduced in
122.Fx 4.0 .
123The
124.Fn acl_add_perm
125function was added in
126.Fx 5.0 .
127.Sh AUTHORS
128The
129.Fn acl_add_perm
130function was written by
131.An Chris D. Faulhaber Aq jedgar@fxp.org .
132