summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
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 e93adafba6d..f6061f1e269 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 7354a0f300a..5479d4d009a 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 d97012a3c57..0ff2d5f762c 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 6214359cd29..37f60fc83f1 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 81c5a8e170e..7665ed43ebc 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>