From dev-return-21983-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Wed Jul 15 10:35:57 2009 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 19912 invoked from network); 15 Jul 2009 10:35:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jul 2009 10:35:57 -0000 Received: (qmail 95611 invoked by uid 500); 15 Jul 2009 10:36:06 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 95515 invoked by uid 500); 15 Jul 2009 10:36:06 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 95507 invoked by uid 99); 15 Jul 2009 10:36:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2009 10:36:06 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bojan@rexursive.com designates 150.101.121.179 as permitted sender) Received: from [150.101.121.179] (HELO beauty.rexursive.com) (150.101.121.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2009 10:35:59 +0000 Received: from [10.1.120.24] (shrek.rexursive.com [10.1.120.24]) by beauty.rexursive.com (Postfix) with ESMTP id D55CC8C030; Wed, 15 Jul 2009 20:35:36 +1000 (EST) Subject: Re: apr-1.3.6 on linux kernel 2.6.26 From: Bojan Smojver To: Chetan Reddy Cc: dev@apr.apache.org In-Reply-To: <1247630837.2811.376.camel@shrek.rexursive.com> References: <125bae360907091054j351ac8d5q7799966424c08636@mail.gmail.com> <1247527021.2811.334.camel@shrek.rexursive.com> <125bae360907141110mf83efeaga1947168d74b45b6@mail.gmail.com> <125bae360907141112o5ee94227n989a7eac21ec1279@mail.gmail.com> <1247614720.2811.374.camel@shrek.rexursive.com> <1247630837.2811.376.camel@shrek.rexursive.com> Content-Type: multipart/mixed; boundary="=-4zY7b/f/vrBNZz798m6z" Date: Wed, 15 Jul 2009 20:35:36 +1000 Message-Id: <1247654136.2811.377.camel@shrek.rexursive.com> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 (2.26.2-1.fc11) X-Virus-Checked: Checked by ClamAV on apache.org --=-4zY7b/f/vrBNZz798m6z Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2009-07-15 at 14:07 +1000, Bojan Smojver wrote: > Can you tell me if the attached runs and detects things properly on > your system? OK, this is probably slightly better. -- Bojan --=-4zY7b/f/vrBNZz798m6z Content-Disposition: attachment; filename="apr-extended-fd-tests.patch" Content-Type: text/x-patch; name="apr-extended-fd-tests.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Index: configure.in =================================================================== --- configure.in (revision 794118) +++ configure.in (working copy) @@ -799,8 +799,113 @@ fi dnl ----------------------------- Checking for extended file descriptor handling -AC_CHECK_FUNCS(dup3 accept4 epoll_create1) +# test for epoll_create1 +AC_CACHE_CHECK([for epoll_create1 support], [apr_cv_epoll_create1], +[AC_TRY_RUN([ +#include +#include +int main() +{ + return epoll_create1(0) == -1; +}], [apr_cv_epoll_create1=yes], [apr_cv_epoll_create1=no], [apr_cv_epoll_create1=no])]) + +if test "$apr_cv_epoll_create1" = "yes"; then + AC_DEFINE([HAVE_EPOLL_CREATE1], 1, [Define if epoll_create1 function is supported]) +fi + +# test for dup3 +AC_CACHE_CHECK([for dup3 support], [apr_cv_dup3], +[AC_TRY_RUN([ +#include + +int main() +{ + return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1; +}], [apr_cv_dup3=yes], [apr_cv_dup3=no], [apr_cv_dup3=no])]) + +if test "$apr_cv_dup3" = "yes"; then + AC_DEFINE([HAVE_DUP3], 1, [Define if dup3 function is supported]) +fi + +# test for accept4 +AC_CACHE_CHECK([for accept4 support], [apr_cv_accept4], +[AC_TRY_RUN([ +#include +#include +#include +#include +#include +#include +#include + +#define A4_SOCK "./apr_accept4_test_socket" + +int main() +{ + pid_t pid; + int fd; + struct sockaddr_un loc, rem; + socklen_t rem_sz; + + if ((pid = fork())) { + int status; + + unlink(A4_SOCK); + + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + goto cleanup_failure2; + + loc.sun_family = AF_UNIX; + strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); + + if (bind(fd, (struct sockaddr *) &loc, + sizeof(struct sockaddr_un)) == -1) + goto cleanup_failure; + + if (listen(fd, 5) == -1) + goto cleanup_failure; + + rem_sz = sizeof(struct sockaddr_un); + if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) { + goto cleanup_failure; + } + else { + close(fd); + waitpid(pid, &status, 0); + unlink(A4_SOCK); + return 0; + } + +cleanup_failure: + close(fd); +cleanup_failure2: + kill(pid, SIGKILL); + waitpid(pid, &status, 0); + unlink(A4_SOCK); + return 1; + } + else { + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + return 1; /* this will be bad: we'll hang */ + + loc.sun_family = AF_UNIX; + strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1); + + while(connect(fd, (struct sockaddr *) &loc, + sizeof(struct sockaddr_un)) == -1 && + (errno==ENOENT || errno==ECONNREFUSED)) + ; + + close(fd); + return 0; + } +}], [apr_cv_accept4=yes], [apr_cv_accept4=no], [apr_cv_accept4=no])]) + +if test "$apr_cv_accept4" = "yes"; then + AC_DEFINE([HAVE_ACCEPT4], 1, [Define if accept4 function is supported]) +fi + AC_CACHE_CHECK([for SOCK_CLOEXEC support], [apr_cv_sock_cloexec], [AC_TRY_RUN([ #include --=-4zY7b/f/vrBNZz798m6z--