Author: mturk
Date: Sun Jul 17 12:02:52 2011
New Revision: 1147587
URL: http://svn.apache.org/viewvc?rev=1147587&view=rev
Log:
Move those lenghty configure code to a separate files inside build directory
Added:
commons/sandbox/runtime/trunk/src/main/native/build/
commons/sandbox/runtime/trunk/src/main/native/build/inonblock.c (with
props)
commons/sandbox/runtime/trunk/src/main/native/build/itcpnodelay.c (with
props)
Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/include/acr/stddefs.h
commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/config.hw
commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c
Added: commons/sandbox/runtime/trunk/src/main/native/build/inonblock.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/inonblock.c?rev=1147587&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/inonblock.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/build/inonblock.c Sun Jul 17
12:02:52 2011
@@ -0,0 +1,100 @@
+/* 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.
+ */
+
+/**
+ * Helper program used by configure to determine
+ * if the O_NONBLOCK socket option is inherited
+ * by the accept call.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int main(void)
+{
+ int listen_s, connected_s, client_s;
+ int listen_port, rc;
+ struct sockaddr_in sa;
+ socklen_t sa_len;
+
+ listen_s = socket(AF_INET, SOCK_STREAM, 0);
+ if (listen_s < 0) {
+ perror("socket");
+ exit(1);
+ }
+ memset(&sa, 0, sizeof sa);
+ sa.sin_family = AF_INET;
+ /* leave port 0 to get ephemeral */
+ rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
+ if (rc < 0) {
+ perror("bind for ephemeral port");
+ exit(1);
+ }
+ /* find ephemeral port */
+ sa_len = sizeof(sa);
+ rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
+ if (rc < 0) {
+ perror("getsockname");
+ exit(1);
+ }
+ listen_port = sa.sin_port;
+ rc = listen(listen_s, 5);
+ if (rc < 0) {
+ perror("listen");
+ exit(1);
+ }
+ rc = fcntl(listen_s, F_SETFL, O_NONBLOCK);
+ if (rc < 0) {
+ perror("fcntl(F_SETFL)");
+ exit(1);
+ }
+ client_s = socket(AF_INET, SOCK_STREAM, 0);
+ if (client_s < 0) {
+ perror("socket");
+ exit(1);
+ }
+ memset(&sa, 0, sizeof sa);
+ sa.sin_family = AF_INET;
+ sa.sin_port = listen_port;
+ /* leave sin_addr all zeros to use loopback */
+ rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
+ if (rc < 0) {
+ perror("connect");
+ exit(1);
+ }
+ sa_len = sizeof sa;
+ connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
+ if (connected_s < 0) {
+ perror("accept");
+ exit(1);
+ }
+ rc = fcntl(connected_s, F_GETFL, 0);
+ if (rc < 0) {
+ perror("fcntl(F_GETFL)");
+ exit(1);
+ }
+ if (!(rc & O_NONBLOCK)) {
+ fprintf(stderr, "O_NONBLOCK is not set in the child.\n");
+ exit(1);
+ }
+ return 0;
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/build/inonblock.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/native/build/itcpnodelay.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/itcpnodelay.c?rev=1147587&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/itcpnodelay.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/build/itcpnodelay.c Sun Jul
17 12:02:52 2011
@@ -0,0 +1,103 @@
+/* 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.
+ */
+
+/**
+ * Helper program used by configure to determine
+ * if the TCP_NODELAY socket option is inherited
+ * by the accept call.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <unistd.h>
+
+int main(void)
+{
+ int listen_s, connected_s, client_s;
+ int listen_port, rc;
+ struct sockaddr_in sa;
+ socklen_t sa_len;
+ socklen_t option_len;
+ int option;
+
+ listen_s = socket(AF_INET, SOCK_STREAM, 0);
+ if (listen_s < 0) {
+ perror("socket");
+ exit(1);
+ }
+ option = 1;
+ rc = setsockopt(listen_s, IPPROTO_TCP, TCP_NODELAY, &option, sizeof
option);
+ if (rc < 0) {
+ perror("setsockopt TCP_NODELAY");
+ exit(1);
+ }
+ memset(&sa, 0, sizeof sa);
+ sa.sin_family = AF_INET;
+ /* leave port 0 to get ephemeral */
+ rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
+ if (rc < 0) {
+ perror("bind for ephemeral port");
+ exit(1);
+ }
+ /* find ephemeral port */
+ sa_len = sizeof(sa);
+ rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
+ if (rc < 0) {
+ perror("getsockname");
+ exit(1);
+ }
+ listen_port = sa.sin_port;
+ rc = listen(listen_s, 5);
+ if (rc < 0) {
+ perror("listen");
+ exit(1);
+ }
+ client_s = socket(AF_INET, SOCK_STREAM, 0);
+ if (client_s < 0) {
+ perror("socket");
+ exit(1);
+ }
+ memset(&sa, 0, sizeof sa);
+ sa.sin_family = AF_INET;
+ sa.sin_port = listen_port;
+ /* leave sin_addr all zeros to use loopback */
+ rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
+ if (rc < 0) {
+ perror("connect");
+ exit(1);
+ }
+ sa_len = sizeof sa;
+ connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
+ if (connected_s < 0) {
+ perror("accept");
+ exit(1);
+ }
+ option_len = sizeof option;
+ rc = getsockopt(connected_s, IPPROTO_TCP, TCP_NODELAY, &option,
&option_len);
+ if (rc < 0) {
+ perror("getsockopt");
+ exit(1);
+ }
+ if (!option) {
+ fprintf(stderr, "TCP_NODELAY is not set in the child.\n");
+ exit(1);
+ }
+ return 0;
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/build/itcpnodelay.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Sun Jul 17 12:02:52
2011
@@ -872,6 +872,19 @@ test_compile()
test ".$rc" = ".1" && rd="`./$cccsrc 2>>$configlog`"
test ".$rd" = "." && rd=$2
rc=$rd
+ elif [ ".$1" = .y ]; then
+ rd="no"
+ rc=1
+ if [ -x ./$cccsrc ]; then
+ ./$cccsrc 2>>$configlog
+ rc=$?
+ fi
+ if [ ".$rc" = ".0" ]; then
+ rc=1
+ rd="yes"
+ else
+ rc=0
+ fi
else
if [ ".$1" = .z ]; then
rv=""
@@ -1146,85 +1159,17 @@ EOF
have_nonblock_inherited()
{
- do_printf 'Checking for %-32s' "nonblock inherited"
- cat > $cccsrc.c << EOF
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <fcntl.h>
-#include <unistd.h>
-int main(void) {
- int listen_s, connected_s, client_s;
- int listen_port, rc;
- struct sockaddr_in sa;
- socklen_t sa_len;
-
- listen_s = socket(AF_INET, SOCK_STREAM, 0);
- if (listen_s < 0) {
- perror("socket");
- exit(1);
- }
- memset(&sa, 0, sizeof sa);
- sa.sin_family = AF_INET;
- /* leave port 0 to get ephemeral */
- rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
- if (rc < 0) {
- perror("bind for ephemeral port");
- exit(1);
- }
- /* find ephemeral port */
- sa_len = sizeof(sa);
- rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
- if (rc < 0) {
- perror("getsockname");
- exit(1);
- }
- listen_port = sa.sin_port;
- rc = listen(listen_s, 5);
- if (rc < 0) {
- perror("listen");
- exit(1);
- }
- rc = fcntl(listen_s, F_SETFL, O_NONBLOCK);
- if (rc < 0) {
- perror("fcntl(F_SETFL)");
- exit(1);
- }
- client_s = socket(AF_INET, SOCK_STREAM, 0);
- if (client_s < 0) {
- perror("socket");
- exit(1);
- }
- memset(&sa, 0, sizeof sa);
- sa.sin_family = AF_INET;
- sa.sin_port = listen_port;
- /* leave sin_addr all zeros to use loopback */
- rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
- if (rc < 0) {
- perror("connect");
- exit(1);
- }
- sa_len = sizeof sa;
- connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
- if (connected_s < 0) {
- perror("accept");
- exit(1);
- }
- rc = fcntl(connected_s, F_GETFL, 0);
- if (rc < 0) {
- perror("fcntl(F_GETFL)");
- exit(1);
- }
- if (!(rc & O_NONBLOCK)) {
- fprintf(stderr, "O_NONBLOCK is not set in the child.\n");
- exit(1);
- }
- return 0;
+ do_printf 'Checking for %-32s' "inherited O_NONBLOCK"
+ cat $topdir/build/inonblock.c > $cccsrc.c
+ rc=`test_compile y`
+ echo $rc
}
-EOF
- rc=`test_compile z 0`
+
+have_tcp_nodelay_inherited()
+{
+ do_printf 'Checking for %-32s' "inherited TCP_NODELAY"
+ cat $topdir/build/itcpnodelay.c > $cccsrc.c
+ rc=`test_compile y`
echo $rc
}
@@ -1405,10 +1350,10 @@ extern "C" {
#define HAVE_LIMITS_H `have_include limits`
#define HAVE_NETDB_H `have_include netdb`
#define HAVE_NETINET_IN_H `have_include netinet/in`
+#define HAVE_NETINET_TCP_H `have_include netinet/tcp`
#define HAVE_ARPA_INET_H `have_include arpa/inet`
#define HAVE_RESOLV_H `have_include resolv`
#define HAVE_IFADDRS_H `have_include ifaddrs`
-#define HAVE_SYS_UN_H `have_include sys/un`
#define HAVE_SEMAPHORE_H `have_include semaphore`
#define HAVE_UCONTEXT_H `have_include ucontext`
#define HAVE_LIBGEN_H `have_include libgen`
@@ -1495,7 +1440,8 @@ extern "C" {
#define HAVE_GETIFADDRS `have_function x getifaddrs`
#define HAVE_SOCK_CLOEXEC `have_socket AF_INET
'SOCK_STREAM|SOCK_CLOEXEC' SOCK_CLOEXEC`
#define HAVE_SOCK_NONBLOCK `have_socket AF_INET
'SOCK_STREAM|SOCK_NONBLOCK' SOCK_NONBLOCK`
-#define HAVE_NONBLOCK_INHERITED `have_nonblock_inherited`
+#define O_NONBLOCK_INHERITED `have_nonblock_inherited`
+#define TCP_NODELAY_INHERITED `have_tcp_nodelay_inherited`
#define HAVE_FILE_CLOEXEC `have_defined O_CLOEXEC`
#define HAVE_SO_ACCEPTFILTER `have_defined SO_ACCEPTFILTER`
#define HAVE_TM_TM_GMTOFF `have_strcut_member time 'struct tm' tm_gmtoff`
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/stddefs.h
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/stddefs.h?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/stddefs.h
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/stddefs.h Sun Jul
17 12:02:52 2011
@@ -279,6 +279,11 @@
#define IS_VALID_WCS(s) ((s) != 0 && *(s) != L'\0')
#define ISIZEOF(s) (int)sizeof(s)
#define TSIZEOF(t, s) (t)sizeof(s)
+#if defined(WINDOWS)
+#define SSIZEOF(s) (int)sizeof(s)
+#else
+#define SSIZEOF(s) (socklen_t)sizeof(s)
+#endif
#define ACR_OS_WINDOWS 0x10000
#define ACR_OS_WIN64 0x10010
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c Sun Jul 17
12:02:52 2011
@@ -23,7 +23,15 @@
#include "arch_opts.h"
#include "arch_sync.h"
#include <poll.h>
+#if HAVE_SYS_UN_H
#include <sys/un.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
#define SOCKADDR_CAST(BA) \
(acr_sockaddr_t *)AcrGetArrayCritical(env, (BA))
@@ -290,3 +298,113 @@ ACR_NET_EXPORT(jint, SocketServerEndpoin
rc = ACR_GET_NETOS_ERROR();
return rc;
}
+
+ACR_NET_EXPORT(jlong, SocketServerEndpoint, accept0)(JNI_STDARGS, jlong fp,
+ jbyteArray ba,
+ jboolean block)
+{
+ int sd;
+ int ad;
+ acr_sockaddr_t aa;
+ socklen_t aalen;
+ acr_sd_t *fd = J2P(fp, acr_sd_t *);
+ acr_sd_t *sp;
+
+#if HAVE_ACCEPT4
+ int flags = SOCK_CLOEXEC;
+# if O_NONBLOCK_INHERITED
+ if (block == JNI_FALSE)
+ flags |= SOCK_NONBLOCK;
+# endif
+#endif
+ ad = AcrSdRetain(fd);
+ memset(&aa, 0, sizeof(aa));
+ aalen = ISIZEOF(struct sockaddr_un);
+ do {
+#if HAVE_ACCEPT4
+ sd = accept4(ad, (struct sockaddr *)&aa.sa, &aalen, flags);
+#else
+ sd = accept(ad, (struct sockaddr *)&aa.sa, &aalen);
+#endif
+ } while (sd == -1 && errno == EINTR);
+ if (AcrSdRelease(fd) == 0 && sd != -1) {
+ sd = -1;
+ errno = ENOTSOCK;
+ }
+ if (sd == -1) {
+ ACR_THROW_NET_ERRNO();
+ return 0;
+ }
+#if !HAVE_ACCEPT4
+ {
+ int rc = AcrCloseOnExec(sd, 1);
+ if (rc != 0) {
+ r_close(sd);
+ ACR_THROW_NET_ERROR(rc);
+ return 0;
+ }
+ }
+#endif
+#if !TCP_NODELAY_INHERITED
+ if (ACR_HASFLAG(fd, ACR_TCP_NODELAY)) {
+ int on = 1;
+ if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (void *)&on,
SSIZEOF(int)) != 0) {
+ int rc = ACR_GET_NETOS_ERROR();
+ r_close(sd);
+ ACR_THROW_NET_ERROR(rc);
+ return 0;
+ }
+ }
+#endif
+ if (block == JNI_FALSE) {
+ int rc = 0;
+#if O_NONBLOCK_INHERITED
+ if (!ACR_HASFLAG(fd, ACR_SO_NONBLOCK))
+#endif
+ rc = AcrNonblock(sd, 1);
+ if (rc != 0) {
+ r_close(sd);
+ ACR_THROW_NET_ERROR(rc);
+ return 0;
+ }
+ }
+#if O_NONBLOCK_INHERITED
+ else if (ACR_HASFLAG(fd, ACR_SO_NONBLOCK)) {
+ /* We have nonblocking acceptor and need
+ * blocking socket
+ */
+ rc = AcrNonblock(sd, 0);
+ if (rc != 0) {
+ r_close(sd);
+ ACR_THROW_NET_ERROR(rc);
+ return 0;
+ }
+ }
+#endif
+ if ((sp = ACR_TALLOC(acr_sd_t)) == 0) {
+ r_close(sd);
+ return 0;
+ }
+ sp->type = ACR_DT_SOCKET;
+ /* Inherit nodelay flag.
+ * It's always valid cause we either inherit or explicitly set that flag.
+ */
+ sp->flags = fd->flags & ACR_TCP_NODELAY;
+#if O_NONBLOCK_INHERITED
+ /* Inherit timeout */
+ sp->timeout = fd->timeout;
+#endif
+ sp->refs = 1;
+ sp->s = sd;
+ if (block == JNI_FALSE) {
+ ACR_SETFLAG(sp, ACR_SO_NONBLOCK);
+ if (sp->timeout < 0)
+ sp->timeout = 0;
+ }
+ else {
+ ACR_CLRFLAG(sp, ACR_SO_NONBLOCK);
+ if (sp->timeout == 0)
+ sp->timeout = -1;
+ }
+ return P2J(sp);
+}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c Sun Jul
17 12:02:52 2011
@@ -27,7 +27,15 @@
#include "arch_opts.h"
#include "arch_sync.h"
#include <poll.h>
+#if HAVE_SYS_UN_H
#include <sys/un.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
#define SOCKADDR_CAST(BA) \
(acr_sockaddr_t *)AcrGetArrayCritical(env, (BA))
@@ -123,7 +131,7 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
#if HAVE_ACCEPT4
int flags = SOCK_CLOEXEC;
-# if HAVE_NONBLOCK_INHERITED
+# if O_NONBLOCK_INHERITED
if (block == JNI_FALSE)
flags |= SOCK_NONBLOCK;
# endif
@@ -156,9 +164,20 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
}
}
#endif
+#if !TCP_NODELAY_INHERITED
+ if (ACR_HASFLAG(fd, ACR_TCP_NODELAY)) {
+ int on = 1;
+ if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (void *)&on,
SSIZEOF(int)) != 0) {
+ int rc = ACR_GET_NETOS_ERROR();
+ r_close(sd);
+ ACR_THROW_NET_ERROR(rc);
+ return 0;
+ }
+ }
+#endif
if (block == JNI_FALSE) {
int rc = 0;
-#if HAVE_NONBLOCK_INHERITED
+#if O_NONBLOCK_INHERITED
if (!ACR_HASFLAG(fd, ACR_SO_NONBLOCK))
#endif
rc = AcrNonblock(sd, 1);
@@ -168,7 +187,7 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
return 0;
}
}
-#if HAVE_NONBLOCK_INHERITED
+#if O_NONBLOCK_INHERITED
else if (ACR_HASFLAG(fd, ACR_SO_NONBLOCK)) {
/* We have nonblocking acceptor and need
* blocking socket
@@ -191,9 +210,12 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
return 0;
}
sp->type = ACR_DT_LOCALSOCK;
-#if HAVE_NONBLOCK_INHERITED
- /* Inherit nonblocking flag */
- sp->flags = fd->flags & ACR_SO_NONBLOCK;
+ /* Inherit nodelay flag
+ * It's always valid cause we either inherit or explicitly set that flag.
+ */
+ sp->flags = fd->flags & ACR_TCP_NODELAY;
+#if O_NONBLOCK_INHERITED
+ /* Inherit timeout */
sp->timeout = fd->timeout;
#endif
sp->refs = 1;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c Sun Jul 17
12:02:52 2011
@@ -30,14 +30,20 @@
#include <sys/ioctl.h>
#endif
#include <poll.h>
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#if HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
+#endif
#define SOCKADDR_CAST(BA) \
(acr_sockaddr_t *)AcrGetArrayCritical(env, (BA))
#define SOCKADDR_RELEASE(BA, SA) \
AcrReleaseArrayCritical(env, (BA), (SA))
-#define SSIZEOF(s) (socklen_t)sizeof(s)
ACR_NET_EXPORT(jboolean, SocketAddress, haveipv6)(JNI_STDARGS)
{
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/config.hw
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/config.hw?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/config.hw (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/config.hw Sun Jul 17
12:02:52 2011
@@ -33,10 +33,10 @@
#define HAVE_LIMITS_H 1
#define HAVE_NETDB_H 0
#define HAVE_NETINET_IN_H 0
+#define HAVE_NETINET_TCP_H 0
#define HAVE_ARPA_INET_H 0
#define HAVE_RESOLV_H 0
#define HAVE_IFADDRS_H 0
-#define HAVE_SYS_UN_H 0
#define HAVE_SEMAPHORE_H 0
#define HAVE_UCONTEXT_H 0
#define HAVE_LIBGEN_H 0
@@ -120,7 +120,8 @@
#define HAVE_GETIFADDRS 0
#define HAVE_SOCK_CLOEXEC 0
#define HAVE_SOCK_NONBLOCK 0
-#define HAVE_NONBLOCK_INHERITED 1
+#define O_NONBLOCK_INHERITED 1
+#define TCP_NODELAY_INHERITED 1
#define HAVE_FILE_CLOEXEC 0
#define HAVE_SO_ACCEPTFILTER 0
#define HAVE_TM_TM_GMTOFF 0
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c?rev=1147587&r1=1147586&r2=1147587&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c Sun Jul
17 12:02:52 2011
@@ -27,7 +27,6 @@
(acr_sockaddr_t *)AcrGetArrayCritical(env, (BA))
#define SOCKADDR_RELEASE(BA, SA) \
AcrReleaseArrayCritical(env, (BA), (SA))
-#define SSIZEOF(s) (int)sizeof(s)
ACR_NET_EXPORT(jboolean, SocketAddress, haveipv6)(JNI_STDARGS)
{