diff lib/acl-internal.h @ 10115:4e8f2032eb4d

Add support for ACLs on OSF/1.
author Bruno Haible <bruno@clisp.org>
date Fri, 23 May 2008 03:48:39 +0200 (2008-05-23)
parents 51164d97e89b
children 437808f00003
line wrap: on
line diff
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -59,19 +59,48 @@
 #endif
 
 /* POSIX 1003.1e (draft 17) */
-#ifndef HAVE_ACL_GET_FD
+#ifdef HAVE_ACL_GET_FD
+/* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
+   macro(!).  */
+# if HAVE_ACL_FREE_TEXT /* OSF/1 */
+static inline acl_t
+rpl_acl_get_fd (int fd)
+{
+  return acl_get_fd (fd, ACL_TYPE_ACCESS);
+}
+#  undef acl_get_fd
+#  define acl_get_fd rpl_acl_get_fd
+# endif
+#else
 # define HAVE_ACL_GET_FD false
 # undef acl_get_fd
 # define acl_get_fd(fd) (NULL)
 #endif
 
 /* POSIX 1003.1e (draft 17) */
-#ifndef HAVE_ACL_SET_FD
+#ifdef HAVE_ACL_SET_FD
+/* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
+   macro(!).  */
+# if HAVE_ACL_FREE_TEXT /* OSF/1 */
+static inline int
+rpl_acl_set_fd (int fd, acl_t acl)
+{
+  return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
+}
+#  undef acl_set_fd
+#  define acl_set_fd rpl_acl_set_fd
+# endif
+#else
 # define HAVE_ACL_SET_FD false
 # undef acl_set_fd
 # define acl_set_fd(fd, acl) (-1)
 #endif
 
+/* POSIX 1003.1e (draft 13) */
+#if ! HAVE_ACL_FREE_TEXT
+# define acl_free_text(buf) acl_free (buf)
+#endif
+
 /* Linux-specific */
 #ifndef HAVE_ACL_EXTENDED_FILE
 # define HAVE_ACL_EXTENDED_FILE false