1ACL_GET_FILE(3) BSD Library Functions Manual ACL_GET_FILE(3)
2
4 acl_get_file — get an ACL by filename
5
7 Linux Access Control Lists library (libacl, -lacl).
8
10 #include <sys/types.h>
11 #include <sys/acl.h>
12
13 acl_t
14 acl_get_file(const char *path_p, acl_type_t type);
15
17 The acl_get_file() function retrieves the access ACL associated with a
18 file or directory, or the default ACL associated with a directory. The
19 pathname for the file or directory is pointed to by the argument path_p.
20 The ACL is placed into working storage and acl_get_file() returns a
21 pointer to that storage.
22
23 In order to read an ACL from an object, a process must have read access
24 to the object's attributes.
25
26 The value of the argument type is used to indicate whether the access ACL
27 or the default ACL associated with path_p is returned. If type is
28 ACL_TYPE_ACCESS, the access ACL of path_p is returned. If type is
29 ACL_TYPE_DEFAULT, the default ACL of path_p is returned. If type is
30 ACL_TYPE_DEFAULT and no default ACL is associated with the directory
31 path_p, then an ACL containing zero ACL entries is returned. If type
32 specifies a type of ACL that cannot be associated with path_p, then the
33 function fails.
34
35 This function may cause memory to be allocated. The caller should free
36 any releasable memory, when the new ACL is no longer required, by calling
37 acl_free(3) with the (void*)acl_t returned by acl_get_file() as an argu‐
38 ment.
39
41 On success, this function returns a pointer to the working storage. On
42 error, a value of (acl_t)NULL is returned, and errno is set appropri‐
43 ately.
44
46 If any of the following conditions occur, the acl_get_file() function re‐
47 turns a value of (acl_t)NULL and sets errno to the corresponding value:
48
49 [EACCES] Search permission is denied for a component of the
50 path prefix or the object exists and the process does
51 not have appropriate access rights.
52
53 Argument type specifies a type of ACL that cannot be
54 associated with path_p.
55
56 [EINVAL] The argument type is not ACL_TYPE_ACCESS or
57 ACL_TYPE_DEFAULT.
58
59 [ENAMETOOLONG] The length of the argument path_p is too long.
60
61 [ENOENT] The named object does not exist or the argument path_p
62 points to an empty string.
63
64 [ENOMEM] The ACL working storage requires more memory than is
65 allowed by the hardware or system-imposed memory man‐
66 agement constraints.
67
68 [ENOTDIR] A component of the path prefix is not a directory.
69
70 [ENOTSUP] The file system on which the file identified by path_p
71 is located does not support ACLs, or ACLs are dis‐
72 abled.
73
75 IEEE Std 1003.1e draft 17 (“POSIX.1e”, abandoned)
76
78 acl_free(3), acl_get_entry(3), acl_get_fd(3), acl_set_file(3), acl(5)
79
81 Derived from the FreeBSD manual pages written by Robert N M Watson
82 <rwatson@FreeBSD.org>, and adapted for Linux by Andreas Gruenbacher
83 <andreas.gruenbacher@gmail.com>.
84
85Linux ACL March 23, 2002 Linux ACL