changeset 4650:d201644bbdb0

7127660: (macosx) *Socket Async close not working Reviewed-by: alanb, phh, ohair
author michaelm
date Tue, 10 Jan 2012 07:34:06 -0800
parents 1a0d29eae7a0
children d7e5eb51caa3
files src/solaris/native/java/net/bsd_close.c src/solaris/native/java/net/net_util_md.h
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/net/bsd_close.c	Tue Jan 10 02:46:19 2012 -0800
+++ b/src/solaris/native/java/net/bsd_close.c	Tue Jan 10 07:34:06 2012 -0800
@@ -87,6 +87,7 @@
     struct rlimit nbr_files;
     sigset_t sigset;
     struct sigaction sa;
+    int i;
 
     /*
      * Allocate table based on the maximum number of
@@ -104,6 +105,9 @@
                 "unable to allocate file descriptor table - out of memory");
         abort();
     }
+    for (i=0; i<fdCount; i++) {
+        pthread_mutex_init(&fdTable[i].lock, NULL);
+    }
 
     /*
      * Setup the signal handler
@@ -293,7 +297,8 @@
 
 int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
        struct sockaddr *from, int *fromlen) {
-    BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) );
+    /* casting int *fromlen -> socklen_t* Both are ints */
+    BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, (socklen_t *)fromlen) );
 }
 
 int NET_Send(int s, void *msg, int len, unsigned int flags) {
--- a/src/solaris/native/java/net/net_util_md.h	Tue Jan 10 02:46:19 2012 -0800
+++ b/src/solaris/native/java/net/net_util_md.h	Tue Jan 10 07:34:06 2012 -0800
@@ -37,7 +37,7 @@
 #endif
 
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(MACOSX)
 extern int NET_Timeout(int s, long timeout);
 extern int NET_Read(int s, void* buf, size_t len);
 extern int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,