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