* lib/time_.h: Port to Solaris 8 with Sun Studio 11, using a
[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 "acl.h"
22
23 #include <stdbool.h>
24 #include <stdlib.h>
25
26 #ifdef HAVE_ACL_LIBACL_H
27 # include <acl/libacl.h>
28 #endif
29
30 #include "error.h"
31 #include "quote.h"
32
33 #include <errno.h>
34 #ifndef ENOSYS
35 # define ENOSYS (-1)
36 #endif
37 #ifndef ENOTSUP
38 # define ENOTSUP (-1)
39 #endif
40
41 #include "gettext.h"
42 #define _(msgid) gettext (msgid)
43
44 #ifndef HAVE_FCHMOD
45 # define HAVE_FCHMOD false
46 # define fchmod(fd, mode) (-1)
47 #endif
48
49 #ifndef MIN_ACL_ENTRIES
50 # define MIN_ACL_ENTRIES 4
51 #endif
52
53 /* POSIX 1003.1e (draft 17) */
54 #ifndef HAVE_ACL_GET_FD
55 # define HAVE_ACL_GET_FD false
56 # undef acl_get_fd
57 # define acl_get_fd(fd) (NULL)
58 #endif
59
60 /* POSIX 1003.1e (draft 17) */
61 #ifndef HAVE_ACL_SET_FD
62 # define HAVE_ACL_SET_FD false
63 # undef acl_set_fd
64 # define acl_set_fd(fd, acl) (-1)
65 #endif
66
67 /* Linux-specific */
68 #ifndef HAVE_ACL_EXTENDED_FILE
69 # define HAVE_ACL_EXTENDED_FILE false
70 # define acl_extended_file(name) (-1)
71 #endif
72
73 /* Linux-specific */
74 #ifndef HAVE_ACL_FROM_MODE
75 # define HAVE_ACL_FROM_MODE false
76 # define acl_from_mode(mode) (NULL)
77 #endif
78
79 #define ACL_NOT_WELL_SUPPORTED(Err) \
80   ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY)
81
82 /* Define a replacement for acl_entries if needed.  */
83 #if USE_ACL && HAVE_ACL_GET_FILE && HAVE_ACL_FREE && !HAVE_ACL_ENTRIES
84 # define acl_entries rpl_acl_entries
85 int acl_entries (acl_t);
86 #endif