xref: /freebsd/lib/libc/posix1e/acl_add_perm.3 (revision 1c05a6ea6b849ff95e539c31adea887c644a6a01)
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.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
55.It ACL_EXECUTE	Execute permission
56.It ACL_WRITE	Write permission
57.It ACL_READ	Read permission
58.El
59.Pp
60For NFSv4 ACLs, valid values are:
61.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
62.It ACL_READ_DATA Ta "Read permission"
63.It ACL_LIST_DIRECTORY Ta "Same as ACL_READ_DATA"
64.It ACL_WRITE_DATA Ta "Write permission, or permission to create files"
65.It ACL_ADD_FILE Ta "Same as ACL_READ_DATA"
66.It ACL_APPEND_DATA Ta "Permission to create directories.  Ignored for files"
67.It ACL_ADD_SUBDIRECTORY Ta "Same as ACL_APPEND_DATA"
68.It ACL_READ_NAMED_ATTRS Ta "Ignored"
69.It ACL_WRITE_NAMED_ATTRS Ta "Ignored"
70.It ACL_EXECUTE Ta "Execute permission"
71.It ACL_DELETE_CHILD Ta "Permission to delete files and subdirectories"
72.It ACL_READ_ATTRIBUTES Ta "Permission to read basic attributes"
73.It ACL_WRITE_ATTRIBUTES Ta "Permission to change basic attributes"
74.It ACL_DELETE Ta "Permission to delete the object this ACL is placed on"
75.It ACL_READ_ACL Ta "Permission to read ACL"
76.It ACL_WRITE_ACL Ta "Permission to change the ACL and file mode"
77.It ACL_SYNCHRONIZE Ta "Ignored"
78.El
79.Pp
80Calling
81.Fn acl_add_perm
82with
83.Fa perm
84equal to ACL_WRITE or ACL_READ brands the ACL as POSIX.
85Calling it with ACL_READ_DATA, ACL_LIST_DIRECTORY, ACL_WRITE_DATA,
86ACL_ADD_FILE, ACL_APPEND_DATA, ACL_ADD_SUBDIRECTORY, ACL_READ_NAMED_ATTRS,
87ACL_WRITE_NAMED_ATTRS, ACL_DELETE_CHILD, ACL_READ_ATTRIBUTES,
88ACL_WRITE_ATTRIBUTES, ACL_DELETE, ACL_READ_ACL, ACL_WRITE_ACL
89or ACL_SYNCHRONIZE brands the ACL as NFSv4.
90.Sh RETURN VALUES
91.Rv -std acl_add_perm
92.Sh ERRORS
93The
94.Fn acl_add_perm
95function fails if:
96.Bl -tag -width Er
97.It Bq Er EINVAL
98Argument
99.Fa permset_d
100is not a valid descriptor for a permission set within an ACL entry.
101Argument
102.Fa perm
103does not contain a valid
104.Vt acl_perm_t
105value.
106ACL is already branded differently.
107.El
108.Sh SEE ALSO
109.Xr acl 3 ,
110.Xr acl_clear_perms 3 ,
111.Xr acl_delete_perm 3 ,
112.Xr acl_get_brand_np 3 ,
113.Xr acl_get_permset 3 ,
114.Xr acl_set_permset 3 ,
115.Xr posix1e 3
116.Sh STANDARDS
117POSIX.1e is described in IEEE POSIX.1e draft 17.
118.Sh HISTORY
119POSIX.1e support was introduced in
120.Fx 4.0 .
121The
122.Fn acl_add_perm
123function was added in
124.Fx 5.0 .
125.Sh AUTHORS
126The
127.Fn acl_add_perm
128function was written by
129.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
130