From 26d111540e3aac50a9bfe2b363ea2d98a5339f7c Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 6 Oct 2003 11:11:07 +0000 Subject: [PATCH] * ext/socket/extconf.rb: check recvmsg even if sendmsg is exists. * ext/socket/socket.c (thread_read_select): restored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/socket/extconf.rb | 2 +- ext/socket/socket.c | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f55752a750..ec8a59056c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Oct 5 23:27:09 2003 Tanaka Akira + + * ext/socket/extconf.rb: check recvmsg even if sendmsg is exists. + + * ext/socket/socket.c (thread_read_select): restored. + Mon Oct 6 16:23:38 2003 Nobuyoshi Nakada * marshal.c (w_object): wrong method name in the message. diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 234f373170..5cdc949d8f 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -194,7 +194,7 @@ end have_header("netinet/tcp.h") if not /cygwin/ =~ RUBY_PLATFORM # for cygwin 1.1.5 have_header("netinet/udp.h") -if have_func("sendmsg") or have_func("recvmsg") +if have_func("sendmsg") | 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 diff --git a/ext/socket/socket.c b/ext/socket/socket.c index ca7bdc50c2..95ec45bfe6 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1502,6 +1502,19 @@ unix_send_io(sock, val) #endif } +#if defined(HAVE_RECVMSG) && (defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS)) +static void +thread_read_select(fd) + int fd; +{ + fd_set fds; + + FD_ZERO(&fds); + FD_SET(fd, &fds); + rb_thread_select(fd+1, &fds, 0, 0, 0); +} +#endif + static VALUE unix_recv_io(argc, argv, sock) int argc;