xref: /aoo41x/main/python/python-freebsd.patch (revision de1dbc42)
1--- misc/Python-2.7.5/Lib/plat-freebsd9/IN.py	1969-12-31 19:00:00.000000000 -0500
2+++ misc/build/Python-2.7.5/Lib/plat-freebsd9/IN.py	2012-08-01 18:56:04.000000000 -0500
3@@ -0,0 +1,612 @@
4+# Generated by h2py from /usr/include/netinet/in.h
5+
6+# Included from sys/cdefs.h
7+__GNUCLIKE_ASM = 3
8+__GNUCLIKE_ASM = 2
9+__GNUCLIKE___TYPEOF = 1
10+__GNUCLIKE___OFFSETOF = 1
11+__GNUCLIKE___SECTION = 1
12+__GNUCLIKE_CTOR_SECTION_HANDLING = 1
13+__GNUCLIKE_BUILTIN_CONSTANT_P = 1
14+__GNUCLIKE_BUILTIN_VARARGS = 1
15+__GNUCLIKE_BUILTIN_STDARG = 1
16+__GNUCLIKE_BUILTIN_VAALIST = 1
17+__GNUC_VA_LIST_COMPATIBILITY = 1
18+__GNUCLIKE_BUILTIN_NEXT_ARG = 1
19+__GNUCLIKE_BUILTIN_MEMCPY = 1
20+__CC_SUPPORTS_INLINE = 1
21+__CC_SUPPORTS___INLINE = 1
22+__CC_SUPPORTS___INLINE__ = 1
23+__CC_SUPPORTS___FUNC__ = 1
24+__CC_SUPPORTS_WARNING = 1
25+__CC_SUPPORTS_VARADIC_XXX = 1
26+__CC_SUPPORTS_DYNAMIC_ARRAY_INIT = 1
27+def __P(protos): return protos
28+
29+def __STRING(x): return #x
30+
31+def __XSTRING(x): return __STRING(x)
32+
33+def __P(protos): return ()
34+
35+def __STRING(x): return "x"
36+
37+def __aligned(x): return __attribute__((__aligned__(x)))
38+
39+def __section(x): return __attribute__((__section__(x)))
40+
41+def __aligned(x): return __attribute__((__aligned__(x)))
42+
43+def __section(x): return __attribute__((__section__(x)))
44+
45+def _Alignas(e): return alignas(e)
46+
47+def _Alignof(e): return alignof(e)
48+
49+def _Alignas(x): return __aligned(x)
50+
51+def _Alignof(x): return __alignof(x)
52+
53+def __nonnull(x): return __attribute__((__nonnull__(x)))
54+
55+def __predict_true(exp): return __builtin_expect((exp), 1)
56+
57+def __predict_false(exp): return __builtin_expect((exp), 0)
58+
59+def __predict_true(exp): return (exp)
60+
61+def __predict_false(exp): return (exp)
62+
63+def __format_arg(fmtarg): return __attribute__((__format_arg__ (fmtarg)))
64+
65+def __GLOBL(sym): return __GLOBL1(sym)
66+
67+def __FBSDID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
68+
69+def __RCSID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
70+
71+def __RCSID_SOURCE(s): return __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
72+
73+def __SCCSID(s): return __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
74+
75+def __COPYRIGHT(s): return __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
76+
77+_POSIX_C_SOURCE = 199009
78+_POSIX_C_SOURCE = 199209
79+__XSI_VISIBLE = 700
80+_POSIX_C_SOURCE = 200809
81+__XSI_VISIBLE = 600
82+_POSIX_C_SOURCE = 200112
83+__XSI_VISIBLE = 500
84+_POSIX_C_SOURCE = 199506
85+_POSIX_C_SOURCE = 198808
86+__POSIX_VISIBLE = 200809
87+__ISO_C_VISIBLE = 1999
88+__POSIX_VISIBLE = 200112
89+__ISO_C_VISIBLE = 1999
90+__POSIX_VISIBLE = 199506
91+__ISO_C_VISIBLE = 1990
92+__POSIX_VISIBLE = 199309
93+__ISO_C_VISIBLE = 1990
94+__POSIX_VISIBLE = 199209
95+__ISO_C_VISIBLE = 1990
96+__POSIX_VISIBLE = 199009
97+__ISO_C_VISIBLE = 1990
98+__POSIX_VISIBLE = 198808
99+__ISO_C_VISIBLE = 0
100+__POSIX_VISIBLE = 0
101+__XSI_VISIBLE = 0
102+__BSD_VISIBLE = 0
103+__ISO_C_VISIBLE = 1990
104+__POSIX_VISIBLE = 0
105+__XSI_VISIBLE = 0
106+__BSD_VISIBLE = 0
107+__ISO_C_VISIBLE = 1999
108+__POSIX_VISIBLE = 200809
109+__XSI_VISIBLE = 700
110+__BSD_VISIBLE = 1
111+__ISO_C_VISIBLE = 1999
112+def __has_feature(x): return 0
113+
114+def __has_include(x): return 0
115+
116+def __has_builtin(x): return 0
117+
118+__NO_TLS = 1
119+
120+# Included from sys/_types.h
121+
122+# Included from machine/_types.h
123+
124+# Included from machine/endian.h
125+_QUAD_HIGHWORD = 1
126+_QUAD_LOWWORD = 0
127+_LITTLE_ENDIAN = 1234
128+_BIG_ENDIAN = 4321
129+_PDP_ENDIAN = 3412
130+_BYTE_ORDER = _LITTLE_ENDIAN
131+LITTLE_ENDIAN = _LITTLE_ENDIAN
132+BIG_ENDIAN = _BIG_ENDIAN
133+PDP_ENDIAN = _PDP_ENDIAN
134+BYTE_ORDER = _BYTE_ORDER
135+def __bswap64_const(_x): return \
136+
137+def __bswap32_const(_x): return \
138+
139+def __bswap16_const(_x): return (__uint16_t)((_x) << 8 | (_x) >> 8)
140+
141+def __bswap64(_x): return \
142+
143+def __bswap32(_x): return \
144+
145+def __bswap16(_x): return \
146+
147+def __htonl(x): return __bswap32(x)
148+
149+def __htons(x): return __bswap16(x)
150+
151+def __ntohl(x): return __bswap32(x)
152+
153+def __ntohs(x): return __bswap16(x)
154+
155+IPPROTO_IP = 0
156+IPPROTO_ICMP = 1
157+IPPROTO_TCP = 6
158+IPPROTO_UDP = 17
159+
160+# Included from sys/_sockaddr_storage.h
161+def htonl(x): return __htonl(x)
162+
163+def htons(x): return __htons(x)
164+
165+def ntohl(x): return __ntohl(x)
166+
167+def ntohs(x): return __ntohs(x)
168+
169+IPPROTO_RAW = 255
170+INET_ADDRSTRLEN = 16
171+IPPROTO_HOPOPTS = 0
172+IPPROTO_IGMP = 2
173+IPPROTO_GGP = 3
174+IPPROTO_IPV4 = 4
175+IPPROTO_IPIP = IPPROTO_IPV4
176+IPPROTO_ST = 7
177+IPPROTO_EGP = 8
178+IPPROTO_PIGP = 9
179+IPPROTO_RCCMON = 10
180+IPPROTO_NVPII = 11
181+IPPROTO_PUP = 12
182+IPPROTO_ARGUS = 13
183+IPPROTO_EMCON = 14
184+IPPROTO_XNET = 15
185+IPPROTO_CHAOS = 16
186+IPPROTO_MUX = 18
187+IPPROTO_MEAS = 19
188+IPPROTO_HMP = 20
189+IPPROTO_PRM = 21
190+IPPROTO_IDP = 22
191+IPPROTO_TRUNK1 = 23
192+IPPROTO_TRUNK2 = 24
193+IPPROTO_LEAF1 = 25
194+IPPROTO_LEAF2 = 26
195+IPPROTO_RDP = 27
196+IPPROTO_IRTP = 28
197+IPPROTO_TP = 29
198+IPPROTO_BLT = 30
199+IPPROTO_NSP = 31
200+IPPROTO_INP = 32
201+IPPROTO_SEP = 33
202+IPPROTO_3PC = 34
203+IPPROTO_IDPR = 35
204+IPPROTO_XTP = 36
205+IPPROTO_DDP = 37
206+IPPROTO_CMTP = 38
207+IPPROTO_TPXX = 39
208+IPPROTO_IL = 40
209+IPPROTO_IPV6 = 41
210+IPPROTO_SDRP = 42
211+IPPROTO_ROUTING = 43
212+IPPROTO_FRAGMENT = 44
213+IPPROTO_IDRP = 45
214+IPPROTO_RSVP = 46
215+IPPROTO_GRE = 47
216+IPPROTO_MHRP = 48
217+IPPROTO_BHA = 49
218+IPPROTO_ESP = 50
219+IPPROTO_AH = 51
220+IPPROTO_INLSP = 52
221+IPPROTO_SWIPE = 53
222+IPPROTO_NHRP = 54
223+IPPROTO_MOBILE = 55
224+IPPROTO_TLSP = 56
225+IPPROTO_SKIP = 57
226+IPPROTO_ICMPV6 = 58
227+IPPROTO_NONE = 59
228+IPPROTO_DSTOPTS = 60
229+IPPROTO_AHIP = 61
230+IPPROTO_CFTP = 62
231+IPPROTO_HELLO = 63
232+IPPROTO_SATEXPAK = 64
233+IPPROTO_KRYPTOLAN = 65
234+IPPROTO_RVD = 66
235+IPPROTO_IPPC = 67
236+IPPROTO_ADFS = 68
237+IPPROTO_SATMON = 69
238+IPPROTO_VISA = 70
239+IPPROTO_IPCV = 71
240+IPPROTO_CPNX = 72
241+IPPROTO_CPHB = 73
242+IPPROTO_WSN = 74
243+IPPROTO_PVP = 75
244+IPPROTO_BRSATMON = 76
245+IPPROTO_ND = 77
246+IPPROTO_WBMON = 78
247+IPPROTO_WBEXPAK = 79
248+IPPROTO_EON = 80
249+IPPROTO_VMTP = 81
250+IPPROTO_SVMTP = 82
251+IPPROTO_VINES = 83
252+IPPROTO_TTP = 84
253+IPPROTO_IGP = 85
254+IPPROTO_DGP = 86
255+IPPROTO_TCF = 87
256+IPPROTO_IGRP = 88
257+IPPROTO_OSPFIGP = 89
258+IPPROTO_SRPC = 90
259+IPPROTO_LARP = 91
260+IPPROTO_MTP = 92
261+IPPROTO_AX25 = 93
262+IPPROTO_IPEIP = 94
263+IPPROTO_MICP = 95
264+IPPROTO_SCCSP = 96
265+IPPROTO_ETHERIP = 97
266+IPPROTO_ENCAP = 98
267+IPPROTO_APES = 99
268+IPPROTO_GMTP = 100
269+IPPROTO_IPCOMP = 108
270+IPPROTO_SCTP = 132
271+IPPROTO_MH = 135
272+IPPROTO_PIM = 103
273+IPPROTO_CARP = 112
274+IPPROTO_PGM = 113
275+IPPROTO_PFSYNC = 240
276+IPPROTO_OLD_DIVERT = 254
277+IPPROTO_MAX = 256
278+IPPROTO_DONE = 257
279+IPPROTO_DIVERT = 258
280+IPPROTO_SEND = 259
281+IPPROTO_SPACER = 32767
282+IPPORT_RESERVED = 1024
283+IPPORT_EPHEMERALFIRST = 10000
284+IPPORT_EPHEMERALLAST = 65535
285+IPPORT_HIFIRSTAUTO = 49152
286+IPPORT_HILASTAUTO = 65535
287+IPPORT_RESERVEDSTART = 600
288+IPPORT_MAX = 65535
289+def IN_CLASSA(i): return (((u_int32_t)(i) & 0x80000000) == 0)
290+
291+IN_CLASSA_NET = 0xff000000
292+IN_CLASSA_NSHIFT = 24
293+IN_CLASSA_HOST = 0x00ffffff
294+IN_CLASSA_MAX = 128
295+def IN_CLASSB(i): return (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
296+
297+IN_CLASSB_NET = 0xffff0000
298+IN_CLASSB_NSHIFT = 16
299+IN_CLASSB_HOST = 0x0000ffff
300+IN_CLASSB_MAX = 65536
301+def IN_CLASSC(i): return (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
302+
303+IN_CLASSC_NET = 0xffffff00
304+IN_CLASSC_NSHIFT = 8
305+IN_CLASSC_HOST = 0x000000ff
306+def IN_CLASSD(i): return (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
307+
308+IN_CLASSD_NET = 0xf0000000
309+IN_CLASSD_NSHIFT = 28
310+IN_CLASSD_HOST = 0x0fffffff
311+def IN_MULTICAST(i): return IN_CLASSD(i)
312+
313+def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
314+
315+def IN_BADCLASS(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
316+
317+def IN_LINKLOCAL(i): return (((u_int32_t)(i) & 0xffff0000) == 0xa9fe0000)
318+
319+def IN_LOOPBACK(i): return (((u_int32_t)(i) & 0xff000000) == 0x7f000000)
320+
321+def IN_ZERONET(i): return (((u_int32_t)(i) & 0xff000000) == 0)
322+
323+def IN_LOCAL_GROUP(i): return (((u_int32_t)(i) & 0xffffff00) == 0xe0000000)
324+
325+INADDR_NONE = 0xffffffff
326+IN_LOOPBACKNET = 127
327+IP_OPTIONS = 1
328+IP_HDRINCL = 2
329+IP_TOS = 3
330+IP_TTL = 4
331+IP_RECVOPTS = 5
332+IP_RECVRETOPTS = 6
333+IP_RECVDSTADDR = 7
334+IP_SENDSRCADDR = IP_RECVDSTADDR
335+IP_RETOPTS = 8
336+IP_MULTICAST_IF = 9
337+IP_MULTICAST_TTL = 10
338+IP_MULTICAST_LOOP = 11
339+IP_ADD_MEMBERSHIP = 12
340+IP_DROP_MEMBERSHIP = 13
341+IP_MULTICAST_VIF = 14
342+IP_RSVP_ON = 15
343+IP_RSVP_OFF = 16
344+IP_RSVP_VIF_ON = 17
345+IP_RSVP_VIF_OFF = 18
346+IP_PORTRANGE = 19
347+IP_RECVIF = 20
348+IP_IPSEC_POLICY = 21
349+IP_FAITH = 22
350+IP_ONESBCAST = 23
351+IP_BINDANY = 24
352+IP_FW_TABLE_ADD = 40
353+IP_FW_TABLE_DEL = 41
354+IP_FW_TABLE_FLUSH = 42
355+IP_FW_TABLE_GETSIZE = 43
356+IP_FW_TABLE_LIST = 44
357+IP_FW3 = 48
358+IP_DUMMYNET3 = 49
359+IP_FW_ADD = 50
360+IP_FW_DEL = 51
361+IP_FW_FLUSH = 52
362+IP_FW_ZERO = 53
363+IP_FW_GET = 54
364+IP_FW_RESETLOG = 55
365+IP_FW_NAT_CFG = 56
366+IP_FW_NAT_DEL = 57
367+IP_FW_NAT_GET_CONFIG = 58
368+IP_FW_NAT_GET_LOG = 59
369+IP_DUMMYNET_CONFIGURE = 60
370+IP_DUMMYNET_DEL = 61
371+IP_DUMMYNET_FLUSH = 62
372+IP_DUMMYNET_GET = 64
373+IP_RECVTTL = 65
374+IP_MINTTL = 66
375+IP_DONTFRAG = 67
376+IP_ADD_SOURCE_MEMBERSHIP = 70
377+IP_DROP_SOURCE_MEMBERSHIP = 71
378+IP_BLOCK_SOURCE = 72
379+IP_UNBLOCK_SOURCE = 73
380+IP_MSFILTER = 74
381+MCAST_JOIN_GROUP = 80
382+MCAST_LEAVE_GROUP = 81
383+MCAST_JOIN_SOURCE_GROUP = 82
384+MCAST_LEAVE_SOURCE_GROUP = 83
385+MCAST_BLOCK_SOURCE = 84
386+MCAST_UNBLOCK_SOURCE = 85
387+IP_DEFAULT_MULTICAST_TTL = 1
388+IP_DEFAULT_MULTICAST_LOOP = 1
389+IP_MIN_MEMBERSHIPS = 31
390+IP_MAX_MEMBERSHIPS = 4095
391+IP_MAX_SOURCE_FILTER = 1024
392+IP_MAX_GROUP_SRC_FILTER = 512
393+IP_MAX_SOCK_SRC_FILTER = 128
394+IP_MAX_SOCK_MUTE_FILTER = 128
395+MCAST_UNDEFINED = 0
396+MCAST_INCLUDE = 1
397+MCAST_EXCLUDE = 2
398+IP_PORTRANGE_DEFAULT = 0
399+IP_PORTRANGE_HIGH = 1
400+IP_PORTRANGE_LOW = 2
401+IPPROTO_MAXID = (IPPROTO_AH + 1)
402+IPCTL_FORWARDING = 1
403+IPCTL_SENDREDIRECTS = 2
404+IPCTL_DEFTTL = 3
405+IPCTL_DEFMTU = 4
406+IPCTL_RTEXPIRE = 5
407+IPCTL_RTMINEXPIRE = 6
408+IPCTL_RTMAXCACHE = 7
409+IPCTL_SOURCEROUTE = 8
410+IPCTL_DIRECTEDBROADCAST = 9
411+IPCTL_INTRQMAXLEN = 10
412+IPCTL_INTRQDROPS = 11
413+IPCTL_STATS = 12
414+IPCTL_ACCEPTSOURCEROUTE = 13
415+IPCTL_FASTFORWARDING = 14
416+IPCTL_KEEPFAITH = 15
417+IPCTL_GIF_TTL = 16
418+IPCTL_MAXID = 17
419+def in_nullhost(x): return ((x).s_addr == INADDR_ANY)
420+
421+def in_allhosts(x): return ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))
422+
423+
424+# Included from netinet6/in6.h
425+__KAME_VERSION = "FreeBSD"
426+IPV6PORT_RESERVED = 1024
427+IPV6PORT_ANONMIN = 49152
428+IPV6PORT_ANONMAX = 65535
429+IPV6PORT_RESERVEDMIN = 600
430+IPV6PORT_RESERVEDMAX = (IPV6PORT_RESERVED-1)
431+INET6_ADDRSTRLEN = 46
432+IPV6_ADDR_INT32_ONE = 1
433+IPV6_ADDR_INT32_TWO = 2
434+IPV6_ADDR_INT32_MNL = 0xff010000
435+IPV6_ADDR_INT32_MLL = 0xff020000
436+IPV6_ADDR_INT32_SMP = 0x0000ffff
437+IPV6_ADDR_INT16_ULL = 0xfe80
438+IPV6_ADDR_INT16_USL = 0xfec0
439+IPV6_ADDR_INT16_MLL = 0xff02
440+IPV6_ADDR_INT32_ONE = 0x01000000
441+IPV6_ADDR_INT32_TWO = 0x02000000
442+IPV6_ADDR_INT32_MNL = 0x000001ff
443+IPV6_ADDR_INT32_MLL = 0x000002ff
444+IPV6_ADDR_INT32_SMP = 0xffff0000
445+IPV6_ADDR_INT16_ULL = 0x80fe
446+IPV6_ADDR_INT16_USL = 0xc0fe
447+IPV6_ADDR_INT16_MLL = 0x02ff
448+def IN6_IS_ADDR_UNSPECIFIED(a): return \
449+
450+def IN6_IS_ADDR_LOOPBACK(a): return \
451+
452+def IN6_IS_ADDR_V4COMPAT(a): return \
453+
454+def IN6_IS_ADDR_V4MAPPED(a): return \
455+
456+IPV6_ADDR_SCOPE_NODELOCAL = 0x01
457+IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01
458+IPV6_ADDR_SCOPE_LINKLOCAL = 0x02
459+IPV6_ADDR_SCOPE_SITELOCAL = 0x05
460+IPV6_ADDR_SCOPE_ORGLOCAL = 0x08
461+IPV6_ADDR_SCOPE_GLOBAL = 0x0e
462+__IPV6_ADDR_SCOPE_NODELOCAL = 0x01
463+__IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01
464+__IPV6_ADDR_SCOPE_LINKLOCAL = 0x02
465+__IPV6_ADDR_SCOPE_SITELOCAL = 0x05
466+__IPV6_ADDR_SCOPE_ORGLOCAL = 0x08
467+__IPV6_ADDR_SCOPE_GLOBAL = 0x0e
468+def IN6_IS_ADDR_LINKLOCAL(a): return \
469+
470+def IN6_IS_ADDR_SITELOCAL(a): return \
471+
472+def IN6_IS_ADDR_MC_NODELOCAL(a): return \
473+
474+def IN6_IS_ADDR_MC_INTFACELOCAL(a): return \
475+
476+def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
477+
478+def IN6_IS_ADDR_MC_SITELOCAL(a): return \
479+
480+def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
481+
482+def IN6_IS_ADDR_MC_GLOBAL(a): return \
483+
484+def IN6_IS_ADDR_MC_NODELOCAL(a): return \
485+
486+def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
487+
488+def IN6_IS_ADDR_MC_SITELOCAL(a): return \
489+
490+def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
491+
492+def IN6_IS_ADDR_MC_GLOBAL(a): return \
493+
494+def IN6_IS_SCOPE_LINKLOCAL(a): return \
495+
496+def IN6_IS_SCOPE_EMBED(a): return \
497+
498+def IFA6_IS_DEPRECATED(a): return \
499+
500+def IFA6_IS_INVALID(a): return \
501+
502+IPV6_OPTIONS = 1
503+IPV6_RECVOPTS = 5
504+IPV6_RECVRETOPTS = 6
505+IPV6_RECVDSTADDR = 7
506+IPV6_RETOPTS = 8
507+IPV6_SOCKOPT_RESERVED1 = 3
508+IPV6_UNICAST_HOPS = 4
509+IPV6_MULTICAST_IF = 9
510+IPV6_MULTICAST_HOPS = 10
511+IPV6_MULTICAST_LOOP = 11
512+IPV6_JOIN_GROUP = 12
513+IPV6_LEAVE_GROUP = 13
514+IPV6_PORTRANGE = 14
515+ICMP6_FILTER = 18
516+IPV6_2292PKTINFO = 19
517+IPV6_2292HOPLIMIT = 20
518+IPV6_2292NEXTHOP = 21
519+IPV6_2292HOPOPTS = 22
520+IPV6_2292DSTOPTS = 23
521+IPV6_2292RTHDR = 24
522+IPV6_2292PKTOPTIONS = 25
523+IPV6_CHECKSUM = 26
524+IPV6_V6ONLY = 27
525+IPV6_BINDV6ONLY = IPV6_V6ONLY
526+IPV6_IPSEC_POLICY = 28
527+IPV6_FAITH = 29
528+IPV6_FW_ADD = 30
529+IPV6_FW_DEL = 31
530+IPV6_FW_FLUSH = 32
531+IPV6_FW_ZERO = 33
532+IPV6_FW_GET = 34
533+IPV6_RTHDRDSTOPTS = 35
534+IPV6_RECVPKTINFO = 36
535+IPV6_RECVHOPLIMIT = 37
536+IPV6_RECVRTHDR = 38
537+IPV6_RECVHOPOPTS = 39
538+IPV6_RECVDSTOPTS = 40
539+IPV6_RECVRTHDRDSTOPTS = 41
540+IPV6_USE_MIN_MTU = 42
541+IPV6_RECVPATHMTU = 43
542+IPV6_PATHMTU = 44
543+IPV6_REACHCONF = 45
544+IPV6_PKTINFO = 46
545+IPV6_HOPLIMIT = 47
546+IPV6_NEXTHOP = 48
547+IPV6_HOPOPTS = 49
548+IPV6_DSTOPTS = 50
549+IPV6_RTHDR = 51
550+IPV6_PKTOPTIONS = 52
551+IPV6_RECVTCLASS = 57
552+IPV6_AUTOFLOWLABEL = 59
553+IPV6_TCLASS = 61
554+IPV6_DONTFRAG = 62
555+IPV6_PREFER_TEMPADDR = 63
556+IPV6_BINDANY = 64
557+IPV6_MSFILTER = 74
558+IPV6_RTHDR_LOOSE = 0
559+IPV6_RTHDR_STRICT = 1
560+IPV6_RTHDR_TYPE_0 = 0
561+IPV6_DEFAULT_MULTICAST_HOPS = 1
562+IPV6_DEFAULT_MULTICAST_LOOP = 1
563+IPV6_MIN_MEMBERSHIPS = 31
564+IPV6_MAX_MEMBERSHIPS = 4095
565+IPV6_MAX_GROUP_SRC_FILTER = 512
566+IPV6_MAX_SOCK_SRC_FILTER = 128
567+IPV6_PORTRANGE_DEFAULT = 0
568+IPV6_PORTRANGE_HIGH = 1
569+IPV6_PORTRANGE_LOW = 2
570+IPV6PROTO_MAXID = (IPPROTO_PIM + 1)
571+IPV6CTL_FORWARDING = 1
572+IPV6CTL_SENDREDIRECTS = 2
573+IPV6CTL_DEFHLIM = 3
574+IPV6CTL_DEFMTU = 4
575+IPV6CTL_FORWSRCRT = 5
576+IPV6CTL_STATS = 6
577+IPV6CTL_MRTSTATS = 7
578+IPV6CTL_MRTPROTO = 8
579+IPV6CTL_MAXFRAGPACKETS = 9
580+IPV6CTL_SOURCECHECK = 10
581+IPV6CTL_SOURCECHECK_LOGINT = 11
582+IPV6CTL_ACCEPT_RTADV = 12
583+IPV6CTL_KEEPFAITH = 13
584+IPV6CTL_LOG_INTERVAL = 14
585+IPV6CTL_HDRNESTLIMIT = 15
586+IPV6CTL_DAD_COUNT = 16
587+IPV6CTL_AUTO_FLOWLABEL = 17
588+IPV6CTL_DEFMCASTHLIM = 18
589+IPV6CTL_GIF_HLIM = 19
590+IPV6CTL_KAME_VERSION = 20
591+IPV6CTL_USE_DEPRECATED = 21
592+IPV6CTL_RR_PRUNE = 22
593+IPV6CTL_MAPPED_ADDR = 23
594+IPV6CTL_V6ONLY = 24
595+IPV6CTL_RTEXPIRE = 25
596+IPV6CTL_RTMINEXPIRE = 26
597+IPV6CTL_RTMAXCACHE = 27
598+IPV6CTL_USETEMPADDR = 32
599+IPV6CTL_TEMPPLTIME = 33
600+IPV6CTL_TEMPVLTIME = 34
601+IPV6CTL_AUTO_LINKLOCAL = 35
602+IPV6CTL_RIP6STATS = 36
603+IPV6CTL_PREFER_TEMPADDR = 37
604+IPV6CTL_ADDRCTLPOLICY = 38
605+IPV6CTL_USE_DEFAULTZONE = 39
606+IPV6CTL_MAXFRAGS = 41
607+IPV6CTL_IFQ = 42
608+IPV6CTL_ISATAPRTR = 43
609+IPV6CTL_MCAST_PMTU = 44
610+IPV6CTL_STEALTH = 45
611+ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47
612+IPV6CTL_NO_RADR = 48
613+IPV6CTL_NORBIT_RAIF = 49
614+IPV6CTL_RFC6204W3 = 50
615+IPV6CTL_MAXID = 51
616--- misc/Python-2.7.5/Lib/plat-freebsd9/regen	1969-12-31 19:00:00.000000000 -0500
617+++ misc/build/Python-2.7.5/Lib/plat-freebsd9/regen	2012-08-01 18:55:27.000000000 -0500
618@@ -0,0 +1,3 @@
619+#! /bin/sh
620+set -v
621+python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
622--- misc/Python-2.7.5/Lib/test/test_threading.py	2012-04-09 18:07:32.000000000 -0500
623+++ misc/build/Python-2.7.5/Lib/test/test_threading.py	2012-08-01 18:44:40.000000000 -0500
624@@ -421,7 +421,7 @@
625     # #12316 and #11870), and fork() from a worker thread is known to trigger
626     # problems with some operating systems (issue #3863): skip problematic tests
627     # on platforms known to behave badly.
628-    platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
629+    platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'netbsd5',
630                          'os2emx')
631
632     def _run_and_join(self, script):
633--- misc/Python-2.7.5/Modules/_ctypes/libffi/configure	2012-04-09 18:07:33.000000000 -0500
634+++ misc/build/Python-2.7.5/Modules/_ctypes/libffi/configure	2012-08-01 18:53:21.000000000 -0500
635@@ -6289,7 +6289,7 @@
636   rm -rf conftest*
637   ;;
638
639-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
640+amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
641 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
642   # Find out which ABI we are using.
643   echo 'int i;' > conftest.$ac_ext
644@@ -11275,6 +11275,9 @@
645   powerpc-*-freebsd*)
646 	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
647 	;;
648+  powerpc64-*-freebsd*)
649+	TARGET=POWERPC; TARGETDIR=powerpc
650+	;;
651   powerpc*-*-rtems*)
652 	TARGET=POWERPC; TARGETDIR=powerpc
653 	;;
654--- misc/Python-2.7.5/Modules/fcntlmodule.c	2012-04-09 18:07:34.000000000 -0500
655+++ misc/build/Python-2.7.5/Modules/fcntlmodule.c	2012-08-01 18:44:40.000000000 -0500
656@@ -97,20 +97,15 @@
657 {
658 #define IOCTL_BUFSZ 1024
659     int fd;
660-    /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I'
661+    /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k'
662        format for the 'code' parameter because Python turns 0x8000000
663        into either a large positive number (PyLong or PyInt on 64-bit
664        platforms) or a negative number on others (32-bit PyInt)
665        whereas the system expects it to be a 32bit bit field value
666        regardless of it being passed as an int or unsigned long on
667-       various platforms.  See the termios.TIOCSWINSZ constant across
668-       platforms for an example of thise.
669-
670-       If any of the 64bit platforms ever decide to use more than 32bits
671-       in their unsigned long ioctl codes this will break and need
672-       special casing based on the platform being built on.
673+       various platforms.
674      */
675-    unsigned int code;
676+    unsigned long code;
677     int arg;
678     int ret;
679     char *str;
680@@ -118,7 +113,7 @@
681     int mutate_arg = 1;
682     char buf[IOCTL_BUFSZ+1];  /* argument plus NUL byte */
683
684-    if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl",
685+    if (PyArg_ParseTuple(args, "O&kw#|i:ioctl",
686                          conv_descriptor, &fd, &code,
687                          &str, &len, &mutate_arg)) {
688         char *arg;
689@@ -169,7 +164,7 @@
690     }
691
692     PyErr_Clear();
693-    if (PyArg_ParseTuple(args, "O&Is#:ioctl",
694+    if (PyArg_ParseTuple(args, "O&ks#:ioctl",
695                          conv_descriptor, &fd, &code, &str, &len)) {
696         if (len > IOCTL_BUFSZ) {
697             PyErr_SetString(PyExc_ValueError,
698@@ -191,7 +186,7 @@
699     PyErr_Clear();
700     arg = 0;
701     if (!PyArg_ParseTuple(args,
702-         "O&I|i;ioctl requires a file or file descriptor,"
703+         "O&k|i;ioctl requires a file or file descriptor,"
704          " an integer and optionally an integer or buffer argument",
705                           conv_descriptor, &fd, &code, &arg)) {
706       return NULL;
707--- misc/Python-2.7.5/Python/thread_pthread.h	2012-04-09 18:07:35.000000000 -0500
708+++ misc/build/Python-2.7.5/Python/thread_pthread.h	2012-08-01 18:44:40.000000000 -0500
709@@ -38,13 +38,18 @@
710 #endif
711 #endif
712
713+#ifdef __FreeBSD__
714+#include <osreldate.h>
715+#endif
716+
717 /* The POSIX spec says that implementations supporting the sem_*
718    family of functions must indicate this by defining
719    _POSIX_SEMAPHORES. */
720 #ifdef _POSIX_SEMAPHORES
721 /* On FreeBSD 4.x, _POSIX_SEMAPHORES is defined empty, so
722    we need to add 0 to make it work there as well. */
723-#if (_POSIX_SEMAPHORES+0) == -1
724+#if defined(__FreeBSD__) && __FreeBSD_version < 701104 && \
725+    (_POSIX_SEMAPHORES+0) == -1
726 #define HAVE_BROKEN_POSIX_SEMAPHORES
727 #else
728 #include <semaphore.h>
729@@ -56,7 +61,6 @@
730    in default setting.  So the process scope is preferred to get
731    enough number of threads to work. */
732 #ifdef __FreeBSD__
733-#include <osreldate.h>
734 #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101
735 #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
736 #endif
737@@ -161,6 +165,7 @@
738 {
739     pthread_t th;
740     int status;
741+    sigset_t set, oset;
742 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
743     pthread_attr_t attrs;
744 #endif
745@@ -189,6 +194,8 @@
746 #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
747     pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
748 #endif
749+    sigfillset(&set);
750+    SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
751
752     status = pthread_create(&th,
753 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
754@@ -200,6 +207,7 @@
755                              (void *)arg
756                              );
757
758+    SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
759 #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
760     pthread_attr_destroy(&attrs);
761 #endif
762diff -ruN misc/Python-2.7.5/configure misc/build/Python-2.7.5/configure
763--- misc/Python-2.7.5/configure	2012-04-09 18:07:36.000000000 -0500
764+++ misc/build/Python-2.7.5/configure	2012-08-01 18:44:40.000000000 -0500
765@@ -4916,7 +4916,7 @@
766           ;;
767     SunOS*)
768 	  LDLIBRARY='libpython$(VERSION).so'
769-	  BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
770+	  BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)'
771 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
772 	  INSTSONAME="$LDLIBRARY".$SOVERSION
773           ;;
774@@ -4924,11 +4924,6 @@
775 	  LDLIBRARY='libpython$(VERSION).so'
776 	  BLDLIBRARY='-L. -lpython$(VERSION)'
777 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
778-	  case $ac_sys_system in
779-	      FreeBSD*)
780-		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
781-		;;
782-	  esac
783 	  INSTSONAME="$LDLIBRARY".$SOVERSION
784 	  ;;
785     hp*|HP*)
786diff -ruN misc/Python-2.7.5/setup.py misc/build/Python-2.7.5/setup.py
787--- misc/Python-2.7.5/setup.py	2012-04-09 18:07:36.000000000 -0500
788+++ misc/build/Python-2.7.5/setup.py	2012-08-01 18:44:40.000000000 -0500
789@@ -1555,7 +1540,7 @@
790             macros = dict()
791             libraries = []
792
793-        elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
794+        elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9'):
795             # FreeBSD's P1003.1b semaphore support is very experimental
796             # and has many known problems. (as of June 2008)
797             macros = dict()
798@@ -1607,7 +1592,7 @@
799             missing.append('linuxaudiodev')
800
801         if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
802-                        'freebsd7', 'freebsd8')
803+                        'freebsd7', 'freebsd8', 'freebsd9')
804             or host_platform.startswith("gnukfreebsd")):
805             exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
806         else:
807