summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2010-11-22 10:36:08 +0000
committerfcolin2010-11-22 10:36:08 +0000
commitb5256e41b191f92d0cf12b42115eff11d0348c8d (patch)
tree4f6d768eb3c2c5c8f44fcb77cd28f7b1ad4b0d6a
parentaf3bdcee77cf816794498db4a67671107b90cd90 (diff)
downloadivy-c-b5256e41b191f92d0cf12b42115eff11d0348c8d.zip
ivy-c-b5256e41b191f92d0cf12b42115eff11d0348c8d.tar.gz
ivy-c-b5256e41b191f92d0cf12b42115eff11d0348c8d.tar.bz2
ivy-c-b5256e41b191f92d0cf12b42115eff11d0348c8d.tar.xz
Compile on Mac OS
-rw-r--r--src/Makefile.osx8
-rw-r--r--src/ivysocket.c21
2 files changed, 18 insertions, 11 deletions
diff --git a/src/Makefile.osx b/src/Makefile.osx
index 6f353d7..4649b0c 100644
--- a/src/Makefile.osx
+++ b/src/Makefile.osx
@@ -40,10 +40,10 @@ OMPLIB = -lgomp -lpthread
LIBTOOL=ar q # linux and solaris
CFLAGS = -g -Wall $(FPIC)
-#CC=gcc
-#CPP=g++
-CC = $(OMPCC)
-CPP = $(OMPCPP)
+CC=gcc
+CPP=g++
+#CC = $(OMPCC)
+#CPP = $(OMPCPP)
LIBTOOL = $(OMPLIBTOOL)
CFLAGS = -g -Wall -Wshadow $(FPIC)
diff --git a/src/ivysocket.c b/src/ivysocket.c
index ee7a4e9..dd4e20a 100644
--- a/src/ivysocket.c
+++ b/src/ivysocket.c
@@ -49,6 +49,13 @@ typedef long ssize_t;
#include <signal.h>
#endif
+#ifndef IPV6_ADD_MEMBERSHIP
+#ifdef IPV6_JOIN_GROUP
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#endif
+#endif
+
#include "param.h"
#include "list.h"
#include "ivychannel.h"
@@ -345,7 +352,7 @@ Server SocketServer(int ipv6, unsigned short port,
local6->sin6_family = AF_INET6;
local6->sin6_addr = in6addr_any;
local6->sin6_port = htons (port);
-
+ addrlen = sizeof(struct sockaddr_in6);
}
else
{
@@ -353,16 +360,15 @@ Server SocketServer(int ipv6, unsigned short port,
local4->sin_family = AF_INET;
local4->sin_addr.s_addr = INADDR_ANY;
local4->sin_port = htons (port);
-
+ addrlen = sizeof(struct sockaddr_in);
}
- if (bind(fd,(struct sockaddr*) &local, sizeof(local)) < 0)
+ if (bind(fd,(struct sockaddr*) &local, addrlen) < 0)
{
perror ("*** bind ***");
exit(0);
}
- addrlen = sizeof(local);
if (getsockname(fd, (struct sockaddr*)&local, &addrlen) < 0)
{
perror ("***get socket name ***");
@@ -898,6 +904,7 @@ Client SocketBroadcastCreate (int ipv6, unsigned short port,
Client client;
int on = 1;
struct sockaddr_storage local;
+ socklen_t addrlen;
memset( &local,0,sizeof(local) );
if ( ipv6 )
@@ -906,7 +913,7 @@ Client SocketBroadcastCreate (int ipv6, unsigned short port,
local6->sin6_family = AF_INET6;
local6->sin6_addr = in6addr_any;
local6->sin6_port = htons (port);
-
+ addrlen = sizeof( struct sockaddr_in6 );
}
else
{
@@ -914,7 +921,7 @@ Client SocketBroadcastCreate (int ipv6, unsigned short port,
local4->sin_family = AF_INET;
local4->sin_addr.s_addr = INADDR_ANY;
local4->sin_port = htons (port);
-
+ addrlen = sizeof( struct sockaddr_in );
}
if ((handle = socket ( ipv6 ? AF_INET6 : AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0){
@@ -943,7 +950,7 @@ Client SocketBroadcastCreate (int ipv6, unsigned short port,
return NULL;
};
- if (bind(handle, (struct sockaddr*)&local, sizeof(local) ) < 0)
+ if (bind(handle, (struct sockaddr*)&local, addrlen ) < 0)
{
perror ("*** BIND ***");
return NULL;