summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLib/plat-freebsd2/FCNTL.py56
-rw-r--r--Lib/plat-freebsd2/IN.py187
-rw-r--r--Lib/plat-freebsd2/SOCKET.py128
-rw-r--r--Lib/plat-freebsd2/TERMIOS.py198
-rwxr-xr-xLib/plat-freebsd2/regen2
-rw-r--r--Lib/plat-freebsd3/FCNTL.py111
-rw-r--r--Lib/plat-freebsd3/IN.py189
-rw-r--r--Lib/plat-freebsd3/SOCKET.py132
-rw-r--r--Lib/plat-freebsd3/TERMIOS.py198
-rwxr-xr-xLib/plat-freebsd3/regen6
10 files changed, 1202 insertions, 5 deletions
diff --git a/Lib/plat-freebsd2/FCNTL.py b/Lib/plat-freebsd2/FCNTL.py
index 8862073..4d5db42 100755
--- a/Lib/plat-freebsd2/FCNTL.py
+++ b/Lib/plat-freebsd2/FCNTL.py
@@ -1,16 +1,61 @@
-# Generated by h2py from /usr/include/sys/fcntl.h
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from sys/types.h
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from machine/ansi.h
+_BSD_PTRDIFF_T_ = int
+_BSD_SSIZE_T_ = int
+_BSD_TIME_T_ = long
+_BSD_CT_RUNE_T_ = int
+_BSD_PID_T_ = int
+_BSD_CLK_TCK_ = 128
+_BSD_CLOCKS_PER_SEC_ = 128
+
+# Included from machine/types.h
+def major(x): return ((int)(((u_int)(x) >> 8)&0xff))
+
+def minor(x): return ((int)((x)&0xffff00ff))
# Included from machine/endian.h
-_MACHINE_ENDIAN_H_ = 1
_QUAD_HIGHWORD = 1
_QUAD_LOWWORD = 0
LITTLE_ENDIAN = 1234
BIG_ENDIAN = 4321
PDP_ENDIAN = 3412
BYTE_ORDER = LITTLE_ENDIAN
+def __word_swap_long(x): return \
-# Included from machine/types.h
+def __byte_swap_long(x): return \
+
+def __byte_swap_word(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_word(x): return \
+
+ntohl = __byte_swap_long
+ntohs = __byte_swap_word
+htonl = __byte_swap_long
+htons = __byte_swap_word
NBBY = 8
FD_SETSIZE = 256
O_RDONLY = 0x0000
@@ -31,7 +76,10 @@ O_EXCL = 0x0800
FMARK = 0x1000
FDEFER = 0x2000
FHASLOCK = 0x4000
-O_NOCTTY = 0
+O_NOCTTY = 0x8000
+def FFLAGS(oflags): return ((oflags) + 1)
+
+def OFLAGS(fflags): return ((fflags) - 1)
FAPPEND = O_APPEND
FASYNC = O_ASYNC
diff --git a/Lib/plat-freebsd2/IN.py b/Lib/plat-freebsd2/IN.py
new file mode 100644
index 0000000..9f7e017
--- /dev/null
+++ b/Lib/plat-freebsd2/IN.py
@@ -0,0 +1,187 @@
+# Generated by h2py from /usr/include/netinet/in.h
+IPPROTO_IP = 0
+IPPROTO_ICMP = 1
+IPPROTO_IGMP = 2
+IPPROTO_GGP = 3
+IPPROTO_IPIP = 4
+IPPROTO_TCP = 6
+IPPROTO_ST = 7
+IPPROTO_EGP = 8
+IPPROTO_PIGP = 9
+IPPROTO_RCCMON = 10
+IPPROTO_NVPII = 11
+IPPROTO_PUP = 12
+IPPROTO_ARGUS = 13
+IPPROTO_EMCON = 14
+IPPROTO_XNET = 15
+IPPROTO_CHAOS = 16
+IPPROTO_UDP = 17
+IPPROTO_MUX = 18
+IPPROTO_MEAS = 19
+IPPROTO_HMP = 20
+IPPROTO_PRM = 21
+IPPROTO_IDP = 22
+IPPROTO_TRUNK1 = 23
+IPPROTO_TRUNK2 = 24
+IPPROTO_LEAF1 = 25
+IPPROTO_LEAF2 = 26
+IPPROTO_RDP = 27
+IPPROTO_IRTP = 28
+IPPROTO_TP = 29
+IPPROTO_BLT = 30
+IPPROTO_NSP = 31
+IPPROTO_INP = 32
+IPPROTO_SEP = 33
+IPPROTO_3PC = 34
+IPPROTO_IDPR = 35
+IPPROTO_XTP = 36
+IPPROTO_DDP = 37
+IPPROTO_CMTP = 38
+IPPROTO_TPXX = 39
+IPPROTO_IL = 40
+IPPROTO_SIP = 41
+IPPROTO_SDRP = 42
+IPPROTO_SIPSR = 43
+IPPROTO_SIPFRAG = 44
+IPPROTO_IDRP = 45
+IPPROTO_RSVP = 46
+IPPROTO_GRE = 47
+IPPROTO_MHRP = 48
+IPPROTO_BHA = 49
+IPPROTO_ESP = 50
+IPPROTO_AH = 51
+IPPROTO_INLSP = 52
+IPPROTO_SWIPE = 53
+IPPROTO_NHRP = 54
+IPPROTO_AHIP = 61
+IPPROTO_CFTP = 62
+IPPROTO_HELLO = 63
+IPPROTO_SATEXPAK = 64
+IPPROTO_KRYPTOLAN = 65
+IPPROTO_RVD = 66
+IPPROTO_IPPC = 67
+IPPROTO_ADFS = 68
+IPPROTO_SATMON = 69
+IPPROTO_VISA = 70
+IPPROTO_IPCV = 71
+IPPROTO_CPNX = 72
+IPPROTO_CPHB = 73
+IPPROTO_WSN = 74
+IPPROTO_PVP = 75
+IPPROTO_BRSATMON = 76
+IPPROTO_ND = 77
+IPPROTO_WBMON = 78
+IPPROTO_WBEXPAK = 79
+IPPROTO_EON = 80
+IPPROTO_VMTP = 81
+IPPROTO_SVMTP = 82
+IPPROTO_VINES = 83
+IPPROTO_TTP = 84
+IPPROTO_IGP = 85
+IPPROTO_DGP = 86
+IPPROTO_TCF = 87
+IPPROTO_IGRP = 88
+IPPROTO_OSPFIGP = 89
+IPPROTO_SRPC = 90
+IPPROTO_LARP = 91
+IPPROTO_MTP = 92
+IPPROTO_AX25 = 93
+IPPROTO_IPEIP = 94
+IPPROTO_MICP = 95
+IPPROTO_SCCSP = 96
+IPPROTO_ETHERIP = 97
+IPPROTO_ENCAP = 98
+IPPROTO_APES = 99
+IPPROTO_GMTP = 100
+IPPROTO_DIVERT = 254
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_HIFIRSTAUTO = 40000
+IPPORT_HILASTAUTO = 44999
+IPPORT_RESERVEDSTART = 600
+def IN_CLASSA(i): return (((long)(i) & 0x80000000) == 0)
+
+IN_CLASSA_NET = 0xff000000
+IN_CLASSA_NSHIFT = 24
+IN_CLASSA_HOST = 0x00ffffff
+IN_CLASSA_MAX = 128
+def IN_CLASSB(i): return (((long)(i) & 0xc0000000) == 0x80000000)
+
+IN_CLASSB_NET = 0xffff0000
+IN_CLASSB_NSHIFT = 16
+IN_CLASSB_HOST = 0x0000ffff
+IN_CLASSB_MAX = 65536
+def IN_CLASSC(i): return (((long)(i) & 0xe0000000) == 0xc0000000)
+
+IN_CLASSC_NET = 0xffffff00
+IN_CLASSC_NSHIFT = 8
+IN_CLASSC_HOST = 0x000000ff
+def IN_CLASSD(i): return (((long)(i) & 0xf0000000) == 0xe0000000)
+
+IN_CLASSD_NET = 0xf0000000
+IN_CLASSD_NSHIFT = 28
+IN_CLASSD_HOST = 0x0fffffff
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+def IN_EXPERIMENTAL(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_ANY = 0x00000000
+INADDR_BROADCAST = 0xffffffff
+INADDR_NONE = 0xffffffff
+INADDR_UNSPEC_GROUP = 0xe0000000
+INADDR_ALLHOSTS_GROUP = 0xe0000001
+INADDR_ALLRTRS_GROUP = 0xe0000002
+INADDR_MAX_LOCAL_GROUP = 0xe00000ff
+IN_LOOPBACKNET = 127
+IP_OPTIONS = 1
+IP_HDRINCL = 2
+IP_TOS = 3
+IP_TTL = 4
+IP_RECVOPTS = 5
+IP_RECVRETOPTS = 6
+IP_RECVDSTADDR = 7
+IP_RETOPTS = 8
+IP_MULTICAST_IF = 9
+IP_MULTICAST_TTL = 10
+IP_MULTICAST_LOOP = 11
+IP_ADD_MEMBERSHIP = 12
+IP_DROP_MEMBERSHIP = 13
+IP_MULTICAST_VIF = 14
+IP_RSVP_ON = 15
+IP_RSVP_OFF = 16
+IP_RSVP_VIF_ON = 17
+IP_RSVP_VIF_OFF = 18
+IP_PORTRANGE = 19
+IP_RECVIF = 20
+IP_FW_ADD = 50
+IP_FW_DEL = 51
+IP_FW_FLUSH = 52
+IP_FW_ZERO = 53
+IP_FW_GET = 54
+IP_NAT = 55
+IP_DEFAULT_MULTICAST_TTL = 1
+IP_DEFAULT_MULTICAST_LOOP = 1
+IP_MAX_MEMBERSHIPS = 20
+IP_PORTRANGE_DEFAULT = 0
+IP_PORTRANGE_HIGH = 1
+IP_PORTRANGE_LOW = 2
+IPPROTO_MAXID = (IPPROTO_IDP + 1)
+IPCTL_FORWARDING = 1
+IPCTL_SENDREDIRECTS = 2
+IPCTL_DEFTTL = 3
+IPCTL_DEFMTU = 4
+IPCTL_RTEXPIRE = 5
+IPCTL_RTMINEXPIRE = 6
+IPCTL_RTMAXCACHE = 7
+IPCTL_SOURCEROUTE = 8
+IPCTL_DIRECTEDBROADCAST = 9
+IPCTL_INTRQMAXLEN = 10
+IPCTL_INTRQDROPS = 11
+IPCTL_ACCEPTSOURCEROUTE = 13
+IPCTL_MAXID = 13
+IP_NAT_IN = 0x00000001
+IP_NAT_OUT = 0x00000002
diff --git a/Lib/plat-freebsd2/SOCKET.py b/Lib/plat-freebsd2/SOCKET.py
new file mode 100644
index 0000000..45f1cb1
--- /dev/null
+++ b/Lib/plat-freebsd2/SOCKET.py
@@ -0,0 +1,128 @@
+# Generated by h2py from /usr/include/sys/socket.h
+SOCK_STREAM = 1
+SOCK_DGRAM = 2
+SOCK_RAW = 3
+SOCK_RDM = 4
+SOCK_SEQPACKET = 5
+SO_DEBUG = 0x0001
+SO_ACCEPTCONN = 0x0002
+SO_REUSEADDR = 0x0004
+SO_KEEPALIVE = 0x0008
+SO_DONTROUTE = 0x0010
+SO_BROADCAST = 0x0020
+SO_USELOOPBACK = 0x0040
+SO_LINGER = 0x0080
+SO_OOBINLINE = 0x0100
+SO_REUSEPORT = 0x0200
+SO_TIMESTAMP = 0x0400
+SO_SNDBUF = 0x1001
+SO_RCVBUF = 0x1002
+SO_SNDLOWAT = 0x1003
+SO_RCVLOWAT = 0x1004
+SO_SNDTIMEO = 0x1005
+SO_RCVTIMEO = 0x1006
+SO_ERROR = 0x1007
+SO_TYPE = 0x1008
+SO_PRIVSTATE = 0x1009
+SOL_SOCKET = 0xffff
+AF_UNSPEC = 0
+AF_LOCAL = 1
+AF_UNIX = AF_LOCAL
+AF_INET = 2
+AF_IMPLINK = 3
+AF_PUP = 4
+AF_CHAOS = 5
+AF_NS = 6
+AF_ISO = 7
+AF_OSI = AF_ISO
+AF_ECMA = 8
+AF_DATAKIT = 9
+AF_CCITT = 10
+AF_SNA = 11
+AF_DECnet = 12
+AF_DLI = 13
+AF_LAT = 14
+AF_HYLINK = 15
+AF_APPLETALK = 16
+AF_ROUTE = 17
+AF_LINK = 18
+pseudo_AF_XTP = 19
+AF_COIP = 20
+AF_CNT = 21
+pseudo_AF_RTIP = 22
+AF_IPX = 23
+AF_SIP = 24
+pseudo_AF_PIP = 25
+AF_ISDN = 26
+AF_E164 = AF_ISDN
+pseudo_AF_KEY = 27
+AF_INET6 = 28
+AF_MAX = 29
+PF_UNSPEC = AF_UNSPEC
+PF_LOCAL = AF_LOCAL
+PF_UNIX = PF_LOCAL
+PF_INET = AF_INET
+PF_IMPLINK = AF_IMPLINK
+PF_PUP = AF_PUP
+PF_CHAOS = AF_CHAOS
+PF_NS = AF_NS
+PF_ISO = AF_ISO
+PF_OSI = AF_ISO
+PF_ECMA = AF_ECMA
+PF_DATAKIT = AF_DATAKIT
+PF_CCITT = AF_CCITT
+PF_SNA = AF_SNA
+PF_DECnet = AF_DECnet
+PF_DLI = AF_DLI
+PF_LAT = AF_LAT
+PF_HYLINK = AF_HYLINK
+PF_APPLETALK = AF_APPLETALK
+PF_ROUTE = AF_ROUTE
+PF_LINK = AF_LINK
+PF_XTP = pseudo_AF_XTP
+PF_COIP = AF_COIP
+PF_CNT = AF_CNT
+PF_SIP = AF_SIP
+PF_IPX = AF_IPX
+PF_RTIP = pseudo_AF_RTIP
+PF_PIP = pseudo_AF_PIP
+PF_ISDN = AF_ISDN
+PF_KEY = pseudo_AF_KEY
+PF_INET6 = AF_INET6
+PF_MAX = AF_MAX
+NET_MAXID = AF_MAX
+NET_RT_DUMP = 1
+NET_RT_FLAGS = 2
+NET_RT_IFLIST = 3
+NET_RT_MAXID = 4
+SOMAXCONN = 128
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+MSG_DONTWAIT = 0x80
+MSG_EOF = 0x100
+MSG_COMPAT = 0x8000
+SCM_RIGHTS = 0x01
+SCM_TIMESTAMP = 0x02
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
diff --git a/Lib/plat-freebsd2/TERMIOS.py b/Lib/plat-freebsd2/TERMIOS.py
new file mode 100644
index 0000000..b0e3d28
--- /dev/null
+++ b/Lib/plat-freebsd2/TERMIOS.py
@@ -0,0 +1,198 @@
+# Generated by h2py from /usr/include/termios.h
+VEOF = 0
+VEOL = 1
+VEOL2 = 2
+VERASE = 3
+VWERASE = 4
+VKILL = 5
+VREPRINT = 6
+VINTR = 8
+VQUIT = 9
+VSUSP = 10
+VDSUSP = 11
+VSTART = 12
+VSTOP = 13
+VLNEXT = 14
+VDISCARD = 15
+VMIN = 16
+VTIME = 17
+VSTATUS = 18
+NCCS = 20
+_POSIX_VDISABLE = 0xff
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IXANY = 0x00000800
+IMAXBEL = 0x00002000
+OPOST = 0x00000001
+ONLCR = 0x00000002
+OXTABS = 0x00000004
+ONOEOT = 0x00000008
+CIGNORE = 0x00000001
+CSIZE = 0x00000300
+CS5 = 0x00000000
+CS6 = 0x00000100
+CS7 = 0x00000200
+CS8 = 0x00000300
+CSTOPB = 0x00000400
+CREAD = 0x00000800
+PARENB = 0x00001000
+PARODD = 0x00002000
+HUPCL = 0x00004000
+CLOCAL = 0x00008000
+CCTS_OFLOW = 0x00010000
+CRTS_IFLOW = 0x00020000
+CDTR_IFLOW = 0x00040000
+CDSR_OFLOW = 0x00080000
+CCAR_OFLOW = 0x00100000
+MDMBUF = 0x00100000
+ECHOKE = 0x00000001
+ECHOE = 0x00000002
+ECHOK = 0x00000004
+ECHO = 0x00000008
+ECHONL = 0x00000010
+ECHOPRT = 0x00000020
+ECHOCTL = 0x00000040
+ISIG = 0x00000080
+ICANON = 0x00000100
+ALTWERASE = 0x00000200
+IEXTEN = 0x00000400
+EXTPROC = 0x00000800
+TOSTOP = 0x00400000
+FLUSHO = 0x00800000
+NOKERNINFO = 0x02000000
+PENDIN = 0x20000000
+NOFLSH = 0x80000000
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCSASOFT = 0x10
+B0 = 0
+B50 = 50
+B75 = 75
+B110 = 110
+B134 = 134
+B150 = 150
+B200 = 200
+B300 = 300
+B600 = 600
+B1200 = 1200
+B1800 = 1800
+B2400 = 2400
+B4800 = 4800
+B9600 = 9600
+B19200 = 19200
+B38400 = 38400
+B7200 = 7200
+B14400 = 14400
+B28800 = 28800
+B57600 = 57600
+B76800 = 76800
+B115200 = 115200
+B230400 = 230400
+EXTA = 19200
+EXTB = 38400
+TCIFLUSH = 1
+TCOFLUSH = 2
+TCIOFLUSH = 3
+TCOOFF = 1
+TCOON = 2
+TCIOFF = 3
+TCION = 4
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from sys/ttycom.h
+
+# Included from sys/ioccom.h
+IOCPARM_MASK = 0x1fff
+def IOCPARM_LEN(x): return (((x) >> 16) & IOCPARM_MASK)
+
+def IOCBASECMD(x): return ((x) & ~(IOCPARM_MASK << 16))
+
+def IOCGROUP(x): return (((x) >> 8) & 0xff)
+
+IOC_VOID = 0x20000000
+IOC_OUT = 0x40000000
+IOC_IN = 0x80000000
+IOC_INOUT = (IOC_IN|IOC_OUT)
+IOC_DIRMASK = 0xe0000000
+TIOCM_LE = 0001
+TIOCM_DTR = 0002
+TIOCM_RTS = 0004
+TIOCM_ST = 0010
+TIOCM_SR = 0020
+TIOCM_CTS = 0040
+TIOCM_CAR = 0100
+TIOCM_CD = TIOCM_CAR
+TIOCM_RNG = 0200
+TIOCM_RI = TIOCM_RNG
+TIOCM_DSR = 0400
+TIOCPKT_DATA = 0x00
+TIOCPKT_FLUSHREAD = 0x01
+TIOCPKT_FLUSHWRITE = 0x02
+TIOCPKT_STOP = 0x04
+TIOCPKT_START = 0x08
+TIOCPKT_NOSTOP = 0x10
+TIOCPKT_DOSTOP = 0x20
+TIOCPKT_IOCTL = 0x40
+def UIOCCMD(n): return _IO(ord('u'), n)
+
+TTYDISC = 0
+TABLDISC = 3
+SLIPDISC = 4
+PPPDISC = 5
+
+# Included from sys/ttydefaults.h
+TTYDEF_IFLAG = (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
+TTYDEF_OFLAG = (OPOST | ONLCR)
+TTYDEF_LFLAG = (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+TTYDEF_CFLAG = (CREAD | CS8 | HUPCL)
+TTYDEF_SPEED = (B9600)
+def CTRL(x): return (x&037)
+
+CEOF = CTRL(ord('d'))
+CEOL = 0xff
+CERASE = 0177
+CINTR = CTRL(ord('c'))
+CSTATUS = CTRL(ord('t'))
+CKILL = CTRL(ord('u'))
+CMIN = 1
+CQUIT = 034
+CSUSP = CTRL(ord('z'))
+CTIME = 0
+CDSUSP = CTRL(ord('y'))
+CSTART = CTRL(ord('q'))
+CSTOP = CTRL(ord('s'))
+CLNEXT = CTRL(ord('v'))
+CDISCARD = CTRL(ord('o'))
+CWERASE = CTRL(ord('w'))
+CREPRINT = CTRL(ord('r'))
+CEOT = CEOF
+CBRK = CEOL
+CRPRNT = CREPRINT
+CFLUSH = CDISCARD
diff --git a/Lib/plat-freebsd2/regen b/Lib/plat-freebsd2/regen
index 1516e60..8c81a5f 100755
--- a/Lib/plat-freebsd2/regen
+++ b/Lib/plat-freebsd2/regen
@@ -1,6 +1,6 @@
#! /bin/sh
set -v
-#h2py /usr/include/sys/fcntl.h
+h2py /usr/include/sys/fcntl.h
h2py /usr/include/sys/socket.h
h2py -i '(u_long)' /usr/include/netinet/in.h
h2py /usr/include/termios.h
diff --git a/Lib/plat-freebsd3/FCNTL.py b/Lib/plat-freebsd3/FCNTL.py
new file mode 100644
index 0000000..d2220e8
--- /dev/null
+++ b/Lib/plat-freebsd3/FCNTL.py
@@ -0,0 +1,111 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from sys/types.h
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from machine/ansi.h
+_BSD_PTRDIFF_T_ = int
+_BSD_SSIZE_T_ = int
+_BSD_TIME_T_ = long
+_BSD_CLOCKID_T_ = int
+_BSD_TIMER_T_ = int
+_BSD_CT_RUNE_T_ = int
+_BSD_PID_T_ = int
+_BSD_CLK_TCK_ = 128
+_BSD_CLOCKS_PER_SEC_ = 128
+
+# Included from machine/types.h
+def major(x): return ((int)(((u_int)(x) >> 8)&0xff))
+
+def minor(x): return ((int)((x)&0xffff00ff))
+
+
+# Included from machine/endian.h
+_QUAD_HIGHWORD = 1
+_QUAD_LOWWORD = 0
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = LITTLE_ENDIAN
+def __word_swap_long(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_long(x): return \
+
+def __byte_swap_word(x): return \
+
+ntohl = __byte_swap_long
+ntohs = __byte_swap_word
+htonl = __byte_swap_long
+htons = __byte_swap_word
+NBBY = 8
+FD_SETSIZE = 1024
+O_RDONLY = 0x0000
+O_WRONLY = 0x0001
+O_RDWR = 0x0002
+O_ACCMODE = 0x0003
+FREAD = 0x0001
+FWRITE = 0x0002
+O_NONBLOCK = 0x0004
+O_APPEND = 0x0008
+O_SHLOCK = 0x0010
+O_EXLOCK = 0x0020
+O_ASYNC = 0x0040
+O_FSYNC = 0x0080
+O_NOFOLLOW = 0x0100
+O_CREAT = 0x0200
+O_TRUNC = 0x0400
+O_EXCL = 0x0800
+FMARK = 0x1000
+FDEFER = 0x2000
+FHASLOCK = 0x4000
+O_NOCTTY = 0x8000
+def FFLAGS(oflags): return ((oflags) + 1)
+
+def OFLAGS(fflags): return ((fflags) - 1)
+
+FAPPEND = O_APPEND
+FASYNC = O_ASYNC
+FFSYNC = O_FSYNC
+FNONBLOCK = O_NONBLOCK
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETOWN = 5
+F_SETOWN = 6
+F_GETLK = 7
+F_SETLK = 8
+F_SETLKW = 9
+FD_CLOEXEC = 1
+F_RDLCK = 1
+F_UNLCK = 2
+F_WRLCK = 3
+F_WAIT = 0x010
+F_FLOCK = 0x020
+F_POSIX = 0x040
+LOCK_SH = 0x01
+LOCK_EX = 0x02
+LOCK_NB = 0x04
+LOCK_UN = 0x08
diff --git a/Lib/plat-freebsd3/IN.py b/Lib/plat-freebsd3/IN.py
new file mode 100644
index 0000000..1751445
--- /dev/null
+++ b/Lib/plat-freebsd3/IN.py
@@ -0,0 +1,189 @@
+# Generated by h2py from /usr/include/netinet/in.h
+IPPROTO_IP = 0
+IPPROTO_ICMP = 1
+IPPROTO_IGMP = 2
+IPPROTO_GGP = 3
+IPPROTO_IPIP = 4
+IPPROTO_TCP = 6
+IPPROTO_ST = 7
+IPPROTO_EGP = 8
+IPPROTO_PIGP = 9
+IPPROTO_RCCMON = 10
+IPPROTO_NVPII = 11
+IPPROTO_PUP = 12
+IPPROTO_ARGUS = 13
+IPPROTO_EMCON = 14
+IPPROTO_XNET = 15
+IPPROTO_CHAOS = 16
+IPPROTO_UDP = 17
+IPPROTO_MUX = 18
+IPPROTO_MEAS = 19
+IPPROTO_HMP = 20
+IPPROTO_PRM = 21
+IPPROTO_IDP = 22
+IPPROTO_TRUNK1 = 23
+IPPROTO_TRUNK2 = 24
+IPPROTO_LEAF1 = 25
+IPPROTO_LEAF2 = 26
+IPPROTO_RDP = 27
+IPPROTO_IRTP = 28
+IPPROTO_TP = 29
+IPPROTO_BLT = 30
+IPPROTO_NSP = 31
+IPPROTO_INP = 32
+IPPROTO_SEP = 33
+IPPROTO_3PC = 34
+IPPROTO_IDPR = 35
+IPPROTO_XTP = 36
+IPPROTO_DDP = 37
+IPPROTO_CMTP = 38
+IPPROTO_TPXX = 39
+IPPROTO_IL = 40
+IPPROTO_SIP = 41
+IPPROTO_SDRP = 42
+IPPROTO_SIPSR = 43
+IPPROTO_SIPFRAG = 44
+IPPROTO_IDRP = 45
+IPPROTO_RSVP = 46
+IPPROTO_GRE = 47
+IPPROTO_MHRP = 48
+IPPROTO_BHA = 49
+IPPROTO_ESP = 50
+IPPROTO_AH = 51
+IPPROTO_INLSP = 52
+IPPROTO_SWIPE = 53
+IPPROTO_NHRP = 54
+IPPROTO_AHIP = 61
+IPPROTO_CFTP = 62
+IPPROTO_HELLO = 63
+IPPROTO_SATEXPAK = 64
+IPPROTO_KRYPTOLAN = 65
+IPPROTO_RVD = 66
+IPPROTO_IPPC = 67
+IPPROTO_ADFS = 68
+IPPROTO_SATMON = 69
+IPPROTO_VISA = 70
+IPPROTO_IPCV = 71
+IPPROTO_CPNX = 72
+IPPROTO_CPHB = 73
+IPPROTO_WSN = 74
+IPPROTO_PVP = 75
+IPPROTO_BRSATMON = 76
+IPPROTO_ND = 77
+IPPROTO_WBMON = 78
+IPPROTO_WBEXPAK = 79
+IPPROTO_EON = 80
+IPPROTO_VMTP = 81
+IPPROTO_SVMTP = 82
+IPPROTO_VINES = 83
+IPPROTO_TTP = 84
+IPPROTO_IGP = 85
+IPPROTO_DGP = 86
+IPPROTO_TCF = 87
+IPPROTO_IGRP = 88
+IPPROTO_OSPFIGP = 89
+IPPROTO_SRPC = 90
+IPPROTO_LARP = 91
+IPPROTO_MTP = 92
+IPPROTO_AX25 = 93
+IPPROTO_IPEIP = 94
+IPPROTO_MICP = 95
+IPPROTO_SCCSP = 96
+IPPROTO_ETHERIP = 97
+IPPROTO_ENCAP = 98
+IPPROTO_APES = 99
+IPPROTO_GMTP = 100
+IPPROTO_DIVERT = 254
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_HIFIRSTAUTO = 49152
+IPPORT_HILASTAUTO = 65535
+IPPORT_RESERVEDSTART = 600
+def IN_CLASSA(i): return (((long)(i) & 0x80000000) == 0)
+
+IN_CLASSA_NET = 0xff000000
+IN_CLASSA_NSHIFT = 24
+IN_CLASSA_HOST = 0x00ffffff
+IN_CLASSA_MAX = 128
+def IN_CLASSB(i): return (((long)(i) & 0xc0000000) == 0x80000000)
+
+IN_CLASSB_NET = 0xffff0000
+IN_CLASSB_NSHIFT = 16
+IN_CLASSB_HOST = 0x0000ffff
+IN_CLASSB_MAX = 65536
+def IN_CLASSC(i): return (((long)(i) & 0xe0000000) == 0xc0000000)
+
+IN_CLASSC_NET = 0xffffff00
+IN_CLASSC_NSHIFT = 8
+IN_CLASSC_HOST = 0x000000ff
+def IN_CLASSD(i): return (((long)(i) & 0xf0000000) == 0xe0000000)
+
+IN_CLASSD_NET = 0xf0000000
+IN_CLASSD_NSHIFT = 28
+IN_CLASSD_HOST = 0x0fffffff
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+def IN_EXPERIMENTAL(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_ANY = 0x00000000
+INADDR_LOOPBACK = 0x7f000001
+INADDR_BROADCAST = 0xffffffff
+INADDR_NONE = 0xffffffff
+INADDR_UNSPEC_GROUP = 0xe0000000
+INADDR_ALLHOSTS_GROUP = 0xe0000001
+INADDR_ALLRTRS_GROUP = 0xe0000002
+INADDR_MAX_LOCAL_GROUP = 0xe00000ff
+IN_LOOPBACKNET = 127
+IP_OPTIONS = 1
+IP_HDRINCL = 2
+IP_TOS = 3
+IP_TTL = 4
+IP_RECVOPTS = 5
+IP_RECVRETOPTS = 6
+IP_RECVDSTADDR = 7
+IP_RETOPTS = 8
+IP_MULTICAST_IF = 9
+IP_MULTICAST_TTL = 10
+IP_MULTICAST_LOOP = 11
+IP_ADD_MEMBERSHIP = 12
+IP_DROP_MEMBERSHIP = 13
+IP_MULTICAST_VIF = 14
+IP_RSVP_ON = 15
+IP_RSVP_OFF = 16
+IP_RSVP_VIF_ON = 17
+IP_RSVP_VIF_OFF = 18
+IP_PORTRANGE = 19
+IP_RECVIF = 20
+IP_FW_ADD = 50
+IP_FW_DEL = 51
+IP_FW_FLUSH = 52
+IP_FW_ZERO = 53
+IP_FW_GET = 54
+IP_NAT = 55
+IP_DEFAULT_MULTICAST_TTL = 1
+IP_DEFAULT_MULTICAST_LOOP = 1
+IP_MAX_MEMBERSHIPS = 20
+IP_PORTRANGE_DEFAULT = 0
+IP_PORTRANGE_HIGH = 1
+IP_PORTRANGE_LOW = 2
+IPPROTO_MAXID = (IPPROTO_IDP + 1)
+IPCTL_FORWARDING = 1
+IPCTL_SENDREDIRECTS = 2
+IPCTL_DEFTTL = 3
+IPCTL_DEFMTU = 4
+IPCTL_RTEXPIRE = 5
+IPCTL_RTMINEXPIRE = 6
+IPCTL_RTMAXCACHE = 7
+IPCTL_SOURCEROUTE = 8
+IPCTL_DIRECTEDBROADCAST = 9
+IPCTL_INTRQMAXLEN = 10
+IPCTL_INTRQDROPS = 11
+IPCTL_STATS = 12
+IPCTL_ACCEPTSOURCEROUTE = 13
+IPCTL_MAXID = 14
+IP_NAT_IN = 0x00000001
+IP_NAT_OUT = 0x00000002
diff --git a/Lib/plat-freebsd3/SOCKET.py b/Lib/plat-freebsd3/SOCKET.py
new file mode 100644
index 0000000..abd0654
--- /dev/null
+++ b/Lib/plat-freebsd3/SOCKET.py
@@ -0,0 +1,132 @@
+# Generated by h2py from /usr/include/sys/socket.h
+SOCK_STREAM = 1
+SOCK_DGRAM = 2
+SOCK_RAW = 3
+SOCK_RDM = 4
+SOCK_SEQPACKET = 5
+SO_DEBUG = 0x0001
+SO_ACCEPTCONN = 0x0002
+SO_REUSEADDR = 0x0004
+SO_KEEPALIVE = 0x0008
+SO_DONTROUTE = 0x0010
+SO_BROADCAST = 0x0020
+SO_USELOOPBACK = 0x0040
+SO_LINGER = 0x0080
+SO_OOBINLINE = 0x0100
+SO_REUSEPORT = 0x0200
+SO_TIMESTAMP = 0x0400
+SO_SNDBUF = 0x1001
+SO_RCVBUF = 0x1002
+SO_SNDLOWAT = 0x1003
+SO_RCVLOWAT = 0x1004
+SO_SNDTIMEO = 0x1005
+SO_RCVTIMEO = 0x1006
+SO_ERROR = 0x1007
+SO_TYPE = 0x1008
+SOL_SOCKET = 0xffff
+AF_UNSPEC = 0
+AF_LOCAL = 1
+AF_UNIX = AF_LOCAL
+AF_INET = 2
+AF_IMPLINK = 3
+AF_PUP = 4
+AF_CHAOS = 5
+AF_NS = 6
+AF_ISO = 7
+AF_OSI = AF_ISO
+AF_ECMA = 8
+AF_DATAKIT = 9
+AF_CCITT = 10
+AF_SNA = 11
+AF_DECnet = 12
+AF_DLI = 13
+AF_LAT = 14
+AF_HYLINK = 15
+AF_APPLETALK = 16
+AF_ROUTE = 17
+AF_LINK = 18
+pseudo_AF_XTP = 19
+AF_COIP = 20
+AF_CNT = 21
+pseudo_AF_RTIP = 22
+AF_IPX = 23
+AF_SIP = 24
+pseudo_AF_PIP = 25
+AF_ISDN = 26
+AF_E164 = AF_ISDN
+pseudo_AF_KEY = 27
+AF_INET6 = 28
+AF_NATM = 29
+AF_MAX = 30
+SOCK_MAXADDRLEN = 255
+PF_UNSPEC = AF_UNSPEC
+PF_LOCAL = AF_LOCAL
+PF_UNIX = PF_LOCAL
+PF_INET = AF_INET
+PF_IMPLINK = AF_IMPLINK
+PF_PUP = AF_PUP
+PF_CHAOS = AF_CHAOS
+PF_NS = AF_NS
+PF_ISO = AF_ISO
+PF_OSI = AF_ISO
+PF_ECMA = AF_ECMA
+PF_DATAKIT = AF_DATAKIT
+PF_CCITT = AF_CCITT
+PF_SNA = AF_SNA
+PF_DECnet = AF_DECnet
+PF_DLI = AF_DLI
+PF_LAT = AF_LAT
+PF_HYLINK = AF_HYLINK
+PF_APPLETALK = AF_APPLETALK
+PF_ROUTE = AF_ROUTE
+PF_LINK = AF_LINK
+PF_XTP = pseudo_AF_XTP
+PF_COIP = AF_COIP
+PF_CNT = AF_CNT
+PF_SIP = AF_SIP
+PF_IPX = AF_IPX
+PF_RTIP = pseudo_AF_RTIP
+PF_PIP = pseudo_AF_PIP
+PF_ISDN = AF_ISDN
+PF_KEY = pseudo_AF_KEY
+PF_INET6 = AF_INET6
+PF_NATM = AF_NATM
+PF_MAX = AF_MAX
+NET_MAXID = AF_MAX
+NET_RT_DUMP = 1
+NET_RT_FLAGS = 2
+NET_RT_IFLIST = 3
+NET_RT_MAXID = 4
+SOMAXCONN = 128
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+MSG_DONTWAIT = 0x80
+MSG_EOF = 0x100
+MSG_COMPAT = 0x8000
+CMGROUP_MAX = 16
+SCM_RIGHTS = 0x01
+SCM_TIMESTAMP = 0x02
+SCM_CREDS = 0x03
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
diff --git a/Lib/plat-freebsd3/TERMIOS.py b/Lib/plat-freebsd3/TERMIOS.py
new file mode 100644
index 0000000..b0e3d28
--- /dev/null
+++ b/Lib/plat-freebsd3/TERMIOS.py
@@ -0,0 +1,198 @@
+# Generated by h2py from /usr/include/termios.h
+VEOF = 0
+VEOL = 1
+VEOL2 = 2
+VERASE = 3
+VWERASE = 4
+VKILL = 5
+VREPRINT = 6
+VINTR = 8
+VQUIT = 9
+VSUSP = 10
+VDSUSP = 11
+VSTART = 12
+VSTOP = 13
+VLNEXT = 14
+VDISCARD = 15
+VMIN = 16
+VTIME = 17
+VSTATUS = 18
+NCCS = 20
+_POSIX_VDISABLE = 0xff
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IXANY = 0x00000800
+IMAXBEL = 0x00002000
+OPOST = 0x00000001
+ONLCR = 0x00000002
+OXTABS = 0x00000004
+ONOEOT = 0x00000008
+CIGNORE = 0x00000001
+CSIZE = 0x00000300
+CS5 = 0x00000000
+CS6 = 0x00000100
+CS7 = 0x00000200
+CS8 = 0x00000300
+CSTOPB = 0x00000400
+CREAD = 0x00000800
+PARENB = 0x00001000
+PARODD = 0x00002000
+HUPCL = 0x00004000
+CLOCAL = 0x00008000
+CCTS_OFLOW = 0x00010000
+CRTS_IFLOW = 0x00020000
+CDTR_IFLOW = 0x00040000
+CDSR_OFLOW = 0x00080000
+CCAR_OFLOW = 0x00100000
+MDMBUF = 0x00100000
+ECHOKE = 0x00000001
+ECHOE = 0x00000002
+ECHOK = 0x00000004
+ECHO = 0x00000008
+ECHONL = 0x00000010
+ECHOPRT = 0x00000020
+ECHOCTL = 0x00000040
+ISIG = 0x00000080
+ICANON = 0x00000100
+ALTWERASE = 0x00000200
+IEXTEN = 0x00000400
+EXTPROC = 0x00000800
+TOSTOP = 0x00400000
+FLUSHO = 0x00800000
+NOKERNINFO = 0x02000000
+PENDIN = 0x20000000
+NOFLSH = 0x80000000
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCSASOFT = 0x10
+B0 = 0
+B50 = 50
+B75 = 75
+B110 = 110
+B134 = 134
+B150 = 150
+B200 = 200
+B300 = 300
+B600 = 600
+B1200 = 1200
+B1800 = 1800
+B2400 = 2400
+B4800 = 4800
+B9600 = 9600
+B19200 = 19200
+B38400 = 38400
+B7200 = 7200
+B14400 = 14400
+B28800 = 28800
+B57600 = 57600
+B76800 = 76800
+B115200 = 115200
+B230400 = 230400
+EXTA = 19200
+EXTB = 38400
+TCIFLUSH = 1
+TCOFLUSH = 2
+TCIOFLUSH = 3
+TCOOFF = 1
+TCOON = 2
+TCIOFF = 3
+TCION = 4
+
+# Included from sys/cdefs.h
+def __P(protos): return protos
+
+def __STRING(x): return #x
+
+def __XSTRING(x): return __STRING(x)
+
+def __P(protos): return ()
+
+def __STRING(x): return "x"
+
+def __RCSID(s): return __IDSTRING(rcsid,s)
+
+def __RCSID_SOURCE(s): return __IDSTRING(rcsid_source,s)
+
+def __COPYRIGHT(s): return __IDSTRING(copyright,s)
+
+
+# Included from sys/ttycom.h
+
+# Included from sys/ioccom.h
+IOCPARM_MASK = 0x1fff
+def IOCPARM_LEN(x): return (((x) >> 16) & IOCPARM_MASK)
+
+def IOCBASECMD(x): return ((x) & ~(IOCPARM_MASK << 16))
+
+def IOCGROUP(x): return (((x) >> 8) & 0xff)
+
+IOC_VOID = 0x20000000
+IOC_OUT = 0x40000000
+IOC_IN = 0x80000000
+IOC_INOUT = (IOC_IN|IOC_OUT)
+IOC_DIRMASK = 0xe0000000
+TIOCM_LE = 0001
+TIOCM_DTR = 0002
+TIOCM_RTS = 0004
+TIOCM_ST = 0010
+TIOCM_SR = 0020
+TIOCM_CTS = 0040
+TIOCM_CAR = 0100
+TIOCM_CD = TIOCM_CAR
+TIOCM_RNG = 0200
+TIOCM_RI = TIOCM_RNG
+TIOCM_DSR = 0400
+TIOCPKT_DATA = 0x00
+TIOCPKT_FLUSHREAD = 0x01
+TIOCPKT_FLUSHWRITE = 0x02
+TIOCPKT_STOP = 0x04
+TIOCPKT_START = 0x08
+TIOCPKT_NOSTOP = 0x10
+TIOCPKT_DOSTOP = 0x20
+TIOCPKT_IOCTL = 0x40
+def UIOCCMD(n): return _IO(ord('u'), n)
+
+TTYDISC = 0
+TABLDISC = 3
+SLIPDISC = 4
+PPPDISC = 5
+
+# Included from sys/ttydefaults.h
+TTYDEF_IFLAG = (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
+TTYDEF_OFLAG = (OPOST | ONLCR)
+TTYDEF_LFLAG = (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+TTYDEF_CFLAG = (CREAD | CS8 | HUPCL)
+TTYDEF_SPEED = (B9600)
+def CTRL(x): return (x&037)
+
+CEOF = CTRL(ord('d'))
+CEOL = 0xff
+CERASE = 0177
+CINTR = CTRL(ord('c'))
+CSTATUS = CTRL(ord('t'))
+CKILL = CTRL(ord('u'))
+CMIN = 1
+CQUIT = 034
+CSUSP = CTRL(ord('z'))
+CTIME = 0
+CDSUSP = CTRL(ord('y'))
+CSTART = CTRL(ord('q'))
+CSTOP = CTRL(ord('s'))
+CLNEXT = CTRL(ord('v'))
+CDISCARD = CTRL(ord('o'))
+CWERASE = CTRL(ord('w'))
+CREPRINT = CTRL(ord('r'))
+CEOT = CEOF
+CBRK = CEOL
+CRPRNT = CREPRINT
+CFLUSH = CDISCARD
diff --git a/Lib/plat-freebsd3/regen b/Lib/plat-freebsd3/regen
new file mode 100755
index 0000000..8c81a5f
--- /dev/null
+++ b/Lib/plat-freebsd3/regen
@@ -0,0 +1,6 @@
+#! /bin/sh
+set -v
+h2py /usr/include/sys/fcntl.h
+h2py /usr/include/sys/socket.h
+h2py -i '(u_long)' /usr/include/netinet/in.h
+h2py /usr/include/termios.h