xref: /netbsd-src/lib/libc/posix1e/acl_get_entry.3 (revision 1b3734281f17fd86d3db0e29f84ea9985be6fe06)
1.\" $NetBSD: acl_get_entry.3,v 1.2 2020/06/18 19:46:34 wiz Exp $
2.\"-
3.\" Copyright (c) 2001 Chris D. Faulhaber
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD: head/lib/libc/posix1e/acl_get_entry.3 267774 2014-06-23 08:25:03Z bapt $
28.\"
29.Dd April 13, 2001
30.Dt ACL_GET_ENTRY 3
31.Os
32.Sh NAME
33.Nm acl_get_entry
34.Nd retrieve an ACL entry from an ACL
35.Sh LIBRARY
36.Lb libc
37.Sh SYNOPSIS
38.In sys/types.h
39.In sys/acl.h
40.Ft int
41.Fn acl_get_entry "acl_t acl" "int entry_id" "acl_entry_t *entry_p"
42.Sh DESCRIPTION
43The
44.Fn acl_get_entry
45function
46is a POSIX.1e call that retrieves a descriptor for an ACL entry
47specified by the argument
48.Fa entry_d
49within the ACL indicated by the argument
50.Fa acl .
51.Pp
52If the value of
53.Fa entry_id
54is
55.Dv ACL_FIRST_ENTRY ,
56then the function will return in
57.Fa entry_p
58a descriptor for the first ACL entry within
59.Fa acl .
60If a call is made to
61.Fn acl_get_entry
62with
63.Fa entry_id
64set to
65.Dv ACL_NEXT_ENTRY
66when there has not been either an initial successful call to
67.Fn acl_get_entry ,
68or a previous successful call to
69.Fn acl_create_entry ,
70.Fn acl_delete_entry ,
71.Fn acl_dup ,
72.Fn acl_from_text ,
73.Fn acl_get_fd ,
74.Fn acl_get_file ,
75.Fn acl_set_fd ,
76.Fn acl_set_file ,
77or
78.Fn acl_valid ,
79then the result is unspecified.
80.Sh RETURN VALUES
81If the
82.Fn acl_get_entry
83function successfully obtains an ACL entry, a value of 1 is returned.
84If the ACL has no ACL entries, the
85.Fn acl_get_entry
86returns a value of 0.
87If the value of
88.Fa entry_id
89is
90.Dv ACL_NEXT_ENTRY
91and the last ACL entry in the ACL has already been returned by a
92previous call to
93.Fn acl_get_entry ,
94a value of 0 will be returned until a successful call with
95.Fa entry_id
96of
97.Dv ACL_FIRST_ENTRY
98is made.
99Otherwise, a value of -1 will be returned and
100the global variable
101.Va errno
102will be set to indicate the error.
103.Sh ERRORS
104The
105.Fn acl_get_entry
106fails if:
107.Bl -tag -width Er
108.It Bq Er EINVAL
109Argument
110.Fa acl
111does not point to a valid ACL.
112Argument
113.Fa entry_id
114is neither
115.Dv ACL_FIRST_ENTRY
116nor
117.Dv ACL_NEXT_ENTRY .
118.El
119.Sh SEE ALSO
120.Xr acl 3 ,
121.Xr acl_calc_mask 3 ,
122.Xr acl_create_entry 3 ,
123.Xr acl_delete_entry 3 ,
124.Xr acl_dup 3 ,
125.Xr acl_from_text 3 ,
126.Xr acl_get_fd 3 ,
127.Xr acl_get_file 3 ,
128.Xr acl_init 3 ,
129.Xr acl_set_fd 3 ,
130.Xr acl_set_file 3 ,
131.Xr acl_valid 3 ,
132.Xr posix1e 3
133.Sh STANDARDS
134POSIX.1e is described in IEEE POSIX.1e draft 17.
135.Sh HISTORY
136POSIX.1e support was introduced in
137.Fx 4.0 .
138The
139.Fn acl_get_entry
140function was added in
141.Fx 5.0 .
142.Sh AUTHORS
143The
144.Fn acl_get_entry
145function was written by
146.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
147