diff --git a/ChangeLog b/ChangeLog index 495be6162a..eb7b045e1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Apr 27 16:00:10 2013 Tanaka Akira + + * ext/socket/extconf.rb (test_recvmsg_with_msg_peek_creates_fds): + Extracted. + Sat Apr 27 15:50:40 2013 Tanaka Akira * internal.h (SIGNED_INTEGER_TYPE_P): New macro. diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index b9333340a1..0bd1371458 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -242,6 +242,52 @@ int main(int argc, char *argv[]) } EOF +def test_recvmsg_with_msg_peek_creates_fds(headers) + case RUBY_PLATFORM + when /linux/ + # Linux 2.6.38 allocate fds by recvmsg with MSG_PEEK. + close_fds = true + when /bsd|darwin/ + # FreeBSD 8.2.0, NetBSD 5 and MacOS X Snow Leopard doesn't + # allocate fds by recvmsg with MSG_PEEK. + # [ruby-dev:44189] + # http://bugs.ruby-lang.org/issues/5075 + close_fds = false + else + close_fds = nil + end + if !CROSS_COMPILING + if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") { + try_run(cpp_include(headers) + RECVMSG_WITH_MSG_PEEK_ALLOCATE_FD_TEST) + } + if close_fds == false + warn "unexpected fd-passing recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation unexpected." + elsif close_fds == nil + puts "info: #{RUBY_PLATFORM} recvmsg() with MSG_PEEK allocates fds on fd-passing." + end + close_fds = true + else + if close_fds == true + warn "unexpected fd-passing recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation expected." + elsif close_fds == nil + puts "info: #{RUBY_PLATFORM}: recvmsg() with MSG_PEEK doesn't allocates fds on fd-passing." + end + close_fds = false + end + end + if close_fds == nil + abort <