1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a

bug in system header of darwin 9.  [ruby-core:32341]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-09-13 10:56:52 +00:00
parent 3e86bd8f3a
commit 4c916ec8b7
3 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Mon Sep 13 19:56:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org>
* lib/mkmf.rb (try_do): fix typo. a patch from Peter Weldon

View file

@ -117,8 +117,7 @@ if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers)
}
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

View file

@ -138,6 +138,16 @@ struct sockaddr_storage {
};
#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))