summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-30 00:32:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-30 00:32:03 +0000
commitdb8874aa1b41ddcebdf79b8ad1ef736028ef45e3 (patch)
treed98988df03efd0a9f114bce9fce5e5b35e88663d /ext
parentfe13785cc699692cefbdf94908fcaa7c99672f0f (diff)
* configure.in (os2-emx): renamed from os2_emx, add flags to
CFLAGS and LDFLAGS, and remove lib prefix. [ruby-dev:20993] * file.c (rb_file_s_rename): retry with removing new file on DOSISH. [ruby-dev:21007] * ext/socket/extconf.rb (sendmsg, recvmsg): check functions. * ext/socket/socket.c (unix_send_io, unix_recv_io): raise NotImplementedError unless system calls are available. * ext/socket/socket.c (sock_initialize): rename from sock_init() to get rid of conflict with OS/2 socket library. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/extconf.rb6
-rw-r--r--ext/socket/socket.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index f72ac2b..45e5967 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -194,8 +194,10 @@ end
have_header("netinet/tcp.h") if not /cygwin/ =~ RUBY_PLATFORM # for cygwin 1.1.5
have_header("netinet/udp.h")
-have_struct_member('struct msghdr', 'msg_control', header=['sys/types.h', 'sys/socket.h'])
-have_struct_member('struct msghdr', 'msg_accrights', header=['sys/types.h', 'sys/socket.h'])
+if have_func("sendmsg") or have_func("recvmsg")
+ have_struct_member('struct msghdr', 'msg_control', header=['sys/types.h', 'sys/socket.h'])
+ have_struct_member('struct msghdr', 'msg_accrights', header=['sys/types.h', 'sys/socket.h'])
+end
$getaddr_info_ok = false
if !enable_config("wide-getaddrinfo", false) and try_run(<<EOF)
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 5c78901..590d2c3 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1508,7 +1508,7 @@ static VALUE
unix_send_io(sock, val)
VALUE sock, val;
{
-#if defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS)
+#if defined(HAVE_SENDMSG) && (defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS))
int fd;
OpenFile *fptr;
struct msghdr msg;
@@ -1574,7 +1574,7 @@ unix_recv_io(argc, argv, sock)
VALUE *argv;
VALUE sock;
{
-#if defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS)
+#if defined(HAVE_RECVMSG) && (defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS))
VALUE klass, mode;
OpenFile *fptr;
struct msghdr msg;
@@ -1817,7 +1817,7 @@ setup_domain_and_type(domain, dv, type, tv)
}
static VALUE
-sock_init(sock, domain, type, protocol)
+sock_initialize(sock, domain, type, protocol)
VALUE sock, domain, type, protocol;
{
int fd;
@@ -2483,7 +2483,7 @@ Init_socket()
rb_cSocket = rb_define_class("Socket", rb_cBasicSocket);
- rb_define_method(rb_cSocket, "initialize", sock_init, 3);
+ rb_define_method(rb_cSocket, "initialize", sock_initialize, 3);
rb_define_method(rb_cSocket, "connect", sock_connect, 1);
rb_define_method(rb_cSocket, "bind", sock_bind, 1);
rb_define_method(rb_cSocket, "listen", sock_listen, 1);