Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 8439:534602746079 legacy-trunk
Some systems (e.g. Linux) use enums for some symbols (like IPPROTO_IP)
so that our #ifdef test has the wrong effect. Substitute hardcoded
values for some important symbols (but not for the whole range -- some
are pretty obscure so it's not worth it).
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 28 May 1998 20:18:18 +0000 |
| parents | ee2aaa2f722a |
| children | d86733676815 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Thu May 28 19:50:02 1998 +0000 +++ b/Modules/socketmodule.c Thu May 28 20:18:18 1998 +0000 @@ -1668,14 +1668,19 @@ #endif /* Protocol level and numbers, usable for [gs]etsockopt */ +/* Sigh -- some systems (e.g. Linux) use enums for these. */ #ifdef SOL_SOCKET insint(d, "SOL_SOCKET", SOL_SOCKET); #endif #ifdef IPPROTO_IP insint(d, "IPPROTO_IP", IPPROTO_IP); +#else + insint(d, "IPPROTO_IP", 0); #endif #ifdef IPPROTO_ICMP insint(d, "IPPROTO_ICMP", IPPROTO_ICMP); +#else + insint(d, "IPPROTO_ICMP", 1); #endif #ifdef IPPROTO_IGMP insint(d, "IPPROTO_IGMP", IPPROTO_IGMP); @@ -1685,6 +1690,8 @@ #endif #ifdef IPPROTO_TCP insint(d, "IPPROTO_TCP", IPPROTO_TCP); +#else + insint(d, "IPPROTO_TCP", 6); #endif #ifdef IPPROTO_EGP insint(d, "IPPROTO_EGP", IPPROTO_EGP); @@ -1694,6 +1701,8 @@ #endif #ifdef IPPROTO_UDP insint(d, "IPPROTO_UDP", IPPROTO_UDP); +#else + insint(d, "IPPROTO_UDP", 17); #endif #ifdef IPPROTO_IDP insint(d, "IPPROTO_IDP", IPPROTO_IDP); @@ -1719,6 +1728,8 @@ /**/ #ifdef IPPROTO_RAW insint(d, "IPPROTO_RAW", IPPROTO_RAW); +#else + insint(d, "IPPROTO_RAW", 255); #endif #ifdef IPPROTO_MAX insint(d, "IPPROTO_MAX", IPPROTO_MAX);
