зеркало из https://github.com/github/ruby.git
socket: fix build error and warnings on mingw
* ext/socket/extconf.rb: check for if_nametoindex() for i686-w64-mingw32, and check for declarations of if_indextoname() and if_nametoindex(). * ext/socket/ifaddr.c (ifaddr_ifindex): not-implement unless if_nametoindex() is available. * ext/socket/rubysocket.h: declare if_indextoname() and if_nametoindex() if available but not declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b6decf289f
Коммит
5ec5c6d52c
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Tue May 14 23:24:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/socket/extconf.rb: check for if_nametoindex() for
|
||||
i686-w64-mingw32, and check for declarations of if_indextoname() and
|
||||
if_nametoindex().
|
||||
|
||||
* ext/socket/ifaddr.c (ifaddr_ifindex): not-implement unless
|
||||
if_nametoindex() is available.
|
||||
|
||||
* ext/socket/rubysocket.h: declare if_indextoname() and
|
||||
if_nametoindex() if available but not declared.
|
||||
|
||||
Tue May 14 19:58:17 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
|
||||
|
||||
* ext/dl/lib/dl/func.rb (DL::Function#call): check tainted when
|
||||
|
|
|
@ -421,7 +421,20 @@ EOF
|
|||
|
||||
have_func("getpeerucred(0, (ucred_t **)NULL)", headers) # SunOS
|
||||
|
||||
have_func('if_indextoname(0, "")', headers)
|
||||
have_func_decl = proc do |name, headers|
|
||||
if !checking_for("declaration of #{name}()") {!%w[int void].all? {|ret| try_compile(<<EOF)}}
|
||||
#{cpp_include(headers)}
|
||||
#{ret} #{name}(void);
|
||||
EOF
|
||||
$defs << "-DNEED_#{name.tr_cpp}_DECL"
|
||||
end
|
||||
end
|
||||
if have_func('if_indextoname(0, "")', headers)
|
||||
have_func_decl["if_indextoname"]
|
||||
end
|
||||
if have_func('if_nametoindex("")', headers)
|
||||
have_func_decl["if_nametoindex"]
|
||||
end
|
||||
|
||||
have_func("hsterror", headers)
|
||||
have_func('getipnodebyname("", 0, 0, (int *)0)', headers) # RFC 2553
|
||||
|
|
|
@ -135,6 +135,7 @@ ifaddr_name(VALUE self)
|
|||
* Returns the interface index of _ifaddr_.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_IF_NAMETOINDEX
|
||||
static VALUE
|
||||
ifaddr_ifindex(VALUE self)
|
||||
{
|
||||
|
@ -146,6 +147,9 @@ ifaddr_ifindex(VALUE self)
|
|||
}
|
||||
return UINT2NUM(ifindex);
|
||||
}
|
||||
#else
|
||||
#define ifaddr_ifindex rb_f_notimplement
|
||||
#endif
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
|
|
@ -106,6 +106,13 @@
|
|||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
#ifdef NEED_IF_INDEXTONAME_DECL
|
||||
char *if_indextoname(unsigned int, char *);
|
||||
#endif
|
||||
#ifdef NEED_IF_NAMETOINDEX_DECL
|
||||
unsigned int if_nametoindex(const char *);
|
||||
#endif
|
||||
|
||||
#define SOCKLEN_MAX \
|
||||
(0 < (socklen_t)-1 ? \
|
||||
~(socklen_t)0 : \
|
||||
|
|
Загрузка…
Ссылка в новой задаче