# Generated by h2py from /usr/include/sys/socket.h

# Included from machine/param.h

# Included from machine/psl.h
PSL_C = 0x00000001
PSL_PF = 0x00000004
PSL_AF = 0x00000010
PSL_Z = 0x00000040
PSL_N = 0x00000080
PSL_T = 0x00000100
PSL_I = 0x00000200
PSL_D = 0x00000400
PSL_V = 0x00000800
PSL_IOPL = 0x00003000
PSL_NT = 0x00004000
PSL_RF = 0x00010000
PSL_VM = 0x00020000
PSL_AC = 0x00040000
PSL_VIF = 0x00080000
PSL_VIP = 0x00100000
PSL_ID = 0x00200000
PSL_MBO = 0x00000002
PSL_MBZ = 0xffc08028
PSL_USERSET = (PSL_MBO | PSL_I)
PSL_USERSTATIC = (PSL_MBO | PSL_MBZ | PSL_I | PSL_IOPL | PSL_NT | PSL_VIF | PSL_VIP)
PSL_USERSTATIC = (PSL_MBO | PSL_MBZ | PSL_I | PSL_IOPL | PSL_NT | PSL_VM | PSL_VIF | PSL_VIP)

# Included from machine/intr.h
IPL_NONE = 0
IPL_BIO = 1
IPL_NET = 2
IPL_TTY = 3
IPL_IMP = 4
IPL_AUDIO = 5
IPL_CLOCK = 6
IPL_HIGH = 7
IST_NONE = 0
IST_PULSE = 1
IST_EDGE = 2
IST_LEVEL = 3
SIR_CLOCK = 31
SIR_CLOCKMASK = ((1 << SIR_CLOCK))
SIR_NET = 30
SIR_NETMASK = ((1 << SIR_NET) | SIR_CLOCKMASK)
SIR_TTY = 29
SIR_TTYMASK = ((1 << SIR_TTY) | SIR_CLOCKMASK)
SIR_ALLMASK = (SIR_CLOCKMASK | SIR_NETMASK | SIR_TTYMASK)

# Included from machine/cpu.h

# Included from machine/frame.h

# Included from sys/signal.h

# Included from sys/cdefs.h

# Included from machine/cdefs.h
def __P(protos): return protos		 

def __STRING(x): return #x

def __P(protos): return ()		 

def __STRING(x): return "x"

def __attribute__(x): return  

def __kprintf_attribute__(a): return __attribute__(a)


# Included from machine/signal.h

# Included from machine/trap.h
T_PRIVINFLT = 0
T_BPTFLT = 1
T_ARITHTRAP = 2
T_ASTFLT = 3
T_PROTFLT = 4
T_TRCTRAP = 5
T_PAGEFLT = 6
T_ALIGNFLT = 7
T_DIVIDE = 8
T_NMI = 9
T_OFLOW = 10
T_BOUND = 11
T_DNA = 12
T_DOUBLEFLT = 13
T_FPOPFLT = 14
T_TSSFLT = 15
T_SEGNPFLT = 16
T_STKFLT = 17
T_MACHK = 18
T_RESERVED = 19
T_USER = 0x100
_NSIG = 32
NSIG = _NSIG
SIGHUP = 1
SIGINT = 2
SIGQUIT = 3
SIGILL = 4
SIGTRAP = 5
SIGABRT = 6
SIGIOT = SIGABRT
SIGEMT = 7
SIGFPE = 8
SIGKILL = 9
SIGBUS = 10
SIGSEGV = 11
SIGSYS = 12
SIGPIPE = 13
SIGALRM = 14
SIGTERM = 15
SIGURG = 16
SIGSTOP = 17
SIGTSTP = 18
SIGCONT = 19
SIGCHLD = 20
SIGTTIN = 21
SIGTTOU = 22
SIGIO = 23
SIGXCPU = 24
SIGXFSZ = 25
SIGVTALRM = 26
SIGPROF = 27
SIGWINCH = 28
SIGINFO = 29
SIGUSR1 = 30
SIGUSR2 = 31

# Included from sys/siginfo.h
SI_NOINFO = 32767
SI_USER = 0
SI_LWP = (-1)
SI_QUEUE = (-2)
SI_TIMER = (-3)
ILL_ILLOPC = 1
ILL_ILLOPN = 2
ILL_ILLADR = 3
ILL_ILLTRP = 4
ILL_PRVOPC = 5
ILL_PRVREG = 6
ILL_COPROC = 7
ILL_BADSTK = 8
NSIGILL = 8
EMT_TAGOVF = 1
NSIGEMT = 1
FPE_INTDIV = 1
FPE_INTOVF = 2
FPE_FLTDIV = 3
FPE_FLTOVF = 4
FPE_FLTUND = 5
FPE_FLTRES = 6
FPE_FLTINV = 7
FPE_FLTSUB = 8
NSIGFPE = 8
SEGV_MAPERR = 1
SEGV_ACCERR = 2
NSIGSEGV = 2
BUS_ADRALN = 1
BUS_ADRERR = 2
BUS_OBJERR = 3
NSIGBUS = 3
TRAP_BRKPT = 1
TRAP_TRACE = 2
NSIGTRAP = 2
CLD_EXITED = 1
CLD_KILLED = 2
CLD_DUMPED = 3
CLD_TRAPPED = 4
CLD_STOPPED = 5
CLD_CONTINUED = 6
NSIGCLD = 6
POLL_IN = 1
POLL_OUT = 2
POLL_MSG = 3
POLL_ERR = 4
POLL_PRI = 5
POLL_HUP = 6
NSIGPOLL = 6
PROF_SIG = 1
NSIGPROF = 1
SI_MAXSZ = 128

# Included from sys/time.h

# Included from sys/types.h

# Included from machine/types.h

# Included from machine/ansi.h
_BSD_PTRDIFF_T_ = int
_BSD_SSIZE_T_ = int
_BSD_TIME_T_ = int
_BSD_CLOCKID_T_ = int
_BSD_TIMER_T_ = int
_BSD_WCHAR_T_ = int
_BSD_WINT_T_ = int
_BSD_RUNE_T_ = int

# Included from machine/endian.h

# Included from sys/endian.h
LITTLE_ENDIAN = 1234
BIG_ENDIAN = 4321
PDP_ENDIAN = 3412
def __swap16gen(x): return \

def __swap32gen(x): return \

swap16 = __swap16gen
swap32 = __swap32gen
_QUAD_HIGHWORD = 1
_QUAD_LOWWORD = 0
htobe16 = swap16
htobe32 = swap32
betoh16 = swap16
betoh32 = swap32
def htole16(x): return (x)

def htole32(x): return (x)

def letoh16(x): return (x)

def letoh32(x): return (x)

_QUAD_HIGHWORD = 0
_QUAD_LOWWORD = 1
htole16 = swap16
htole32 = swap32
letoh16 = swap16
letoh32 = swap32
def htobe16(x): return (x)

def htobe32(x): return (x)

def betoh16(x): return (x)

def betoh32(x): return (x)

htons = htobe16
htonl = htobe32
ntohs = betoh16
ntohl = betoh32
def major(x): return ((int32_t)(((u_int32_t)(x) >> 8) & 0xff))

def minor(x): return ((int32_t)((x) & 0xff))

NBBY = 8
FD_SETSIZE = 256
def FD_ZERO(p): return bzero(p, sizeof(*(p)))

def FD_ZERO(p): return memset(p, 0, sizeof(*(p)))

DST_NONE = 0
DST_USA = 1
DST_AUST = 2
DST_WET = 3
DST_MET = 4
DST_EET = 5
DST_CAN = 6
ITIMER_REAL = 0
ITIMER_VIRTUAL = 1
ITIMER_PROF = 2
CLOCK_REALTIME = 0
CLOCK_VIRTUAL = 1
CLOCK_PROF = 2
TIMER_RELTIME = 0x0
TIMER_ABSTIME = 0x1

# Included from time.h
NULL = 0
CLOCKS_PER_SEC = 100
CLK_TCK = 100
SA_ONSTACK = 0x0001
SA_RESTART = 0x0002
SA_RESETHAND = 0x0004
SA_NODEFER = 0x0010
SA_NOCLDWAIT = 0x0020
SA_USERTRAMP = 0x0100
SA_NOCLDSTOP = 0x0008
SA_SIGINFO = 0x0040
SIG_BLOCK = 1
SIG_UNBLOCK = 2
SIG_SETMASK = 3
SS_ONSTACK = 0x0001
SS_DISABLE = 0x0004
MINSIGSTKSZ = 8192
SIGSTKSZ = (MINSIGSTKSZ + 32768)
SV_ONSTACK = SA_ONSTACK
SV_INTERRUPT = SA_RESTART
SV_RESETHAND = SA_RESETHAND
def sigmask(m): return (1 << ((m)-1))


# Included from machine/segments.h
def ISPL(s): return ((s) & SEL_RPL)	 

SEL_KPL = 0
SEL_UPL = 3
SEL_RPL = 3
def ISLDT(s): return ((s) & SEL_LDT)	 

SEL_LDT = 4
def IDXSEL(s): return (((s) >> 3) & 0x1fff)		 

SDT_SYSNULL = 0
SDT_SYS286TSS = 1
SDT_SYSLDT = 2
SDT_SYS286BSY = 3
SDT_SYS286CGT = 4
SDT_SYSTASKGT = 5
SDT_SYS286IGT = 6
SDT_SYS286TGT = 7
SDT_SYSNULL2 = 8
SDT_SYS386TSS = 9
SDT_SYSNULL3 = 10
SDT_SYS386BSY = 11
SDT_SYS386CGT = 12
SDT_SYSNULL4 = 13
SDT_SYS386IGT = 14
SDT_SYS386TGT = 15
SDT_MEMRO = 16
SDT_MEMROA = 17
SDT_MEMRW = 18
SDT_MEMRWA = 19
SDT_MEMROD = 20
SDT_MEMRODA = 21
SDT_MEMRWD = 22
SDT_MEMRWDA = 23
SDT_MEME = 24
SDT_MEMEA = 25
SDT_MEMER = 26
SDT_MEMERA = 27
SDT_MEMEC = 28
SDT_MEMEAC = 29
SDT_MEMERC = 30
SDT_MEMERAC = 31
SEGEX_EXT = 0x01
SEGEX_IDT = 0x02
SEGEX_TI = 0x04
NIDT = 256
NRSVIDT = 32
GNULL_SEL = 0
GCODE_SEL = 1
GDATA_SEL = 2
GLDT_SEL = 3
GUCODE_SEL = 4
GUDATA_SEL = 5
GAPM32CODE_SEL = 6
GAPM16CODE_SEL = 7
GAPMDATA_SEL = 8
GICODE_SEL = 9
NGDT = 10
LSYS5CALLS_SEL = 0
LSYS5SIGR_SEL = 1
LUCODE_SEL = 2
LUDATA_SEL = 3
LBSDICALLS_SEL = 16
NLDT = 17
def cpu_swapin(p): return  

def signotify(p): return setsoftast()

def DELAY(x): return delay(x)


# Included from machine/cputypes.h
CPUCLASS_386 = 0
CPUCLASS_486 = 1
CPUCLASS_586 = 2
CPUCLASS_686 = 3
CPU_386SX = 0
CPU_386 = 1
CPU_486SX = 2
CPU_486 = 3
CPU_486DLC = 4
CPU_6x86 = 5
CPU_NX586 = 6
CPU_586 = 7
CPU_AM586 = 8
CPU_K5 = 9
CPU_K6 = 10
CPU_686 = 11
CPUVENDOR_UNKNOWN = -1
CPUVENDOR_INTEL = 0
CPUVENDOR_CYRIX = 1
CPUVENDOR_NEXGEN = 2
CPUVENDOR_AMD = 3
CPUVENDOR_IDT = 4
CPUVENDOR_RISE = 5
CPUVENDOR_TRANSMETA = 6
CPU_MAXMODEL = 15
CPU_DEFMODEL = 16
CPU_MINFAMILY = 4
CPU_MAXFAMILY = 0xf
CPU_CONSDEV = 1
CPU_BIOS = 2
CPU_BLK2CHR = 3
CPU_CHR2BLK = 4
CPU_ALLOWAPERTURE = 5
CPU_CPUVENDOR = 6
CPU_CPUID = 7
CPU_CPUFEATURE = 8
CPU_APMWARN = 9
CPU_KBDRESET = 10
CPU_APMHALT = 11
CPU_MAXID = 12
MACHINE = "i386"
MACHINE_ARCH = "i386"
def ALIGN(p): return (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)

PGSHIFT = 12
NBPG = (1 << PGSHIFT)
PGOFSET = (NBPG-1)
PAGE_SHIFT = 12
PAGE_SIZE = (1 << PAGE_SHIFT)
PAGE_MASK = (PAGE_SIZE - 1)
KERNBASE = 0xe0000000
KERNTEXTOFF = (KERNBASE+0x100000)
DEV_BSHIFT = 9
DEV_BSIZE = (1 << DEV_BSHIFT)
BLKDEV_IOSIZE = 2048
MAXPHYS = (64 * 1024)
CLSIZELOG2 = 0
CLSIZE = (1 << CLSIZELOG2)
SSIZE = 1
SINCR = 1
UPAGES = 2
USPACE = (UPAGES * NBPG)
MSGBUFSIZE = 2*NBPG
MSIZE = 128
MCLSHIFT = 11
MCLBYTES = (1 << MCLSHIFT)
MCLOFSET = (MCLBYTES - 1)
NMBCLUSTERS = 2048
def ctod(x): return ((x) << (PGSHIFT - DEV_BSHIFT))

def dtoc(x): return ((x) >> (PGSHIFT - DEV_BSHIFT))

def ctob(x): return ((x) << PGSHIFT)

def btoc(x): return (((x) + PGOFSET) >> PGSHIFT)

def dbtob(x): return ((x) << DEV_BSHIFT)

def btodb(x): return ((x) >> DEV_BSHIFT)

def bdbtofsb(bn): return ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))

def i386_round_pdr(x): return ((((unsigned)(x)) + PDOFSET) & ~PDOFSET)

def i386_trunc_pdr(x): return ((unsigned)(x) & ~PDOFSET)

def i386_btod(x): return ((unsigned)(x) >> PDSHIFT)

def i386_dtob(x): return ((unsigned)(x) << PDSHIFT)

def i386_round_page(x): return ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)

def i386_trunc_page(x): return ((unsigned)(x) & ~PGOFSET)

def i386_btop(x): return ((unsigned)(x) >> PGSHIFT)

def i386_ptob(x): return ((unsigned)(x) << PGSHIFT)

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_SNDBUF = 0x1001
SO_RCVBUF = 0x1002
SO_SNDLOWAT = 0x1003
SO_RCVLOWAT = 0x1004
SO_SNDTIMEO = 0x1005
SO_RCVTIMEO = 0x1006
SO_ERROR = 0x1007
SO_TYPE = 0x1008
SO_NETPROC = 0x1020
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_INET6 = 24
pseudo_AF_PIP = 25
AF_ISDN = 26
AF_E164 = AF_ISDN
AF_NATM = 27
AF_ENCAP = 28
AF_SIP = 29
AF_KEY = 30
AF_MAX = 31
PF_UNSPEC = AF_UNSPEC
PF_LOCAL = AF_LOCAL
PF_UNIX = PF_LOCAL
PF_INET = AF_INET
PF_INET6 = AF_INET6
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_IPX = AF_IPX
PF_INET6 = AF_INET6
PF_PIP = pseudo_AF_PIP
PF_ISDN = AF_ISDN
PF_NATM = AF_NATM
PF_ENCAP = AF_ENCAP
PF_SIP = AF_SIP
PF_KEY = AF_KEY
PF_MAX = AF_MAX
SHUT_RD = 0
SHUT_WR = 1
SHUT_RDWR = 2
def SOCKCREDSIZE(ngrps): return \

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_BCAST = 0x100
MSG_MCAST = 0x200
def CMSG_DATA(cmsg): return \

def __CMSG_ALIGN(len): return ALIGN(len)

def CMSG_ALIGN(n): return __CMSG_ALIGN(n)

SCM_RIGHTS = 0x01
SCM_CREDS = 0x02
MSG_COMPAT = 0x8000
