* ext/socket/ancdata.c: not use pktinfo.ipi_spec_dst if not defined

* ext/socket/extconf.rb: define HAVE_IPI_SPEC_DST


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
takano32 2009-03-18 08:04:17 +00:00
Родитель a8aa5c44fc
Коммит 867cd89920
3 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -3,6 +3,11 @@ Wed Mar 18 16:59:48 2009 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* test/test_syslog.rb (TestSyslog#test_open): check
param after block again. because detect not to call block.
Wed Mar 18 16:54:04 2009 TAKANO Mitsuhiro (takano32) <tak@no32.tk>
* ext/socket/ancdata.c: not use pktinfo.ipi_spec_dst if not defined
* ext/socket/extconf.rb: define HAVE_IPI_SPEC_DST
Wed Mar 18 16:38:11 2009 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* test/test_syslog.rb (TestSyslog#test_open): check

Просмотреть файл

@ -414,7 +414,7 @@ ancillary_int(VALUE self)
static VALUE
ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self)
{
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
VALUE v_addr, v_ifindex, v_spec_dst;
unsigned int ifindex;
struct sockaddr_in sa;
@ -477,7 +477,7 @@ ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self)
static VALUE
ancillary_ip_pktinfo(VALUE self)
{
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
int level, type;
VALUE data;
struct in_pktinfo pktinfo;
@ -790,7 +790,7 @@ anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret)
}
#endif
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */
#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
static int
anc_inspect_ip_pktinfo(int level, int type, VALUE data, VALUE ret)
{
@ -1042,7 +1042,7 @@ ancillary_inspect(VALUE self)
# if defined(IP_RECVDSTADDR) /* 4.4BSD */
case IP_RECVDSTADDR: inspected = anc_inspect_ip_recvdstaddr(level, type, data, ret); break;
# endif
# if defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) /* GNU/Linux */
# if defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */
case IP_PKTINFO: inspected = anc_inspect_ip_pktinfo(level, type, data, ret); break;
# endif
}

Просмотреть файл

@ -310,6 +310,9 @@ have_type("struct in6_pktinfo", headers) {|src|
src.sub(%r'^/\*top\*/', '\1'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
"#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
}
if have_struct_member("struct in_pktinfo", "ipi_spec_dst", headers)
$defs[-1] = "-DHAVE_IPI_SPEC_DST"
end
have_type("struct sockcred", headers)
have_type("struct cmsgcred", headers)