From: Antoine Pitrou Date: Wed, 27 Oct 2010 20:35:26 +0000 (+0000) Subject: Merged revisions 85868 via svnmerge from X-Git-Tag: v2.7.1rc1~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0c5f3cf38aa0e913dffb028d9128f61514ae258;p=python Merged revisions 85868 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85868 | antoine.pitrou | 2010-10-27 22:13:57 +0200 (mer., 27 oct. 2010) | 3 lines Issue #8852: Allow the socket module to build on OpenSolaris. ........ --- diff --git a/Misc/NEWS b/Misc/NEWS index 5b89ec09a8..fa41945c91 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -411,6 +411,8 @@ Tools/Demos Build ----- +- Issue #8852: Allow the socket module to build on OpenSolaris. + - Issue #10054: Some platforms provide uintptr_t in inttypes.h. Patch by Akira Kitada. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 89d80be8a3..e4f6e636f7 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1102,7 +1102,7 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto) } #endif -#ifdef HAVE_NETPACKET_PACKET_H +#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFNAME) case AF_PACKET: { struct sockaddr_ll *a = (struct sockaddr_ll *)addr; @@ -1418,7 +1418,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, } #endif -#ifdef HAVE_NETPACKET_PACKET_H +#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFINDEX) case AF_PACKET: { struct sockaddr_ll* addr; @@ -4678,16 +4678,32 @@ init_socket(void) PyModule_AddStringConstant(m, "BDADDR_LOCAL", "00:00:00:FF:FF:FF"); #endif -#ifdef HAVE_NETPACKET_PACKET_H - PyModule_AddIntConstant(m, "AF_PACKET", AF_PACKET); - PyModule_AddIntConstant(m, "PF_PACKET", PF_PACKET); - PyModule_AddIntConstant(m, "PACKET_HOST", PACKET_HOST); - PyModule_AddIntConstant(m, "PACKET_BROADCAST", PACKET_BROADCAST); - PyModule_AddIntConstant(m, "PACKET_MULTICAST", PACKET_MULTICAST); - PyModule_AddIntConstant(m, "PACKET_OTHERHOST", PACKET_OTHERHOST); - PyModule_AddIntConstant(m, "PACKET_OUTGOING", PACKET_OUTGOING); - PyModule_AddIntConstant(m, "PACKET_LOOPBACK", PACKET_LOOPBACK); - PyModule_AddIntConstant(m, "PACKET_FASTROUTE", PACKET_FASTROUTE); +#ifdef AF_PACKET + PyModule_AddIntMacro(m, AF_PACKET); +#endif +#ifdef PF_PACKET + PyModule_AddIntMacro(m, PF_PACKET); +#endif +#ifdef PACKET_HOST + PyModule_AddIntMacro(m, PACKET_HOST); +#endif +#ifdef PACKET_BROADCAST + PyModule_AddIntMacro(m, PACKET_BROADCAST); +#endif +#ifdef PACKET_MULTICAST + PyModule_AddIntMacro(m, PACKET_MULTICAST); +#endif +#ifdef PACKET_OTHERHOST + PyModule_AddIntMacro(m, PACKET_OTHERHOST); +#endif +#ifdef PACKET_OUTGOING + PyModule_AddIntMacro(m, PACKET_OUTGOING); +#endif +#ifdef PACKET_LOOPBACK + PyModule_AddIntMacro(m, PACKET_LOOPBACK); +#endif +#ifdef PACKET_FASTROUTE + PyModule_AddIntMacro(m, PACKET_FASTROUTE); #endif #ifdef HAVE_LINUX_TIPC_H