~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/acl-internal.h

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Internal implementation of access control lists.
2
2
 
3
 
   Copyright (C) 2002-2003, 2005-2011 Free Software Foundation, Inc.
 
3
   Copyright (C) 2002-2003, 2005-2012 Free Software Foundation, Inc.
4
4
 
5
5
   This program is free software: you can redistribute it and/or modify
6
6
   it under the terms of the GNU General Public License as published by
55
55
# define ENOTSUP (-1)
56
56
#endif
57
57
 
 
58
#include <limits.h>
 
59
#ifndef MIN
 
60
# define MIN(a,b) ((a) < (b) ? (a) : (b))
 
61
#endif
 
62
 
 
63
#ifndef SIZE_MAX
 
64
# define SIZE_MAX ((size_t) -1)
 
65
#endif
 
66
 
58
67
#ifndef HAVE_FCHMOD
59
68
# define HAVE_FCHMOD false
60
69
# define fchmod(fd, mode) (-1)
62
71
 
63
72
/* Recognize some common errors such as from an NFS mount that does
64
73
   not support ACLs, even when local drives do.  */
65
 
#if defined __APPLE__ && defined __MACH__ /* MacOS X */
 
74
#if defined __APPLE__ && defined __MACH__ /* Mac OS X */
66
75
# define ACL_NOT_WELL_SUPPORTED(Err) \
67
76
     ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT)
68
77
#elif defined EOPNOTSUPP /* Tru64 NFS */
73
82
     ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY)
74
83
#endif
75
84
 
 
85
_GL_INLINE_HEADER_BEGIN
 
86
#ifndef ACL_INTERNAL_INLINE
 
87
# define ACL_INTERNAL_INLINE _GL_INLINE
 
88
#endif
 
89
 
76
90
#if USE_ACL
77
91
 
78
92
# if HAVE_ACL_GET_FILE
79
93
/* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
80
 
/* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
 
94
/* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
81
95
 
82
96
#  ifndef MIN_ACL_ENTRIES
83
97
#   define MIN_ACL_ENTRIES 4
88
102
/* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
89
103
   macro(!).  */
90
104
#   if HAVE_ACL_FREE_TEXT /* OSF/1 */
91
 
static inline acl_t
 
105
ACL_INTERNAL_INLINE acl_t
92
106
rpl_acl_get_fd (int fd)
93
107
{
94
108
  return acl_get_fd (fd, ACL_TYPE_ACCESS);
107
121
/* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
108
122
   macro(!).  */
109
123
#   if HAVE_ACL_FREE_TEXT /* OSF/1 */
110
 
static inline int
 
124
ACL_INTERNAL_INLINE int
111
125
rpl_acl_set_fd (int fd, acl_t acl)
112
126
{
113
127
  return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
133
147
#  endif
134
148
 
135
149
/* Linux-specific */
136
 
#  ifndef HAVE_ACL_EXTENDED_FILE_NOFOLLOW
137
 
#   define HAVE_ACL_EXTENDED_FILE_NOFOLLOW false
138
 
#   define acl_extended_file_nofollow(name) (-1)
139
 
#  endif
140
 
 
141
 
/* Linux-specific */
142
150
#  ifndef HAVE_ACL_FROM_MODE
143
151
#   define HAVE_ACL_FROM_MODE false
144
152
#   define acl_from_mode(mode) (NULL)
146
154
 
147
155
/* Set to 1 if a file's mode is implicit by the ACL.
148
156
   Set to 0 if a file's mode is stored independently from the ACL.  */
149
 
#  if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* MacOS X, IRIX */
 
157
#  if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */
150
158
#   define MODE_INSIDE_ACL 0
151
159
#  else
152
160
#   define MODE_INSIDE_ACL 1
160
168
extern int acl_entries (acl_t);
161
169
#  endif
162
170
 
163
 
#  if HAVE_ACL_TYPE_EXTENDED /* MacOS X */
 
171
#  if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
164
172
/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
165
173
   Return 1 if the given ACL is non-trivial.
166
174
   Return 0 if it is trivial.  */
260
268
# endif
261
269
 
262
270
#endif
 
271
 
 
272
_GL_INLINE_HEADER_END