[前][次][番号順一覧][スレッド一覧]

ruby-changes:17242

From: nobu <ko1@a...>
Date: Mon, 13 Sep 2010 19:57:00 +0900 (JST)
Subject: [ruby-changes:17242] Ruby:r29242 (trunk): * ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a

nobu	2010-09-13 19:56:52 +0900 (Mon, 13 Sep 2010)

  New Revision: 29242

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29242

  Log:
    * ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a
      bug in system header of darwin 9.  [ruby-core:32341]

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/extconf.rb
    trunk/ext/socket/rubysocket.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29241)
+++ ChangeLog	(revision 29242)
@@ -1,3 +1,8 @@
+Mon Sep 13 19:56:50 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a
+	  bug in system header of darwin 9.  [ruby-core:32341]
+
 Mon Sep 13 18:11:55 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (try_do): fix typo.  a patch from Peter Weldon
Index: ext/socket/rubysocket.h
===================================================================
--- ext/socket/rubysocket.h	(revision 29241)
+++ ext/socket/rubysocket.h	(revision 29242)
@@ -138,6 +138,16 @@
 };
 #endif
 
+#if defined __APPLE__ && defined __MACH__
+/*
+ * CMSG_ macros are broken on 64bit darwin, because __DARWIN_ALIGN
+ * aligns up to __darwin_size_t which is 64bit, but CMSG_DATA is
+ * 32bit-aligned.
+ */
+#undef __DARWIN_ALIGNBYTES
+#define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1)
+#endif
+
 #if defined(_AIX)
 #ifndef CMSG_SPACE
 # define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
Index: ext/socket/extconf.rb
===================================================================
--- ext/socket/extconf.rb	(revision 29241)
+++ ext/socket/extconf.rb	(revision 29242)
@@ -117,8 +117,7 @@
   }
 end
 
-if (have_func("sendmsg") | have_func("recvmsg")) && /64-darwin/ !~ RUBY_PLATFORM
-  # CMSG_ macros are broken on 64bit darwin, because of use of __DARWIN_ALIGN.
+if have_func("sendmsg") | have_func("recvmsg")
   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'])
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]