apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r795269 - in /apr/apr/branches/1.3.x: ./ CHANGES configure.in test/NWGNUaprtest test/NWGNUglobalmutexchild test/NWGNUmod_test test/NWGNUproc_child test/NWGNUreadchild test/NWGNUsockchild test/NWGNUtestatmc test/NWGNUtryread
Date Fri, 17 Jul 2009 23:14:26 GMT
Author: bojan
Date: Fri Jul 17 23:14:25 2009
New Revision: 795269

URL: http://svn.apache.org/viewvc?rev=795269&view=rev
Log:
Backport r794485 and r795267 from the trunk.
Use more elaborate checks for epoll_create1, dup3 and accept4.
PR 47519.
Patch contribution: Chetan Reddy <chetanreddy gmail.com>.

Modified:
    apr/apr/branches/1.3.x/   (props changed)
    apr/apr/branches/1.3.x/CHANGES
    apr/apr/branches/1.3.x/configure.in
    apr/apr/branches/1.3.x/test/NWGNUaprtest   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUglobalmutexchild   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUmod_test   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUproc_child   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUreadchild   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUsockchild   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUtestatmc   (props changed)
    apr/apr/branches/1.3.x/test/NWGNUtryread   (props changed)

Propchange: apr/apr/branches/1.3.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,2 @@
 /apr/apr/branches/1.4.x:783970
-/apr/apr/trunk:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588
+/apr/apr/trunk:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588,794485,795267

Modified: apr/apr/branches/1.3.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/CHANGES?rev=795269&r1=795268&r2=795269&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.3.x/CHANGES [utf-8] Fri Jul 17 23:14:25 2009
@@ -1,7 +1,8 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.3.7
 
-
+  *) More elaborate detection for dup3(), accept4() and epoll_create1().
+     [Chetan Reddy <chetanreddy gmail.com>, Bojan Smojver]
 
 Changes for APR 1.3.6
 

Modified: apr/apr/branches/1.3.x/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/configure.in?rev=795269&r1=795268&r2=795269&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/configure.in (original)
+++ apr/apr/branches/1.3.x/configure.in Fri Jul 17 23:14:25 2009
@@ -779,7 +779,112 @@
 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 <sys/epoll.h>
+#include <unistd.h>
+
+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 <unistd.h>
+
+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 <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <errno.h>
+
+#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([

Propchange: apr/apr/branches/1.3.x/test/NWGNUaprtest
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnuaprtest:783970
+/apr/apr/trunk/test/NWGNUaprtest:794485,795267
 /apr/apr/trunk/test/nwgnuaprtest:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUglobalmutexchild
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnuglobalmutexchild:783970
+/apr/apr/trunk/test/NWGNUglobalmutexchild:794485,795267
 /apr/apr/trunk/test/nwgnuglobalmutexchild:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUmod_test
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnumod_test:783970
+/apr/apr/trunk/test/NWGNUmod_test:794485,795267
 /apr/apr/trunk/test/nwgnumod_test:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUproc_child
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnuproc_child:783970
+/apr/apr/trunk/test/NWGNUproc_child:794485,795267
 /apr/apr/trunk/test/nwgnuproc_child:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUreadchild
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnureadchild:783970
+/apr/apr/trunk/test/NWGNUreadchild:794485,795267
 /apr/apr/trunk/test/nwgnureadchild:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUsockchild
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnusockchild:783970
+/apr/apr/trunk/test/NWGNUsockchild:794485,795267
 /apr/apr/trunk/test/nwgnusockchild:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUtestatmc
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnutestatmc:783970
+/apr/apr/trunk/test/NWGNUtestatmc:794485,795267
 /apr/apr/trunk/test/nwgnutestatmc:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588

Propchange: apr/apr/branches/1.3.x/test/NWGNUtryread
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 23:14:25 2009
@@ -1,2 +1,3 @@
 /apr/apr/branches/1.4.x/test/nwgnutryread:783970
+/apr/apr/trunk/test/NWGNUtryread:794485,795267
 /apr/apr/trunk/test/nwgnutryread:712674,733052,742752,747990,748361,748371,748565,748988,749810,782838,783398,783958,788588



Mime
View raw message