1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/extconf.rb (have_struct_member): new method.

check msg_control and msg_accrights in struct msghdr.  check sys/uio.h.

* socket/socket.c: include sys/uio.h if available.
(thread_read_select): new function.
(unix_send_io): ditto.
(unix_recv_io): ditto.
(unix_s_socketpair): ditto.
(Init_socket): define UNIXSocket#send_io, UNIXSocket#recv_io,


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2002-02-28 21:31:35 +00:00
parent bf7037833d
commit 4efd36bbd9
3 changed files with 247 additions and 0 deletions

View file

@ -2,6 +2,42 @@ require 'mkmf'
$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
def have_struct_member(type, member, header=nil)
printf "checking for %s.%s... ", type, member
STDOUT.flush
libs = $libs
src =
if /mswin32|mingw/ =~ RUBY_PLATFORM
r = <<"SRC"
#include <windows.h>
#include <winsock.h>
SRC
else
""
end
unless header.nil?
header = [header] unless header.kind_of? Array
header.each {|h|
src << <<"SRC"
#include <#{h}>
SRC
}
end
src << <<"SRC"
int main() { return 0; }
int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
SRC
r = try_link(src, libs) # xxx try_compile is not available.
unless r
print "no\n"
return false
end
$defs.push(format("-DHAVE_ST_%s", member.upcase))
print "yes\n"
return true
end
case RUBY_PLATFORM
when /mswin32|mingw/
test_func = "WSACleanup"
@ -176,6 +212,9 @@ 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'])
$getaddr_info_ok = false
if not enable_config("wide-getaddrinfo", false) and try_run(<<EOF)
#include <sys/types.h>
@ -329,6 +368,7 @@ EOF
end
have_header("sys/un.h")
have_header("sys/uio.h")
if have_func(test_func)
have_func("hsterror")