ruby-changes:27178
From: akr <ko1@a...>
Date: Thu, 14 Feb 2013 08:21:12 +0900 (JST)
Subject: [ruby-changes:27178] akr:r39230 (trunk): * ext/socket/extconf.rb: don't define HAVE_SA_LEN and HAVE_SA_LEN.
akr 2013-02-14 08:20:27 +0900 (Thu, 14 Feb 2013) New Revision: 39230 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39230 Log: * ext/socket/extconf.rb: don't define HAVE_SA_LEN and HAVE_SA_LEN. use HAVE_STRUCT_SOCKADDR_SA_LEN and HAVE_STRUCT_SOCKADDR_IN_SIN_LEN instead. Modified files: trunk/ChangeLog trunk/ext/socket/extconf.rb trunk/ext/socket/rubysocket.h trunk/ext/socket/socket.c trunk/ext/socket/sockport.h Index: ChangeLog =================================================================== --- ChangeLog (revision 39229) +++ ChangeLog (revision 39230) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Feb 14 08:18:47 2013 Tanaka Akira <akr@f...> + + * ext/socket/extconf.rb: don't define HAVE_SA_LEN and HAVE_SA_LEN. + use HAVE_STRUCT_SOCKADDR_SA_LEN and HAVE_STRUCT_SOCKADDR_IN_SIN_LEN + instead. + Wed Feb 13 20:59:48 2013 Tanaka Akira <akr@f...> * ext/socket/extconf.rb: don't define socklen_t here, just test. Index: ext/socket/rubysocket.h =================================================================== --- ext/socket/rubysocket.h (revision 39229) +++ ext/socket/rubysocket.h (revision 39230) @@ -136,7 +136,7 @@ typedef int socklen_t; https://github.com/ruby/ruby/blob/trunk/ext/socket/rubysocket.h#L136 _SS_PAD1SIZE - _SS_ALIGNSIZE) struct sockaddr_storage { -#ifdef HAVE_SA_LEN +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN unsigned char ss_len; /* address length */ unsigned char ss_family; /* address family */ #else Index: ext/socket/sockport.h =================================================================== --- ext/socket/sockport.h (revision 39229) +++ ext/socket/sockport.h (revision 39230) @@ -13,7 +13,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/sockport.h#L13 #ifdef SA_LEN # define SS_LEN(ss) (ss)->ss_len #else -# ifdef HAVE_SA_LEN +# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN # define SA_LEN(sa) (sa)->sa_len # define SS_LEN(ss) (ss)->ss_len # else @@ -32,7 +32,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/sockport.h#L32 # endif #endif -#ifdef HAVE_SA_LEN +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN # define SET_SA_LEN(sa, len) (void)((sa)->sa_len = (len)) # define SET_SS_LEN(ss, len) (void)((ss)->ss_len = (len)) #else @@ -40,7 +40,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/sockport.h#L40 # define SET_SS_LEN(ss, len) (void)(len) #endif -#ifdef HAVE_SIN_LEN +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN # define SIN_LEN(si) (si)->sin_len # define SET_SIN_LEN(si,len) (si)->sin_len = (len) #else Index: ext/socket/extconf.rb =================================================================== --- ext/socket/extconf.rb (revision 39229) +++ ext/socket/extconf.rb (revision 39230) @@ -74,9 +74,9 @@ have_type("struct ip_mreq", headers) # 4 https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L74 have_type("struct ip_mreqn", headers) # Linux 2.4 have_type("struct ipv6_mreq", headers) # RFC 3493 -if have_struct_member("struct sockaddr_in", "sin_len", headers) - $defs[-1] = "-DHAVE_SIN_LEN" # change from -DHAVE_ST_SIN_LEN. -end +# 4.4BSD +have_struct_member("struct sockaddr", "sa_len", headers) +have_struct_member("struct sockaddr_in", "sin_len", headers) # doug's fix, NOW add -Dss_family... only if required! doug = proc {have_struct_member("struct sockaddr_storage", "ss_family", headers)} @@ -87,10 +87,6 @@ if (doug[] or https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L87 doug[] or with_cppflags($CPPFLAGS + " -Dss_len=__ss_len", &doug) end -if have_struct_member("struct sockaddr", "sa_len", headers) - $defs[-1] = "-DHAVE_SA_LEN " # change from -DHAVE_ST_SA_LEN. -end - have_struct_member('struct msghdr', 'msg_control', ['sys/types.h', 'sys/socket.h']) have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h']) Index: ext/socket/socket.c =================================================================== --- ext/socket/socket.c (revision 39229) +++ ext/socket/socket.c (revision 39230) @@ -1698,7 +1698,7 @@ socket_s_ip_address_list(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1698 if (IS_IP_FAMILY(addr->sa_family)) { rb_ary_push(list, sockaddr_obj(addr)); } -#ifdef HAVE_SA_LEN +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN # ifndef _SIZEOF_ADDR_IFREQ # define _SIZEOF_ADDR_IFREQ(r) \ (sizeof(struct ifreq) + \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/