summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/aix3/FCNTL.py145
-rw-r--r--Lib/aix3/IN.py126
-rw-r--r--Lib/aix3/SOCKET.py86
-rw-r--r--Lib/aix3/TERMIOS.py195
-rwxr-xr-xLib/aix3/regen11
-rw-r--r--Lib/aix4/FCNTL.py387
-rw-r--r--Lib/aix4/IN.py165
-rw-r--r--Lib/aix4/SOCKET.py93
-rw-r--r--Lib/aix4/TERMIOS.py206
-rwxr-xr-xLib/aix4/regen11
-rw-r--r--Lib/plat-aix3/FCNTL.py145
-rw-r--r--Lib/plat-aix3/IN.py126
-rw-r--r--Lib/plat-aix3/SOCKET.py86
-rw-r--r--Lib/plat-aix3/TERMIOS.py195
-rwxr-xr-xLib/plat-aix3/regen11
-rw-r--r--Lib/plat-aix4/FCNTL.py387
-rw-r--r--Lib/plat-aix4/IN.py165
-rw-r--r--Lib/plat-aix4/SOCKET.py93
-rw-r--r--Lib/plat-aix4/TERMIOS.py206
-rwxr-xr-xLib/plat-aix4/regen11
20 files changed, 2850 insertions, 0 deletions
diff --git a/Lib/aix3/FCNTL.py b/Lib/aix3/FCNTL.py
new file mode 100644
index 0000000000..90e9ea52b8
--- /dev/null
+++ b/Lib/aix3/FCNTL.py
@@ -0,0 +1,145 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+
+# Included from stddef.h
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+
+# Included from sys/flock.h
+F_RDLCK = 01
+F_WRLCK = 02
+F_UNLCK = 03
+INOFLCK = 1
+SETFLCK = 2
+SLPFLCK = 4
+LCK_UNBLOCK = 0
+LCK_BLOCKER = 1
+LCK_BLOCKED = 2
+LCK_WASBLOCK = 4
+MAXEND = 017777777777
+RMTLOCK = 1
+def ENF_LOCK(mode): return (((mode) & (ISGID | IEXEC | (IEXEC >> 3) | (IEXEC >> 6))) == ISGID)
+
+O_RDONLY = 00000000
+O_WRONLY = 00000001
+O_RDWR = 00000002
+O_ACCMODE = 3
+O_NONBLOCK = 00000004
+O_APPEND = 00000010
+O_CREAT = 00000400
+O_TRUNC = 00001000
+O_EXCL = 00002000
+O_NOCTTY = 00004000
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETLK = 5
+F_SETLK = 6
+F_SETLKW = 7
+FD_CLOEXEC = 1
+O_SYNC = 00000020
+O_NONE = 00000003
+O_EXEC = 00000040
+O_RSHARE = 00010000
+O_DEFER = 00020000
+O_DELAY = 00040000
+O_NDELAY = 00100000
+O_NSHARE = 00200000
+F_GETOWN = 8
+F_SETOWN = 9
+F_CLOSEM = 10
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+FNDELAY = O_NDELAY
+FNONBLOCK = O_NONBLOCK
+FAPPEND = O_APPEND
+FSYNC = O_SYNC
+FASYNC = 00400000
+FOPEN = (-1)
+FREAD = (O_RDONLY-FOPEN)
+FWRITE = (O_WRONLY-FOPEN)
+FMPX = 00000200
+FMASK = 00374377
+FFCNTL = (FNONBLOCK|FNDELAY|FAPPEND|FSYNC|FASYNC)
+FCREAT = O_CREAT
+FTRUNC = O_TRUNC
+FEXCL = O_EXCL
+FRSHARE = O_RSHARE
+FDEFER = O_DEFER
+FDELAY = O_DELAY
+FNDELAY = O_NDELAY
+FNSHARE = O_NSHARE
+FEXEC = O_EXEC
+FNOCTTY = O_NOCTTY
+FMOUNT = 01000000
+FREVOKED = 0x20000000
+FKERNEL = 0x40000000
+FAIO = 00000100
+FDOCLONE = 0x10000000
diff --git a/Lib/aix3/IN.py b/Lib/aix3/IN.py
new file mode 100644
index 0000000000..2c57362fc8
--- /dev/null
+++ b/Lib/aix3/IN.py
@@ -0,0 +1,126 @@
+# Generated by h2py from /usr/include/netinet/in.h
+
+# Included from net/nh.h
+
+# Included from sys/machine.h
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = BIG_ENDIAN
+DEFAULT_GPR = 0xDEADBEEF
+MSR_EE = 0x8000
+MSR_PR = 0x4000
+MSR_FP = 0x2000
+MSR_ME = 0x1000
+MSR_FE = 0x0800
+MSR_FE0 = 0x0800
+MSR_SE = 0x0400
+MSR_BE = 0x0200
+MSR_IE = 0x0100
+MSR_FE1 = 0x0100
+MSR_AL = 0x0080
+MSR_IP = 0x0040
+MSR_IR = 0x0020
+MSR_DR = 0x0010
+MSR_PM = 0x0004
+DEFAULT_MSR = (MSR_EE | MSR_ME | MSR_AL | MSR_IR | MSR_DR)
+DEFAULT_USER_MSR = (DEFAULT_MSR | MSR_PR)
+CR_LT = 0x80000000
+CR_GT = 0x40000000
+CR_EQ = 0x20000000
+CR_SO = 0x10000000
+CR_FX = 0x08000000
+CR_FEX = 0x04000000
+CR_VX = 0x02000000
+CR_OX = 0x01000000
+XER_SO = 0x80000000
+XER_OV = 0x40000000
+XER_CA = 0x20000000
+def XER_COMP_BYTE(xer): return ((xer >> 8) & 0x000000FF)
+
+def XER_LENGTH(xer): return (xer & 0x0000007F)
+
+DSISR_IO = 0x80000000
+DSISR_PFT = 0x40000000
+DSISR_LOCK = 0x20000000
+DSISR_FPIO = 0x10000000
+DSISR_PROT = 0x08000000
+DSISR_LOOP = 0x04000000
+DSISR_DRST = 0x04000000
+DSISR_ST = 0x02000000
+DSISR_SEGB = 0x01000000
+DSISR_DABR = 0x00400000
+DSISR_EAR = 0x00100000
+SRR_IS_PFT = 0x40000000
+SRR_IS_ISPEC = 0x20000000
+SRR_IS_IIO = 0x10000000
+SRR_IS_PROT = 0x08000000
+SRR_IS_LOOP = 0x04000000
+SRR_PR_FPEN = 0x00100000
+SRR_PR_INVAL = 0x00080000
+SRR_PR_PRIV = 0x00040000
+SRR_PR_TRAP = 0x00020000
+SRR_PR_IMPRE = 0x00010000
+def ntohl(x): return (x)
+
+def ntohs(x): return (x)
+
+def htonl(x): return (x)
+
+def htons(x): return (x)
+
+IPPROTO_IP = 0
+IPPROTO_ICMP = 1
+IPPROTO_GGP = 3
+IPPROTO_TCP = 6
+IPPROTO_EGP = 8
+IPPROTO_PUP = 12
+IPPROTO_UDP = 17
+IPPROTO_IDP = 22
+IPPROTO_TP = 29
+IPPROTO_LOCAL = 63
+IPPROTO_EON = 80
+IPPROTO_BIP = 0x53
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_TIMESERVER = 37
+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)
+
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+def IN_EXPERIMENTAL(i): return (((long)(i) & 0xe0000000) == 0xe0000000)
+
+def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_ANY = 0x00000000
+INADDR_LOOPBACK = 0x7f000001
+INADDR_BROADCAST = 0xffffffff
+INADDR_NONE = 0xffffffff
+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
diff --git a/Lib/aix3/SOCKET.py b/Lib/aix3/SOCKET.py
new file mode 100644
index 0000000000..5e529146b8
--- /dev/null
+++ b/Lib/aix3/SOCKET.py
@@ -0,0 +1,86 @@
+# 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_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_UNIX = 1
+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_INTF = 20
+AF_RIF = 21
+PF_INTF = AF_INTF
+AF_NETWARE = 22
+AF_NDD = 23
+AF_MAX = 30
+PF_UNSPEC = AF_UNSPEC
+PF_UNIX = AF_UNIX
+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_INTF = AF_INTF
+PF_RIF = AF_RIF
+PF_NDD = AF_NDD
+PF_MAX = AF_MAX
+SOMAXCONN = 10
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+SCM_RIGHTS = 0x01
+MSG_MAXIOVLEN = 16
diff --git a/Lib/aix3/TERMIOS.py b/Lib/aix3/TERMIOS.py
new file mode 100644
index 0000000000..a048cd9f88
--- /dev/null
+++ b/Lib/aix3/TERMIOS.py
@@ -0,0 +1,195 @@
+# Generated by h2py from /usr/include/termios.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+
+# Included from stddef.h
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+NCCS = 16
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCIFLUSH = 0
+TCOFLUSH = 1
+TCIOFLUSH = 2
+TCOOFF = 0
+TCOON = 1
+TCIOFF = 2
+TCION = 3
+VINTR = 0
+VQUIT = 1
+VERASE = 2
+VKILL = 3
+VEOF = 4
+VEOL = 5
+VSTART = 7
+VSTOP = 8
+VSUSP = 9
+VMIN = 4
+VTIME = 5
+VEOL2 = 6
+VDSUSP = 10
+VREPRINT = 11
+VDISCRD = 12
+VWERSE = 13
+VLNEXT = 14
+VSTRT = VSTART
+B0 = 0x00000000
+B50 = 0x00000001
+B75 = 0x00000002
+B110 = 0x00000003
+B134 = 0x00000004
+B150 = 0x00000005
+B200 = 0x00000006
+B300 = 0x00000007
+B600 = 0x00000008
+B1200 = 0x00000009
+B1800 = 0x0000000a
+B2400 = 0x0000000b
+B4800 = 0x0000000c
+B9600 = 0x0000000d
+B19200 = 0x0000000e
+B38400 = 0x0000000f
+EXTA = B19200
+EXTB = B38400
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IUCLC = 0x00000800
+IXANY = 0x00001000
+IMAXBEL = 0x00010000
+OPOST = 0x00000001
+OLCUC = 0x00000002
+ONLCR = 0x00000004
+OCRNL = 0x00000008
+ONOCR = 0x00000010
+ONLRET = 0x00000020
+OFILL = 0x00000040
+OFDEL = 0x00000080
+CRDLY = 0x00000300
+CR0 = 0x00000000
+CR1 = 0x00000100
+CR2 = 0x00000200
+CR3 = 0x00000300
+TABDLY = 0x00000c00
+TAB0 = 0x00000000
+TAB1 = 0x00000400
+TAB2 = 0x00000800
+TAB3 = 0x00000c00
+BSDLY = 0x00001000
+BS0 = 0x00000000
+BS1 = 0x00001000
+FFDLY = 0x00002000
+FF0 = 0x00000000
+FF1 = 0x00002000
+NLDLY = 0x00004000
+NL0 = 0x00000000
+NL1 = 0x00004000
+VTDLY = 0x00008000
+VT0 = 0x00000000
+VT1 = 0x00008000
+DLY_MASK = (NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY)
+_CBAUD = 0x0000000f
+CSIZE = 0x00000030
+CS5 = 0x00000000
+CS6 = 0x00000010
+CS7 = 0x00000020
+CS8 = 0x00000030
+CSTOPB = 0x00000040
+CREAD = 0x00000080
+PARENB = 0x00000100
+PARODD = 0x00000200
+HUPCL = 0x00000400
+CLOCAL = 0x00000800
+_CIBAUD = 0x000f0000
+_IBSHIFT = 16
+CIBAUD = _CIBAUD
+IBSHIFT = _IBSHIFT
+PAREXT = 0x00100000
+ISIG = 0x00000001
+ICANON = 0x00000002
+XCASE = 0x00000004
+ECHO = 0x00000008
+ECHOE = 0x00000010
+ECHOK = 0x00000020
+ECHONL = 0x00000040
+NOFLSH = 0x00000080
+TOSTOP = 0x00010000
+ECHOCTL = 0x00020000
+ECHOPRT = 0x00040000
+ECHOKE = 0x00080000
+FLUSHO = 0x00100000
+PENDIN = 0x20000000
+IEXTEN = 0x00200000
diff --git a/Lib/aix3/regen b/Lib/aix3/regen
new file mode 100755
index 0000000000..256e7d2466
--- /dev/null
+++ b/Lib/aix3/regen
@@ -0,0 +1,11 @@
+#! /bin/sh
+case `uname -sv` in
+'AIX 3'*) ;;
+*) echo Probably not on an AIX 3 system 1>&2
+ exit 1;;
+esac
+set -v
+h2py.py /usr/include/fcntl.h
+h2py.py /usr/include/sys/socket.h
+h2py.py -i '(u_long)' /usr/include/netinet/in.h
+h2py.py /usr/include/termios.h
diff --git a/Lib/aix4/FCNTL.py b/Lib/aix4/FCNTL.py
new file mode 100644
index 0000000000..739ada40fc
--- /dev/null
+++ b/Lib/aix4/FCNTL.py
@@ -0,0 +1,387 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+NULL = 0
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+ITIMER_REAL1 = 20
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+TIMERID_REAL1 = (ITIMER_REAL1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+NALRM_THREAD = 1
+NTIMERS_THREAD = (NALRM_THREAD)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+NULL = 0
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+
+# Included from stddef.h
+NULL = 0
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+
+# Included from sys/flock.h
+F_RDLCK = 01
+F_WRLCK = 02
+F_UNLCK = 03
+INOFLCK = 1
+SETFLCK = 2
+SLPFLCK = 4
+LCK_UNBLOCK = 0
+LCK_BLOCKER = 1
+LCK_BLOCKED = 2
+LCK_WASBLOCK = 4
+MAXEND = 017777777777
+RMTLOCK = 1
+def ENF_LOCK(mode): return (((mode) & (ISGID | IEXEC | (IEXEC >> 3) | (IEXEC >> 6))) == ISGID)
+
+O_RDONLY = 00000000
+O_WRONLY = 00000001
+O_RDWR = 00000002
+O_ACCMODE = 3
+O_NONBLOCK = 00000004
+O_APPEND = 00000010
+O_CREAT = 00000400
+O_TRUNC = 00001000
+O_EXCL = 00002000
+O_NOCTTY = 00004000
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETLK = 5
+F_SETLK = 6
+F_SETLKW = 7
+FD_CLOEXEC = 1
+
+# Included from unistd.h
+
+# Included from sys/access.h
+F_OK = 00
+X_OK = 01
+W_OK = 02
+R_OK = 04
+R_ACC = 04
+W_ACC = 02
+X_ACC = 01
+E_ACC = 00
+NO_ACC = 00
+ACC_SELF = 0x00
+ACC_INVOKER = 0x01
+ACC_OBJ_OWNER = 0x02
+ACC_OBJ_GROUP = 0x04
+ACC_OTHERS = 0x08
+ACC_ANY = 0x10
+ACC_ALL = 0x20
+ACC_PERMIT = 0x01
+ACC_DENY = 0x02
+ACC_SPECIFY = 0x03
+SEEK_SET = 0
+SEEK_CUR = 1
+SEEK_END = 2
+STDIN_FILENO = 0
+STDOUT_FILENO = 1
+STDERR_FILENO = 2
+_POSIX_JOB_CONTROL = 1
+_POSIX_SAVED_IDS = 1
+_POSIX_VERSION = 199009L
+_POSIX2_VERSION = 199209L
+_POSIX2_C_VERSION = 199209L
+_POSIX_REENTRANT_FUNCTIONS = 1
+_POSIX_THREADS = 1
+_POSIX_THREAD_ATTR_STACKSIZE = 1
+_POSIX_THREAD_PRIORITY_SCHEDULING = 1
+_POSIX_CHOWN_RESTRICTED = 0
+_POSIX_VDISABLE = 0xFF
+_POSIX_NO_TRUNC = 0
+NULL = 0
+_CS_PATH = 1
+_CSPATH = "/usr/bin"
+_PC_CHOWN_RESTRICTED = 10
+_PC_LINK_MAX = 11
+_PC_MAX_CANON = 12
+_PC_MAX_INPUT = 13
+_PC_NAME_MAX = 14
+_PC_NO_TRUNC = 15
+_PC_PATH_MAX = 16
+_PC_PIPE_BUF = 17
+_PC_VDISABLE = 18
+_SC_ARG_MAX = 0
+_SC_CHILD_MAX = 1
+_SC_CLK_TCK = 2
+_SC_NGROUPS_MAX = 3
+_SC_OPEN_MAX = 4
+_SC_STREAM_MAX = 5
+_SC_TZNAME_MAX = 6
+_SC_JOB_CONTROL = 7
+_SC_SAVED_IDS = 8
+_SC_VERSION = 9
+_SC_POSIX_ARG_MAX = 10
+_SC_POSIX_CHILD_MAX = 11
+_SC_POSIX_LINK_MAX = 12
+_SC_POSIX_MAX_CANON = 13
+_SC_POSIX_MAX_INPUT = 14
+_SC_POSIX_NAME_MAX = 15
+_SC_POSIX_NGROUPS_MAX = 16
+_SC_POSIX_OPEN_MAX = 17
+_SC_POSIX_PATH_MAX = 18
+_SC_POSIX_PIPE_BUF = 19
+_SC_POSIX_SSIZE_MAX = 20
+_SC_POSIX_STREAM_MAX = 21
+_SC_POSIX_TZNAME_MAX = 22
+_SC_BC_BASE_MAX = 23
+_SC_BC_DIM_MAX = 24
+_SC_BC_SCALE_MAX = 25
+_SC_BC_STRING_MAX = 26
+_SC_EQUIV_CLASS_MAX = 27
+_SC_EXPR_NEST_MAX = 28
+_SC_LINE_MAX = 29
+_SC_RE_DUP_MAX = 30
+_SC_2_VERSION = 31
+_SC_2_C_DEV = 32
+_SC_2_FORT_DEV = 33
+_SC_2_FORT_RUN = 34
+_SC_2_LOCALEDEF = 35
+_SC_2_SW_DEV = 36
+_SC_POSIX2_BC_BASE_MAX = 37
+_SC_POSIX2_BC_DIM_MAX = 38
+_SC_POSIX2_BC_SCALE_MAX = 39
+_SC_POSIX2_BC_STRING_MAX = 40
+_SC_POSIX2_EQUIV_CLASS_MAX = 41
+_SC_POSIX2_EXPR_NEST_MAX = 42
+_SC_POSIX2_LINE_MAX = 43
+_SC_POSIX2_RE_DUP_MAX = 44
+_SC_PASS_MAX = 45
+_SC_XOPEN_VERSION = 46
+_SC_ATEXIT_MAX = 47
+_SC_PAGE_SIZE = 48
+_SC_AES_OS_VERSION = 49
+_SC_COLL_WEIGHTS_MAX = 50
+_SC_2_C_BIND = 51
+_SC_2_C_VERSION = 52
+_SC_2_UPE = 53
+_SC_2_CHAR_TERM = 54
+_SC_XOPEN_SHM = 55
+_SC_XOPEN_CRYPT = 56
+_SC_XOPEN_ENH_I18N = 57
+_SC_PAGESIZE = _SC_PAGE_SIZE
+_SC_IOV_MAX = 58
+_SC_REENTRANT_FUNCTIONS = 59
+_SC_THREADS = 60
+_SC_THREAD_ATTR_STACKADDR = 61
+_SC_THREAD_ATTR_STACKSIZE = 62
+_SC_THREAD_FORKALL = 63
+_SC_THREAD_PRIORITY_SCHEDULING = 64
+_SC_THREAD_PRIO_INHERIT = 65
+_SC_THREAD_PRIO_PROTECT = 66
+_SC_THREAD_PROCESS_SHARED = 67
+_SC_THREAD_DATAKEYS_MAX = 68
+_SC_THREAD_STACK_MIN = 69
+_SC_THREAD_THREADS_MAX = 70
+_SC_NPROCESSORS_CONF = 71
+_SC_NPROCESSORS_ONLN = 72
+_XOPEN_VERSION = 4
+_XOPEN_XCU_VERSION = 4
+_XOPEN_XPG3 = 1
+_XOPEN_XPG4 = 1
+_POSIX2_C_BIND = 1
+_POSIX2_C_DEV = 1
+_POSIX2_CHAR_TERM = 1
+_POSIX2_LOCALEDEF = 1
+_POSIX2_UPE = 1
+_POSIX2_FORT_DEV = (-1)
+_POSIX2_FORT_RUN = (-1)
+_POSIX2_SW_DEV = 1
+_XOPEN_CRYPT = 1
+_XOPEN_SHM = 1
+_XOPEN_ENH_I18N = 1
+
+# Included from sys/lockf.h
+
+# Included from sys/stat.h
+
+# Included from sys/mode.h
+_S_IFMT = 0170000
+_S_IFREG = 0100000
+_S_IFDIR = 0040000
+_S_IFBLK = 0060000
+_S_IFCHR = 0020000
+_S_IFIFO = 0010000
+S_ISUID = 0004000
+S_ISGID = 0002000
+S_IRWXU = 0000700
+S_IRUSR = 0000400
+S_IWUSR = 0000200
+S_IXUSR = 0000100
+S_IRWXG = 0000070
+S_IRGRP = 0000040
+S_IWGRP = 0000020
+S_IXGRP = 0000010
+S_IRWXO = 0000007
+S_IROTH = 0000004
+S_IWOTH = 0000002
+S_IXOTH = 0000001
+def S_ISFIFO(m): return (((m)&(_S_IFMT)) == (_S_IFIFO))
+
+def S_ISDIR(m): return (((m)&(_S_IFMT)) == (_S_IFDIR))
+
+def S_ISCHR(m): return (((m)&(_S_IFMT)) == (_S_IFCHR))
+
+def S_ISBLK(m): return (((m)&(_S_IFMT)) == (_S_IFBLK))
+
+def S_ISREG(m): return (((m)&(_S_IFMT)) == (_S_IFREG))
+
+S_ISVTX = 0001000
+S_IFMT = _S_IFMT
+S_IFREG = _S_IFREG
+S_IFDIR = _S_IFDIR
+S_IFBLK = _S_IFBLK
+S_IFCHR = _S_IFCHR
+S_IFIFO = _S_IFIFO
+S_IFSOCK = 0140000
+S_IFLNK = 0120000
+S_IREAD = 0000400
+S_IWRITE = 0000200
+S_IEXEC = 0000100
+S_ENFMT = S_ISGID
+S_IFMPX = (S_IFCHR|S_ISVTX)
+def S_ISMPX(m): return (((m)&(S_IFMT|S_ISVTX)) == (S_IFMPX))
+
+def S_ISLNK(m): return (((m)&(S_IFMT)) == (S_IFLNK))
+
+def S_ISSOCK(m): return (((m)&(S_IFMT)) == (S_IFSOCK))
+
+IFMT = S_IFMT
+IFDIR = S_IFDIR
+IFCHR = S_IFCHR
+IFBLK = S_IFBLK
+IFREG = S_IFREG
+IFIFO = S_IFIFO
+IFSOCK = S_IFSOCK
+IFLNK = S_IFLNK
+ISUID = S_ISUID
+ISGID = S_ISGID
+ISVTX = S_ISVTX
+IREAD = S_IREAD
+IWRITE = S_IWRITE
+IEXEC = S_IEXEC
+S_INMOD = 0xC0000000
+S_IXMOD = 0x40000000
+S_IJRNL = 0x04000000
+S_IXACL = 0x02000000
+S_ITCB = 0x01000000
+S_ITP = 0x00800000
+FS_VMP = 01
+FS_MOUNT = FS_VMP
+FS_REMOTE = 02
+SDEV_REMOTE = 0x80000000
+STX_NORMAL = 0x00
+STX_LINK = 0x01
+STX_MOUNT = 0x02
+STX_HIDDEN = 0x04
+S_ENFMT = S_ISGID
+F_ULOCK = 0
+F_LOCK = 1
+F_TLOCK = 2
+F_TEST = 3
+_AES_OS_VERSION = 1
+O_SYNC = 00000020
+O_NONE = 00000003
+O_EXEC = 00000040
+O_RSHARE = 00010000
+O_DEFER = 00020000
+O_DELAY = 00040000
+O_NDELAY = 00100000
+O_NSHARE = 00200000
+F_GETOWN = 8
+F_SETOWN = 9
+F_CLOSEM = 10
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+FNDELAY = O_NDELAY
+FNONBLOCK = O_NONBLOCK
+FAPPEND = O_APPEND
+FSYNC = O_SYNC
+FASYNC = 00400000
+FSYNCALL = 02000000
+FOPEN = (-1)
+FREAD = (O_RDONLY-FOPEN)
+FWRITE = (O_WRONLY-FOPEN)
+FMPX = 00000200
+FMASK = 00374377
+FFCNTL = (FNONBLOCK|FNDELAY|FAPPEND|FSYNC|FASYNC)
+FCREAT = O_CREAT
+FTRUNC = O_TRUNC
+FEXCL = O_EXCL
+FRSHARE = O_RSHARE
+FDEFER = O_DEFER
+FDELAY = O_DELAY
+FNDELAY = O_NDELAY
+FNSHARE = O_NSHARE
+FEXEC = O_EXEC
+FNOCTTY = O_NOCTTY
+FMOUNT = 01000000
+FREVOKED = 0x20000000
+FKERNEL = 0x40000000
+FAIO = 00000100
+FDOCLONE = 0x10000000
+GCFMARK = 0x00100000
+GCFDEFER = 0x00200000
diff --git a/Lib/aix4/IN.py b/Lib/aix4/IN.py
new file mode 100644
index 0000000000..00f0e1f878
--- /dev/null
+++ b/Lib/aix4/IN.py
@@ -0,0 +1,165 @@
+# Generated by h2py from /usr/include/netinet/in.h
+
+# Included from net/nh.h
+
+# Included from sys/machine.h
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = BIG_ENDIAN
+DEFAULT_GPR = 0xDEADBEEF
+MSR_EE = 0x8000
+MSR_PR = 0x4000
+MSR_FP = 0x2000
+MSR_ME = 0x1000
+MSR_FE = 0x0800
+MSR_FE0 = 0x0800
+MSR_SE = 0x0400
+MSR_BE = 0x0200
+MSR_IE = 0x0100
+MSR_FE1 = 0x0100
+MSR_AL = 0x0080
+MSR_IP = 0x0040
+MSR_IR = 0x0020
+MSR_DR = 0x0010
+MSR_PM = 0x0004
+DEFAULT_MSR = (MSR_EE | MSR_ME | MSR_AL | MSR_IR | MSR_DR)
+DEFAULT_USER_MSR = (DEFAULT_MSR | MSR_PR)
+CR_LT = 0x80000000
+CR_GT = 0x40000000
+CR_EQ = 0x20000000
+CR_SO = 0x10000000
+CR_FX = 0x08000000
+CR_FEX = 0x04000000
+CR_VX = 0x02000000
+CR_OX = 0x01000000
+XER_SO = 0x80000000
+XER_OV = 0x40000000
+XER_CA = 0x20000000
+def XER_COMP_BYTE(xer): return ((xer >> 8) & 0x000000FF)
+
+def XER_LENGTH(xer): return (xer & 0x0000007F)
+
+DSISR_IO = 0x80000000
+DSISR_PFT = 0x40000000
+DSISR_LOCK = 0x20000000
+DSISR_FPIO = 0x10000000
+DSISR_PROT = 0x08000000
+DSISR_LOOP = 0x04000000
+DSISR_DRST = 0x04000000
+DSISR_ST = 0x02000000
+DSISR_SEGB = 0x01000000
+DSISR_DABR = 0x00400000
+DSISR_EAR = 0x00100000
+SRR_IS_PFT = 0x40000000
+SRR_IS_ISPEC = 0x20000000
+SRR_IS_IIO = 0x10000000
+SRR_IS_GUARD = 0x10000000
+SRR_IS_PROT = 0x08000000
+SRR_IS_LOOP = 0x04000000
+SRR_PR_FPEN = 0x00100000
+SRR_PR_INVAL = 0x00080000
+SRR_PR_PRIV = 0x00040000
+SRR_PR_TRAP = 0x00020000
+SRR_PR_IMPRE = 0x00010000
+def BUID_7F_SRVAL(raddr): return (0x87F00000 | (((uint)(raddr)) >> 28))
+
+BT_256M = 0x1FFC
+BT_128M = 0x0FFC
+BT_64M = 0x07FC
+BT_32M = 0x03FC
+BT_16M = 0x01FC
+BT_8M = 0x00FC
+BT_4M = 0x007C
+BT_2M = 0x003C
+BT_1M = 0x001C
+BT_512K = 0x000C
+BT_256K = 0x0004
+BT_128K = 0x0000
+BT_NOACCESS = 0x0
+BT_RDONLY = 0x1
+BT_WRITE = 0x2
+BT_VS = 0x2
+BT_VP = 0x1
+def BAT_ESEG(dbatu): return (((uint)(dbatu) >> 28))
+
+MIN_BAT_SIZE = 0x00020000
+MAX_BAT_SIZE = 0x10000000
+def ntohl(x): return (x)
+
+def ntohs(x): return (x)
+
+def htonl(x): return (x)
+
+def htons(x): return (x)
+
+IPPROTO_IP = 0
+IPPROTO_ICMP = 1
+IPPROTO_IGMP = 2
+IPPROTO_GGP = 3
+IPPROTO_TCP = 6
+IPPROTO_EGP = 8
+IPPROTO_PUP = 12
+IPPROTO_UDP = 17
+IPPROTO_IDP = 22
+IPPROTO_TP = 29
+IPPROTO_LOCAL = 63
+IPPROTO_EON = 80
+IPPROTO_BIP = 0x53
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_TIMESERVER = 37
+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)
+
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+IN_CLASSD_NET = 0xf0000000
+IN_CLASSD_NSHIFT = 28
+IN_CLASSD_HOST = 0x0fffffff
+INADDR_UNSPEC_GROUP = 0xe0000000
+INADDR_ALLHOSTS_GROUP = 0xe0000001
+INADDR_MAX_LOCAL_GROUP = 0xe00000ff
+def IN_EXPERIMENTAL(i): return (((long)(i) & 0xe0000000) == 0xe0000000)
+
+def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_ANY = 0x00000000
+INADDR_BROADCAST = 0xffffffff
+INADDR_LOOPBACK = 0x7f000001
+INADDR_NONE = 0xffffffff
+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_DEFAULT_MULTICAST_TTL = 1
+IP_DEFAULT_MULTICAST_LOOP = 1
+IP_MAX_MEMBERSHIPS = 20
diff --git a/Lib/aix4/SOCKET.py b/Lib/aix4/SOCKET.py
new file mode 100644
index 0000000000..5f7ee3ea82
--- /dev/null
+++ b/Lib/aix4/SOCKET.py
@@ -0,0 +1,93 @@
+# 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_CKSUMRECV = 0x0800
+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_UNIX = 1
+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_INTF = 20
+AF_RIF = 21
+AF_NETWARE = 22
+AF_NDD = 23
+AF_MAX = 30
+AF_MAX = 20
+PF_UNSPEC = AF_UNSPEC
+PF_UNIX = AF_UNIX
+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_INTF = AF_INTF
+PF_RIF = AF_RIF
+PF_INTF = AF_INTF
+PF_NDD = AF_NDD
+PF_MAX = AF_MAX
+SOMAXCONN = 10
+SOMAXCONN = 5
+MSG_MAXIOVLEN = 16
+UIO_MAXIOV = 1024
+UIO_SMALLIOV = 8
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+MSG_NONBLOCK = 0x4000
+MSG_COMPAT = 0x8000
+SCM_RIGHTS = 0x01
diff --git a/Lib/aix4/TERMIOS.py b/Lib/aix4/TERMIOS.py
new file mode 100644
index 0000000000..6b58f03c8b
--- /dev/null
+++ b/Lib/aix4/TERMIOS.py
@@ -0,0 +1,206 @@
+# Generated by h2py from /usr/include/termios.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+NULL = 0
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+ITIMER_REAL1 = 20
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+TIMERID_REAL1 = (ITIMER_REAL1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+NALRM_THREAD = 1
+NTIMERS_THREAD = (NALRM_THREAD)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+NULL = 0
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+
+# Included from stddef.h
+NULL = 0
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+NCCS = 16
+CSMAP_DIR = "/usr/lib/nls/csmap/"
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCIFLUSH = 0
+TCOFLUSH = 1
+TCIOFLUSH = 2
+TCOOFF = 0
+TCOON = 1
+TCIOFF = 2
+TCION = 3
+VINTR = 0
+VQUIT = 1
+VERASE = 2
+VKILL = 3
+VEOF = 4
+VEOL = 5
+VSTART = 7
+VSTOP = 8
+VSUSP = 9
+VMIN = 4
+VTIME = 5
+VEOL2 = 6
+VDSUSP = 10
+VREPRINT = 11
+VDISCRD = 12
+VWERSE = 13
+VLNEXT = 14
+VSTRT = VSTART
+B0 = 0x00000000
+B50 = 0x00000001
+B75 = 0x00000002
+B110 = 0x00000003
+B134 = 0x00000004
+B150 = 0x00000005
+B200 = 0x00000006
+B300 = 0x00000007
+B600 = 0x00000008
+B1200 = 0x00000009
+B1800 = 0x0000000a
+B2400 = 0x0000000b
+B4800 = 0x0000000c
+B9600 = 0x0000000d
+B19200 = 0x0000000e
+B38400 = 0x0000000f
+EXTA = B19200
+EXTB = B38400
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IUCLC = 0x00000800
+IXANY = 0x00001000
+IMAXBEL = 0x00010000
+OPOST = 0x00000001
+OLCUC = 0x00000002
+ONLCR = 0x00000004
+OCRNL = 0x00000008
+ONOCR = 0x00000010
+ONLRET = 0x00000020
+OFILL = 0x00000040
+OFDEL = 0x00000080
+CRDLY = 0x00000300
+CR0 = 0x00000000
+CR1 = 0x00000100
+CR2 = 0x00000200
+CR3 = 0x00000300
+TABDLY = 0x00000c00
+TAB0 = 0x00000000
+TAB1 = 0x00000400
+TAB2 = 0x00000800
+TAB3 = 0x00000c00
+BSDLY = 0x00001000
+BS0 = 0x00000000
+BS1 = 0x00001000
+FFDLY = 0x00002000
+FF0 = 0x00000000
+FF1 = 0x00002000
+NLDLY = 0x00004000
+NL0 = 0x00000000
+NL1 = 0x00004000
+VTDLY = 0x00008000
+VT0 = 0x00000000
+VT1 = 0x00008000
+DLY_MASK = (NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY)
+OXTABS = 0x00040000
+ONOEOT = 0x00080000
+_CBAUD = 0x0000000f
+CSIZE = 0x00000030
+CS5 = 0x00000000
+CS6 = 0x00000010
+CS7 = 0x00000020
+CS8 = 0x00000030
+CSTOPB = 0x00000040
+CREAD = 0x00000080
+PARENB = 0x00000100
+PARODD = 0x00000200
+HUPCL = 0x00000400
+CLOCAL = 0x00000800
+_CIBAUD = 0x000f0000
+_IBSHIFT = 16
+CIBAUD = _CIBAUD
+IBSHIFT = _IBSHIFT
+PAREXT = 0x00100000
+ISIG = 0x00000001
+ICANON = 0x00000002
+XCASE = 0x00000004
+ECHO = 0x00000008
+ECHOE = 0x00000010
+ECHOK = 0x00000020
+ECHONL = 0x00000040
+NOFLSH = 0x00000080
+TOSTOP = 0x00010000
+ECHOCTL = 0x00020000
+ECHOPRT = 0x00040000
+ECHOKE = 0x00080000
+FLUSHO = 0x00100000
+ALTWERASE = 0x00400000
+PENDIN = 0x20000000
+IEXTEN = 0x00200000
diff --git a/Lib/aix4/regen b/Lib/aix4/regen
new file mode 100755
index 0000000000..94016627cc
--- /dev/null
+++ b/Lib/aix4/regen
@@ -0,0 +1,11 @@
+#! /bin/sh
+case `uname -sv` in
+'AIX 4'*) ;;
+*) echo Probably not on an AIX 4 system 1>&2
+ exit 1;;
+esac
+set -v
+h2py.py /usr/include/fcntl.h
+h2py.py /usr/include/sys/socket.h
+h2py.py -i '(u_long)' /usr/include/netinet/in.h
+h2py.py /usr/include/termios.h
diff --git a/Lib/plat-aix3/FCNTL.py b/Lib/plat-aix3/FCNTL.py
new file mode 100644
index 0000000000..90e9ea52b8
--- /dev/null
+++ b/Lib/plat-aix3/FCNTL.py
@@ -0,0 +1,145 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+
+# Included from stddef.h
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+
+# Included from sys/flock.h
+F_RDLCK = 01
+F_WRLCK = 02
+F_UNLCK = 03
+INOFLCK = 1
+SETFLCK = 2
+SLPFLCK = 4
+LCK_UNBLOCK = 0
+LCK_BLOCKER = 1
+LCK_BLOCKED = 2
+LCK_WASBLOCK = 4
+MAXEND = 017777777777
+RMTLOCK = 1
+def ENF_LOCK(mode): return (((mode) & (ISGID | IEXEC | (IEXEC >> 3) | (IEXEC >> 6))) == ISGID)
+
+O_RDONLY = 00000000
+O_WRONLY = 00000001
+O_RDWR = 00000002
+O_ACCMODE = 3
+O_NONBLOCK = 00000004
+O_APPEND = 00000010
+O_CREAT = 00000400
+O_TRUNC = 00001000
+O_EXCL = 00002000
+O_NOCTTY = 00004000
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETLK = 5
+F_SETLK = 6
+F_SETLKW = 7
+FD_CLOEXEC = 1
+O_SYNC = 00000020
+O_NONE = 00000003
+O_EXEC = 00000040
+O_RSHARE = 00010000
+O_DEFER = 00020000
+O_DELAY = 00040000
+O_NDELAY = 00100000
+O_NSHARE = 00200000
+F_GETOWN = 8
+F_SETOWN = 9
+F_CLOSEM = 10
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+FNDELAY = O_NDELAY
+FNONBLOCK = O_NONBLOCK
+FAPPEND = O_APPEND
+FSYNC = O_SYNC
+FASYNC = 00400000
+FOPEN = (-1)
+FREAD = (O_RDONLY-FOPEN)
+FWRITE = (O_WRONLY-FOPEN)
+FMPX = 00000200
+FMASK = 00374377
+FFCNTL = (FNONBLOCK|FNDELAY|FAPPEND|FSYNC|FASYNC)
+FCREAT = O_CREAT
+FTRUNC = O_TRUNC
+FEXCL = O_EXCL
+FRSHARE = O_RSHARE
+FDEFER = O_DEFER
+FDELAY = O_DELAY
+FNDELAY = O_NDELAY
+FNSHARE = O_NSHARE
+FEXEC = O_EXEC
+FNOCTTY = O_NOCTTY
+FMOUNT = 01000000
+FREVOKED = 0x20000000
+FKERNEL = 0x40000000
+FAIO = 00000100
+FDOCLONE = 0x10000000
diff --git a/Lib/plat-aix3/IN.py b/Lib/plat-aix3/IN.py
new file mode 100644
index 0000000000..2c57362fc8
--- /dev/null
+++ b/Lib/plat-aix3/IN.py
@@ -0,0 +1,126 @@
+# Generated by h2py from /usr/include/netinet/in.h
+
+# Included from net/nh.h
+
+# Included from sys/machine.h
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = BIG_ENDIAN
+DEFAULT_GPR = 0xDEADBEEF
+MSR_EE = 0x8000
+MSR_PR = 0x4000
+MSR_FP = 0x2000
+MSR_ME = 0x1000
+MSR_FE = 0x0800
+MSR_FE0 = 0x0800
+MSR_SE = 0x0400
+MSR_BE = 0x0200
+MSR_IE = 0x0100
+MSR_FE1 = 0x0100
+MSR_AL = 0x0080
+MSR_IP = 0x0040
+MSR_IR = 0x0020
+MSR_DR = 0x0010
+MSR_PM = 0x0004
+DEFAULT_MSR = (MSR_EE | MSR_ME | MSR_AL | MSR_IR | MSR_DR)
+DEFAULT_USER_MSR = (DEFAULT_MSR | MSR_PR)
+CR_LT = 0x80000000
+CR_GT = 0x40000000
+CR_EQ = 0x20000000
+CR_SO = 0x10000000
+CR_FX = 0x08000000
+CR_FEX = 0x04000000
+CR_VX = 0x02000000
+CR_OX = 0x01000000
+XER_SO = 0x80000000
+XER_OV = 0x40000000
+XER_CA = 0x20000000
+def XER_COMP_BYTE(xer): return ((xer >> 8) & 0x000000FF)
+
+def XER_LENGTH(xer): return (xer & 0x0000007F)
+
+DSISR_IO = 0x80000000
+DSISR_PFT = 0x40000000
+DSISR_LOCK = 0x20000000
+DSISR_FPIO = 0x10000000
+DSISR_PROT = 0x08000000
+DSISR_LOOP = 0x04000000
+DSISR_DRST = 0x04000000
+DSISR_ST = 0x02000000
+DSISR_SEGB = 0x01000000
+DSISR_DABR = 0x00400000
+DSISR_EAR = 0x00100000
+SRR_IS_PFT = 0x40000000
+SRR_IS_ISPEC = 0x20000000
+SRR_IS_IIO = 0x10000000
+SRR_IS_PROT = 0x08000000
+SRR_IS_LOOP = 0x04000000
+SRR_PR_FPEN = 0x00100000
+SRR_PR_INVAL = 0x00080000
+SRR_PR_PRIV = 0x00040000
+SRR_PR_TRAP = 0x00020000
+SRR_PR_IMPRE = 0x00010000
+def ntohl(x): return (x)
+
+def ntohs(x): return (x)
+
+def htonl(x): return (x)
+
+def htons(x): return (x)
+
+IPPROTO_IP = 0
+IPPROTO_ICMP = 1
+IPPROTO_GGP = 3
+IPPROTO_TCP = 6
+IPPROTO_EGP = 8
+IPPROTO_PUP = 12
+IPPROTO_UDP = 17
+IPPROTO_IDP = 22
+IPPROTO_TP = 29
+IPPROTO_LOCAL = 63
+IPPROTO_EON = 80
+IPPROTO_BIP = 0x53
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_TIMESERVER = 37
+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)
+
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+def IN_EXPERIMENTAL(i): return (((long)(i) & 0xe0000000) == 0xe0000000)
+
+def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_ANY = 0x00000000
+INADDR_LOOPBACK = 0x7f000001
+INADDR_BROADCAST = 0xffffffff
+INADDR_NONE = 0xffffffff
+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
diff --git a/Lib/plat-aix3/SOCKET.py b/Lib/plat-aix3/SOCKET.py
new file mode 100644
index 0000000000..5e529146b8
--- /dev/null
+++ b/Lib/plat-aix3/SOCKET.py
@@ -0,0 +1,86 @@
+# 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_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_UNIX = 1
+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_INTF = 20
+AF_RIF = 21
+PF_INTF = AF_INTF
+AF_NETWARE = 22
+AF_NDD = 23
+AF_MAX = 30
+PF_UNSPEC = AF_UNSPEC
+PF_UNIX = AF_UNIX
+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_INTF = AF_INTF
+PF_RIF = AF_RIF
+PF_NDD = AF_NDD
+PF_MAX = AF_MAX
+SOMAXCONN = 10
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+SCM_RIGHTS = 0x01
+MSG_MAXIOVLEN = 16
diff --git a/Lib/plat-aix3/TERMIOS.py b/Lib/plat-aix3/TERMIOS.py
new file mode 100644
index 0000000000..a048cd9f88
--- /dev/null
+++ b/Lib/plat-aix3/TERMIOS.py
@@ -0,0 +1,195 @@
+# Generated by h2py from /usr/include/termios.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+
+# Included from stddef.h
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+NCCS = 16
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCIFLUSH = 0
+TCOFLUSH = 1
+TCIOFLUSH = 2
+TCOOFF = 0
+TCOON = 1
+TCIOFF = 2
+TCION = 3
+VINTR = 0
+VQUIT = 1
+VERASE = 2
+VKILL = 3
+VEOF = 4
+VEOL = 5
+VSTART = 7
+VSTOP = 8
+VSUSP = 9
+VMIN = 4
+VTIME = 5
+VEOL2 = 6
+VDSUSP = 10
+VREPRINT = 11
+VDISCRD = 12
+VWERSE = 13
+VLNEXT = 14
+VSTRT = VSTART
+B0 = 0x00000000
+B50 = 0x00000001
+B75 = 0x00000002
+B110 = 0x00000003
+B134 = 0x00000004
+B150 = 0x00000005
+B200 = 0x00000006
+B300 = 0x00000007
+B600 = 0x00000008
+B1200 = 0x00000009
+B1800 = 0x0000000a
+B2400 = 0x0000000b
+B4800 = 0x0000000c
+B9600 = 0x0000000d
+B19200 = 0x0000000e
+B38400 = 0x0000000f
+EXTA = B19200
+EXTB = B38400
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IUCLC = 0x00000800
+IXANY = 0x00001000
+IMAXBEL = 0x00010000
+OPOST = 0x00000001
+OLCUC = 0x00000002
+ONLCR = 0x00000004
+OCRNL = 0x00000008
+ONOCR = 0x00000010
+ONLRET = 0x00000020
+OFILL = 0x00000040
+OFDEL = 0x00000080
+CRDLY = 0x00000300
+CR0 = 0x00000000
+CR1 = 0x00000100
+CR2 = 0x00000200
+CR3 = 0x00000300
+TABDLY = 0x00000c00
+TAB0 = 0x00000000
+TAB1 = 0x00000400
+TAB2 = 0x00000800
+TAB3 = 0x00000c00
+BSDLY = 0x00001000
+BS0 = 0x00000000
+BS1 = 0x00001000
+FFDLY = 0x00002000
+FF0 = 0x00000000
+FF1 = 0x00002000
+NLDLY = 0x00004000
+NL0 = 0x00000000
+NL1 = 0x00004000
+VTDLY = 0x00008000
+VT0 = 0x00000000
+VT1 = 0x00008000
+DLY_MASK = (NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY)
+_CBAUD = 0x0000000f
+CSIZE = 0x00000030
+CS5 = 0x00000000
+CS6 = 0x00000010
+CS7 = 0x00000020
+CS8 = 0x00000030
+CSTOPB = 0x00000040
+CREAD = 0x00000080
+PARENB = 0x00000100
+PARODD = 0x00000200
+HUPCL = 0x00000400
+CLOCAL = 0x00000800
+_CIBAUD = 0x000f0000
+_IBSHIFT = 16
+CIBAUD = _CIBAUD
+IBSHIFT = _IBSHIFT
+PAREXT = 0x00100000
+ISIG = 0x00000001
+ICANON = 0x00000002
+XCASE = 0x00000004
+ECHO = 0x00000008
+ECHOE = 0x00000010
+ECHOK = 0x00000020
+ECHONL = 0x00000040
+NOFLSH = 0x00000080
+TOSTOP = 0x00010000
+ECHOCTL = 0x00020000
+ECHOPRT = 0x00040000
+ECHOKE = 0x00080000
+FLUSHO = 0x00100000
+PENDIN = 0x20000000
+IEXTEN = 0x00200000
diff --git a/Lib/plat-aix3/regen b/Lib/plat-aix3/regen
new file mode 100755
index 0000000000..256e7d2466
--- /dev/null
+++ b/Lib/plat-aix3/regen
@@ -0,0 +1,11 @@
+#! /bin/sh
+case `uname -sv` in
+'AIX 3'*) ;;
+*) echo Probably not on an AIX 3 system 1>&2
+ exit 1;;
+esac
+set -v
+h2py.py /usr/include/fcntl.h
+h2py.py /usr/include/sys/socket.h
+h2py.py -i '(u_long)' /usr/include/netinet/in.h
+h2py.py /usr/include/termios.h
diff --git a/Lib/plat-aix4/FCNTL.py b/Lib/plat-aix4/FCNTL.py
new file mode 100644
index 0000000000..739ada40fc
--- /dev/null
+++ b/Lib/plat-aix4/FCNTL.py
@@ -0,0 +1,387 @@
+# Generated by h2py from /usr/include/fcntl.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+NULL = 0
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+ITIMER_REAL1 = 20
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+TIMERID_REAL1 = (ITIMER_REAL1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+NALRM_THREAD = 1
+NTIMERS_THREAD = (NALRM_THREAD)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+NULL = 0
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+
+# Included from stddef.h
+NULL = 0
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+
+# Included from sys/flock.h
+F_RDLCK = 01
+F_WRLCK = 02
+F_UNLCK = 03
+INOFLCK = 1
+SETFLCK = 2
+SLPFLCK = 4
+LCK_UNBLOCK = 0
+LCK_BLOCKER = 1
+LCK_BLOCKED = 2
+LCK_WASBLOCK = 4
+MAXEND = 017777777777
+RMTLOCK = 1
+def ENF_LOCK(mode): return (((mode) & (ISGID | IEXEC | (IEXEC >> 3) | (IEXEC >> 6))) == ISGID)
+
+O_RDONLY = 00000000
+O_WRONLY = 00000001
+O_RDWR = 00000002
+O_ACCMODE = 3
+O_NONBLOCK = 00000004
+O_APPEND = 00000010
+O_CREAT = 00000400
+O_TRUNC = 00001000
+O_EXCL = 00002000
+O_NOCTTY = 00004000
+F_DUPFD = 0
+F_GETFD = 1
+F_SETFD = 2
+F_GETFL = 3
+F_SETFL = 4
+F_GETLK = 5
+F_SETLK = 6
+F_SETLKW = 7
+FD_CLOEXEC = 1
+
+# Included from unistd.h
+
+# Included from sys/access.h
+F_OK = 00
+X_OK = 01
+W_OK = 02
+R_OK = 04
+R_ACC = 04
+W_ACC = 02
+X_ACC = 01
+E_ACC = 00
+NO_ACC = 00
+ACC_SELF = 0x00
+ACC_INVOKER = 0x01
+ACC_OBJ_OWNER = 0x02
+ACC_OBJ_GROUP = 0x04
+ACC_OTHERS = 0x08
+ACC_ANY = 0x10
+ACC_ALL = 0x20
+ACC_PERMIT = 0x01
+ACC_DENY = 0x02
+ACC_SPECIFY = 0x03
+SEEK_SET = 0
+SEEK_CUR = 1
+SEEK_END = 2
+STDIN_FILENO = 0
+STDOUT_FILENO = 1
+STDERR_FILENO = 2
+_POSIX_JOB_CONTROL = 1
+_POSIX_SAVED_IDS = 1
+_POSIX_VERSION = 199009L
+_POSIX2_VERSION = 199209L
+_POSIX2_C_VERSION = 199209L
+_POSIX_REENTRANT_FUNCTIONS = 1
+_POSIX_THREADS = 1
+_POSIX_THREAD_ATTR_STACKSIZE = 1
+_POSIX_THREAD_PRIORITY_SCHEDULING = 1
+_POSIX_CHOWN_RESTRICTED = 0
+_POSIX_VDISABLE = 0xFF
+_POSIX_NO_TRUNC = 0
+NULL = 0
+_CS_PATH = 1
+_CSPATH = "/usr/bin"
+_PC_CHOWN_RESTRICTED = 10
+_PC_LINK_MAX = 11
+_PC_MAX_CANON = 12
+_PC_MAX_INPUT = 13
+_PC_NAME_MAX = 14
+_PC_NO_TRUNC = 15
+_PC_PATH_MAX = 16
+_PC_PIPE_BUF = 17
+_PC_VDISABLE = 18
+_SC_ARG_MAX = 0
+_SC_CHILD_MAX = 1
+_SC_CLK_TCK = 2
+_SC_NGROUPS_MAX = 3
+_SC_OPEN_MAX = 4
+_SC_STREAM_MAX = 5
+_SC_TZNAME_MAX = 6
+_SC_JOB_CONTROL = 7
+_SC_SAVED_IDS = 8
+_SC_VERSION = 9
+_SC_POSIX_ARG_MAX = 10
+_SC_POSIX_CHILD_MAX = 11
+_SC_POSIX_LINK_MAX = 12
+_SC_POSIX_MAX_CANON = 13
+_SC_POSIX_MAX_INPUT = 14
+_SC_POSIX_NAME_MAX = 15
+_SC_POSIX_NGROUPS_MAX = 16
+_SC_POSIX_OPEN_MAX = 17
+_SC_POSIX_PATH_MAX = 18
+_SC_POSIX_PIPE_BUF = 19
+_SC_POSIX_SSIZE_MAX = 20
+_SC_POSIX_STREAM_MAX = 21
+_SC_POSIX_TZNAME_MAX = 22
+_SC_BC_BASE_MAX = 23
+_SC_BC_DIM_MAX = 24
+_SC_BC_SCALE_MAX = 25
+_SC_BC_STRING_MAX = 26
+_SC_EQUIV_CLASS_MAX = 27
+_SC_EXPR_NEST_MAX = 28
+_SC_LINE_MAX = 29
+_SC_RE_DUP_MAX = 30
+_SC_2_VERSION = 31
+_SC_2_C_DEV = 32
+_SC_2_FORT_DEV = 33
+_SC_2_FORT_RUN = 34
+_SC_2_LOCALEDEF = 35
+_SC_2_SW_DEV = 36
+_SC_POSIX2_BC_BASE_MAX = 37
+_SC_POSIX2_BC_DIM_MAX = 38
+_SC_POSIX2_BC_SCALE_MAX = 39
+_SC_POSIX2_BC_STRING_MAX = 40
+_SC_POSIX2_EQUIV_CLASS_MAX = 41
+_SC_POSIX2_EXPR_NEST_MAX = 42
+_SC_POSIX2_LINE_MAX = 43
+_SC_POSIX2_RE_DUP_MAX = 44
+_SC_PASS_MAX = 45
+_SC_XOPEN_VERSION = 46
+_SC_ATEXIT_MAX = 47
+_SC_PAGE_SIZE = 48
+_SC_AES_OS_VERSION = 49
+_SC_COLL_WEIGHTS_MAX = 50
+_SC_2_C_BIND = 51
+_SC_2_C_VERSION = 52
+_SC_2_UPE = 53
+_SC_2_CHAR_TERM = 54
+_SC_XOPEN_SHM = 55
+_SC_XOPEN_CRYPT = 56
+_SC_XOPEN_ENH_I18N = 57
+_SC_PAGESIZE = _SC_PAGE_SIZE
+_SC_IOV_MAX = 58
+_SC_REENTRANT_FUNCTIONS = 59
+_SC_THREADS = 60
+_SC_THREAD_ATTR_STACKADDR = 61
+_SC_THREAD_ATTR_STACKSIZE = 62
+_SC_THREAD_FORKALL = 63
+_SC_THREAD_PRIORITY_SCHEDULING = 64
+_SC_THREAD_PRIO_INHERIT = 65
+_SC_THREAD_PRIO_PROTECT = 66
+_SC_THREAD_PROCESS_SHARED = 67
+_SC_THREAD_DATAKEYS_MAX = 68
+_SC_THREAD_STACK_MIN = 69
+_SC_THREAD_THREADS_MAX = 70
+_SC_NPROCESSORS_CONF = 71
+_SC_NPROCESSORS_ONLN = 72
+_XOPEN_VERSION = 4
+_XOPEN_XCU_VERSION = 4
+_XOPEN_XPG3 = 1
+_XOPEN_XPG4 = 1
+_POSIX2_C_BIND = 1
+_POSIX2_C_DEV = 1
+_POSIX2_CHAR_TERM = 1
+_POSIX2_LOCALEDEF = 1
+_POSIX2_UPE = 1
+_POSIX2_FORT_DEV = (-1)
+_POSIX2_FORT_RUN = (-1)
+_POSIX2_SW_DEV = 1
+_XOPEN_CRYPT = 1
+_XOPEN_SHM = 1
+_XOPEN_ENH_I18N = 1
+
+# Included from sys/lockf.h
+
+# Included from sys/stat.h
+
+# Included from sys/mode.h
+_S_IFMT = 0170000
+_S_IFREG = 0100000
+_S_IFDIR = 0040000
+_S_IFBLK = 0060000
+_S_IFCHR = 0020000
+_S_IFIFO = 0010000
+S_ISUID = 0004000
+S_ISGID = 0002000
+S_IRWXU = 0000700
+S_IRUSR = 0000400
+S_IWUSR = 0000200
+S_IXUSR = 0000100
+S_IRWXG = 0000070
+S_IRGRP = 0000040
+S_IWGRP = 0000020
+S_IXGRP = 0000010
+S_IRWXO = 0000007
+S_IROTH = 0000004
+S_IWOTH = 0000002
+S_IXOTH = 0000001
+def S_ISFIFO(m): return (((m)&(_S_IFMT)) == (_S_IFIFO))
+
+def S_ISDIR(m): return (((m)&(_S_IFMT)) == (_S_IFDIR))
+
+def S_ISCHR(m): return (((m)&(_S_IFMT)) == (_S_IFCHR))
+
+def S_ISBLK(m): return (((m)&(_S_IFMT)) == (_S_IFBLK))
+
+def S_ISREG(m): return (((m)&(_S_IFMT)) == (_S_IFREG))
+
+S_ISVTX = 0001000
+S_IFMT = _S_IFMT
+S_IFREG = _S_IFREG
+S_IFDIR = _S_IFDIR
+S_IFBLK = _S_IFBLK
+S_IFCHR = _S_IFCHR
+S_IFIFO = _S_IFIFO
+S_IFSOCK = 0140000
+S_IFLNK = 0120000
+S_IREAD = 0000400
+S_IWRITE = 0000200
+S_IEXEC = 0000100
+S_ENFMT = S_ISGID
+S_IFMPX = (S_IFCHR|S_ISVTX)
+def S_ISMPX(m): return (((m)&(S_IFMT|S_ISVTX)) == (S_IFMPX))
+
+def S_ISLNK(m): return (((m)&(S_IFMT)) == (S_IFLNK))
+
+def S_ISSOCK(m): return (((m)&(S_IFMT)) == (S_IFSOCK))
+
+IFMT = S_IFMT
+IFDIR = S_IFDIR
+IFCHR = S_IFCHR
+IFBLK = S_IFBLK
+IFREG = S_IFREG
+IFIFO = S_IFIFO
+IFSOCK = S_IFSOCK
+IFLNK = S_IFLNK
+ISUID = S_ISUID
+ISGID = S_ISGID
+ISVTX = S_ISVTX
+IREAD = S_IREAD
+IWRITE = S_IWRITE
+IEXEC = S_IEXEC
+S_INMOD = 0xC0000000
+S_IXMOD = 0x40000000
+S_IJRNL = 0x04000000
+S_IXACL = 0x02000000
+S_ITCB = 0x01000000
+S_ITP = 0x00800000
+FS_VMP = 01
+FS_MOUNT = FS_VMP
+FS_REMOTE = 02
+SDEV_REMOTE = 0x80000000
+STX_NORMAL = 0x00
+STX_LINK = 0x01
+STX_MOUNT = 0x02
+STX_HIDDEN = 0x04
+S_ENFMT = S_ISGID
+F_ULOCK = 0
+F_LOCK = 1
+F_TLOCK = 2
+F_TEST = 3
+_AES_OS_VERSION = 1
+O_SYNC = 00000020
+O_NONE = 00000003
+O_EXEC = 00000040
+O_RSHARE = 00010000
+O_DEFER = 00020000
+O_DELAY = 00040000
+O_NDELAY = 00100000
+O_NSHARE = 00200000
+F_GETOWN = 8
+F_SETOWN = 9
+F_CLOSEM = 10
+FNDELAY = O_NONBLOCK
+O_NDELAY = O_NONBLOCK
+FNDELAY = O_NDELAY
+FNONBLOCK = O_NONBLOCK
+FAPPEND = O_APPEND
+FSYNC = O_SYNC
+FASYNC = 00400000
+FSYNCALL = 02000000
+FOPEN = (-1)
+FREAD = (O_RDONLY-FOPEN)
+FWRITE = (O_WRONLY-FOPEN)
+FMPX = 00000200
+FMASK = 00374377
+FFCNTL = (FNONBLOCK|FNDELAY|FAPPEND|FSYNC|FASYNC)
+FCREAT = O_CREAT
+FTRUNC = O_TRUNC
+FEXCL = O_EXCL
+FRSHARE = O_RSHARE
+FDEFER = O_DEFER
+FDELAY = O_DELAY
+FNDELAY = O_NDELAY
+FNSHARE = O_NSHARE
+FEXEC = O_EXEC
+FNOCTTY = O_NOCTTY
+FMOUNT = 01000000
+FREVOKED = 0x20000000
+FKERNEL = 0x40000000
+FAIO = 00000100
+FDOCLONE = 0x10000000
+GCFMARK = 0x00100000
+GCFDEFER = 0x00200000
diff --git a/Lib/plat-aix4/IN.py b/Lib/plat-aix4/IN.py
new file mode 100644
index 0000000000..00f0e1f878
--- /dev/null
+++ b/Lib/plat-aix4/IN.py
@@ -0,0 +1,165 @@
+# Generated by h2py from /usr/include/netinet/in.h
+
+# Included from net/nh.h
+
+# Included from sys/machine.h
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 4321
+PDP_ENDIAN = 3412
+BYTE_ORDER = BIG_ENDIAN
+DEFAULT_GPR = 0xDEADBEEF
+MSR_EE = 0x8000
+MSR_PR = 0x4000
+MSR_FP = 0x2000
+MSR_ME = 0x1000
+MSR_FE = 0x0800
+MSR_FE0 = 0x0800
+MSR_SE = 0x0400
+MSR_BE = 0x0200
+MSR_IE = 0x0100
+MSR_FE1 = 0x0100
+MSR_AL = 0x0080
+MSR_IP = 0x0040
+MSR_IR = 0x0020
+MSR_DR = 0x0010
+MSR_PM = 0x0004
+DEFAULT_MSR = (MSR_EE | MSR_ME | MSR_AL | MSR_IR | MSR_DR)
+DEFAULT_USER_MSR = (DEFAULT_MSR | MSR_PR)
+CR_LT = 0x80000000
+CR_GT = 0x40000000
+CR_EQ = 0x20000000
+CR_SO = 0x10000000
+CR_FX = 0x08000000
+CR_FEX = 0x04000000
+CR_VX = 0x02000000
+CR_OX = 0x01000000
+XER_SO = 0x80000000
+XER_OV = 0x40000000
+XER_CA = 0x20000000
+def XER_COMP_BYTE(xer): return ((xer >> 8) & 0x000000FF)
+
+def XER_LENGTH(xer): return (xer & 0x0000007F)
+
+DSISR_IO = 0x80000000
+DSISR_PFT = 0x40000000
+DSISR_LOCK = 0x20000000
+DSISR_FPIO = 0x10000000
+DSISR_PROT = 0x08000000
+DSISR_LOOP = 0x04000000
+DSISR_DRST = 0x04000000
+DSISR_ST = 0x02000000
+DSISR_SEGB = 0x01000000
+DSISR_DABR = 0x00400000
+DSISR_EAR = 0x00100000
+SRR_IS_PFT = 0x40000000
+SRR_IS_ISPEC = 0x20000000
+SRR_IS_IIO = 0x10000000
+SRR_IS_GUARD = 0x10000000
+SRR_IS_PROT = 0x08000000
+SRR_IS_LOOP = 0x04000000
+SRR_PR_FPEN = 0x00100000
+SRR_PR_INVAL = 0x00080000
+SRR_PR_PRIV = 0x00040000
+SRR_PR_TRAP = 0x00020000
+SRR_PR_IMPRE = 0x00010000
+def BUID_7F_SRVAL(raddr): return (0x87F00000 | (((uint)(raddr)) >> 28))
+
+BT_256M = 0x1FFC
+BT_128M = 0x0FFC
+BT_64M = 0x07FC
+BT_32M = 0x03FC
+BT_16M = 0x01FC
+BT_8M = 0x00FC
+BT_4M = 0x007C
+BT_2M = 0x003C
+BT_1M = 0x001C
+BT_512K = 0x000C
+BT_256K = 0x0004
+BT_128K = 0x0000
+BT_NOACCESS = 0x0
+BT_RDONLY = 0x1
+BT_WRITE = 0x2
+BT_VS = 0x2
+BT_VP = 0x1
+def BAT_ESEG(dbatu): return (((uint)(dbatu) >> 28))
+
+MIN_BAT_SIZE = 0x00020000
+MAX_BAT_SIZE = 0x10000000
+def ntohl(x): return (x)
+
+def ntohs(x): return (x)
+
+def htonl(x): return (x)
+
+def htons(x): return (x)
+
+IPPROTO_IP = 0
+IPPROTO_ICMP = 1
+IPPROTO_IGMP = 2
+IPPROTO_GGP = 3
+IPPROTO_TCP = 6
+IPPROTO_EGP = 8
+IPPROTO_PUP = 12
+IPPROTO_UDP = 17
+IPPROTO_IDP = 22
+IPPROTO_TP = 29
+IPPROTO_LOCAL = 63
+IPPROTO_EON = 80
+IPPROTO_BIP = 0x53
+IPPROTO_RAW = 255
+IPPROTO_MAX = 256
+IPPORT_RESERVED = 1024
+IPPORT_USERRESERVED = 5000
+IPPORT_TIMESERVER = 37
+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)
+
+def IN_MULTICAST(i): return IN_CLASSD(i)
+
+IN_CLASSD_NET = 0xf0000000
+IN_CLASSD_NSHIFT = 28
+IN_CLASSD_HOST = 0x0fffffff
+INADDR_UNSPEC_GROUP = 0xe0000000
+INADDR_ALLHOSTS_GROUP = 0xe0000001
+INADDR_MAX_LOCAL_GROUP = 0xe00000ff
+def IN_EXPERIMENTAL(i): return (((long)(i) & 0xe0000000) == 0xe0000000)
+
+def IN_BADCLASS(i): return (((long)(i) & 0xf0000000) == 0xf0000000)
+
+INADDR_ANY = 0x00000000
+INADDR_BROADCAST = 0xffffffff
+INADDR_LOOPBACK = 0x7f000001
+INADDR_NONE = 0xffffffff
+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_DEFAULT_MULTICAST_TTL = 1
+IP_DEFAULT_MULTICAST_LOOP = 1
+IP_MAX_MEMBERSHIPS = 20
diff --git a/Lib/plat-aix4/SOCKET.py b/Lib/plat-aix4/SOCKET.py
new file mode 100644
index 0000000000..5f7ee3ea82
--- /dev/null
+++ b/Lib/plat-aix4/SOCKET.py
@@ -0,0 +1,93 @@
+# 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_CKSUMRECV = 0x0800
+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_UNIX = 1
+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_INTF = 20
+AF_RIF = 21
+AF_NETWARE = 22
+AF_NDD = 23
+AF_MAX = 30
+AF_MAX = 20
+PF_UNSPEC = AF_UNSPEC
+PF_UNIX = AF_UNIX
+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_INTF = AF_INTF
+PF_RIF = AF_RIF
+PF_INTF = AF_INTF
+PF_NDD = AF_NDD
+PF_MAX = AF_MAX
+SOMAXCONN = 10
+SOMAXCONN = 5
+MSG_MAXIOVLEN = 16
+UIO_MAXIOV = 1024
+UIO_SMALLIOV = 8
+MSG_OOB = 0x1
+MSG_PEEK = 0x2
+MSG_DONTROUTE = 0x4
+MSG_EOR = 0x8
+MSG_TRUNC = 0x10
+MSG_CTRUNC = 0x20
+MSG_WAITALL = 0x40
+MSG_NONBLOCK = 0x4000
+MSG_COMPAT = 0x8000
+SCM_RIGHTS = 0x01
diff --git a/Lib/plat-aix4/TERMIOS.py b/Lib/plat-aix4/TERMIOS.py
new file mode 100644
index 0000000000..6b58f03c8b
--- /dev/null
+++ b/Lib/plat-aix4/TERMIOS.py
@@ -0,0 +1,206 @@
+# Generated by h2py from /usr/include/termios.h
+
+# Included from standards.h
+
+# Included from sys/types.h
+
+# Included from sys/m_types.h
+NULL = 0
+TRUE = 1
+FALSE = 0
+NBBY = 8
+FHSIZE = 32
+
+# Included from sys/select.h
+
+# Included from sys/time.h
+ITIMER_REAL = 0
+ITIMER_VIRTUAL = 1
+ITIMER_PROF = 2
+ITIMER_VIRT = 3
+ITIMER_REAL1 = 20
+TIMEOFDAY = 9
+TIMERID_ALRM = (ITIMER_REAL)
+TIMERID_REAL = (ITIMER_REAL)
+TIMERID_VIRTUAL = (ITIMER_VIRTUAL)
+TIMERID_PROF = (ITIMER_PROF)
+TIMERID_VIRT = (ITIMER_VIRT)
+TIMERID_TOD = (TIMERID_VIRT+1)
+TIMERID_REAL1 = (ITIMER_REAL1)
+NALRM = 1
+NPROF = 1
+NVIRTUAL = 2
+NTIMEOFDAY = 5
+NTIMERS = (NALRM + NPROF + NVIRTUAL + NTIMEOFDAY)
+NALRM_THREAD = 1
+NTIMERS_THREAD = (NALRM_THREAD)
+MIN_SECS_SINCE_EPOCH = 0
+uS_PER_SECOND = (1000000)
+NS_PER_uS = (1000)
+MAX_SECS_TO_uS = 4000
+MAX_NS_TO_uS = 294967296
+NS_PER_SEC = 1000000000
+uS_PER_SEC = (NS_PER_SEC / 1000)
+NS_PER_MSEC = (NS_PER_SEC / 1000)
+MAX_DEC_SECS = 2
+MAX_DEC_NS = 147483647
+DST_NONE = 0
+DST_USA = 1
+DST_AUST = 2
+DST_WET = 3
+DST_MET = 4
+DST_EET = 5
+DST_CAN = 6
+
+# Included from time.h
+NULL = 0
+CLOCKS_PER_SEC = 1000000
+CLK_TCK = 100
+
+# Included from stddef.h
+NULL = 0
+TIMELEN = 26
+NLTBMAX = 64
+NO_TIMEOUT = 0
+INF_TIMEOUT = -1
+def NFDS(x): return ((x) & 0x0000FFFF)
+
+def LOW_HALF(x): return NFDS(x)
+
+def NMSGS(x): return (((x) >> 16) & 0x0000FFFF)
+
+def HIGH_HALF(x): return NMSGS(x)
+
+FD_SETSIZE = 2048
+def major(__x): return (int)((unsigned)(__x)>>16)
+
+def minor(__x): return (int)((__x)&0xFFFF)
+
+NCCS = 16
+CSMAP_DIR = "/usr/lib/nls/csmap/"
+TCSANOW = 0
+TCSADRAIN = 1
+TCSAFLUSH = 2
+TCIFLUSH = 0
+TCOFLUSH = 1
+TCIOFLUSH = 2
+TCOOFF = 0
+TCOON = 1
+TCIOFF = 2
+TCION = 3
+VINTR = 0
+VQUIT = 1
+VERASE = 2
+VKILL = 3
+VEOF = 4
+VEOL = 5
+VSTART = 7
+VSTOP = 8
+VSUSP = 9
+VMIN = 4
+VTIME = 5
+VEOL2 = 6
+VDSUSP = 10
+VREPRINT = 11
+VDISCRD = 12
+VWERSE = 13
+VLNEXT = 14
+VSTRT = VSTART
+B0 = 0x00000000
+B50 = 0x00000001
+B75 = 0x00000002
+B110 = 0x00000003
+B134 = 0x00000004
+B150 = 0x00000005
+B200 = 0x00000006
+B300 = 0x00000007
+B600 = 0x00000008
+B1200 = 0x00000009
+B1800 = 0x0000000a
+B2400 = 0x0000000b
+B4800 = 0x0000000c
+B9600 = 0x0000000d
+B19200 = 0x0000000e
+B38400 = 0x0000000f
+EXTA = B19200
+EXTB = B38400
+IGNBRK = 0x00000001
+BRKINT = 0x00000002
+IGNPAR = 0x00000004
+PARMRK = 0x00000008
+INPCK = 0x00000010
+ISTRIP = 0x00000020
+INLCR = 0x00000040
+IGNCR = 0x00000080
+ICRNL = 0x00000100
+IXON = 0x00000200
+IXOFF = 0x00000400
+IUCLC = 0x00000800
+IXANY = 0x00001000
+IMAXBEL = 0x00010000
+OPOST = 0x00000001
+OLCUC = 0x00000002
+ONLCR = 0x00000004
+OCRNL = 0x00000008
+ONOCR = 0x00000010
+ONLRET = 0x00000020
+OFILL = 0x00000040
+OFDEL = 0x00000080
+CRDLY = 0x00000300
+CR0 = 0x00000000
+CR1 = 0x00000100
+CR2 = 0x00000200
+CR3 = 0x00000300
+TABDLY = 0x00000c00
+TAB0 = 0x00000000
+TAB1 = 0x00000400
+TAB2 = 0x00000800
+TAB3 = 0x00000c00
+BSDLY = 0x00001000
+BS0 = 0x00000000
+BS1 = 0x00001000
+FFDLY = 0x00002000
+FF0 = 0x00000000
+FF1 = 0x00002000
+NLDLY = 0x00004000
+NL0 = 0x00000000
+NL1 = 0x00004000
+VTDLY = 0x00008000
+VT0 = 0x00000000
+VT1 = 0x00008000
+DLY_MASK = (NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY)
+OXTABS = 0x00040000
+ONOEOT = 0x00080000
+_CBAUD = 0x0000000f
+CSIZE = 0x00000030
+CS5 = 0x00000000
+CS6 = 0x00000010
+CS7 = 0x00000020
+CS8 = 0x00000030
+CSTOPB = 0x00000040
+CREAD = 0x00000080
+PARENB = 0x00000100
+PARODD = 0x00000200
+HUPCL = 0x00000400
+CLOCAL = 0x00000800
+_CIBAUD = 0x000f0000
+_IBSHIFT = 16
+CIBAUD = _CIBAUD
+IBSHIFT = _IBSHIFT
+PAREXT = 0x00100000
+ISIG = 0x00000001
+ICANON = 0x00000002
+XCASE = 0x00000004
+ECHO = 0x00000008
+ECHOE = 0x00000010
+ECHOK = 0x00000020
+ECHONL = 0x00000040
+NOFLSH = 0x00000080
+TOSTOP = 0x00010000
+ECHOCTL = 0x00020000
+ECHOPRT = 0x00040000
+ECHOKE = 0x00080000
+FLUSHO = 0x00100000
+ALTWERASE = 0x00400000
+PENDIN = 0x20000000
+IEXTEN = 0x00200000
diff --git a/Lib/plat-aix4/regen b/Lib/plat-aix4/regen
new file mode 100755
index 0000000000..94016627cc
--- /dev/null
+++ b/Lib/plat-aix4/regen
@@ -0,0 +1,11 @@
+#! /bin/sh
+case `uname -sv` in
+'AIX 4'*) ;;
+*) echo Probably not on an AIX 4 system 1>&2
+ exit 1;;
+esac
+set -v
+h2py.py /usr/include/fcntl.h
+h2py.py /usr/include/sys/socket.h
+h2py.py -i '(u_long)' /usr/include/netinet/in.h
+h2py.py /usr/include/termios.h