summaryrefslogtreecommitdiffstats
path: root/ext/socket
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-06 20:52:44 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-06 20:52:44 +0000
commit04fb0a3fed441108a389e36918a42742dc1b866c (patch)
treea87024f988f543cb81a6076a3987ccd32c934019 /ext/socket
parenta4ac4058ecc0affbdfdef7273f930143395c4f53 (diff)
downloadruby-04fb0a3fed441108a389e36918a42742dc1b866c.tar.gz
ruby-04fb0a3fed441108a389e36918a42742dc1b866c.tar.xz
ruby-04fb0a3fed441108a389e36918a42742dc1b866c.zip
* eval_intern.h: Add support to Haiku. see [ruby-core:18110]
* include/ruby/defines.h: ditto. * configure.in: ditto. * thread_pthread.c: ditto. * io.c: ditto. * lib/mkmf.rb: ditto. * ext/socket/getaddrinfo.c: ditto. * ext/socket/extconf.rb: ditto. * ext/socket/socket.c: ditto. * ext/socket/addrinfo.h: ditto. * ext/socket/getnameinfo.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/addrinfo.h4
-rw-r--r--ext/socket/extconf.rb5
-rw-r--r--ext/socket/getaddrinfo.c4
-rw-r--r--ext/socket/getnameinfo.c5
-rw-r--r--ext/socket/socket.c2
5 files changed, 16 insertions, 4 deletions
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
index e93adafba..f6061f1e2 100644
--- a/ext/socket/addrinfo.h
+++ b/ext/socket/addrinfo.h
@@ -108,7 +108,9 @@
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
/* valid flags for addrinfo */
+#ifndef __HAIKU__
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
+#endif
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
@@ -164,7 +166,9 @@ extern void freeaddrinfo __P((struct addrinfo *));
#if defined __UCLIBC__
const
#endif
+#ifndef __HAIKU__
extern char *gai_strerror __P((int));
+#endif
/* In case there is no definition of offsetof() provided - though any proper
Standard C system should have one. */
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 7354a0f30..5479d4d00 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -9,6 +9,9 @@ when /cygwin/
when /beos/
test_func = "socket"
have_library("net", "socket")
+when /haiku/
+ test_func = "socket"
+ have_library("network", "socket")
when /i386-os2_emx/
test_func = "socket"
have_library("socket", "socket")
@@ -30,7 +33,7 @@ if have_header("arpa/inet.h")
end
ipv6 = false
-default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
+default_ipv6 = /cygwin|beos|haiku/ !~ RUBY_PLATFORM
if enable_config("ipv6", default_ipv6)
if checking_for("ipv6") {try_link(<<EOF)}
#include <sys/types.h>
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index d97012a3c..0ff2d5f76 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -42,7 +42,7 @@
#include <sys/types.h>
#ifndef _WIN32
#include <sys/param.h>
-#if defined(__BEOS__)
+#if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/socket.h>
#else
# include <sys/socket.h>
@@ -194,6 +194,7 @@ if (pai->ai_flags & AI_CANONNAME) {\
#define ERR(err) { error = (err); goto bad; }
+/*
#if defined __UCLIBC__
const
#endif
@@ -204,6 +205,7 @@ gai_strerror(int ecode)
ecode = EAI_MAX;
return (char *)ai_errlist[ecode];
}
+*/
void
freeaddrinfo(struct addrinfo *ai)
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index 6214359cd..37f60fc83 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -38,7 +38,7 @@
#include <stdio.h>
#include <sys/types.h>
#ifndef _WIN32
-#if defined(__BEOS__)
+#if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/socket.h>
#else
# include <sys/socket.h>
@@ -110,6 +110,9 @@ static struct afd {
#define ENI_FAMILY 5
#define ENI_SALEN 6
+#ifdef __HAIKU__
+#define HAVE_INET_NTOP
+#endif
#ifndef HAVE_INET_NTOP
static const char *
inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 81c5a8e17..7665ed43e 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -29,7 +29,7 @@
#endif
#ifndef _WIN32
-#if defined(__BEOS__)
+#if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/socket.h>
#else
# include <sys/socket.h>