* ext/socket/socket.c (ruby_getnameinfo__aix): AF_INET6 workaround

for AIX.  a patch from Yutaka Kanemoto <kinpoco AT gmail.com>.
  [ruby-dev:29744]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-11-02 15:38:59 +00:00
Родитель 63c55ef265
Коммит 66b90161cf
3 изменённых файлов: 38 добавлений и 0 удалений

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

@ -1,3 +1,9 @@
Fri Nov 3 00:16:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/socket/socket.c (ruby_getnameinfo__aix): AF_INET6 workaround
for AIX. a patch from Yutaka Kanemoto <kinpoco AT gmail.com>.
[ruby-dev:29744]
Thu Nov 2 14:19:44 2006 Akinori MUSHA <knu@iDaemons.org>
* lib/set.rb (Set#^): Fix XOR operation against a container that

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

@ -141,6 +141,10 @@ main()
if (ai->ai_addr == NULL)
goto bad;
#if defined(_AIX)
if (ai->ai_family == AF_INET6 && passive) {
inet6++;
continue;
}
ai->ai_addr->sa_len = ai->ai_addrlen;
ai->ai_addr->sa_family = ai->ai_family;
#endif

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

@ -188,6 +188,34 @@ ruby_getaddrinfo__aix(char *nodename, char *servname,
}
#undef getaddrinfo
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
static int
ruby_getnameinfo__aix(sa, salen, host, hostlen, serv, servlen, flags)
const struct sockaddr *sa;
size_t salen;
char *host;
size_t hostlen;
char *serv;
size_t servlen;
int flags;
{
struct sockaddr_in6 *sa6;
u_int32_t *a6;
if (sa->sa_family == AF_INET6) {
sa6 = (struct sockaddr_in6 *)sa;
a6 = sa6->sin6_addr.u6_addr.u6_addr32;
if (a6[0] == 0 && a6[1] == 0 && a6[2] == 0 && a6[3] == 0) {
strncpy(host, "::", hostlen);
snprintf(serv, servlen, "%d", sa6->sin6_port);
return 0;
}
}
return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
}
#undef getnameinfo
#define getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) \
ruby_getnameinfo__aix((sa), (salen), (host), (hostlen), (serv), (servlen), (flags))
#ifndef CMSG_SPACE
# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
#endif