Add limited support for Solaris 10 ZFS-style ACLs: just enough to
[gnulib.git] / lib / acl-internal.h
1 /* Internal implementation of access control lists.
2
3    Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19    Written by Paul Eggert and Andreas Gruenbacher.  */
20
21 #include <config.h>
22
23 #include "acl.h"
24
25 #include <stdbool.h>
26 #include <stdlib.h>
27
28 #ifdef HAVE_ACL_LIBACL_H
29 # include <acl/libacl.h>
30 #endif
31
32 #include "error.h"
33 #include "quote.h"
34
35 #include <errno.h>
36 #ifndef ENOSYS
37 # define ENOSYS (-1)
38 #endif
39 #ifndef ENOTSUP
40 # define ENOTSUP (-1)
41 #endif
42
43 #if ENABLE_NLS
44 # include <libintl.h>
45 # define _(Text) gettext (Text)
46 #else
47 # define _(Text) Text
48 #endif
49
50 #ifndef HAVE_FCHMOD
51 # define HAVE_FCHMOD false
52 # define fchmod(fd, mode) (-1)
53 #endif
54
55 #ifndef MIN_ACL_ENTRIES
56 # define MIN_ACL_ENTRIES 4
57 #endif
58
59 /* POSIX 1003.1e (draft 17) */
60 #ifndef HAVE_ACL_GET_FD
61 # define HAVE_ACL_GET_FD false
62 # define acl_get_fd(fd) (NULL)
63 #endif
64
65 /* POSIX 1003.1e (draft 17) */
66 #ifndef HAVE_ACL_SET_FD
67 # define HAVE_ACL_SET_FD false
68 # define acl_set_fd(fd, acl) (-1)
69 #endif
70
71 /* Linux-specific */
72 #ifndef HAVE_ACL_EXTENDED_FILE
73 # define HAVE_ACL_EXTENDED_FILE false
74 # define acl_extended_file(name) (-1)
75 #endif
76
77 /* Linux-specific */
78 #ifndef HAVE_ACL_FROM_MODE
79 # define HAVE_ACL_FROM_MODE false
80 # define acl_from_mode(mode) (NULL)
81 #endif
82
83 #define ACL_NOT_WELL_SUPPORTED(Errno) \
84   (Errno == ENOTSUP || Errno == ENOSYS || Errno == EINVAL)
85
86 /* Define a replacement for acl_entries if needed.  */
87 #if USE_ACL && HAVE_ACL_GET_FILE && HAVE_ACL_FREE && !HAVE_ACL_ENTRIES
88 # define acl_entries rpl_acl_entries
89 int acl_entries (acl_t);
90 #endif