diff --git a/dev-libs/apr/ChangeLog b/dev-libs/apr/ChangeLog new file mode 100644 index 0000000..e008206 --- /dev/null +++ b/dev-libs/apr/ChangeLog @@ -0,0 +1,13 @@ +# ChangeLog for dev-libs/apr +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*apr-1.4.5 (21 Nov 2011) + + 21 Nov 2011; Mario Fetka +apr-1.4.5.ebuild, + +files/apr-1.4.x-apr_common-m4.patch, +files/apr-1.4.5-xattr-build-1.patch, + +files/apr-xattr-build.patch, +files/apr-xattr-headers.patch, + +files/apr-xattr-impl.patch, +files/apr-xattr-tests.patch, + +files/config.layout.patch, +metadata.xml: + add privsep patch & Multilib Patch + diff --git a/dev-libs/apr/Manifest b/dev-libs/apr/Manifest new file mode 100644 index 0000000..055405e --- /dev/null +++ b/dev-libs/apr/Manifest @@ -0,0 +1,11 @@ +AUX apr-1.4.5-xattr-build-1.patch 5932 RMD160 c9c33e9f9c13e21a05131c52865f91603e6d6791 SHA1 856d0333c7295c0ff5d80fe3967d678294fb6e7a SHA256 f1d4cfe011c0e0e507f5bda965f78cbe2884249b06f231d8c7b7252be49ab0ff +AUX apr-1.4.x-apr_common-m4.patch 844 RMD160 2e27c63fde2c014379b1a57e84c497d3c00a7acb SHA1 fd9911cfcc18428cc65cd519768372df8268082a SHA256 cc7f7d91bd81753ae77e5807588d205eb7ae647f3ed05e4ce7e5bf9edc0dfa6d +AUX apr-xattr-build.patch 5530 RMD160 f1846815ee32366e51ef7b765f7cb8d1f10642ed SHA1 f61d3f8618e8faf7426125be4147542f2db11787 SHA256 ccda7d84d0a4c95507e82bcbf157dca91e420e7825c80cbd60894d2b047b2b1d +AUX apr-xattr-headers.patch 13791 RMD160 b6a71fcdea238bf8bc10cc43b5d346a6c54f11ae SHA1 431051e2bcc23776786453e329bbfd467fc8da4b SHA256 0d7068d1738dd2bedd8fffe7e95f0089e70b9730a81d35b2688c50e506f718ee +AUX apr-xattr-impl.patch 38289 RMD160 41c2de08ff8ab4e94222ee49679da3a9ae0b78a9 SHA1 143c7054f040acd55ca3bedc9fac410f6ed37204 SHA256 3998baaad273f88bf3d82cf6522d7da88a5d03ffbc75bd5c781e1142b010fa13 +AUX apr-xattr-tests.patch 17458 RMD160 b314abc82368a9a69e35082d8117c7361866699a SHA1 ca51974638a1b7cd0e3c1e957dd792c26587a4cb SHA256 14b0b7750c795734a1e71688e084c08e8af6db83acab0f8b135f08cfa92c080e +AUX config.layout.patch 818 RMD160 dada232c8b85e6c3c62fbc6caa1d05f36164dc27 SHA1 3822a0ec508165dd189e1b750bdf4e7778b6c21e SHA256 eeacaf654f23084e842bff02b97c083a8da5b5c056fd086166ba2d250edf3181 +DIST apr-1.4.5.tar.bz2 754763 RMD160 d2a966c1b143416cd3655cf849cb5d3cb1ca2c5f SHA1 517de5e3cc1e3be810d9bc95508ab66bb8ebe7cb SHA256 38c61cacb39be649411cdab212979c71ce29495549c249c2e9a1b0d12480c93e +EBUILD apr-1.4.5.ebuild 2369 RMD160 8c916a247bbcb575ea7c82e4c9234a976847aa1e SHA1 c63b2cdfb4b7f0b551c86add38f88aa0da510c08 SHA256 f9da2d933aa22f791dddc4760b500c53e25b6732d4e776efb2437f681e42a621 +MISC ChangeLog 495 RMD160 2e037d1d581df1836b2192687df15bc63c7968fb SHA1 823623e6b05563ef89e3c8605e8196c282562f47 SHA256 fa0aab5930faea0e8d567ce5e9981d593240dfdd5734fe603ad2ab6bd192bd08 +MISC metadata.xml 453 RMD160 44be42dfd9fe4c26f5655b4a8b78446ae1c073e7 SHA1 d7378602457f126b8448744b2f965853b4a17188 SHA256 c089c114bb8c838899abeb5c1f1c19a495039b30e106363c14e5de83b7e9a1f4 diff --git a/dev-libs/apr/apr-1.4.5.ebuild b/dev-libs/apr/apr-1.4.5.ebuild new file mode 100644 index 0000000..146cccf --- /dev/null +++ b/dev-libs/apr/apr-1.4.5.ebuild @@ -0,0 +1,97 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/apr/apr-1.4.5.ebuild,v 1.8 2011/11/11 19:17:50 hwoarang Exp $ + +EAPI="4" + +inherit autotools eutils libtool multilib + +DESCRIPTION="Apache Portable Runtime Library" +HOMEPAGE="http://apr.apache.org/" +SRC_URI="mirror://apache/apr/${P}.tar.bz2" + +LICENSE="Apache-2.0" +SLOT="1" +KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd" +IUSE="doc elibc_FreeBSD older-kernels-compatibility static-libs +urandom +uuid" +RESTRICT="test" + +RDEPEND="uuid? ( !elibc_FreeBSD? ( >=sys-apps/util-linux-2.16 ) )" +DEPEND="${RDEPEND} + doc? ( app-doc/doxygen )" + +DOCS=(CHANGES NOTICE README) + +src_prepare() { + epatch "${FILESDIR}/apr-1.4.x-apr_common-m4.patch" + epatch "${FILESDIR}/apr-1.4.5-xattr-build-1.patch" + epatch "${FILESDIR}/apr-xattr-headers.patch" + epatch "${FILESDIR}/apr-xattr-impl.patch" + epatch "${FILESDIR}/apr-xattr-tests.patch" + + # Ensure that system libtool is used. + sed -e 's:${installbuilddir}/libtool:/usr/bin/libtool:' -i apr-config.in || die "sed failed" + sed -e 's:@LIBTOOL@:$(SHELL) /usr/bin/libtool:' -i build/apr_rules.mk.in || die "sed failed" + + AT_M4DIR="build" eautoreconf + elibtoolize + + epatch "${FILESDIR}/config.layout.patch" +} + +src_configure() { + local myconf + + if use older-kernels-compatibility; then + local apr_cv_accept4 apr_cv_dup3 apr_cv_epoll_create1 apr_cv_sock_cloexec + export apr_cv_accept4="no" + export apr_cv_dup3="no" + export apr_cv_epoll_create1="no" + export apr_cv_sock_cloexec="no" + fi + + if use urandom; then + myconf+=" --with-devrandom=/dev/urandom" + else + myconf+=" --with-devrandom=/dev/random" + fi + + if ! use uuid; then + local apr_cv_osuuid + export apr_cv_osuuid="no" + fi + + CONFIG_SHELL="/bin/bash" econf \ + --enable-layout=gentoo \ + --enable-nonportable-atomics \ + --enable-threads \ + ${myconf} + + rm -f libtool +} + +src_compile() { + emake + + if use doc; then + emake dox + fi +} + +src_install() { + default + + find "${ED}" -name "*.la" -exec rm -f {} + + + if use doc; then + dohtml -r docs/dox/html/* + fi + + if ! use static-libs; then + find "${ED}" -name "*.a" -exec rm -f {} + + fi + + # This file is only used on AIX systems, which Gentoo is not, + # and causes collisions between the SLOTs, so remove it. + rm -f "${ED}usr/$(get_libdir)/apr.exp" +} diff --git a/dev-libs/apr/files/apr-1.4.5-xattr-build-1.patch b/dev-libs/apr/files/apr-1.4.5-xattr-build-1.patch new file mode 100644 index 0000000..856b67f --- /dev/null +++ b/dev-libs/apr/files/apr-1.4.5-xattr-build-1.patch @@ -0,0 +1,159 @@ +Submitted By: Mario Fetka (mario dot fetka at gmail dot com) +Date: 2011-11-21 +Initial Package Version: 1.4.5 +Origin: http://privsep.org/patches/2.3.0-dev/xattr-patches/apr-xattr-build.patch +Upstream Status: unknown +Description: build infrastructure + +diff -Naur apr-1.4.5.orig/build.conf apr-1.4.5/build.conf +--- apr-1.4.5.orig/build.conf 2011-11-21 18:38:28.659217726 +0000 ++++ apr-1.4.5/build.conf 2011-11-21 18:39:17.735760998 +0000 +@@ -13,7 +13,7 @@ + # directories that have platform-specific code in them. the resulting + # pattern will be: SUBDIR/PLATFORM/*.c + platform_dirs = +- dso file_io locks memory misc mmap network_io poll random ++ dso file_io locks memory misc mmap network_io poll random xattr + shmem support threadproc time user atomic + + # all the public headers +diff -Naur apr-1.4.5.orig/configure.in apr-1.4.5/configure.in +--- apr-1.4.5.orig/configure.in 2011-11-21 18:38:28.985607639 +0000 ++++ apr-1.4.5/configure.in 2011-11-21 18:43:25.981912296 +0000 +@@ -197,7 +197,7 @@ + DEFAULT_OSDIR="unix" + echo "(Default will be ${DEFAULT_OSDIR})" + +-apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random" ++apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random xattr" + + dnl Checks for programs. + AC_PROG_MAKE_SET +@@ -1466,7 +1466,9 @@ + sys/types.h \ + sys/uio.h \ + sys/un.h \ +- sys/wait.h) ++ sys/wait.h \ ++ sys/xattr.h \ ++ sys/extattr.h) + + # IRIX 6.5 has a problem in which prevents it from + # being included by itself. Check for manually, +@@ -1518,6 +1520,8 @@ + AC_SUBST(unistdh) + AC_SUBST(signalh) + AC_SUBST(sys_waith) ++AC_SUBST(sys_xattrh) ++AC_SUBST(sys_extattrh) + AC_SUBST(processh) + AC_SUBST(pthreadh) + AC_SUBST(semaphoreh) +@@ -2472,6 +2476,87 @@ + APR_CHECK_DIRENT_INODE + APR_CHECK_DIRENT_TYPE + ++dnl ----------------------------- Checking for Extended Attributes Support ++echo "${nl}Checking for Extended Attributes Support..." ++ ++# Check whether Extended Attributes have explicitly been disabled ++AC_ARG_ENABLE(xattr, ++ [ --disable-xattr Disable Extended Attributes support in APR.], ++ [ if test "$enableval" = "no"; then ++ user_disabled_xattr=1 ++ fi ], ++ [ user_disabled_xattr=0 ] ) ++ ++xattrdarwin="0" ++xattrlinux="0" ++xattrfreebsd="0" ++xattrsolaris="0" ++if test "$user_disabled_xattr" = 1; then ++ echo "no -- disabled by user" ++else ++ AC_CHECK_FUNCS([fgetxattr fsetxattr flistxattr fremovexattr lgetxattr \ ++ extattr_get_fd extattr_set_fd extattr_list_fd \ ++ extattr_delete_fd openat unlinkat]) ++ APR_CHECK_DEFINE(O_XATTR, sys/fcntl.h) ++ APR_CHECK_DEFINE(XATTR_NOFOLLOW, sys/xattr.h) ++ APR_CHECK_DEFINE(XATTR_CREATE, sys/xattr.h) ++ APR_CHECK_DEFINE(XATTR_REPLACE, sys/xattr.h) ++ APR_CHECK_DEFINE(XATTR_NAME_MAX, linux/limits.h) ++ APR_CHECK_DEFINE(XATTR_SIZE_MAX, linux/limits.h) ++ APR_CHECK_DEFINE(XATTR_LIST_MAX, linux/limits.h) ++ APR_CHECK_DEFINE(XATTR_MAXNAMELEN, sys/xattr.h) ++ APR_CHECK_DEFINE(EXTATTR_NAMESPACE_USER, sys/extattr.h) ++ APR_CHECK_DEFINE(EXTATTR_NAMESPACE_SYSTEM, sys/extattr.h) ++ APR_CHECK_DEFINE(EXTATTR_MAXNAMELEN, sys/extattr.h) ++ ++ APR_BEGIN_DECISION([xattr attribute system interface]) ++ APR_IFALLYES(header:sys/xattr.h dnl ++ define:XATTR_NOFOLLOW dnl ++ func:fgetxattr dnl ++ func:fsetxattr dnl ++ func:flistxattr dnl ++ func:fremovexattr, ++ [xattrdarwin="1" ++ APR_DECIDE(USE_XATTR_DARWIN, [xattr (Darwin)])]) ++ ++ APR_IFALLYES(header:sys/xattr.h dnl ++ func:lgetxattr dnl ++ func:fgetxattr dnl ++ func:fsetxattr dnl ++ func:flistxattr dnl ++ func:fremovexattr, ++ [xattrlinux="1" ++ APR_DECIDE(USE_XATTR_LINUX, [xattr (Linux)])]) ++ ++ APR_IFALLYES(header:sys/extattr.h dnl ++ func:extattr_set_fd dnl ++ func:func:extattr_get_fd dnl ++ func:extattr_list_fd dnl ++ func:func:extattr_delete_fd, ++ [xattrfreebsd="1" ++ APR_DECIDE(USE_XATTR_FREEBSD, [extattr (FreeBSD)])]) ++ ++ APR_IFALLYES(define:O_XATTR dnl ++ func:openat dnl ++ func:unlinkat, ++ [xattrsolaris="1" ++ APR_DECIDE(USE_XATTR_SOLARIS, [attropen (Solaris)])]) ++ ++ if test "x$ac_decision" = "x"; then ++ ac_decision="USE_XATTR_NONE" ++ ac_decision_msg="no xattr interface available" ++ fi ++ APR_END_DECISION ++ AC_DEFINE_UNQUOTED($ac_decision) ++fi ++ ++if test "$xattrdarwin$xattrlinux$xattrfreebsd$xattrsolaris" = "0000"; then ++ xattr="0" ++else ++ xattr="1" ++fi ++AC_SUBST(xattr) ++ + dnl ----------------------------- Checking for UUID Support + echo "${nl}Checking for OS UUID Support..." + +diff -Naur apr-1.4.5.orig/include/apr.h.in apr-1.4.5/include/apr.h.in +--- apr-1.4.5.orig/include/apr.h.in 2011-11-21 18:38:28.661532544 +0000 ++++ apr-1.4.5/include/apr.h.in 2011-11-21 18:40:23.666523955 +0000 +@@ -104,6 +104,8 @@ + #define APR_HAVE_SYS_UIO_H @sys_uioh@ + #define APR_HAVE_SYS_UN_H @sys_unh@ + #define APR_HAVE_SYS_WAIT_H @sys_waith@ ++#define APR_HAVE_SYS_XATTR_H @sys_xattrh@ ++#define APR_HAVE_SYS_EXTATTR_H @sys_extattrh@ + #define APR_HAVE_TIME_H @timeh@ + #define APR_HAVE_UNISTD_H @unistdh@ + #define APR_HAVE_WINDOWS_H @windowsh@ +@@ -276,6 +278,7 @@ + #define APR_HAS_UNICODE_FS @have_unicode_fs@ + #define APR_HAS_PROC_INVOKED @have_proc_invoked@ + #define APR_HAS_USER @apr_has_user@ ++#define APR_HAS_XATTR @xattr@ + #define APR_HAS_LARGE_FILES @aprlfs@ + #define APR_HAS_XTHREAD_FILES @apr_has_xthread_files@ + #define APR_HAS_OS_UUID @osuuid@ diff --git a/dev-libs/apr/files/apr-1.4.x-apr_common-m4.patch b/dev-libs/apr/files/apr-1.4.x-apr_common-m4.patch new file mode 100644 index 0000000..bab895b --- /dev/null +++ b/dev-libs/apr/files/apr-1.4.x-apr_common-m4.patch @@ -0,0 +1,24 @@ +diff -uNr apr-1.4.5.orig/build/apr_common.m4 apr-1.4.5/build/apr_common.m4 +--- apr-1.4.5.orig/build/apr_common.m4 2011-11-21 19:58:38.341263862 +0100 ++++ apr-1.4.5/build/apr_common.m4 2011-11-21 20:07:28.368394177 +0100 +@@ -202,14 +202,18 @@ + dnl for a user to override configure when it does something stupid. + dnl + AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [ +-if test "x$apr_ste_save_$1" = "x"; then ++dnl Check whether $apr_ste_save_$1 is empty or ++dnl only whitespace. The verbatim "X" is token number 1, ++dnl the following whitespace will be ignored. ++set X $apr_ste_save_$1 ++if test ${#} -eq 1; then + $2$1="$$1" + $1= + else + if test "x$apr_ste_save_$1" = "x$$1"; then + $2$1= + else +- $2$1=`echo $$1 | sed -e "s%${apr_ste_save_$1}%%"` ++ $2$1=`echo "$$1" | sed -e "s%${apr_ste_save_$1}%%"` + $1="$apr_ste_save_$1" + fi + fi diff --git a/dev-libs/apr/files/apr-xattr-build.patch b/dev-libs/apr/files/apr-xattr-build.patch new file mode 100644 index 0000000..f815acd --- /dev/null +++ b/dev-libs/apr/files/apr-xattr-build.patch @@ -0,0 +1,155 @@ +Index: include/apr.h.in +=================================================================== +--- include/apr.h.in (revision 606453) ++++ include/apr.h.in (working copy) +@@ -103,6 +103,8 @@ + #define APR_HAVE_SYS_UIO_H @sys_uioh@ + #define APR_HAVE_SYS_UN_H @sys_unh@ + #define APR_HAVE_SYS_WAIT_H @sys_waith@ ++#define APR_HAVE_SYS_XATTR_H @sys_xattrh@ ++#define APR_HAVE_SYS_EXTATTR_H @sys_extattrh@ + #define APR_HAVE_TIME_H @timeh@ + #define APR_HAVE_UNISTD_H @unistdh@ + #define APR_HAVE_WINDOWS_H @windowsh@ +@@ -238,6 +240,7 @@ + #define APR_HAS_UNICODE_FS @have_unicode_fs@ + #define APR_HAS_PROC_INVOKED @have_proc_invoked@ + #define APR_HAS_USER 1 ++#define APR_HAS_XATTR @xattr@ + #define APR_HAS_LARGE_FILES @aprlfs@ + #define APR_HAS_XTHREAD_FILES 0 + #define APR_HAS_OS_UUID @osuuid@ +Index: configure.in +=================================================================== +--- configure.in (revision 606453) ++++ configure.in (working copy) +@@ -124,7 +124,7 @@ + DEFAULT_OSDIR="unix" + echo "(Default will be ${DEFAULT_OSDIR})" + +-apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random" ++apr_modules="file_io network_io threadproc misc locks time mmap shmem user memory atomic poll support random xattr" + + dnl Checks for programs. + AC_PROG_MAKE_SET +@@ -1135,7 +1135,9 @@ + sys/types.h \ + sys/uio.h \ + sys/un.h \ +- sys/wait.h) ++ sys/wait.h \ ++ sys/xattr.h \ ++ sys/extattr.h) + + # IRIX 6.5 has a problem in which prevents it from + # being included by itself. Check for manually, +@@ -1187,6 +1189,8 @@ + AC_SUBST(unistdh) + AC_SUBST(signalh) + AC_SUBST(sys_waith) ++AC_SUBST(sys_xattrh) ++AC_SUBST(sys_extattrh) + AC_SUBST(pthreadh) + AC_SUBST(semaphoreh) + AC_SUBST(windowsh) +@@ -2030,6 +2034,87 @@ + APR_CHECK_DIRENT_INODE + APR_CHECK_DIRENT_TYPE + ++dnl ----------------------------- Checking for Extended Attributes Support ++echo "${nl}Checking for Extended Attributes Support..." ++ ++# Check whether Extended Attributes have explicitly been disabled ++AC_ARG_ENABLE(xattr, ++ [ --disable-xattr Disable Extended Attributes support in APR.], ++ [ if test "$enableval" = "no"; then ++ user_disabled_xattr=1 ++ fi ], ++ [ user_disabled_xattr=0 ] ) ++ ++xattrdarwin="0" ++xattrlinux="0" ++xattrfreebsd="0" ++xattrsolaris="0" ++if test "$user_disabled_xattr" = 1; then ++ echo "no -- disabled by user" ++else ++ AC_CHECK_FUNCS([fgetxattr fsetxattr flistxattr fremovexattr lgetxattr \ ++ extattr_get_fd extattr_set_fd extattr_list_fd \ ++ extattr_delete_fd openat unlinkat]) ++ APR_CHECK_DEFINE(O_XATTR, sys/fcntl.h) ++ APR_CHECK_DEFINE(XATTR_NOFOLLOW, sys/xattr.h) ++ APR_CHECK_DEFINE(XATTR_CREATE, sys/xattr.h) ++ APR_CHECK_DEFINE(XATTR_REPLACE, sys/xattr.h) ++ APR_CHECK_DEFINE(XATTR_NAME_MAX, linux/limits.h) ++ APR_CHECK_DEFINE(XATTR_SIZE_MAX, linux/limits.h) ++ APR_CHECK_DEFINE(XATTR_LIST_MAX, linux/limits.h) ++ APR_CHECK_DEFINE(XATTR_MAXNAMELEN, sys/xattr.h) ++ APR_CHECK_DEFINE(EXTATTR_NAMESPACE_USER, sys/extattr.h) ++ APR_CHECK_DEFINE(EXTATTR_NAMESPACE_SYSTEM, sys/extattr.h) ++ APR_CHECK_DEFINE(EXTATTR_MAXNAMELEN, sys/extattr.h) ++ ++ APR_BEGIN_DECISION([xattr attribute system interface]) ++ APR_IFALLYES(header:sys/xattr.h dnl ++ define:XATTR_NOFOLLOW dnl ++ func:fgetxattr dnl ++ func:fsetxattr dnl ++ func:flistxattr dnl ++ func:fremovexattr, ++ [xattrdarwin="1" ++ APR_DECIDE(USE_XATTR_DARWIN, [xattr (Darwin)])]) ++ ++ APR_IFALLYES(header:sys/xattr.h dnl ++ func:lgetxattr dnl ++ func:fgetxattr dnl ++ func:fsetxattr dnl ++ func:flistxattr dnl ++ func:fremovexattr, ++ [xattrlinux="1" ++ APR_DECIDE(USE_XATTR_LINUX, [xattr (Linux)])]) ++ ++ APR_IFALLYES(header:sys/extattr.h dnl ++ func:extattr_set_fd dnl ++ func:func:extattr_get_fd dnl ++ func:extattr_list_fd dnl ++ func:func:extattr_delete_fd, ++ [xattrfreebsd="1" ++ APR_DECIDE(USE_XATTR_FREEBSD, [extattr (FreeBSD)])]) ++ ++ APR_IFALLYES(define:O_XATTR dnl ++ func:openat dnl ++ func:unlinkat, ++ [xattrsolaris="1" ++ APR_DECIDE(USE_XATTR_SOLARIS, [attropen (Solaris)])]) ++ ++ if test "x$ac_decision" = "x"; then ++ ac_decision="USE_XATTR_NONE" ++ ac_decision_msg="no xattr interface available" ++ fi ++ APR_END_DECISION ++ AC_DEFINE_UNQUOTED($ac_decision) ++fi ++ ++if test "$xattrdarwin$xattrlinux$xattrfreebsd$xattrsolaris" = "0000"; then ++ xattr="0" ++else ++ xattr="1" ++fi ++AC_SUBST(xattr) ++ + dnl ----------------------------- Checking for UUID Support + echo "${nl}Checking for OS UUID Support..." + +Index: build.conf +=================================================================== +--- build.conf (revision 606453) ++++ build.conf (working copy) +@@ -13,7 +13,7 @@ + # directories that have platform-specific code in them. the resulting + # pattern will be: SUBDIR/PLATFORM/*.c + platform_dirs = +- dso file_io locks memory misc mmap network_io poll random ++ dso file_io locks memory misc mmap network_io poll random xattr + shmem support threadproc time user atomic + + # all the public headers diff --git a/dev-libs/apr/files/apr-xattr-headers.patch b/dev-libs/apr/files/apr-xattr-headers.patch new file mode 100644 index 0000000..329d7a8 --- /dev/null +++ b/dev-libs/apr/files/apr-xattr-headers.patch @@ -0,0 +1,366 @@ +Index: include/apr_file_xattr.h +=================================================================== +--- include/apr_file_xattr.h (revision 0) ++++ include/apr_file_xattr.h (revision 0) +@@ -0,0 +1,249 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef APR_FILE_XATTR_H ++#define APR_FILE_XATTR_H ++ ++/** ++ * @file apr_file_xattr.h ++ * @brief APR File Extended Attributes ++ */ ++ ++#include "apr.h" ++#include "apr_pools.h" ++#include "apr_tables.h" ++#include "apr_file_io.h" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++/** ++ * @defgroup apr_xattr File Extended Attribute Functions ++ * @ingroup APR ++ * @{ ++ */ ++ ++/** When setting values, fail if the attribute already exists */ ++#define APR_XATTR_CREATE 1 ++ ++/** When setting values, fail if the attribute does not already exist */ ++#define APR_XATTR_REPLACE 2 ++ ++typedef struct apr_xattr_t apr_xattr_t; ++ ++/** ++ * Open a context for access to the extended attributes of a file or ++ * directory specified by a path name ++ * ++ * @param new the context allocated for access to extended attributes ++ * @param pathname the path name of the file or directory ++ * @param p the pool to allocate any memory from ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the path was opened for attribute access
++ *        APR_STATUS_IS_ENOENT()  the file or directory does not exist
++ * 
++ * Other operating system dependant error codes may be returned. ++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_open_path(apr_xattr_t **new, ++ const char *pathname, ++ apr_pool_t *p); ++ ++/** ++ * Open a context for access to the extended attributes of an open file ++ * ++ * @param new the context allocated for access to extended attributes ++ * @param file the open file to access the extended attributes on ++ * @param p the pool to allocate any memory from ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the file was opened for attribute access
++ * 
++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_open_file(apr_xattr_t **new, ++ apr_file_t *file, ++ apr_pool_t *p); ++ ++/** ++ * Open a context for access to the extended attributes of an open directory ++ * ++ * @param new the context allocated for access to extended attributes ++ * @param dir the open directory to access the extended attributes on ++ * @param p the pool to allocate any memory from if required ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the directory was opened for attribute access
++ * 
++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_open_dir(apr_xattr_t **new, ++ apr_dir_t *dir, ++ apr_pool_t *p); ++ ++/** ++ * Destroy a context used for access to extended attributes ++ * ++ * @param xattr the context to destroy ++ *
++ *        APR_SUCCESS             the context was destroyed
++ * 
++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_destroy(apr_xattr_t *xattr); ++ ++/** ++ * Set an extended attribute on a file or directory ++ * @param xattr the opened extended attribute file or directory context ++ * @param name the attribute name to set ++ * @param value the attribute value ++ * @param size the size in bytes of the attribute value ++ * @param flags to control how the attribute is set ++ *
++ *         APR_XATTR_CREATE       return an error if the attribute name
++ *                                already exists.
++ *         APR_XATTR_REPLACE      return an error if the attribute name
++ *                                does not already exist.
++ * 
++ * @param p the pool to allocate any memory from if required ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the attribute was set
++ *        APR_STATUS_IS_EEXIST()  create flag and the attribute exists
++ *        APR_STATUS_IS_ENOATTR() replace flag and the attribute doesn't exist
++ * 
++ * Other operating system dependant error codes may be returned ++ * in the cases not listed above. ++ * ++ * @remark if neither flag APR_XATTR_CREATE or APR_XATTR_REPLACE are ++ * given then the attribute will either be created if it does not ++ * already exist or replaced if it does exist. ++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags); ++ ++/** ++ * Get an extended attribute from a file or directory ++ * @param xattr the opened extended attribute file or directory context ++ * @param name the name of the attribute to get ++ * @param value the returned attribute value allocated from the pool ++ * @param size the returned size of the attribute value ++ * @param flags to control how the attribute is got (reserved for future use) ++ * @param p the pool to allocate any memory from if required ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the attribute was retrieved
++ *        APR_STATUS_IS_ENOATTR() the attribute does not exist
++ * 
++ * Other operating system dependant error codes may be returned ++ * in the cases not listed above. ++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags); ++ ++/** ++ * Check for the existence of an extended attribute on a file or directory ++ * @param xattr the opened extended attribute file or directory context ++ * @param name the name of the attribute to get ++ * @param exists the returned value indicating whether the attribute exists ++ * @param flags to control how the attribute is got (reserved for future use) ++ * @param p the pool to allocate any memory from if required ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the existence was successfully tested
++ * 
++ * Other operating system dependant error codes may be returned ++ * in the cases not listed above. ++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags); ++ ++/** ++ * List the extended attributes on a file or directory ++ * @param xattr the opened extended attribute file or directory context ++ * @param list the returned array of attributes names ++ * @param flags to control how the file is listed (reserved for future use) ++ * @param p the pool to allocate any memory from if required ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the attributes were listed
++ * 
++ * Other operating system dependant error codes may be returned ++ * in the cases not listed above. ++ * ++ * @remark list is an array containing simple null terminated strings. ++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags); ++ ++/** ++ * Remove an extended attribute from a file or directory ++ * @param xattr the opened extended attribute file or directory context ++ * @param name the attribute name to remove ++ * @param flags to control how the attribute is removed (reserved for future use) ++ * @param p the pool to allocate any memory from if required ++ * @return the status of the operation: ++ *
++ *        APR_SUCCESS             the attribute was removed
++ *        APR_STATUS_IS_ENOATTR() the attribute does not exist
++ * 
++ * Other operating system dependant error codes may be returned ++ * in the cases not listed above. ++ * ++ * @warning Platforms which do not implement this feature will return ++ * APR_ENOTIMPL. ++ */ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags); ++/** @} */ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* ! APR_FILE_XATTR_H */ +Index: include/arch/unix/apr_arch_xattr.h +=================================================================== +--- include/arch/unix/apr_arch_xattr.h (revision 0) ++++ include/arch/unix/apr_arch_xattr.h (revision 0) +@@ -0,0 +1,51 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FILE_XATTR_H ++#define FILE_XATTR_H ++ ++#if APR_HAVE_CTYPE_H ++#include ++#endif ++#if APR_HAVA_ERRNO_H ++#include ++#endif ++#if APR_HAVE_SYS_XATTR_H ++#include ++#endif ++#if APR_HAVE_SYS_EXTATTR_H ++#include ++#endif ++#if APR_HAVE_FCNTL_H ++#include ++#endif ++#if APR_HAVE_DIRENT_H ++#include ++#endif ++ ++#ifdef _LARGEFILE64_SOURCE ++#define XATTR_OPEN_FLAGS O_RDONLY | O_LARGEFILE ++#else ++#define XATTR_OPEN_FLAGS O_RDONLY ++#endif ++ ++struct apr_xattr_t { ++ int fd; ++ apr_uint32_t flags; ++ apr_pool_t *pool; ++}; ++ ++#endif +Index: include/apr_errno.h +=================================================================== +--- include/apr_errno.h (revision 606453) ++++ include/apr_errno.h (working copy) +@@ -851,6 +851,13 @@ + #define APR_EAFNOSUPPORT (APR_OS_START_CANONERR + 27) + #endif + ++/** @see APR_STATUS_IS_ENOATTR */ ++#ifdef ENOATTR ++#define APR_ENOATTR ENOATTR ++#else ++#define APR_ENOATTR (APR_OS_START_CANONERR + 28) ++#endif ++ + /** @} */ + + #if defined(OS2) && !defined(DOXYGEN) +@@ -995,6 +1002,7 @@ + || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED) + #define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_AFNOSUPPORT \ + || (s) == APR_OS_START_SYSERR + SOCEAFNOSUPPORT) ++#define APR_STATUS_IS_ENOATTR(s) ((s) == APR_ENOATTR) + + /* + Sorry, too tired to wrap this up for OS2... feel free to +@@ -1139,6 +1147,7 @@ + || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY) + #define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_EAFNOSUPPORT \ + || (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT) ++#define APR_STATUS_IS_ENOATTR(s) ((s) == APR_ENOATTR) + + #elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */ + +@@ -1200,6 +1209,7 @@ + #define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY) + #define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_EAFNOSUPPORT \ + || (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT) ++#define APR_STATUS_IS_ENOATTR(s) ((s) == APR_ENOATTR) + + #else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */ + +@@ -1319,6 +1329,13 @@ + (s) == APR_EEXIST) + /** Address Family not supported */ + #define APR_STATUS_IS_EAFNOSUPPORT(s) ((s) == APR_EAFNOSUPPORT) ++/** Attribute does not exists */ ++#ifdef ENODATA ++#define APR_STATUS_IS_ENOATTR(s) ((s) == APR_ENOATTR \ ++ || (s) == ENODATA) ++#else ++#define APR_STATUS_IS_ENOATTR(s) ((s) == APR_ENOATTR) ++#endif + /** @} */ + + #endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */ diff --git a/dev-libs/apr/files/apr-xattr-impl.patch b/dev-libs/apr/files/apr-xattr-impl.patch new file mode 100644 index 0000000..47628c9 --- /dev/null +++ b/dev-libs/apr/files/apr-xattr-impl.patch @@ -0,0 +1,1233 @@ +Index: xattr/unix/xattr.c +=================================================================== +--- xattr/unix/xattr.c (revision 0) ++++ xattr/unix/xattr.c (revision 0) +@@ -0,0 +1,165 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_private.h" ++#include "apr_tables.h" ++ ++#if USE_XATTR_DARWIN || USE_XATTR_FREEBSD || USE_XATTR_LINUX || \ ++ USE_XATTR_SOLARIS ++ ++#include "apr_arch_file_io.h" ++#include "apr_arch_xattr.h" ++ ++#include "apr_file_xattr.h" ++ ++ ++static apr_status_t xattr_cleanup(void *xattr) ++{ ++ close(((apr_xattr_t*)xattr)->fd); ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_path(apr_xattr_t **new, ++ const char *pathname, ++ apr_pool_t *p) ++{ ++ int fd; ++ int osflags = 0; ++ ++ fd = open(pathname, XATTR_OPEN_FLAGS); ++ if (fd < 0) { ++ return errno; ++ } ++ ++ *new = apr_palloc(p, sizeof(apr_xattr_t)); ++ (*new)->fd = fd; ++ (*new)->flags = 0; ++ (*new)->pool = p; ++ ++ apr_pool_cleanup_register((*new)->pool, (void *)(*new), ++ xattr_cleanup, xattr_cleanup); ++ ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_file(apr_xattr_t **new, ++ apr_file_t *file, ++ apr_pool_t *p) ++{ ++ *new = apr_palloc(p, sizeof(apr_xattr_t)); ++ (*new)->fd = file->filedes; ++ (*new)->flags = APR_FILE_NOCLEANUP; ++ (*new)->pool = p; ++ ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_dir(apr_xattr_t **new, ++ apr_dir_t *dir, ++ apr_pool_t *p) ++{ ++ *new = apr_palloc(p, sizeof(apr_xattr_t)); ++ (*new)->fd = dirfd(dir->dirstruct); ++ (*new)->flags = APR_FILE_NOCLEANUP; ++ (*new)->pool = p; ++ ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_destroy(apr_xattr_t *xattr) ++{ ++ if (!(xattr->flags & APR_FILE_NOCLEANUP)) { ++ return apr_pool_cleanup_run(xattr->pool, xattr, xattr_cleanup); ++ } ++ return APR_SUCCESS; ++} ++ ++#else ++ ++#include "apr_file_xattr.h" ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_path(apr_xattr_t **new, ++ const char *pathname, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_file(apr_xattr_t **new, ++ apr_file_t *file, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_dir(apr_xattr_t **new, ++ apr_dir_t *dir, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_destroy(apr_xattr_t *xattr) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ *exists = 0; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++#endif +Index: xattr/unix/darwin.c +=================================================================== +--- xattr/unix/darwin.c (revision 0) ++++ xattr/unix/darwin.c (revision 0) +@@ -0,0 +1,143 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_private.h" ++ ++#if USE_XATTR_DARWIN ++ ++#include "apr_arch_xattr.h" ++ ++#include "apr_strings.h" ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ int ret; ++ int osflags = 0; ++ ++ if (flags & APR_XATTR_CREATE) { ++ osflags |= XATTR_CREATE; ++ } ++ if (flags & APR_XATTR_REPLACE) { ++ osflags |= XATTR_REPLACE; ++ } ++ ++ ret = fsetxattr(xattr->fd, name, value, size, 0, osflags); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ apr_ssize_t ret; ++ ++ ret = fgetxattr(xattr->fd, name, NULL, 0, 0, 0); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ *value = apr_palloc(xattr->pool, ret); ++ ++ ret = fgetxattr(xattr->fd, name, *value, ret, 0, 0); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ *size = ret; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ apr_ssize_t ret; ++ ++ ret = fgetxattr(xattr->fd, name, NULL, 0, 0, 0); ++ ++ if (ret < 0) { ++ *exists = 0; ++ if (errno == ENOATTR) { ++ return APR_SUCCESS; ++ } ++ return errno; ++ } ++ *exists = 1; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ apr_ssize_t lsize; ++ char *listbuf, *listp; ++ ++ lsize = flistxattr(xattr->fd, NULL, 0, 0); ++ ++ if (lsize < 0) { ++ return errno; ++ } ++ if (lsize == 0) { ++ *list = apr_array_make(xattr->pool, 0, sizeof(char*)); ++ return APR_SUCCESS; ++ } ++ listbuf = apr_palloc(xattr->pool, lsize); ++ ++ lsize = flistxattr(xattr->fd, listbuf, lsize, 0); ++ ++ if (lsize < 0) { ++ return errno; ++ } ++ *list = apr_array_make(xattr->pool, 1, sizeof(char*)); ++ listp = listbuf; ++ while (listp < listbuf + lsize) { ++ int attrlen = strlen(listp) + 1; ++ *(char**)apr_array_push(*list) = listp; ++ listp += attrlen; ++ } ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ int ret; ++ ++ ret = fremovexattr(xattr->fd, name, 0); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ return APR_SUCCESS; ++} ++ ++#endif /* USE_XATTR_DARWIN */ +Index: xattr/unix/linux.c +=================================================================== +--- xattr/unix/linux.c (revision 0) ++++ xattr/unix/linux.c (revision 0) +@@ -0,0 +1,156 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_private.h" ++ ++#if USE_XATTR_LINUX ++ ++#include "apr_arch_xattr.h" ++ ++#include "apr_strings.h" ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++static const char* user_ns_prefix = "user."; ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ int ret; ++ int osflags = 0; ++ ++ char *tmpname = apr_pstrcat(xattr->pool, user_ns_prefix, name, NULL); ++ ++ if (flags & APR_XATTR_CREATE) { ++ osflags |= XATTR_CREATE; ++ } ++ if (flags & APR_XATTR_REPLACE) { ++ osflags |= XATTR_REPLACE; ++ } ++ ++ ret = fsetxattr(xattr->fd, tmpname, value, size, osflags); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ apr_ssize_t ret; ++ char *tmpname = apr_pstrcat(xattr->pool, user_ns_prefix, name, NULL); ++ ++ ret = fgetxattr(xattr->fd, tmpname, NULL, 0); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ *value = apr_palloc(xattr->pool, ret); ++ ++ ret = fgetxattr(xattr->fd, tmpname, *value, ret); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ *size = ret; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ apr_ssize_t ret; ++ char *tmpname = apr_pstrcat(xattr->pool, user_ns_prefix, name, NULL); ++ ++ ret = fgetxattr(xattr->fd, tmpname, NULL, 0); ++ ++ if (ret < 0) { ++ *exists = 0; ++ if (errno == ENODATA) { ++ return APR_SUCCESS; ++ } ++ return errno; ++ } ++ *exists = 1; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ apr_ssize_t lsize; ++ char *listbuf, *listp; ++ ++ lsize = flistxattr(xattr->fd, NULL, 0); ++ ++ if (lsize < 0) { ++ return errno; ++ } ++ if (lsize == 0) { ++ *list = apr_array_make(xattr->pool, 0, sizeof(char*)); ++ return APR_SUCCESS; ++ } ++ listbuf = apr_palloc(xattr->pool, lsize); ++ ++ lsize = flistxattr(xattr->fd, listbuf, lsize); ++ ++ if (lsize < 0) { ++ return errno; ++ } ++ *list = apr_array_make(xattr->pool, 1, sizeof(char*)); ++ listp = listbuf; ++ while (listp < listbuf + lsize) { ++ int attrlen = strlen(listp) + 1; ++ int user_ns_prefix_len = strlen(user_ns_prefix); ++ if (strncmp(listp, user_ns_prefix, user_ns_prefix_len) != 0) { ++ continue; ++ } ++ listp += user_ns_prefix_len; ++ attrlen -= user_ns_prefix_len; ++ *(char**)apr_array_push(*list) = listp; ++ listp += attrlen; ++ } ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ int ret; ++ char *tmpname = apr_pstrcat(xattr->pool, user_ns_prefix, name, NULL); ++ ++ ret = fremovexattr(xattr->fd, tmpname); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ return APR_SUCCESS; ++} ++ ++#endif /* USE_XATTR_LINUX */ +Index: xattr/unix/freebsd.c +=================================================================== +--- xattr/unix/freebsd.c (revision 0) ++++ xattr/unix/freebsd.c (revision 0) +@@ -0,0 +1,162 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_private.h" ++ ++#if USE_XATTR_FREEBSD ++ ++#include "apr_arch_xattr.h" ++ ++#include "apr_strings.h" ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ int ret; ++ ++ if ((flags & APR_XATTR_CREATE) && (flags & APR_XATTR_REPLACE)) { ++ return APR_EINVAL; ++ } ++ ++ if ((flags & APR_XATTR_CREATE) || (flags & APR_XATTR_REPLACE)) { ++ ++ ret = extattr_get_fd(xattr->fd, EXTATTR_NAMESPACE_USER, name, NULL, 0); ++ ++ if (ret >= 0 && (flags & APR_XATTR_CREATE)) { ++ return APR_EEXIST; ++ } ++ else if (ret == -1 && errno == ENOATTR) { ++ if (flags & APR_XATTR_REPLACE) { ++ return APR_ENOATTR; ++ } ++ } ++ else if (ret == -1) { ++ return errno; ++ } ++ } ++ ++ ret = extattr_set_fd(xattr->fd, EXTATTR_NAMESPACE_USER, name, value, size); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ int ret; ++ ++ ret = extattr_get_fd(xattr->fd, EXTATTR_NAMESPACE_USER, name, NULL, 0); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ *value = apr_palloc(xattr->pool, ret); ++ ++ ret = extattr_get_fd(xattr->fd, EXTATTR_NAMESPACE_USER, name, *value, ret); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ *size = ret; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ int ret; ++ ++ ret = extattr_get_fd(xattr->fd, EXTATTR_NAMESPACE_USER, name, NULL, 0); ++ ++ if (ret < 0) { ++ *exists = 0; ++ if (errno == ENOATTR) { ++ return APR_SUCCESS; ++ } ++ return errno; ++ } ++ *exists = 1; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ int lsize; ++ char *listbuf, *listp; ++ ++ lsize = extattr_list_fd(xattr->fd, EXTATTR_NAMESPACE_USER, NULL, 0); ++ ++ if (lsize < 0) { ++ return errno; ++ } ++ if (lsize == 0) { ++ *list = apr_array_make(xattr->pool, 0, sizeof(char*)); ++ return APR_SUCCESS; ++ } ++ listbuf = apr_palloc(xattr->pool, lsize); ++ ++ lsize = extattr_list_fd(xattr->fd, EXTATTR_NAMESPACE_USER, listbuf, lsize); ++ ++ if (lsize < 0) { ++ return errno; ++ } ++ ++ *list = apr_array_make(xattr->pool, 1, sizeof(char*)); ++ listp = listbuf; ++ while(listp < listbuf + lsize) { ++ /* first byte is the length of the attribute name and the ++ strings are not null terminated, so we copy them */ ++ int attrlen = (int)*listp; ++ *(char**)apr_array_push(*list) = apr_pstrndup(xattr->pool, listp+1, ++ attrlen); ++ listp += (attrlen + 1); ++ } ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ int ret; ++ ++ ret = extattr_delete_fd(xattr->fd, EXTATTR_NAMESPACE_USER, name); ++ ++ if (ret < 0) { ++ return errno; ++ } ++ ++ return APR_SUCCESS; ++} ++ ++#endif /* USE_XATTR_FREEBSD */ +Index: xattr/unix/solaris.c +=================================================================== +--- xattr/unix/solaris.c (revision 0) ++++ xattr/unix/solaris.c (revision 0) +@@ -0,0 +1,300 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_private.h" ++ ++#if USE_XATTR_SOLARIS ++ ++#include "apr_arch_xattr.h" ++#include "apr_arch_file_io.h" ++ ++#include "apr_strings.h" ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++ ++/* The following code is for escaping and unescaping '/' chars ++ (and '%' as it is used as an escape character) in attribute names. ++ ++ This is because '/' can't be used in Solaris subfile names and doing ++ so could present a security risk as files could be opened elsewhere. ++*/ ++ ++static char nibble_to_hex(register char c) ++{ ++ if (c >= 0 && c <= 9) return '0' + c; ++ if (c >= 10 && c <= 15) return 'a' + c - 10; ++ else return 0; ++} ++ ++static char hex_to_nibble(register char c) ++{ ++ if (c >= '0' && c <= '9') return c - '0'; ++ if (c >= 'a' && c <= 'f') return c - 'a' + 10; ++ else if(c >= 'A' && c <= 'F') return c - 'A' + 10; ++ else return 0; ++} ++ ++static const char* escape_attr_name(const char *name, apr_pool_t *p) ++{ ++ const char *namep; ++ int hasspecial = 0; ++ apr_array_header_t *arr; ++ ++ /* fastpath if atttrname contains no characters that need escaping */ ++ if(strchr(name, '/') == NULL && strchr(name, '%') == NULL) { ++ return name; ++ } ++ ++ /* start with a conservative amount of additional space */ ++ arr = apr_array_make(p, strlen(name) + 16, sizeof(char)); ++ namep = name; ++ while (*namep) { ++ if(*namep == '/' || *namep == '%') { ++ *(char*)apr_array_push(arr) = '%'; ++ *(char*)apr_array_push(arr) = nibble_to_hex(*namep >> 4); ++ *(char*)apr_array_push(arr) = nibble_to_hex(*namep & 0x0f); ++ } else { ++ *(char*)apr_array_push(arr) = *namep; ++ } ++ namep++; ++ } ++ *(char*)apr_array_push(arr) = '\0'; ++ ++ return arr->elts; ++} ++ ++static const char* unescape_attr_name(const char *name, apr_pool_t *p) ++{ ++ const char *namep; ++ int hasspecial = 0; ++ apr_array_header_t *arr; ++ ++ /* fastpath if atttrname contains no escaped characters */ ++ if(strchr(name, '%') == NULL) { ++ return name; ++ } ++ ++ /* start with a conservative amount of additional space */ ++ arr = apr_array_make(p, strlen(name) + 16, sizeof(char)); ++ namep = name; ++ while (*namep) { ++ if(*namep == '%' && *(namep+1) != 0 && *(namep+2) != 0) { ++ namep++; ++ *(char*)apr_array_push(arr) = ++ hex_to_nibble(*namep++) << 4 | hex_to_nibble(*namep++); ++ } else { ++ *(char*)apr_array_push(arr) = *namep++; ++ } ++ } ++ *(char*)apr_array_push(arr) = '\0'; ++ ++ return arr->elts; ++} ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ int ret, fd, osflags; ++ struct_stat statbuf; ++ ++ if (strncmp(name, "SUNW", 4) == 0) { ++ /* don't clash with sun namespace */ ++ return EINVAL; ++ } else if (flags & APR_XATTR_CREATE && flags & APR_XATTR_REPLACE) { ++ return EINVAL; ++ } else if (flags & APR_XATTR_CREATE) { ++ osflags = O_CREAT | O_EXCL; ++ } else if (flags & APR_XATTR_REPLACE) { ++ osflags = 0; ++ } else { ++ osflags = O_CREAT; ++ } ++ ++ fd = openat(xattr->fd, escape_attr_name(name, xattr->pool), ++ osflags | O_XATTR | O_TRUNC | O_WRONLY, 0666); ++ ++ if (fd < 0) { ++ if(errno == ENOENT) { ++ return APR_ENOATTR; ++ } ++ return errno; ++ } ++ ++ do { ++ ret = write(fd, value, size); ++ } while(ret < 0 && errno == EINTR); ++ ++ if (ret < 0) { ++ ret = errno; ++ } ++ else if (ret != size) { ++ ret = APR_EGENERAL; ++ } ++ else { ++ ret = APR_SUCCESS; ++ } ++ close(fd); ++ return ret; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ int ret, fd; ++ ssize_t rsize; ++ struct_stat statbuf; ++ ++ fd = openat(xattr->fd, escape_attr_name(name, xattr->pool), ++ O_RDONLY | O_XATTR); ++ if (fd < 0) { ++ if(errno == ENOENT) { ++ return APR_ENOATTR; ++ } ++ return errno; ++ } ++ ++ ret = fstat(fd, &statbuf); ++ ++ if (ret < 0) { ++ ret = errno; ++ close(fd); ++ return ret; ++ } ++ *value = apr_palloc(xattr->pool, statbuf.st_size); ++ ++ do { ++ rsize = read(fd, *value, statbuf.st_size); ++ } while(rsize < 0 && errno == EINTR); ++ ++ if (rsize < 0) { ++ ret = errno; ++ } ++ else if (rsize != statbuf.st_size) { ++ ret = APR_EGENERAL; ++ } ++ else { ++ ret = APR_SUCCESS; ++ *size = rsize; ++ } ++ close(fd); ++ return ret; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ int ret, fd; ++ ssize_t rsize; ++ struct_stat statbuf; ++ ++ fd = openat(xattr->fd, escape_attr_name(name, xattr->pool), ++ O_RDONLY | O_XATTR); ++ if (fd < 0) { ++ *exists = 0; ++ if(errno == ENOENT) { ++ /* non-existant attribute does not return an error */ ++ return APR_SUCCESS; ++ } ++ return errno; ++ } ++ *exists = 1; ++ return APR_SUCCESS; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ int ret, fd; ++ DIR *dirp; ++ struct dirent *ent, *retent; ++ apr_size_t dirent_size = ++ sizeof(*ent) + (sizeof(ent->d_name) > 1 ? 0 : 255); ++ ++ fd = openat(xattr->fd, ".", O_RDONLY | O_XATTR); ++ ++ if (fd < 0) { ++ return errno; ++ } ++ dirp = fdopendir(fd); ++ if (dirp == NULL) { ++ ret = errno; ++ close(fd); ++ return ret; ++ } ++ ++ *list = apr_array_make(xattr->pool, 1, sizeof(char*)); ++ ent = apr_palloc(xattr->pool, dirent_size); ++ while ((ret = readdir_r(dirp, ent, &retent)) == 0 && retent) { ++ const char *name; ++ if (strncmp(ent->d_name, "SUNW", 4) == 0 || /* private */ ++ strcmp(ent->d_name, ".") == 0 || ++ strcmp(ent->d_name, "..") == 0) continue; ++ ++ name = unescape_attr_name(ent->d_name, xattr->pool); ++ /* we don't need to copy if the name has been unescaped as it ++ is pool allocated memory already */ ++ *(const char**)apr_array_push(*list) = ++ (name != ent->d_name) ? ++ name : apr_pstrdup(xattr->pool, ent->d_name); ++ } ++ ++ if (ret < 0) { ++ ret = errno; ++ } ++ else { ++ ret = APR_SUCCESS; ++ } ++ closedir(dirp); ++ return ret; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ int ret, fd; ++ struct_stat statbuf; ++ ++ fd = openat(xattr->fd, ".", O_XATTR | O_RDONLY); ++ ++ if (fd < 0) { ++ return errno; ++ } ++ ++ ret = unlinkat(fd, escape_attr_name(name, xattr->pool), 0); ++ ++ if (ret < 0) { ++ ret = (errno == ENOENT) ? APR_ENOATTR : errno; ++ } ++ else { ++ ret = APR_SUCCESS; ++ } ++ close(fd); ++ return ret; ++} ++ ++#endif /* USE_XATTR_SOLARIS */ +Index: xattr/netware/xattr.c +=================================================================== +--- xattr/netware/xattr.c (revision 0) ++++ xattr/netware/xattr.c (revision 0) +@@ -0,0 +1,89 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_path(apr_xattr_t **new, ++ const char *pathname, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_file(apr_xattr_t **new, ++ apr_file_t *file, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_dir(apr_xattr_t **new, ++ apr_dir_t *dir, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_destroy(apr_xattr_t *xattr) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ *exists = 0; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} +Index: xattr/os2/xattr.c +=================================================================== +--- xattr/os2/xattr.c (revision 0) ++++ xattr/os2/xattr.c (revision 0) +@@ -0,0 +1,89 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_path(apr_xattr_t **new, ++ const char *pathname, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_file(apr_xattr_t **new, ++ apr_file_t *file, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_dir(apr_xattr_t **new, ++ apr_dir_t *dir, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_destroy(apr_xattr_t *xattr) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ *exists = 0; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} +Index: xattr/win32/xattr.c +=================================================================== +--- xattr/win32/xattr.c (revision 0) ++++ xattr/win32/xattr.c (revision 0) +@@ -0,0 +1,89 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_tables.h" ++#include "apr_file_xattr.h" ++ ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_path(apr_xattr_t **new, ++ const char *pathname, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_file(apr_xattr_t **new, ++ apr_file_t *file, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_open_dir(apr_xattr_t **new, ++ apr_dir_t *dir, ++ apr_pool_t *p) ++{ ++ *new = NULL; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_destroy(apr_xattr_t *xattr) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_set(const apr_xattr_t *xattr, ++ const char *name, ++ const void *value, ++ apr_size_t size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_get(const apr_xattr_t *xattr, ++ const char *name, ++ void **value, ++ apr_size_t *size, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_exists(const apr_xattr_t *xattr, ++ const char *name, ++ int *exists, ++ apr_uint32_t flags) ++{ ++ *exists = 0; ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_list(const apr_xattr_t *xattr, ++ apr_array_header_t **list, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} ++ ++APR_DECLARE(apr_status_t) apr_xattr_remove(const apr_xattr_t *xattr, ++ const char *name, ++ apr_uint32_t flags) ++{ ++ return APR_ENOTIMPL; ++} diff --git a/dev-libs/apr/files/apr-xattr-tests.patch b/dev-libs/apr/files/apr-xattr-tests.patch new file mode 100644 index 0000000..6e979c6 --- /dev/null +++ b/dev-libs/apr/files/apr-xattr-tests.patch @@ -0,0 +1,542 @@ +Index: test/Makefile.in +=================================================================== +--- test/Makefile.in (revision 606453) ++++ test/Makefile.in (working copy) +@@ -28,7 +28,7 @@ + testhash.lo testargs.lo testnames.lo testuser.lo testpath.lo \ + testenv.lo testprocmutex.lo testfnmatch.lo testatomic.lo testflock.lo \ + testsock.lo testglobalmutex.lo teststrnatcmp.lo testfilecopy.lo \ +- testtemp.lo testlfs.lo testcond.lo ++ testtemp.lo testlfs.lo testcond.lo testxattr.lo + + OTHER_PROGRAMS = \ + sendfile@EXEEXT@ \ +Index: test/testxattr.c +=================================================================== +--- test/testxattr.c (revision 0) ++++ test/testxattr.c (revision 0) +@@ -0,0 +1,499 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "apr_file_io.h" ++#include "apr_file_xattr.h" ++#include "apr_errno.h" ++#include "apr_general.h" ++#include "testutil.h" ++ ++#if APR_HAS_XATTR ++ ++#define DIRNAME "data" ++#define FNAME DIRNAME "/file_xattrfile.txt" ++#define DNAME DIRNAME "/dir_xattrdir" ++ ++#define TESTKEY1 "testkey1" ++#define TESTVAL1 "testval1" ++#define TESTKEY2 "testkey2" ++#define TESTVAL2 "testval2" ++ ++/* test solaris subfilename escaping */ ++#define TESTKEYSPECIAL1 "/testkey2" ++#define TESTKEYSPECIAL2 "%testkey2" ++ ++static void test_xattr_file_set(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_set_create(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), ++ APR_XATTR_CREATE); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), ++ APR_XATTR_CREATE); ++ ABTS_TRUE(tc, APR_STATUS_IS_EEXIST(rv)); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_set_replace(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), ++ APR_XATTR_REPLACE); ++ ABTS_TRUE(tc, APR_STATUS_IS_ENOATTR(rv)); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), ++ APR_XATTR_CREATE); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), ++ APR_XATTR_REPLACE); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_get(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ char *val = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_get(xattr, TESTKEY1, (void**)&val, &size, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_INT_EQUAL(tc, strlen(TESTVAL1), size); ++ ABTS_PTR_NOTNULL(tc, val); ++ ABTS_TRUE(tc, strncmp(TESTVAL1, val, strlen(TESTVAL1)) == 0); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_get_enoattr(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ char *val = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_get(xattr, TESTKEY1, (void**)&val, &size, 0); ++ ABTS_TRUE(tc, APR_STATUS_IS_ENOATTR(rv)); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_exists(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ int exists; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_exists(xattr, TESTKEY1, &exists, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_TRUE(tc, !exists); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_exists(xattr, TESTKEY1, &exists, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_TRUE(tc, exists); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_list(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_array_header_t *list = NULL; ++ int cmp1, cmp2; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ rv = apr_xattr_set(xattr, TESTKEY2, TESTVAL2, strlen(TESTVAL2), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_list(xattr, &list, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_PTR_NOTNULL(tc, list); ++ ABTS_INT_EQUAL(tc, 2, list->nelts); ++ cmp1 = (strcmp(APR_ARRAY_IDX(list, 0, char*), TESTKEY1) == 0) && ++ (strcmp(APR_ARRAY_IDX(list, 1, char*), TESTKEY2) == 0); ++ cmp2 = (strcmp(APR_ARRAY_IDX(list, 0, char*), TESTKEY2) == 0) && ++ (strcmp(APR_ARRAY_IDX(list, 1, char*), TESTKEY1) == 0); ++ ABTS_TRUE(tc, cmp1 || cmp2 ); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_remove(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ char *val = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_remove(xattr, TESTKEY1, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_get(xattr, TESTKEY1, (void**)&val, &size, 0); ++ ABTS_INT_NEQUAL(tc, APR_SUCCESS, rv); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_file_remove_enoattr(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ char *val = NULL; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_remove(xattr, TESTKEY1, 0); ++ ABTS_TRUE(tc, APR_STATUS_IS_ENOATTR(rv)); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++static void test_xattr_dir_set(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ ++ rv = apr_dir_make(DNAME, APR_OS_DEFAULT, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, DNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ apr_xattr_destroy(xattr); ++ apr_dir_remove(DNAME, p); ++} ++ ++static void test_xattr_dir_get(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_size_t size; ++ char *val = NULL; ++ ++ rv = apr_dir_make(DNAME, APR_OS_DEFAULT, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, DNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_get(xattr, TESTKEY1, (void**)&val, &size, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_INT_EQUAL(tc, strlen(TESTVAL1), size); ++ ABTS_PTR_NOTNULL(tc, val); ++ ABTS_TRUE(tc, strncmp(TESTVAL1, val, strlen(TESTVAL1)) == 0); ++ ++ apr_xattr_destroy(xattr); ++ apr_dir_remove(DNAME, p); ++} ++ ++static void test_xattr_dir_exists(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ int exists; ++ ++ rv = apr_dir_make(DNAME, APR_OS_DEFAULT, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, DNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_exists(xattr, TESTKEY1, &exists, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_TRUE(tc, !exists); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_exists(xattr, TESTKEY1, &exists, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_TRUE(tc, exists); ++ ++ apr_xattr_destroy(xattr); ++ apr_dir_remove(DNAME, p); ++} ++ ++static void test_xattr_dir_list(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_array_header_t *list = NULL; ++ int cmp1, cmp2; ++ ++ rv = apr_dir_make(DNAME, APR_OS_DEFAULT, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, DNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ rv = apr_xattr_set(xattr, TESTKEY2, TESTVAL2, strlen(TESTVAL2), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_list(xattr, &list, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_PTR_NOTNULL(tc, list); ++ ABTS_INT_EQUAL(tc, 2, list->nelts); ++ cmp1 = (strcmp(APR_ARRAY_IDX(list, 0, char*), TESTKEY1) == 0) && ++ (strcmp(APR_ARRAY_IDX(list, 1, char*), TESTKEY2) == 0); ++ cmp2 = (strcmp(APR_ARRAY_IDX(list, 0, char*), TESTKEY2) == 0) && ++ (strcmp(APR_ARRAY_IDX(list, 1, char*), TESTKEY1) == 0); ++ ABTS_TRUE(tc, cmp1 || cmp2 ); ++ ++ apr_xattr_destroy(xattr); ++ apr_dir_remove(DNAME, p); ++} ++ ++static void test_xattr_dir_remove(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_size_t size; ++ char *val = NULL; ++ ++ rv = apr_dir_make(DNAME, APR_OS_DEFAULT, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, DNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, TESTKEY1, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_remove(xattr, TESTKEY1, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_get(xattr, TESTKEY1, (void**)&val, &size, 0); ++ ABTS_INT_NEQUAL(tc, APR_SUCCESS, rv); ++ ++ apr_xattr_destroy(xattr); ++ apr_dir_remove(DNAME, p); ++} ++ ++static void test_xattr_open_path_enoent(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_TRUE(tc, APR_STATUS_IS_ENOENT(rv)); ++} ++ ++static void test_xattr_file_special_chars(abts_case *tc, void *data) ++{ ++ apr_status_t rv; ++ apr_xattr_t *xattr; ++ apr_file_t *filetest = NULL; ++ apr_size_t size; ++ const char *name = (const char*)data; ++ char *val = NULL; ++ apr_array_header_t *list = NULL; ++ int cmp1, cmp2; ++ ++ rv = apr_file_open(&filetest, FNAME, ++ APR_WRITE | APR_CREATE | APR_DELONCLOSE, ++ APR_UREAD | APR_UWRITE | APR_GREAD, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_open_path(&xattr, FNAME, p); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_set(xattr, name, TESTVAL1, strlen(TESTVAL1), 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ++ rv = apr_xattr_get(xattr, name, (void**)&val, &size, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_INT_EQUAL(tc, strlen(TESTVAL1), size); ++ ABTS_PTR_NOTNULL(tc, val); ++ ABTS_TRUE(tc, strncmp(TESTVAL1, val, strlen(TESTVAL1)) == 0); ++ ++ rv = apr_xattr_list(xattr, &list, 0); ++ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ++ ABTS_PTR_NOTNULL(tc, list); ++ ABTS_INT_EQUAL(tc, 1, list->nelts); ++ ABTS_TRUE(tc, strcmp(name, APR_ARRAY_IDX(list, 0, char*)) == 0); ++ ++ apr_xattr_destroy(xattr); ++ apr_file_close(filetest); ++} ++ ++#else ++ ++static void test_xattr_not_impl(abts_case *tc, void *data) ++{ ++ ABTS_NOT_IMPL(tc, "xattr not implemented on this platform"); ++} ++ ++#endif /* APR_HAS_XATTR */ ++ ++abts_suite *testxattr(abts_suite *suite) ++{ ++ suite = ADD_SUITE(suite) ++ ++#if !APR_HAS_XATTR ++ abts_run_test(suite, test_xattr_not_impl, NULL); ++#else ++ abts_run_test(suite, test_xattr_file_set, NULL); ++ abts_run_test(suite, test_xattr_file_set_create, NULL); ++ abts_run_test(suite, test_xattr_file_set_replace, NULL); ++ abts_run_test(suite, test_xattr_file_get, NULL); ++ abts_run_test(suite, test_xattr_file_get_enoattr, NULL); ++ abts_run_test(suite, test_xattr_file_exists, NULL); ++ abts_run_test(suite, test_xattr_file_list, NULL); ++ abts_run_test(suite, test_xattr_file_remove, NULL); ++ abts_run_test(suite, test_xattr_file_remove_enoattr, NULL); ++ abts_run_test(suite, test_xattr_dir_set, NULL); ++ abts_run_test(suite, test_xattr_dir_get, NULL); ++ abts_run_test(suite, test_xattr_dir_exists, NULL); ++ abts_run_test(suite, test_xattr_dir_list, NULL); ++ abts_run_test(suite, test_xattr_dir_remove, NULL); ++ abts_run_test(suite, test_xattr_open_path_enoent, NULL); ++ abts_run_test(suite, test_xattr_file_special_chars, TESTKEYSPECIAL1); ++ abts_run_test(suite, test_xattr_file_special_chars, TESTKEYSPECIAL2); ++#endif ++ ++ return suite; ++} +Index: test/abts_tests.h +=================================================================== +--- test/abts_tests.h (revision 606453) ++++ test/abts_tests.h (working copy) +@@ -66,7 +66,8 @@ + {testtime}, + {testud}, + {testuser}, +- {testvsn} ++ {testvsn}, ++ {testxattr} + }; + + #endif /* APR_TEST_INCLUDES */ +Index: test/testutil.h +=================================================================== +--- test/testutil.h (revision 606453) ++++ test/testutil.h (working copy) +@@ -102,5 +102,6 @@ + abts_suite *testud(abts_suite *suite); + abts_suite *testuser(abts_suite *suite); + abts_suite *testvsn(abts_suite *suite); ++abts_suite *testxattr(abts_suite *suite); + + #endif /* APR_TEST_INCLUDES */ diff --git a/dev-libs/apr/files/config.layout.patch b/dev-libs/apr/files/config.layout.patch new file mode 100644 index 0000000..66fa868 --- /dev/null +++ b/dev-libs/apr/files/config.layout.patch @@ -0,0 +1,25 @@ +--- config.layout.orig 2006-07-06 21:44:41.000000000 -0700 ++++ config.layout 2006-07-06 21:46:26.000000000 -0700 +@@ -229,3 +229,22 @@ + infodir: ${exec_prefix}/share/info + libsuffix: -${APR_MAJOR_VERSION} + ++ ++# Gentoo layout ++ ++ prefix: /usr ++ exec_prefix: ${prefix} ++ bindir: ${exec_prefix}/bin ++ sbindir: ${exec_prefix}/bin ++ libdir: ${exec_prefix}/lib ++ libexecdir: ${exec_prefix}/modules ++ mandir: ${prefix}/man ++ sysconfdir: ${prefix}/conf ++ datadir: /usr/share/apr-${APR_MAJOR_VERSION} ++ installbuilddir: ${datadir}/build-${APR_MAJOR_VERSION} ++ includedir: ${prefix}/include/apr-${APR_MAJOR_VERSION} ++ localstatedir: ${prefix} ++ libsuffix: -${APR_MAJOR_VERSION} ++ ++ ++ diff --git a/dev-libs/apr/metadata.xml b/dev-libs/apr/metadata.xml new file mode 100644 index 0000000..7a90328 --- /dev/null +++ b/dev-libs/apr/metadata.xml @@ -0,0 +1,13 @@ + + + +apache + + apache-bugs@gentoo.org + + + Enable binary compatibility with older kernels + Use /dev/urandom instead of /dev/random + Enable UUID support + +