runtime, syscall: convert from godefs to cgo

R=golang-dev, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/5348052
diff --git a/src/pkg/runtime/darwin/386/defs.h b/src/pkg/runtime/darwin/386/defs.h
index bb70207..6d1863c 100644
--- a/src/pkg/runtime/darwin/386/defs.h
+++ b/src/pkg/runtime/darwin/386/defs.h
@@ -1,289 +1,362 @@
-// godefs -f -m32 defs.c
+// Created by cgo -cdefs - DO NOT EDIT
+// cgo -cdefs defs.go
 
-// MACHINE GENERATED - DO NOT EDIT.
 
-// Constants
 enum {
-	PROT_NONE = 0,
-	PROT_READ = 0x1,
-	PROT_WRITE = 0x2,
-	PROT_EXEC = 0x4,
-	MAP_ANON = 0x1000,
-	MAP_PRIVATE = 0x2,
-	MAP_FIXED = 0x10,
-	MACH_MSG_TYPE_MOVE_RECEIVE = 0x10,
-	MACH_MSG_TYPE_MOVE_SEND = 0x11,
-	MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12,
-	MACH_MSG_TYPE_COPY_SEND = 0x13,
-	MACH_MSG_TYPE_MAKE_SEND = 0x14,
-	MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15,
-	MACH_MSG_TYPE_COPY_RECEIVE = 0x16,
-	MACH_MSG_PORT_DESCRIPTOR = 0,
-	MACH_MSG_OOL_DESCRIPTOR = 0x1,
-	MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2,
-	MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3,
-	MACH_MSGH_BITS_COMPLEX = 0x80000000,
-	MACH_SEND_MSG = 0x1,
-	MACH_RCV_MSG = 0x2,
-	MACH_RCV_LARGE = 0x4,
-	MACH_SEND_TIMEOUT = 0x10,
-	MACH_SEND_INTERRUPT = 0x40,
-	MACH_SEND_CANCEL = 0x80,
-	MACH_SEND_ALWAYS = 0x10000,
-	MACH_SEND_TRAILER = 0x20000,
-	MACH_RCV_TIMEOUT = 0x100,
-	MACH_RCV_NOTIFY = 0x200,
-	MACH_RCV_INTERRUPT = 0x400,
-	MACH_RCV_OVERWRITE = 0x1000,
-	NDR_PROTOCOL_2_0 = 0,
-	NDR_INT_BIG_ENDIAN = 0,
-	NDR_INT_LITTLE_ENDIAN = 0x1,
-	NDR_FLOAT_IEEE = 0,
-	NDR_CHAR_ASCII = 0,
-	SA_SIGINFO = 0x40,
-	SA_RESTART = 0x2,
-	SA_ONSTACK = 0x1,
-	SA_USERTRAMP = 0x100,
-	SA_64REGSET = 0x200,
-	SIGHUP = 0x1,
-	SIGINT = 0x2,
-	SIGQUIT = 0x3,
-	SIGILL = 0x4,
-	SIGTRAP = 0x5,
-	SIGABRT = 0x6,
-	SIGEMT = 0x7,
-	SIGFPE = 0x8,
-	SIGKILL = 0x9,
-	SIGBUS = 0xa,
-	SIGSEGV = 0xb,
-	SIGSYS = 0xc,
-	SIGPIPE = 0xd,
-	SIGALRM = 0xe,
-	SIGTERM = 0xf,
-	SIGURG = 0x10,
-	SIGSTOP = 0x11,
-	SIGTSTP = 0x12,
-	SIGCONT = 0x13,
-	SIGCHLD = 0x14,
-	SIGTTIN = 0x15,
-	SIGTTOU = 0x16,
-	SIGIO = 0x17,
-	SIGXCPU = 0x18,
-	SIGXFSZ = 0x19,
-	SIGVTALRM = 0x1a,
-	SIGPROF = 0x1b,
-	SIGWINCH = 0x1c,
-	SIGINFO = 0x1d,
-	SIGUSR1 = 0x1e,
-	SIGUSR2 = 0x1f,
-	FPE_INTDIV = 0x7,
-	FPE_INTOVF = 0x8,
-	FPE_FLTDIV = 0x1,
-	FPE_FLTOVF = 0x2,
-	FPE_FLTUND = 0x3,
-	FPE_FLTRES = 0x4,
-	FPE_FLTINV = 0x5,
-	FPE_FLTSUB = 0x6,
-	BUS_ADRALN = 0x1,
-	BUS_ADRERR = 0x2,
-	BUS_OBJERR = 0x3,
-	SEGV_MAPERR = 0x1,
-	SEGV_ACCERR = 0x2,
-	ITIMER_REAL = 0,
-	ITIMER_VIRTUAL = 0x1,
-	ITIMER_PROF = 0x2,
-};
+	PROT_NONE	= 0x0,
+	PROT_READ	= 0x1,
+	PROT_WRITE	= 0x2,
+	PROT_EXEC	= 0x4,
 
-// Types
-#pragma pack on
+	MAP_ANON	= 0x1000,
+	MAP_PRIVATE	= 0x2,
+	MAP_FIXED	= 0x10,
+
+	MACH_MSG_TYPE_MOVE_RECEIVE	= 0x10,
+	MACH_MSG_TYPE_MOVE_SEND		= 0x11,
+	MACH_MSG_TYPE_MOVE_SEND_ONCE	= 0x12,
+	MACH_MSG_TYPE_COPY_SEND		= 0x13,
+	MACH_MSG_TYPE_MAKE_SEND		= 0x14,
+	MACH_MSG_TYPE_MAKE_SEND_ONCE	= 0x15,
+	MACH_MSG_TYPE_COPY_RECEIVE	= 0x16,
+
+	MACH_MSG_PORT_DESCRIPTOR		= 0x0,
+	MACH_MSG_OOL_DESCRIPTOR			= 0x1,
+	MACH_MSG_OOL_PORTS_DESCRIPTOR		= 0x2,
+	MACH_MSG_OOL_VOLATILE_DESCRIPTOR	= 0x3,
+
+	MACH_MSGH_BITS_COMPLEX	= 0x80000000,
+
+	MACH_SEND_MSG	= 0x1,
+	MACH_RCV_MSG	= 0x2,
+	MACH_RCV_LARGE	= 0x4,
+
+	MACH_SEND_TIMEOUT	= 0x10,
+	MACH_SEND_INTERRUPT	= 0x40,
+	MACH_SEND_CANCEL	= 0x80,
+	MACH_SEND_ALWAYS	= 0x10000,
+	MACH_SEND_TRAILER	= 0x20000,
+	MACH_RCV_TIMEOUT	= 0x100,
+	MACH_RCV_NOTIFY		= 0x200,
+	MACH_RCV_INTERRUPT	= 0x400,
+	MACH_RCV_OVERWRITE	= 0x1000,
+
+	NDR_PROTOCOL_2_0	= 0x0,
+	NDR_INT_BIG_ENDIAN	= 0x0,
+	NDR_INT_LITTLE_ENDIAN	= 0x1,
+	NDR_FLOAT_IEEE		= 0x0,
+	NDR_CHAR_ASCII		= 0x0,
+
+	SA_SIGINFO	= 0x40,
+	SA_RESTART	= 0x2,
+	SA_ONSTACK	= 0x1,
+	SA_USERTRAMP	= 0x100,
+	SA_64REGSET	= 0x200,
+
+	SIGHUP		= 0x1,
+	SIGINT		= 0x2,
+	SIGQUIT		= 0x3,
+	SIGILL		= 0x4,
+	SIGTRAP		= 0x5,
+	SIGABRT		= 0x6,
+	SIGEMT		= 0x7,
+	SIGFPE		= 0x8,
+	SIGKILL		= 0x9,
+	SIGBUS		= 0xa,
+	SIGSEGV		= 0xb,
+	SIGSYS		= 0xc,
+	SIGPIPE		= 0xd,
+	SIGALRM		= 0xe,
+	SIGTERM		= 0xf,
+	SIGURG		= 0x10,
+	SIGSTOP		= 0x11,
+	SIGTSTP		= 0x12,
+	SIGCONT		= 0x13,
+	SIGCHLD		= 0x14,
+	SIGTTIN		= 0x15,
+	SIGTTOU		= 0x16,
+	SIGIO		= 0x17,
+	SIGXCPU		= 0x18,
+	SIGXFSZ		= 0x19,
+	SIGVTALRM	= 0x1a,
+	SIGPROF		= 0x1b,
+	SIGWINCH	= 0x1c,
+	SIGINFO		= 0x1d,
+	SIGUSR1		= 0x1e,
+	SIGUSR2		= 0x1f,
+
+	FPE_INTDIV	= 0x7,
+	FPE_INTOVF	= 0x8,
+	FPE_FLTDIV	= 0x1,
+	FPE_FLTOVF	= 0x2,
+	FPE_FLTUND	= 0x3,
+	FPE_FLTRES	= 0x4,
+	FPE_FLTINV	= 0x5,
+	FPE_FLTSUB	= 0x6,
+
+	BUS_ADRALN	= 0x1,
+	BUS_ADRERR	= 0x2,
+	BUS_OBJERR	= 0x3,
+
+	SEGV_MAPERR	= 0x1,
+	SEGV_ACCERR	= 0x2,
+
+	ITIMER_REAL	= 0x0,
+	ITIMER_VIRTUAL	= 0x1,
+	ITIMER_PROF	= 0x2,
+};
 
 typedef struct MachBody MachBody;
-struct MachBody {
-	uint32 msgh_descriptor_count;
-};
-
 typedef struct MachHeader MachHeader;
-struct MachHeader {
-	uint32 msgh_bits;
-	uint32 msgh_size;
-	uint32 msgh_remote_port;
-	uint32 msgh_local_port;
-	uint32 msgh_reserved;
-	int32 msgh_id;
-};
-
 typedef struct MachNDR MachNDR;
-struct MachNDR {
-	uint8 mig_vers;
-	uint8 if_vers;
-	uint8 reserved1;
-	uint8 mig_encoding;
-	uint8 int_rep;
-	uint8 char_rep;
-	uint8 float_rep;
-	uint8 reserved2;
-};
-
 typedef struct MachPort MachPort;
-struct MachPort {
-	uint32 name;
-	uint32 pad1;
-	uint16 pad2;
-	uint8 disposition;
-	uint8 type;
-};
-
 typedef struct StackT StackT;
-struct StackT {
-	void *ss_sp;
-	uint32 ss_size;
-	int32 ss_flags;
-};
-
-typedef union Sighandler Sighandler;
-union Sighandler {
-	uint32 __sa_handler;
-	uint32 __sa_sigaction;
-};
-
 typedef struct Sigaction Sigaction;
-struct Sigaction {
-	Sighandler __sigaction_u;
-	uint32 sa_tramp;
-	uint32 sa_mask;
-	int32 sa_flags;
-};
-
-typedef union Sigval Sigval;
-union Sigval {
-	int32 sival_int;
-	void *sival_ptr;
-};
-
 typedef struct Siginfo Siginfo;
-struct Siginfo {
-	int32 si_signo;
-	int32 si_errno;
-	int32 si_code;
-	int32 si_pid;
-	uint32 si_uid;
-	int32 si_status;
-	void *si_addr;
-	Sigval si_value;
-	int32 si_band;
-	uint32 __pad[7];
-};
-
 typedef struct Timeval Timeval;
-struct Timeval {
-	int32 tv_sec;
-	int32 tv_usec;
-};
-
 typedef struct Itimerval Itimerval;
-struct Itimerval {
-	Timeval it_interval;
-	Timeval it_value;
-};
-
 typedef struct FPControl FPControl;
-struct FPControl {
-	byte pad_godefs_0[2];
-};
-
 typedef struct FPStatus FPStatus;
-struct FPStatus {
-	byte pad_godefs_0[2];
-};
-
 typedef struct RegMMST RegMMST;
-struct RegMMST {
-	int8 mmst_reg[10];
-	int8 mmst_rsrv[6];
-};
-
 typedef struct RegXMM RegXMM;
-struct RegXMM {
-	int8 xmm_reg[16];
-};
-
-typedef struct Regs Regs;
-struct Regs {
-	uint32 eax;
-	uint32 ebx;
-	uint32 ecx;
-	uint32 edx;
-	uint32 edi;
-	uint32 esi;
-	uint32 ebp;
-	uint32 esp;
-	uint32 ss;
-	uint32 eflags;
-	uint32 eip;
-	uint32 cs;
-	uint32 ds;
-	uint32 es;
-	uint32 fs;
-	uint32 gs;
-};
-
-typedef struct FloatState FloatState;
-struct FloatState {
-	uint64 fpu_reserved;
-	FPControl fpu_fcw;
-	FPStatus fpu_fsw;
-	uint8 fpu_ftw;
-	uint8 fpu_rsrv1;
-	uint16 fpu_fop;
-	uint32 fpu_ip;
-	uint16 fpu_cs;
-	uint16 fpu_rsrv2;
-	uint32 fpu_dp;
-	uint16 fpu_ds;
-	uint16 fpu_rsrv3;
-	uint32 fpu_mxcsr;
-	uint32 fpu_mxcsrmask;
-	RegMMST fpu_stmm0;
-	RegMMST fpu_stmm1;
-	RegMMST fpu_stmm2;
-	RegMMST fpu_stmm3;
-	RegMMST fpu_stmm4;
-	RegMMST fpu_stmm5;
-	RegMMST fpu_stmm6;
-	RegMMST fpu_stmm7;
-	RegXMM fpu_xmm0;
-	RegXMM fpu_xmm1;
-	RegXMM fpu_xmm2;
-	RegXMM fpu_xmm3;
-	RegXMM fpu_xmm4;
-	RegXMM fpu_xmm5;
-	RegXMM fpu_xmm6;
-	RegXMM fpu_xmm7;
-	int8 fpu_rsrv4[224];
-	int32 fpu_reserved1;
-};
-
-typedef struct ExceptionState ExceptionState;
-struct ExceptionState {
-	uint32 trapno;
-	uint32 err;
-	uint32 faultvaddr;
-};
-
-typedef struct Mcontext Mcontext;
-struct Mcontext {
-	ExceptionState es;
-	Regs ss;
-	FloatState fs;
-};
-
+typedef struct Regs64 Regs64;
+typedef struct FloatState64 FloatState64;
+typedef struct ExceptionState64 ExceptionState64;
+typedef struct Mcontext64 Mcontext64;
+typedef struct Regs32 Regs32;
+typedef struct FloatState32 FloatState32;
+typedef struct ExceptionState32 ExceptionState32;
+typedef struct Mcontext32 Mcontext32;
 typedef struct Ucontext Ucontext;
-struct Ucontext {
-	int32 uc_onstack;
-	uint32 uc_sigmask;
-	StackT uc_stack;
-	uint32 uc_link;
-	uint32 uc_mcsize;
-	Mcontext *uc_mcontext;
+
+#pragma pack on
+
+struct MachBody {
+	uint32	msgh_descriptor_count;
 };
+struct MachHeader {
+	uint32	msgh_bits;
+	uint32	msgh_size;
+	uint32	msgh_remote_port;
+	uint32	msgh_local_port;
+	uint32	msgh_reserved;
+	int32	msgh_id;
+};
+struct MachNDR {
+	uint8	mig_vers;
+	uint8	if_vers;
+	uint8	reserved1;
+	uint8	mig_encoding;
+	uint8	int_rep;
+	uint8	char_rep;
+	uint8	float_rep;
+	uint8	reserved2;
+};
+struct MachPort {
+	uint32	name;
+	uint32	pad1;
+	uint16	pad2;
+	uint8	disposition;
+	uint8	type;
+};
+
+struct StackT {
+	byte	*ss_sp;
+	uint32	ss_size;
+	int32	ss_flags;
+};
+typedef	byte	Sighandler[4];
+
+struct Sigaction {
+	Sighandler	__sigaction_u;
+	void	*sa_tramp;
+	uint32	sa_mask;
+	int32	sa_flags;
+};
+
+typedef	byte	Sigval[4];
+struct Siginfo {
+	int32	si_signo;
+	int32	si_errno;
+	int32	si_code;
+	int32	si_pid;
+	uint32	si_uid;
+	int32	si_status;
+	byte	*si_addr;
+	Sigval	si_value;
+	int32	si_band;
+	uint32	__pad[7];
+};
+struct Timeval {
+	int32	tv_sec;
+	int32	tv_usec;
+};
+struct Itimerval {
+	Timeval	it_interval;
+	Timeval	it_value;
+};
+
+struct FPControl {
+	byte	Pad_godefs_0[2];
+};
+struct FPStatus {
+	byte	Pad_godefs_0[2];
+};
+struct RegMMST {
+	int8	mmst_reg[10];
+	int8	mmst_rsrv[6];
+};
+struct RegXMM {
+	int8	xmm_reg[16];
+};
+
+struct Regs64 {
+	uint64	rax;
+	uint64	rbx;
+	uint64	rcx;
+	uint64	rdx;
+	uint64	rdi;
+	uint64	rsi;
+	uint64	rbp;
+	uint64	rsp;
+	uint64	r8;
+	uint64	r9;
+	uint64	r10;
+	uint64	r11;
+	uint64	r12;
+	uint64	r13;
+	uint64	r14;
+	uint64	r15;
+	uint64	rip;
+	uint64	rflags;
+	uint64	cs;
+	uint64	fs;
+	uint64	gs;
+};
+struct FloatState64 {
+	int32	fpu_reserved[2];
+	FPControl	fpu_fcw;
+	FPStatus	fpu_fsw;
+	uint8	fpu_ftw;
+	uint8	fpu_rsrv1;
+	uint16	fpu_fop;
+	uint32	fpu_ip;
+	uint16	fpu_cs;
+	uint16	fpu_rsrv2;
+	uint32	fpu_dp;
+	uint16	fpu_ds;
+	uint16	fpu_rsrv3;
+	uint32	fpu_mxcsr;
+	uint32	fpu_mxcsrmask;
+	RegMMST	fpu_stmm0;
+	RegMMST	fpu_stmm1;
+	RegMMST	fpu_stmm2;
+	RegMMST	fpu_stmm3;
+	RegMMST	fpu_stmm4;
+	RegMMST	fpu_stmm5;
+	RegMMST	fpu_stmm6;
+	RegMMST	fpu_stmm7;
+	RegXMM	fpu_xmm0;
+	RegXMM	fpu_xmm1;
+	RegXMM	fpu_xmm2;
+	RegXMM	fpu_xmm3;
+	RegXMM	fpu_xmm4;
+	RegXMM	fpu_xmm5;
+	RegXMM	fpu_xmm6;
+	RegXMM	fpu_xmm7;
+	RegXMM	fpu_xmm8;
+	RegXMM	fpu_xmm9;
+	RegXMM	fpu_xmm10;
+	RegXMM	fpu_xmm11;
+	RegXMM	fpu_xmm12;
+	RegXMM	fpu_xmm13;
+	RegXMM	fpu_xmm14;
+	RegXMM	fpu_xmm15;
+	int8	fpu_rsrv4[96];
+	int32	fpu_reserved1;
+};
+struct ExceptionState64 {
+	uint32	trapno;
+	uint32	err;
+	uint64	faultvaddr;
+};
+struct Mcontext64 {
+	ExceptionState64	es;
+	Regs64	ss;
+	FloatState64	fs;
+};
+
+struct Regs32 {
+	uint32	eax;
+	uint32	ebx;
+	uint32	ecx;
+	uint32	edx;
+	uint32	edi;
+	uint32	esi;
+	uint32	ebp;
+	uint32	esp;
+	uint32	ss;
+	uint32	eflags;
+	uint32	eip;
+	uint32	cs;
+	uint32	ds;
+	uint32	es;
+	uint32	fs;
+	uint32	gs;
+};
+struct FloatState32 {
+	int32	fpu_reserved[2];
+	FPControl	fpu_fcw;
+	FPStatus	fpu_fsw;
+	uint8	fpu_ftw;
+	uint8	fpu_rsrv1;
+	uint16	fpu_fop;
+	uint32	fpu_ip;
+	uint16	fpu_cs;
+	uint16	fpu_rsrv2;
+	uint32	fpu_dp;
+	uint16	fpu_ds;
+	uint16	fpu_rsrv3;
+	uint32	fpu_mxcsr;
+	uint32	fpu_mxcsrmask;
+	RegMMST	fpu_stmm0;
+	RegMMST	fpu_stmm1;
+	RegMMST	fpu_stmm2;
+	RegMMST	fpu_stmm3;
+	RegMMST	fpu_stmm4;
+	RegMMST	fpu_stmm5;
+	RegMMST	fpu_stmm6;
+	RegMMST	fpu_stmm7;
+	RegXMM	fpu_xmm0;
+	RegXMM	fpu_xmm1;
+	RegXMM	fpu_xmm2;
+	RegXMM	fpu_xmm3;
+	RegXMM	fpu_xmm4;
+	RegXMM	fpu_xmm5;
+	RegXMM	fpu_xmm6;
+	RegXMM	fpu_xmm7;
+	int8	fpu_rsrv4[224];
+	int32	fpu_reserved1;
+};
+struct ExceptionState32 {
+	uint32	trapno;
+	uint32	err;
+	uint32	faultvaddr;
+};
+struct Mcontext32 {
+	ExceptionState32	es;
+	Regs32	ss;
+	FloatState32	fs;
+};
+
+struct Ucontext {
+	int32	uc_onstack;
+	uint32	uc_sigmask;
+	StackT	uc_stack;
+	Ucontext	*uc_link;
+	uint32	uc_mcsize;
+	Mcontext32	*uc_mcontext;
+};
+
+
 #pragma pack off
diff --git a/src/pkg/runtime/darwin/386/signal.c b/src/pkg/runtime/darwin/386/signal.c
index 29170b6..95c48b2 100644
--- a/src/pkg/runtime/darwin/386/signal.c
+++ b/src/pkg/runtime/darwin/386/signal.c
@@ -8,7 +8,7 @@
 #include "signals.h"
 
 void
-runtime·dumpregs(Regs *r)
+runtime·dumpregs(Regs32 *r)
 {
 	runtime·printf("eax     %x\n", r->eax);
 	runtime·printf("ebx     %x\n", r->ebx);
@@ -37,8 +37,8 @@
 runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp)
 {
 	Ucontext *uc;
-	Mcontext *mc;
-	Regs *r;
+	Mcontext32 *mc;
+	Regs32 *r;
 	uintptr *sp;
 	byte *pc;
 
@@ -141,8 +141,8 @@
 	if(restart)
 		sa.sa_flags |= SA_RESTART;
 	sa.sa_mask = ~0U;
-	sa.sa_tramp = (uintptr)runtime·sigtramp;	// runtime·sigtramp's job is to call into real handler
-	sa.__sigaction_u.__sa_sigaction = (uintptr)fn;
+	sa.sa_tramp = (void*)runtime·sigtramp;	// runtime·sigtramp's job is to call into real handler
+	*(uintptr*)&sa.__sigaction_u = (uintptr)fn;
 	runtime·sigaction(i, &sa, nil);
 }
 
diff --git a/src/pkg/runtime/darwin/amd64/defs.h b/src/pkg/runtime/darwin/amd64/defs.h
index 90f798e..a8493e4 100644
--- a/src/pkg/runtime/darwin/amd64/defs.h
+++ b/src/pkg/runtime/darwin/amd64/defs.h
@@ -1,305 +1,365 @@
-// godefs -f -m64 defs.c
+// Created by cgo -cdefs - DO NOT EDIT
+// cgo -cdefs defs.go
 
-// MACHINE GENERATED - DO NOT EDIT.
 
-// Constants
 enum {
-	PROT_NONE = 0,
-	PROT_READ = 0x1,
-	PROT_WRITE = 0x2,
-	PROT_EXEC = 0x4,
-	MAP_ANON = 0x1000,
-	MAP_PRIVATE = 0x2,
-	MAP_FIXED = 0x10,
-	MACH_MSG_TYPE_MOVE_RECEIVE = 0x10,
-	MACH_MSG_TYPE_MOVE_SEND = 0x11,
-	MACH_MSG_TYPE_MOVE_SEND_ONCE = 0x12,
-	MACH_MSG_TYPE_COPY_SEND = 0x13,
-	MACH_MSG_TYPE_MAKE_SEND = 0x14,
-	MACH_MSG_TYPE_MAKE_SEND_ONCE = 0x15,
-	MACH_MSG_TYPE_COPY_RECEIVE = 0x16,
-	MACH_MSG_PORT_DESCRIPTOR = 0,
-	MACH_MSG_OOL_DESCRIPTOR = 0x1,
-	MACH_MSG_OOL_PORTS_DESCRIPTOR = 0x2,
-	MACH_MSG_OOL_VOLATILE_DESCRIPTOR = 0x3,
-	MACH_MSGH_BITS_COMPLEX = 0x80000000,
-	MACH_SEND_MSG = 0x1,
-	MACH_RCV_MSG = 0x2,
-	MACH_RCV_LARGE = 0x4,
-	MACH_SEND_TIMEOUT = 0x10,
-	MACH_SEND_INTERRUPT = 0x40,
-	MACH_SEND_CANCEL = 0x80,
-	MACH_SEND_ALWAYS = 0x10000,
-	MACH_SEND_TRAILER = 0x20000,
-	MACH_RCV_TIMEOUT = 0x100,
-	MACH_RCV_NOTIFY = 0x200,
-	MACH_RCV_INTERRUPT = 0x400,
-	MACH_RCV_OVERWRITE = 0x1000,
-	NDR_PROTOCOL_2_0 = 0,
-	NDR_INT_BIG_ENDIAN = 0,
-	NDR_INT_LITTLE_ENDIAN = 0x1,
-	NDR_FLOAT_IEEE = 0,
-	NDR_CHAR_ASCII = 0,
-	SA_SIGINFO = 0x40,
-	SA_RESTART = 0x2,
-	SA_ONSTACK = 0x1,
-	SA_USERTRAMP = 0x100,
-	SA_64REGSET = 0x200,
-	SIGHUP = 0x1,
-	SIGINT = 0x2,
-	SIGQUIT = 0x3,
-	SIGILL = 0x4,
-	SIGTRAP = 0x5,
-	SIGABRT = 0x6,
-	SIGEMT = 0x7,
-	SIGFPE = 0x8,
-	SIGKILL = 0x9,
-	SIGBUS = 0xa,
-	SIGSEGV = 0xb,
-	SIGSYS = 0xc,
-	SIGPIPE = 0xd,
-	SIGALRM = 0xe,
-	SIGTERM = 0xf,
-	SIGURG = 0x10,
-	SIGSTOP = 0x11,
-	SIGTSTP = 0x12,
-	SIGCONT = 0x13,
-	SIGCHLD = 0x14,
-	SIGTTIN = 0x15,
-	SIGTTOU = 0x16,
-	SIGIO = 0x17,
-	SIGXCPU = 0x18,
-	SIGXFSZ = 0x19,
-	SIGVTALRM = 0x1a,
-	SIGPROF = 0x1b,
-	SIGWINCH = 0x1c,
-	SIGINFO = 0x1d,
-	SIGUSR1 = 0x1e,
-	SIGUSR2 = 0x1f,
-	FPE_INTDIV = 0x7,
-	FPE_INTOVF = 0x8,
-	FPE_FLTDIV = 0x1,
-	FPE_FLTOVF = 0x2,
-	FPE_FLTUND = 0x3,
-	FPE_FLTRES = 0x4,
-	FPE_FLTINV = 0x5,
-	FPE_FLTSUB = 0x6,
-	BUS_ADRALN = 0x1,
-	BUS_ADRERR = 0x2,
-	BUS_OBJERR = 0x3,
-	SEGV_MAPERR = 0x1,
-	SEGV_ACCERR = 0x2,
-	ITIMER_REAL = 0,
-	ITIMER_VIRTUAL = 0x1,
-	ITIMER_PROF = 0x2,
-};
+	PROT_NONE	= 0x0,
+	PROT_READ	= 0x1,
+	PROT_WRITE	= 0x2,
+	PROT_EXEC	= 0x4,
 
-// Types
-#pragma pack on
+	MAP_ANON	= 0x1000,
+	MAP_PRIVATE	= 0x2,
+	MAP_FIXED	= 0x10,
+
+	MACH_MSG_TYPE_MOVE_RECEIVE	= 0x10,
+	MACH_MSG_TYPE_MOVE_SEND		= 0x11,
+	MACH_MSG_TYPE_MOVE_SEND_ONCE	= 0x12,
+	MACH_MSG_TYPE_COPY_SEND		= 0x13,
+	MACH_MSG_TYPE_MAKE_SEND		= 0x14,
+	MACH_MSG_TYPE_MAKE_SEND_ONCE	= 0x15,
+	MACH_MSG_TYPE_COPY_RECEIVE	= 0x16,
+
+	MACH_MSG_PORT_DESCRIPTOR		= 0x0,
+	MACH_MSG_OOL_DESCRIPTOR			= 0x1,
+	MACH_MSG_OOL_PORTS_DESCRIPTOR		= 0x2,
+	MACH_MSG_OOL_VOLATILE_DESCRIPTOR	= 0x3,
+
+	MACH_MSGH_BITS_COMPLEX	= 0x80000000,
+
+	MACH_SEND_MSG	= 0x1,
+	MACH_RCV_MSG	= 0x2,
+	MACH_RCV_LARGE	= 0x4,
+
+	MACH_SEND_TIMEOUT	= 0x10,
+	MACH_SEND_INTERRUPT	= 0x40,
+	MACH_SEND_CANCEL	= 0x80,
+	MACH_SEND_ALWAYS	= 0x10000,
+	MACH_SEND_TRAILER	= 0x20000,
+	MACH_RCV_TIMEOUT	= 0x100,
+	MACH_RCV_NOTIFY		= 0x200,
+	MACH_RCV_INTERRUPT	= 0x400,
+	MACH_RCV_OVERWRITE	= 0x1000,
+
+	NDR_PROTOCOL_2_0	= 0x0,
+	NDR_INT_BIG_ENDIAN	= 0x0,
+	NDR_INT_LITTLE_ENDIAN	= 0x1,
+	NDR_FLOAT_IEEE		= 0x0,
+	NDR_CHAR_ASCII		= 0x0,
+
+	SA_SIGINFO	= 0x40,
+	SA_RESTART	= 0x2,
+	SA_ONSTACK	= 0x1,
+	SA_USERTRAMP	= 0x100,
+	SA_64REGSET	= 0x200,
+
+	SIGHUP		= 0x1,
+	SIGINT		= 0x2,
+	SIGQUIT		= 0x3,
+	SIGILL		= 0x4,
+	SIGTRAP		= 0x5,
+	SIGABRT		= 0x6,
+	SIGEMT		= 0x7,
+	SIGFPE		= 0x8,
+	SIGKILL		= 0x9,
+	SIGBUS		= 0xa,
+	SIGSEGV		= 0xb,
+	SIGSYS		= 0xc,
+	SIGPIPE		= 0xd,
+	SIGALRM		= 0xe,
+	SIGTERM		= 0xf,
+	SIGURG		= 0x10,
+	SIGSTOP		= 0x11,
+	SIGTSTP		= 0x12,
+	SIGCONT		= 0x13,
+	SIGCHLD		= 0x14,
+	SIGTTIN		= 0x15,
+	SIGTTOU		= 0x16,
+	SIGIO		= 0x17,
+	SIGXCPU		= 0x18,
+	SIGXFSZ		= 0x19,
+	SIGVTALRM	= 0x1a,
+	SIGPROF		= 0x1b,
+	SIGWINCH	= 0x1c,
+	SIGINFO		= 0x1d,
+	SIGUSR1		= 0x1e,
+	SIGUSR2		= 0x1f,
+
+	FPE_INTDIV	= 0x7,
+	FPE_INTOVF	= 0x8,
+	FPE_FLTDIV	= 0x1,
+	FPE_FLTOVF	= 0x2,
+	FPE_FLTUND	= 0x3,
+	FPE_FLTRES	= 0x4,
+	FPE_FLTINV	= 0x5,
+	FPE_FLTSUB	= 0x6,
+
+	BUS_ADRALN	= 0x1,
+	BUS_ADRERR	= 0x2,
+	BUS_OBJERR	= 0x3,
+
+	SEGV_MAPERR	= 0x1,
+	SEGV_ACCERR	= 0x2,
+
+	ITIMER_REAL	= 0x0,
+	ITIMER_VIRTUAL	= 0x1,
+	ITIMER_PROF	= 0x2,
+};
 
 typedef struct MachBody MachBody;
-struct MachBody {
-	uint32 msgh_descriptor_count;
-};
-
 typedef struct MachHeader MachHeader;
-struct MachHeader {
-	uint32 msgh_bits;
-	uint32 msgh_size;
-	uint32 msgh_remote_port;
-	uint32 msgh_local_port;
-	uint32 msgh_reserved;
-	int32 msgh_id;
-};
-
 typedef struct MachNDR MachNDR;
-struct MachNDR {
-	uint8 mig_vers;
-	uint8 if_vers;
-	uint8 reserved1;
-	uint8 mig_encoding;
-	uint8 int_rep;
-	uint8 char_rep;
-	uint8 float_rep;
-	uint8 reserved2;
-};
-
 typedef struct MachPort MachPort;
-struct MachPort {
-	uint32 name;
-	uint32 pad1;
-	uint16 pad2;
-	uint8 disposition;
-	uint8 type;
-};
-
 typedef struct StackT StackT;
-struct StackT {
-	void *ss_sp;
-	uint64 ss_size;
-	int32 ss_flags;
-	byte pad_godefs_0[4];
-};
-
-typedef union Sighandler Sighandler;
-union Sighandler {
-	uint64 __sa_handler;
-	uint64 __sa_sigaction;
-};
-
 typedef struct Sigaction Sigaction;
-struct Sigaction {
-	Sighandler __sigaction_u;
-	uint64 sa_tramp;
-	uint32 sa_mask;
-	int32 sa_flags;
-};
-
-typedef union Sigval Sigval;
-union Sigval {
-	int32 sival_int;
-	void *sival_ptr;
-};
-
 typedef struct Siginfo Siginfo;
-struct Siginfo {
-	int32 si_signo;
-	int32 si_errno;
-	int32 si_code;
-	int32 si_pid;
-	uint32 si_uid;
-	int32 si_status;
-	void *si_addr;
-	Sigval si_value;
-	int64 si_band;
-	uint64 __pad[7];
-};
-
 typedef struct Timeval Timeval;
-struct Timeval {
-	int64 tv_sec;
-	int32 tv_usec;
-	byte pad_godefs_0[4];
-};
-
 typedef struct Itimerval Itimerval;
-struct Itimerval {
-	Timeval it_interval;
-	Timeval it_value;
-};
-
 typedef struct FPControl FPControl;
-struct FPControl {
-	byte pad_godefs_0[2];
-};
-
 typedef struct FPStatus FPStatus;
-struct FPStatus {
-	byte pad_godefs_0[2];
-};
-
 typedef struct RegMMST RegMMST;
-struct RegMMST {
-	int8 mmst_reg[10];
-	int8 mmst_rsrv[6];
-};
-
 typedef struct RegXMM RegXMM;
-struct RegXMM {
-	int8 xmm_reg[16];
-};
-
-typedef struct Regs Regs;
-struct Regs {
-	uint64 rax;
-	uint64 rbx;
-	uint64 rcx;
-	uint64 rdx;
-	uint64 rdi;
-	uint64 rsi;
-	uint64 rbp;
-	uint64 rsp;
-	uint64 r8;
-	uint64 r9;
-	uint64 r10;
-	uint64 r11;
-	uint64 r12;
-	uint64 r13;
-	uint64 r14;
-	uint64 r15;
-	uint64 rip;
-	uint64 rflags;
-	uint64 cs;
-	uint64 fs;
-	uint64 gs;
-};
-
-typedef struct FloatState FloatState;
-struct FloatState {
-	uint64 fpu_reserved;
-	FPControl fpu_fcw;
-	FPStatus fpu_fsw;
-	uint8 fpu_ftw;
-	uint8 fpu_rsrv1;
-	uint16 fpu_fop;
-	uint32 fpu_ip;
-	uint16 fpu_cs;
-	uint16 fpu_rsrv2;
-	uint32 fpu_dp;
-	uint16 fpu_ds;
-	uint16 fpu_rsrv3;
-	uint32 fpu_mxcsr;
-	uint32 fpu_mxcsrmask;
-	RegMMST fpu_stmm0;
-	RegMMST fpu_stmm1;
-	RegMMST fpu_stmm2;
-	RegMMST fpu_stmm3;
-	RegMMST fpu_stmm4;
-	RegMMST fpu_stmm5;
-	RegMMST fpu_stmm6;
-	RegMMST fpu_stmm7;
-	RegXMM fpu_xmm0;
-	RegXMM fpu_xmm1;
-	RegXMM fpu_xmm2;
-	RegXMM fpu_xmm3;
-	RegXMM fpu_xmm4;
-	RegXMM fpu_xmm5;
-	RegXMM fpu_xmm6;
-	RegXMM fpu_xmm7;
-	RegXMM fpu_xmm8;
-	RegXMM fpu_xmm9;
-	RegXMM fpu_xmm10;
-	RegXMM fpu_xmm11;
-	RegXMM fpu_xmm12;
-	RegXMM fpu_xmm13;
-	RegXMM fpu_xmm14;
-	RegXMM fpu_xmm15;
-	int8 fpu_rsrv4[96];
-	int32 fpu_reserved1;
-};
-
-typedef struct ExceptionState ExceptionState;
-struct ExceptionState {
-	uint32 trapno;
-	uint32 err;
-	uint64 faultvaddr;
-};
-
-typedef struct Mcontext Mcontext;
-struct Mcontext {
-	ExceptionState es;
-	Regs ss;
-	FloatState fs;
-	byte pad_godefs_0[4];
-};
-
+typedef struct Regs64 Regs64;
+typedef struct FloatState64 FloatState64;
+typedef struct ExceptionState64 ExceptionState64;
+typedef struct Mcontext64 Mcontext64;
+typedef struct Regs32 Regs32;
+typedef struct FloatState32 FloatState32;
+typedef struct ExceptionState32 ExceptionState32;
+typedef struct Mcontext32 Mcontext32;
 typedef struct Ucontext Ucontext;
-struct Ucontext {
-	int32 uc_onstack;
-	uint32 uc_sigmask;
-	StackT uc_stack;
-	uint64 uc_link;
-	uint64 uc_mcsize;
-	Mcontext *uc_mcontext;
+
+#pragma pack on
+
+struct MachBody {
+	uint32	msgh_descriptor_count;
 };
+struct MachHeader {
+	uint32	msgh_bits;
+	uint32	msgh_size;
+	uint32	msgh_remote_port;
+	uint32	msgh_local_port;
+	uint32	msgh_reserved;
+	int32	msgh_id;
+};
+struct MachNDR {
+	uint8	mig_vers;
+	uint8	if_vers;
+	uint8	reserved1;
+	uint8	mig_encoding;
+	uint8	int_rep;
+	uint8	char_rep;
+	uint8	float_rep;
+	uint8	reserved2;
+};
+struct MachPort {
+	uint32	name;
+	uint32	pad1;
+	uint16	pad2;
+	uint8	disposition;
+	uint8	type;
+};
+
+struct StackT {
+	byte	*ss_sp;
+	uint64	ss_size;
+	int32	ss_flags;
+	byte	Pad_godefs_0[4];
+};
+typedef	byte	Sighandler[8];
+
+struct Sigaction {
+	Sighandler	__sigaction_u;
+	void	*sa_tramp;
+	uint32	sa_mask;
+	int32	sa_flags;
+};
+
+typedef	byte	Sigval[8];
+struct Siginfo {
+	int32	si_signo;
+	int32	si_errno;
+	int32	si_code;
+	int32	si_pid;
+	uint32	si_uid;
+	int32	si_status;
+	byte	*si_addr;
+	Sigval	si_value;
+	int64	si_band;
+	uint64	__pad[7];
+};
+struct Timeval {
+	int64	tv_sec;
+	int32	tv_usec;
+	byte	Pad_godefs_0[4];
+};
+struct Itimerval {
+	Timeval	it_interval;
+	Timeval	it_value;
+};
+
+struct FPControl {
+	byte	Pad_godefs_0[2];
+};
+struct FPStatus {
+	byte	Pad_godefs_0[2];
+};
+struct RegMMST {
+	int8	mmst_reg[10];
+	int8	mmst_rsrv[6];
+};
+struct RegXMM {
+	int8	xmm_reg[16];
+};
+
+struct Regs64 {
+	uint64	rax;
+	uint64	rbx;
+	uint64	rcx;
+	uint64	rdx;
+	uint64	rdi;
+	uint64	rsi;
+	uint64	rbp;
+	uint64	rsp;
+	uint64	r8;
+	uint64	r9;
+	uint64	r10;
+	uint64	r11;
+	uint64	r12;
+	uint64	r13;
+	uint64	r14;
+	uint64	r15;
+	uint64	rip;
+	uint64	rflags;
+	uint64	cs;
+	uint64	fs;
+	uint64	gs;
+};
+struct FloatState64 {
+	int32	fpu_reserved[2];
+	FPControl	fpu_fcw;
+	FPStatus	fpu_fsw;
+	uint8	fpu_ftw;
+	uint8	fpu_rsrv1;
+	uint16	fpu_fop;
+	uint32	fpu_ip;
+	uint16	fpu_cs;
+	uint16	fpu_rsrv2;
+	uint32	fpu_dp;
+	uint16	fpu_ds;
+	uint16	fpu_rsrv3;
+	uint32	fpu_mxcsr;
+	uint32	fpu_mxcsrmask;
+	RegMMST	fpu_stmm0;
+	RegMMST	fpu_stmm1;
+	RegMMST	fpu_stmm2;
+	RegMMST	fpu_stmm3;
+	RegMMST	fpu_stmm4;
+	RegMMST	fpu_stmm5;
+	RegMMST	fpu_stmm6;
+	RegMMST	fpu_stmm7;
+	RegXMM	fpu_xmm0;
+	RegXMM	fpu_xmm1;
+	RegXMM	fpu_xmm2;
+	RegXMM	fpu_xmm3;
+	RegXMM	fpu_xmm4;
+	RegXMM	fpu_xmm5;
+	RegXMM	fpu_xmm6;
+	RegXMM	fpu_xmm7;
+	RegXMM	fpu_xmm8;
+	RegXMM	fpu_xmm9;
+	RegXMM	fpu_xmm10;
+	RegXMM	fpu_xmm11;
+	RegXMM	fpu_xmm12;
+	RegXMM	fpu_xmm13;
+	RegXMM	fpu_xmm14;
+	RegXMM	fpu_xmm15;
+	int8	fpu_rsrv4[96];
+	int32	fpu_reserved1;
+};
+struct ExceptionState64 {
+	uint32	trapno;
+	uint32	err;
+	uint64	faultvaddr;
+};
+struct Mcontext64 {
+	ExceptionState64	es;
+	Regs64	ss;
+	FloatState64	fs;
+	byte	Pad_godefs_0[4];
+};
+
+struct Regs32 {
+	uint32	eax;
+	uint32	ebx;
+	uint32	ecx;
+	uint32	edx;
+	uint32	edi;
+	uint32	esi;
+	uint32	ebp;
+	uint32	esp;
+	uint32	ss;
+	uint32	eflags;
+	uint32	eip;
+	uint32	cs;
+	uint32	ds;
+	uint32	es;
+	uint32	fs;
+	uint32	gs;
+};
+struct FloatState32 {
+	int32	fpu_reserved[2];
+	FPControl	fpu_fcw;
+	FPStatus	fpu_fsw;
+	uint8	fpu_ftw;
+	uint8	fpu_rsrv1;
+	uint16	fpu_fop;
+	uint32	fpu_ip;
+	uint16	fpu_cs;
+	uint16	fpu_rsrv2;
+	uint32	fpu_dp;
+	uint16	fpu_ds;
+	uint16	fpu_rsrv3;
+	uint32	fpu_mxcsr;
+	uint32	fpu_mxcsrmask;
+	RegMMST	fpu_stmm0;
+	RegMMST	fpu_stmm1;
+	RegMMST	fpu_stmm2;
+	RegMMST	fpu_stmm3;
+	RegMMST	fpu_stmm4;
+	RegMMST	fpu_stmm5;
+	RegMMST	fpu_stmm6;
+	RegMMST	fpu_stmm7;
+	RegXMM	fpu_xmm0;
+	RegXMM	fpu_xmm1;
+	RegXMM	fpu_xmm2;
+	RegXMM	fpu_xmm3;
+	RegXMM	fpu_xmm4;
+	RegXMM	fpu_xmm5;
+	RegXMM	fpu_xmm6;
+	RegXMM	fpu_xmm7;
+	int8	fpu_rsrv4[224];
+	int32	fpu_reserved1;
+};
+struct ExceptionState32 {
+	uint32	trapno;
+	uint32	err;
+	uint32	faultvaddr;
+};
+struct Mcontext32 {
+	ExceptionState32	es;
+	Regs32	ss;
+	FloatState32	fs;
+};
+
+struct Ucontext {
+	int32	uc_onstack;
+	uint32	uc_sigmask;
+	StackT	uc_stack;
+	Ucontext	*uc_link;
+	uint64	uc_mcsize;
+	Mcontext64	*uc_mcontext;
+};
+
+
 #pragma pack off
diff --git a/src/pkg/runtime/darwin/amd64/signal.c b/src/pkg/runtime/darwin/amd64/signal.c
index 036a3ac..c0ef89f 100644
--- a/src/pkg/runtime/darwin/amd64/signal.c
+++ b/src/pkg/runtime/darwin/amd64/signal.c
@@ -8,7 +8,7 @@
 #include "signals.h"
 
 void
-runtime·dumpregs(Regs *r)
+runtime·dumpregs(Regs64 *r)
 {
 	runtime·printf("rax     %X\n", r->rax);
 	runtime·printf("rbx     %X\n", r->rbx);
@@ -45,8 +45,8 @@
 runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp)
 {
 	Ucontext *uc;
-	Mcontext *mc;
-	Regs *r;
+	Mcontext64 *mc;
+	Regs64 *r;
 	uintptr *sp;
 	byte *pc;
 
@@ -151,8 +151,8 @@
 	if(restart)
 		sa.sa_flags |= SA_RESTART;
 	sa.sa_mask = ~0ULL;
-	sa.sa_tramp = (uintptr)runtime·sigtramp;	// runtime·sigtramp's job is to call into real handler
-	sa.__sigaction_u.__sa_sigaction = (uintptr)fn;
+	sa.sa_tramp = runtime·sigtramp;	// runtime·sigtramp's job is to call into real handler
+	*(uintptr*)&sa.__sigaction_u = (uintptr)fn;
 	runtime·sigaction(i, &sa, nil);
 }
 
diff --git a/src/pkg/runtime/darwin/defs.c b/src/pkg/runtime/darwin/defs.c
deleted file mode 100644
index 032a6bc..0000000
--- a/src/pkg/runtime/darwin/defs.c
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs.
- *
-	godefs -f -m64 defs.c >amd64/defs.h
-	godefs -f -m32 defs.c >386/defs.h
- */
-
-#define __DARWIN_UNIX03 0
-
-#include <mach/mach.h>
-#include <mach/message.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <sys/mman.h>
-
-enum {
-	$PROT_NONE = PROT_NONE,
-	$PROT_READ = PROT_READ,
-	$PROT_WRITE = PROT_WRITE,
-	$PROT_EXEC = PROT_EXEC,
-
-	$MAP_ANON = MAP_ANON,
-	$MAP_PRIVATE = MAP_PRIVATE,
-	$MAP_FIXED = MAP_FIXED,
-
-	$MACH_MSG_TYPE_MOVE_RECEIVE = MACH_MSG_TYPE_MOVE_RECEIVE,
-	$MACH_MSG_TYPE_MOVE_SEND = MACH_MSG_TYPE_MOVE_SEND,
-	$MACH_MSG_TYPE_MOVE_SEND_ONCE = MACH_MSG_TYPE_MOVE_SEND_ONCE,
-	$MACH_MSG_TYPE_COPY_SEND = MACH_MSG_TYPE_COPY_SEND,
-	$MACH_MSG_TYPE_MAKE_SEND = MACH_MSG_TYPE_MAKE_SEND,
-	$MACH_MSG_TYPE_MAKE_SEND_ONCE = MACH_MSG_TYPE_MAKE_SEND_ONCE,
-	$MACH_MSG_TYPE_COPY_RECEIVE = MACH_MSG_TYPE_COPY_RECEIVE,
-
-	$MACH_MSG_PORT_DESCRIPTOR = MACH_MSG_PORT_DESCRIPTOR,
-	$MACH_MSG_OOL_DESCRIPTOR = MACH_MSG_OOL_DESCRIPTOR,
-	$MACH_MSG_OOL_PORTS_DESCRIPTOR = MACH_MSG_OOL_PORTS_DESCRIPTOR,
-	$MACH_MSG_OOL_VOLATILE_DESCRIPTOR = MACH_MSG_OOL_VOLATILE_DESCRIPTOR,
-
-	$MACH_MSGH_BITS_COMPLEX = MACH_MSGH_BITS_COMPLEX,
-
-	$MACH_SEND_MSG = MACH_SEND_MSG,
-	$MACH_RCV_MSG = MACH_RCV_MSG,
-	$MACH_RCV_LARGE = MACH_RCV_LARGE,
-
-	$MACH_SEND_TIMEOUT = MACH_SEND_TIMEOUT,
-	$MACH_SEND_INTERRUPT = MACH_SEND_INTERRUPT,
-	$MACH_SEND_CANCEL = MACH_SEND_CANCEL,
-	$MACH_SEND_ALWAYS = MACH_SEND_ALWAYS,
-	$MACH_SEND_TRAILER = MACH_SEND_TRAILER,
-	$MACH_RCV_TIMEOUT = MACH_RCV_TIMEOUT,
-	$MACH_RCV_NOTIFY = MACH_RCV_NOTIFY,
-	$MACH_RCV_INTERRUPT = MACH_RCV_INTERRUPT,
-	$MACH_RCV_OVERWRITE = MACH_RCV_OVERWRITE,
-
-	$NDR_PROTOCOL_2_0 = NDR_PROTOCOL_2_0,
-	$NDR_INT_BIG_ENDIAN = NDR_INT_BIG_ENDIAN,
-	$NDR_INT_LITTLE_ENDIAN = NDR_INT_LITTLE_ENDIAN,
-	$NDR_FLOAT_IEEE = NDR_FLOAT_IEEE,
-	$NDR_CHAR_ASCII = NDR_CHAR_ASCII,
-
-	$SA_SIGINFO = SA_SIGINFO,
-	$SA_RESTART = SA_RESTART,
-	$SA_ONSTACK = SA_ONSTACK,
-	$SA_USERTRAMP = SA_USERTRAMP,
-	$SA_64REGSET = SA_64REGSET,
-	
-	$SIGHUP = SIGHUP,
-	$SIGINT = SIGINT,
-	$SIGQUIT = SIGQUIT,
-	$SIGILL = SIGILL,
-	$SIGTRAP = SIGTRAP,
-	$SIGABRT = SIGABRT,
-	$SIGEMT = SIGEMT,
-	$SIGFPE = SIGFPE,
-	$SIGKILL = SIGKILL,
-	$SIGBUS = SIGBUS,
-	$SIGSEGV = SIGSEGV,
-	$SIGSYS = SIGSYS,
-	$SIGPIPE = SIGPIPE,
-	$SIGALRM = SIGALRM,
-	$SIGTERM = SIGTERM,
-	$SIGURG = SIGURG,
-	$SIGSTOP = SIGSTOP,
-	$SIGTSTP = SIGTSTP,
-	$SIGCONT = SIGCONT,
-	$SIGCHLD = SIGCHLD,
-	$SIGTTIN = SIGTTIN,
-	$SIGTTOU = SIGTTOU,
-	$SIGIO = SIGIO,
-	$SIGXCPU = SIGXCPU,
-	$SIGXFSZ = SIGXFSZ,
-	$SIGVTALRM = SIGVTALRM,
-	$SIGPROF = SIGPROF,
-	$SIGWINCH = SIGWINCH,
-	$SIGINFO = SIGINFO,
-	$SIGUSR1 = SIGUSR1,
-	$SIGUSR2 = SIGUSR2,
-	
-	$FPE_INTDIV = FPE_INTDIV,
-	$FPE_INTOVF = FPE_INTOVF,
-	$FPE_FLTDIV = FPE_FLTDIV,
-	$FPE_FLTOVF = FPE_FLTOVF,
-	$FPE_FLTUND = FPE_FLTUND,
-	$FPE_FLTRES = FPE_FLTRES,
-	$FPE_FLTINV = FPE_FLTINV,
-	$FPE_FLTSUB = FPE_FLTSUB,
-	
-	$BUS_ADRALN = BUS_ADRALN,
-	$BUS_ADRERR = BUS_ADRERR,
-	$BUS_OBJERR = BUS_OBJERR,
-	
-	$SEGV_MAPERR = SEGV_MAPERR,
-	$SEGV_ACCERR = SEGV_ACCERR,
-	
-	$ITIMER_REAL = ITIMER_REAL,
-	$ITIMER_VIRTUAL = ITIMER_VIRTUAL,
-	$ITIMER_PROF = ITIMER_PROF,
-};
-
-typedef mach_msg_body_t	$MachBody;
-typedef mach_msg_header_t	$MachHeader;
-typedef NDR_record_t		$MachNDR;
-typedef mach_msg_port_descriptor_t	$MachPort;
-
-typedef stack_t	$StackT;
-typedef union __sigaction_u	$Sighandler;
-
-typedef struct __sigaction	$Sigaction;	// used in syscalls
-// typedef struct sigaction	$Sigaction;	// used by the C library
-typedef union sigval $Sigval;
-typedef siginfo_t $Siginfo;
-typedef struct timeval	$Timeval;
-typedef struct itimerval	$Itimerval;
-
-typedef struct fp_control $FPControl;
-typedef struct fp_status $FPStatus;
-typedef struct mmst_reg $RegMMST;
-typedef struct xmm_reg $RegXMM;
-
-#ifdef __LP64__
-// amd64
-typedef x86_thread_state64_t	$Regs;
-typedef x86_float_state64_t $FloatState;
-typedef x86_exception_state64_t $ExceptionState;
-typedef struct mcontext64 $Mcontext;
-#else
-// 386
-typedef x86_thread_state32_t	$Regs;
-typedef x86_float_state32_t $FloatState;
-typedef x86_exception_state32_t $ExceptionState;
-typedef struct mcontext32 $Mcontext;
-#endif
-
-typedef ucontext_t	$Ucontext;
diff --git a/src/pkg/runtime/darwin/defs.go b/src/pkg/runtime/darwin/defs.go
new file mode 100644
index 0000000..6cd988d
--- /dev/null
+++ b/src/pkg/runtime/darwin/defs.go
@@ -0,0 +1,159 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo.
+
+GOARCH=amd64 cgo -cdefs defs.go >amd64/defs.h
+GOARCH=386 cgo -cdefs defs.go >386/defs.h
+*/
+
+package runtime
+
+/*
+#define __DARWIN_UNIX03 0
+#include <mach/mach.h>
+#include <mach/message.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <sys/mman.h>
+*/
+import "C"
+
+const (
+	PROT_NONE  = C.PROT_NONE
+	PROT_READ  = C.PROT_READ
+	PROT_WRITE = C.PROT_WRITE
+	PROT_EXEC  = C.PROT_EXEC
+
+	MAP_ANON    = C.MAP_ANON
+	MAP_PRIVATE = C.MAP_PRIVATE
+	MAP_FIXED   = C.MAP_FIXED
+
+	MACH_MSG_TYPE_MOVE_RECEIVE   = C.MACH_MSG_TYPE_MOVE_RECEIVE
+	MACH_MSG_TYPE_MOVE_SEND      = C.MACH_MSG_TYPE_MOVE_SEND
+	MACH_MSG_TYPE_MOVE_SEND_ONCE = C.MACH_MSG_TYPE_MOVE_SEND_ONCE
+	MACH_MSG_TYPE_COPY_SEND      = C.MACH_MSG_TYPE_COPY_SEND
+	MACH_MSG_TYPE_MAKE_SEND      = C.MACH_MSG_TYPE_MAKE_SEND
+	MACH_MSG_TYPE_MAKE_SEND_ONCE = C.MACH_MSG_TYPE_MAKE_SEND_ONCE
+	MACH_MSG_TYPE_COPY_RECEIVE   = C.MACH_MSG_TYPE_COPY_RECEIVE
+
+	MACH_MSG_PORT_DESCRIPTOR         = C.MACH_MSG_PORT_DESCRIPTOR
+	MACH_MSG_OOL_DESCRIPTOR          = C.MACH_MSG_OOL_DESCRIPTOR
+	MACH_MSG_OOL_PORTS_DESCRIPTOR    = C.MACH_MSG_OOL_PORTS_DESCRIPTOR
+	MACH_MSG_OOL_VOLATILE_DESCRIPTOR = C.MACH_MSG_OOL_VOLATILE_DESCRIPTOR
+
+	MACH_MSGH_BITS_COMPLEX = C.MACH_MSGH_BITS_COMPLEX
+
+	MACH_SEND_MSG  = C.MACH_SEND_MSG
+	MACH_RCV_MSG   = C.MACH_RCV_MSG
+	MACH_RCV_LARGE = C.MACH_RCV_LARGE
+
+	MACH_SEND_TIMEOUT   = C.MACH_SEND_TIMEOUT
+	MACH_SEND_INTERRUPT = C.MACH_SEND_INTERRUPT
+	MACH_SEND_CANCEL    = C.MACH_SEND_CANCEL
+	MACH_SEND_ALWAYS    = C.MACH_SEND_ALWAYS
+	MACH_SEND_TRAILER   = C.MACH_SEND_TRAILER
+	MACH_RCV_TIMEOUT    = C.MACH_RCV_TIMEOUT
+	MACH_RCV_NOTIFY     = C.MACH_RCV_NOTIFY
+	MACH_RCV_INTERRUPT  = C.MACH_RCV_INTERRUPT
+	MACH_RCV_OVERWRITE  = C.MACH_RCV_OVERWRITE
+
+	NDR_PROTOCOL_2_0      = C.NDR_PROTOCOL_2_0
+	NDR_INT_BIG_ENDIAN    = C.NDR_INT_BIG_ENDIAN
+	NDR_INT_LITTLE_ENDIAN = C.NDR_INT_LITTLE_ENDIAN
+	NDR_FLOAT_IEEE        = C.NDR_FLOAT_IEEE
+	NDR_CHAR_ASCII        = C.NDR_CHAR_ASCII
+
+	SA_SIGINFO   = C.SA_SIGINFO
+	SA_RESTART   = C.SA_RESTART
+	SA_ONSTACK   = C.SA_ONSTACK
+	SA_USERTRAMP = C.SA_USERTRAMP
+	SA_64REGSET  = C.SA_64REGSET
+
+	SIGHUP    = C.SIGHUP
+	SIGINT    = C.SIGINT
+	SIGQUIT   = C.SIGQUIT
+	SIGILL    = C.SIGILL
+	SIGTRAP   = C.SIGTRAP
+	SIGABRT   = C.SIGABRT
+	SIGEMT    = C.SIGEMT
+	SIGFPE    = C.SIGFPE
+	SIGKILL   = C.SIGKILL
+	SIGBUS    = C.SIGBUS
+	SIGSEGV   = C.SIGSEGV
+	SIGSYS    = C.SIGSYS
+	SIGPIPE   = C.SIGPIPE
+	SIGALRM   = C.SIGALRM
+	SIGTERM   = C.SIGTERM
+	SIGURG    = C.SIGURG
+	SIGSTOP   = C.SIGSTOP
+	SIGTSTP   = C.SIGTSTP
+	SIGCONT   = C.SIGCONT
+	SIGCHLD   = C.SIGCHLD
+	SIGTTIN   = C.SIGTTIN
+	SIGTTOU   = C.SIGTTOU
+	SIGIO     = C.SIGIO
+	SIGXCPU   = C.SIGXCPU
+	SIGXFSZ   = C.SIGXFSZ
+	SIGVTALRM = C.SIGVTALRM
+	SIGPROF   = C.SIGPROF
+	SIGWINCH  = C.SIGWINCH
+	SIGINFO   = C.SIGINFO
+	SIGUSR1   = C.SIGUSR1
+	SIGUSR2   = C.SIGUSR2
+
+	FPE_INTDIV = C.FPE_INTDIV
+	FPE_INTOVF = C.FPE_INTOVF
+	FPE_FLTDIV = C.FPE_FLTDIV
+	FPE_FLTOVF = C.FPE_FLTOVF
+	FPE_FLTUND = C.FPE_FLTUND
+	FPE_FLTRES = C.FPE_FLTRES
+	FPE_FLTINV = C.FPE_FLTINV
+	FPE_FLTSUB = C.FPE_FLTSUB
+
+	BUS_ADRALN = C.BUS_ADRALN
+	BUS_ADRERR = C.BUS_ADRERR
+	BUS_OBJERR = C.BUS_OBJERR
+
+	SEGV_MAPERR = C.SEGV_MAPERR
+	SEGV_ACCERR = C.SEGV_ACCERR
+
+	ITIMER_REAL    = C.ITIMER_REAL
+	ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
+	ITIMER_PROF    = C.ITIMER_PROF
+)
+
+type MachBody C.mach_msg_body_t
+type MachHeader C.mach_msg_header_t
+type MachNDR C.NDR_record_t
+type MachPort C.mach_msg_port_descriptor_t
+
+type StackT C.struct_sigaltstack
+type Sighandler C.union___sigaction_u
+
+type Sigaction C.struct___sigaction // used in syscalls
+// type Sigaction C.struct_sigaction	// used by the C library
+type Sigval C.union_sigval
+type Siginfo C.siginfo_t
+type Timeval C.struct_timeval
+type Itimerval C.struct_itimerval
+
+type FPControl C.struct_fp_control
+type FPStatus C.struct_fp_status
+type RegMMST C.struct_mmst_reg
+type RegXMM C.struct_xmm_reg
+
+type Regs64 C.struct_x86_thread_state64
+type FloatState64 C.struct_x86_float_state64
+type ExceptionState64 C.struct_x86_exception_state64
+type Mcontext64 C.struct_mcontext64
+
+type Regs32 C.struct_i386_thread_state
+type FloatState32 C.struct_i386_float_state
+type ExceptionState32 C.struct_i386_exception_state
+type Mcontext32 C.struct_mcontext32
+
+type Ucontext C.struct_ucontext
diff --git a/src/pkg/runtime/freebsd/defs.c b/src/pkg/runtime/freebsd/defs.c
deleted file mode 100644
index 7eb60c4..0000000
--- a/src/pkg/runtime/freebsd/defs.c
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs.
- *
-	godefs -f -m64 defs.c >amd64/defs.h
-	godefs -f -m32 defs.c >386/defs.h
- */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/ucontext.h>
-#include <sys/umtx.h>
-#include <sys/rtprio.h>
-#include <sys/thr.h>
-#include <sys/_sigset.h>
-#include <sys/unistd.h>
-
-enum {
-	$PROT_NONE = PROT_NONE,
-	$PROT_READ = PROT_READ,
-	$PROT_WRITE = PROT_WRITE,
-	$PROT_EXEC = PROT_EXEC,
-
-	$MAP_ANON = MAP_ANON,
-	$MAP_PRIVATE = MAP_PRIVATE,
-	$MAP_FIXED = MAP_FIXED,
-
-	$SA_SIGINFO = SA_SIGINFO,
-	$SA_RESTART = SA_RESTART,
-	$SA_ONSTACK = SA_ONSTACK,
-
-	$UMTX_OP_WAIT = UMTX_OP_WAIT,
-	$UMTX_OP_WAKE = UMTX_OP_WAKE,
-
-	$EINTR = EINTR,
-	
-	$SIGHUP = SIGHUP,
-	$SIGINT = SIGINT,
-	$SIGQUIT = SIGQUIT,
-	$SIGILL = SIGILL,
-	$SIGTRAP = SIGTRAP,
-	$SIGABRT = SIGABRT,
-	$SIGEMT = SIGEMT,
-	$SIGFPE = SIGFPE,
-	$SIGKILL = SIGKILL,
-	$SIGBUS = SIGBUS,
-	$SIGSEGV = SIGSEGV,
-	$SIGSYS = SIGSYS,
-	$SIGPIPE = SIGPIPE,
-	$SIGALRM = SIGALRM,
-	$SIGTERM = SIGTERM,
-	$SIGURG = SIGURG,
-	$SIGSTOP = SIGSTOP,
-	$SIGTSTP = SIGTSTP,
-	$SIGCONT = SIGCONT,
-	$SIGCHLD = SIGCHLD,
-	$SIGTTIN = SIGTTIN,
-	$SIGTTOU = SIGTTOU,
-	$SIGIO = SIGIO,
-	$SIGXCPU = SIGXCPU,
-	$SIGXFSZ = SIGXFSZ,
-	$SIGVTALRM = SIGVTALRM,
-	$SIGPROF = SIGPROF,
-	$SIGWINCH = SIGWINCH,
-	$SIGINFO = SIGINFO,
-	$SIGUSR1 = SIGUSR1,
-	$SIGUSR2 = SIGUSR2,
-	
-	$FPE_INTDIV = FPE_INTDIV,
-	$FPE_INTOVF = FPE_INTOVF,
-	$FPE_FLTDIV = FPE_FLTDIV,
-	$FPE_FLTOVF = FPE_FLTOVF,
-	$FPE_FLTUND = FPE_FLTUND,
-	$FPE_FLTRES = FPE_FLTRES,
-	$FPE_FLTINV = FPE_FLTINV,
-	$FPE_FLTSUB = FPE_FLTSUB,
-	
-	$BUS_ADRALN = BUS_ADRALN,
-	$BUS_ADRERR = BUS_ADRERR,
-	$BUS_OBJERR = BUS_OBJERR,
-	
-	$SEGV_MAPERR = SEGV_MAPERR,
-	$SEGV_ACCERR = SEGV_ACCERR,
-	
-	$ITIMER_REAL = ITIMER_REAL,
-	$ITIMER_VIRTUAL = ITIMER_VIRTUAL,
-	$ITIMER_PROF = ITIMER_PROF,
-};
-
-typedef struct rtprio	$Rtprio;
-typedef struct thr_param $ThrParam;
-typedef struct sigaltstack $Sigaltstack;
-typedef struct __sigset $Sigset;
-typedef union sigval $Sigval;
-typedef stack_t	$StackT;
-
-typedef siginfo_t $Siginfo;
-
-typedef mcontext_t $Mcontext;
-typedef ucontext_t $Ucontext;
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-typedef struct itimerval $Itimerval;
diff --git a/src/pkg/runtime/freebsd/defs.go b/src/pkg/runtime/freebsd/defs.go
new file mode 100644
index 0000000..ee80bb2
--- /dev/null
+++ b/src/pkg/runtime/freebsd/defs.go
@@ -0,0 +1,115 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo.
+
+GOARCH=amd64 cgo -cdefs defs.go >amd64/defs.h
+GOARCH=386 cgo -cdefs defs.go >386/defs.h
+*/
+
+package runtime
+
+/*
+#include <sys/types.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/ucontext.h>
+#include <sys/umtx.h>
+#include <sys/rtprio.h>
+#include <sys/thr.h>
+#include <sys/_sigset.h>
+#include <sys/unistd.h>
+*/
+import "C"
+
+const (
+	PROT_NONE  = C.PROT_NONE
+	PROT_READ  = C.PROT_READ
+	PROT_WRITE = C.PROT_WRITE
+	PROT_EXEC  = C.PROT_EXEC
+
+	MAP_ANON    = C.MAP_ANON
+	MAP_PRIVATE = C.MAP_PRIVATE
+	MAP_FIXED   = C.MAP_FIXED
+
+	SA_SIGINFO = C.SA_SIGINFO
+	SA_RESTART = C.SA_RESTART
+	SA_ONSTACK = C.SA_ONSTACK
+
+	UMTX_OP_WAIT = C.UMTX_OP_WAIT
+	UMTX_OP_WAKE = C.UMTX_OP_WAKE
+
+	EINTR = C.EINTR
+
+	SIGHUP    = C.SIGHUP
+	SIGINT    = C.SIGINT
+	SIGQUIT   = C.SIGQUIT
+	SIGILL    = C.SIGILL
+	SIGTRAP   = C.SIGTRAP
+	SIGABRT   = C.SIGABRT
+	SIGEMT    = C.SIGEMT
+	SIGFPE    = C.SIGFPE
+	SIGKILL   = C.SIGKILL
+	SIGBUS    = C.SIGBUS
+	SIGSEGV   = C.SIGSEGV
+	SIGSYS    = C.SIGSYS
+	SIGPIPE   = C.SIGPIPE
+	SIGALRM   = C.SIGALRM
+	SIGTERM   = C.SIGTERM
+	SIGURG    = C.SIGURG
+	SIGSTOP   = C.SIGSTOP
+	SIGTSTP   = C.SIGTSTP
+	SIGCONT   = C.SIGCONT
+	SIGCHLD   = C.SIGCHLD
+	SIGTTIN   = C.SIGTTIN
+	SIGTTOU   = C.SIGTTOU
+	SIGIO     = C.SIGIO
+	SIGXCPU   = C.SIGXCPU
+	SIGXFSZ   = C.SIGXFSZ
+	SIGVTALRM = C.SIGVTALRM
+	SIGPROF   = C.SIGPROF
+	SIGWINCH  = C.SIGWINCH
+	SIGINFO   = C.SIGINFO
+	SIGUSR1   = C.SIGUSR1
+	SIGUSR2   = C.SIGUSR2
+
+	FPE_INTDIV = C.FPE_INTDIV
+	FPE_INTOVF = C.FPE_INTOVF
+	FPE_FLTDIV = C.FPE_FLTDIV
+	FPE_FLTOVF = C.FPE_FLTOVF
+	FPE_FLTUND = C.FPE_FLTUND
+	FPE_FLTRES = C.FPE_FLTRES
+	FPE_FLTINV = C.FPE_FLTINV
+	FPE_FLTSUB = C.FPE_FLTSUB
+
+	BUS_ADRALN = C.BUS_ADRALN
+	BUS_ADRERR = C.BUS_ADRERR
+	BUS_OBJERR = C.BUS_OBJERR
+
+	SEGV_MAPERR = C.SEGV_MAPERR
+	SEGV_ACCERR = C.SEGV_ACCERR
+
+	ITIMER_REAL    = C.ITIMER_REAL
+	ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
+	ITIMER_PROF    = C.ITIMER_PROF
+)
+
+type Rtprio C.struct_rtprio
+type ThrParam C.struct_thr_param
+type Sigaltstack C.struct_sigaltstack
+type Sigset C.struct___sigset
+type Sigval C.union_sigval
+type StackT C.stack_t
+
+type Siginfo C.siginfo_t
+
+type Mcontext C.mcontext_t
+type Ucontext C.ucontext_t
+
+type Timespec C.struct_timespec
+type Timeval C.struct_timeval
+type Itimerval C.struct_itimerval
diff --git a/src/pkg/runtime/linux/386/defs.h b/src/pkg/runtime/linux/386/defs.h
index 73fe23e..19d6d9e 100644
--- a/src/pkg/runtime/linux/386/defs.h
+++ b/src/pkg/runtime/linux/386/defs.h
@@ -1,191 +1,189 @@
-// godefs -f -m32 -f -I/home/rsc/pub/linux-2.6/arch/x86/include -f -I/home/rsc/pub/linux-2.6/include -f -D_LOOSE_KERNEL_NAMES -f -D__ARCH_SI_UID_T=__kernel_uid32_t defs2.c
+// Created by cgo -cdefs - DO NOT EDIT
+// cgo -cdefs defs2.go
 
-// MACHINE GENERATED - DO NOT EDIT.
 
-// Constants
 enum {
-	PROT_NONE = 0,
-	PROT_READ = 0x1,
-	PROT_WRITE = 0x2,
-	PROT_EXEC = 0x4,
-	MAP_ANON = 0x20,
-	MAP_PRIVATE = 0x2,
-	MAP_FIXED = 0x10,
-	SA_RESTART = 0x10000000,
-	SA_ONSTACK = 0x8000000,
-	SA_RESTORER = 0x4000000,
-	SA_SIGINFO = 0x4,
-	SIGHUP = 0x1,
-	SIGINT = 0x2,
-	SIGQUIT = 0x3,
-	SIGILL = 0x4,
-	SIGTRAP = 0x5,
-	SIGABRT = 0x6,
-	SIGBUS = 0x7,
-	SIGFPE = 0x8,
-	SIGKILL = 0x9,
-	SIGUSR1 = 0xa,
-	SIGSEGV = 0xb,
-	SIGUSR2 = 0xc,
-	SIGPIPE = 0xd,
-	SIGALRM = 0xe,
-	SIGSTKFLT = 0x10,
-	SIGCHLD = 0x11,
-	SIGCONT = 0x12,
-	SIGSTOP = 0x13,
-	SIGTSTP = 0x14,
-	SIGTTIN = 0x15,
-	SIGTTOU = 0x16,
-	SIGURG = 0x17,
-	SIGXCPU = 0x18,
-	SIGXFSZ = 0x19,
-	SIGVTALRM = 0x1a,
-	SIGPROF = 0x1b,
-	SIGWINCH = 0x1c,
-	SIGIO = 0x1d,
-	SIGPWR = 0x1e,
-	SIGSYS = 0x1f,
-	FPE_INTDIV = 0x1,
-	FPE_INTOVF = 0x2,
-	FPE_FLTDIV = 0x3,
-	FPE_FLTOVF = 0x4,
-	FPE_FLTUND = 0x5,
-	FPE_FLTRES = 0x6,
-	FPE_FLTINV = 0x7,
-	FPE_FLTSUB = 0x8,
-	BUS_ADRALN = 0x1,
-	BUS_ADRERR = 0x2,
-	BUS_OBJERR = 0x3,
-	SEGV_MAPERR = 0x1,
-	SEGV_ACCERR = 0x2,
-	ITIMER_REAL = 0,
-	ITIMER_VIRTUAL = 0x1,
-	ITIMER_PROF = 0x2,
-	O_RDONLY = 0,
-	O_CLOEXEC = 02000000,
-};
+	PROT_NONE	= 0x0,
+	PROT_READ	= 0x1,
+	PROT_WRITE	= 0x2,
+	PROT_EXEC	= 0x4,
 
-// Types
-#pragma pack on
+	MAP_ANON	= 0x20,
+	MAP_PRIVATE	= 0x2,
+	MAP_FIXED	= 0x10,
+
+	SA_RESTART	= 0x10000000,
+	SA_ONSTACK	= 0x8000000,
+	SA_RESTORER	= 0x4000000,
+	SA_SIGINFO	= 0x4,
+
+	SIGHUP		= 0x1,
+	SIGINT		= 0x2,
+	SIGQUIT		= 0x3,
+	SIGILL		= 0x4,
+	SIGTRAP		= 0x5,
+	SIGABRT		= 0x6,
+	SIGBUS		= 0x7,
+	SIGFPE		= 0x8,
+	SIGKILL		= 0x9,
+	SIGUSR1		= 0xa,
+	SIGSEGV		= 0xb,
+	SIGUSR2		= 0xc,
+	SIGPIPE		= 0xd,
+	SIGALRM		= 0xe,
+	SIGSTKFLT	= 0x10,
+	SIGCHLD		= 0x11,
+	SIGCONT		= 0x12,
+	SIGSTOP		= 0x13,
+	SIGTSTP		= 0x14,
+	SIGTTIN		= 0x15,
+	SIGTTOU		= 0x16,
+	SIGURG		= 0x17,
+	SIGXCPU		= 0x18,
+	SIGXFSZ		= 0x19,
+	SIGVTALRM	= 0x1a,
+	SIGPROF		= 0x1b,
+	SIGWINCH	= 0x1c,
+	SIGIO		= 0x1d,
+	SIGPWR		= 0x1e,
+	SIGSYS		= 0x1f,
+
+	FPE_INTDIV	= 0x1,
+	FPE_INTOVF	= 0x2,
+	FPE_FLTDIV	= 0x3,
+	FPE_FLTOVF	= 0x4,
+	FPE_FLTUND	= 0x5,
+	FPE_FLTRES	= 0x6,
+	FPE_FLTINV	= 0x7,
+	FPE_FLTSUB	= 0x8,
+
+	BUS_ADRALN	= 0x1,
+	BUS_ADRERR	= 0x2,
+	BUS_OBJERR	= 0x3,
+
+	SEGV_MAPERR	= 0x1,
+	SEGV_ACCERR	= 0x2,
+
+	ITIMER_REAL	= 0x0,
+	ITIMER_VIRTUAL	= 0x1,
+	ITIMER_PROF	= 0x2,
+
+	O_RDONLY	= 0x0,
+	O_CLOEXEC	= 0x80000,
+};
 
 typedef struct Fpreg Fpreg;
-struct Fpreg {
-	uint16 significand[4];
-	uint16 exponent;
-};
-
 typedef struct Fpxreg Fpxreg;
-struct Fpxreg {
-	uint16 significand[4];
-	uint16 exponent;
-	uint16 padding[3];
-};
-
 typedef struct Xmmreg Xmmreg;
-struct Xmmreg {
-	uint32 element[4];
-};
-
 typedef struct Fpstate Fpstate;
-struct Fpstate {
-	uint32 cw;
-	uint32 sw;
-	uint32 tag;
-	uint32 ipoff;
-	uint32 cssel;
-	uint32 dataoff;
-	uint32 datasel;
-	Fpreg _st[8];
-	uint16 status;
-	uint16 magic;
-	uint32 _fxsr_env[6];
-	uint32 mxcsr;
-	uint32 reserved;
-	Fpxreg _fxsr_st[8];
-	Xmmreg _xmm[8];
-	uint32 padding1[44];
-	byte Pad_godefs_0[48];
-};
-
 typedef struct Timespec Timespec;
-struct Timespec {
-	int32 tv_sec;
-	int32 tv_nsec;
-};
-
 typedef struct Timeval Timeval;
-struct Timeval {
-	int32 tv_sec;
-	int32 tv_usec;
-};
-
 typedef struct Sigaction Sigaction;
-struct Sigaction {
-	void *k_sa_handler;
-	uint32 sa_flags;
-	void *sa_restorer;
-	uint32 sa_mask;
-};
-
 typedef struct Siginfo Siginfo;
-struct Siginfo {
-	int32 si_signo;
-	int32 si_errno;
-	int32 si_code;
-	byte _sifields[116];
-};
-
 typedef struct Sigaltstack Sigaltstack;
-struct Sigaltstack {
-	void *ss_sp;
-	int32 ss_flags;
-	uint32 ss_size;
-};
-
 typedef struct Sigcontext Sigcontext;
-struct Sigcontext {
-	uint16 gs;
-	uint16 __gsh;
-	uint16 fs;
-	uint16 __fsh;
-	uint16 es;
-	uint16 __esh;
-	uint16 ds;
-	uint16 __dsh;
-	uint32 edi;
-	uint32 esi;
-	uint32 ebp;
-	uint32 esp;
-	uint32 ebx;
-	uint32 edx;
-	uint32 ecx;
-	uint32 eax;
-	uint32 trapno;
-	uint32 err;
-	uint32 eip;
-	uint16 cs;
-	uint16 __csh;
-	uint32 eflags;
-	uint32 esp_at_signal;
-	uint16 ss;
-	uint16 __ssh;
-	Fpstate *fpstate;
-	uint32 oldmask;
-	uint32 cr2;
-};
-
 typedef struct Ucontext Ucontext;
+typedef struct Itimerval Itimerval;
+
+#pragma pack on
+
+struct Fpreg {
+	uint16	significand[4];
+	uint16	exponent;
+};
+struct Fpxreg {
+	uint16	significand[4];
+	uint16	exponent;
+	uint16	padding[3];
+};
+struct Xmmreg {
+	uint32	element[4];
+};
+struct Fpstate {
+	uint32	cw;
+	uint32	sw;
+	uint32	tag;
+	uint32	ipoff;
+	uint32	cssel;
+	uint32	dataoff;
+	uint32	datasel;
+	Fpreg	_st[8];
+	uint16	status;
+	uint16	magic;
+	uint32	_fxsr_env[6];
+	uint32	mxcsr;
+	uint32	reserved;
+	Fpxreg	_fxsr_st[8];
+	Xmmreg	_xmm[8];
+	uint32	padding1[44];
+	byte	anon0[48];
+};
+struct Timespec {
+	int32	tv_sec;
+	int32	tv_nsec;
+};
+struct Timeval {
+	int32	tv_sec;
+	int32	tv_usec;
+};
+struct Sigaction {
+	void	*k_sa_handler;
+	uint32	sa_flags;
+	void	*sa_restorer;
+	uint32	sa_mask;
+};
+struct Siginfo {
+	int32	si_signo;
+	int32	si_errno;
+	int32	si_code;
+	byte	_sifields[116];
+};
+struct Sigaltstack {
+	byte	*ss_sp;
+	int32	ss_flags;
+	uint32	ss_size;
+};
+struct Sigcontext {
+	uint16	gs;
+	uint16	__gsh;
+	uint16	fs;
+	uint16	__fsh;
+	uint16	es;
+	uint16	__esh;
+	uint16	ds;
+	uint16	__dsh;
+	uint32	edi;
+	uint32	esi;
+	uint32	ebp;
+	uint32	esp;
+	uint32	ebx;
+	uint32	edx;
+	uint32	ecx;
+	uint32	eax;
+	uint32	trapno;
+	uint32	err;
+	uint32	eip;
+	uint16	cs;
+	uint16	__csh;
+	uint32	eflags;
+	uint32	esp_at_signal;
+	uint16	ss;
+	uint16	__ssh;
+	Fpstate	*fpstate;
+	uint32	oldmask;
+	uint32	cr2;
+};
 struct Ucontext {
-	uint32 uc_flags;
-	Ucontext *uc_link;
-	Sigaltstack uc_stack;
-	Sigcontext uc_mcontext;
-	uint32 uc_sigmask;
+	uint32	uc_flags;
+	Ucontext	*uc_link;
+	Sigaltstack	uc_stack;
+	Sigcontext	uc_mcontext;
+	uint32	uc_sigmask;
+};
+struct Itimerval {
+	Timeval	it_interval;
+	Timeval	it_value;
 };
 
-typedef struct Itimerval Itimerval;
-struct Itimerval {
-	Timeval it_interval;
-	Timeval it_value;
-};
+
 #pragma pack off
diff --git a/src/pkg/runtime/linux/amd64/defs.h b/src/pkg/runtime/linux/amd64/defs.h
index 8053dd1..5b44a78 100644
--- a/src/pkg/runtime/linux/amd64/defs.h
+++ b/src/pkg/runtime/linux/amd64/defs.h
@@ -1,236 +1,232 @@
-// godefs -f -m64 defs.c
+// Created by cgo -cdefs - DO NOT EDIT
+// cgo -cdefs defs.go defs1.go
 
-// MACHINE GENERATED - DO NOT EDIT.
 
-// Constants
 enum {
-	PROT_NONE = 0,
-	PROT_READ = 0x1,
-	PROT_WRITE = 0x2,
-	PROT_EXEC = 0x4,
-	MAP_ANON = 0x20,
-	MAP_PRIVATE = 0x2,
-	MAP_FIXED = 0x10,
-	SA_RESTART = 0x10000000,
-	SA_ONSTACK = 0x8000000,
-	SA_RESTORER = 0x4000000,
-	SA_SIGINFO = 0x4,
-	SIGHUP = 0x1,
-	SIGINT = 0x2,
-	SIGQUIT = 0x3,
-	SIGILL = 0x4,
-	SIGTRAP = 0x5,
-	SIGABRT = 0x6,
-	SIGBUS = 0x7,
-	SIGFPE = 0x8,
-	SIGKILL = 0x9,
-	SIGUSR1 = 0xa,
-	SIGSEGV = 0xb,
-	SIGUSR2 = 0xc,
-	SIGPIPE = 0xd,
-	SIGALRM = 0xe,
-	SIGSTKFLT = 0x10,
-	SIGCHLD = 0x11,
-	SIGCONT = 0x12,
-	SIGSTOP = 0x13,
-	SIGTSTP = 0x14,
-	SIGTTIN = 0x15,
-	SIGTTOU = 0x16,
-	SIGURG = 0x17,
-	SIGXCPU = 0x18,
-	SIGXFSZ = 0x19,
-	SIGVTALRM = 0x1a,
-	SIGPROF = 0x1b,
-	SIGWINCH = 0x1c,
-	SIGIO = 0x1d,
-	SIGPWR = 0x1e,
-	SIGSYS = 0x1f,
-	FPE_INTDIV = 0x1,
-	FPE_INTOVF = 0x2,
-	FPE_FLTDIV = 0x3,
-	FPE_FLTOVF = 0x4,
-	FPE_FLTUND = 0x5,
-	FPE_FLTRES = 0x6,
-	FPE_FLTINV = 0x7,
-	FPE_FLTSUB = 0x8,
-	BUS_ADRALN = 0x1,
-	BUS_ADRERR = 0x2,
-	BUS_OBJERR = 0x3,
-	SEGV_MAPERR = 0x1,
-	SEGV_ACCERR = 0x2,
-	ITIMER_REAL = 0,
-	ITIMER_VIRTUAL = 0x1,
-	ITIMER_PROF = 0x2,
-	O_RDONLY = 0,
-	O_CLOEXEC = 02000000,
-};
+	PROT_NONE	= 0x0,
+	PROT_READ	= 0x1,
+	PROT_WRITE	= 0x2,
+	PROT_EXEC	= 0x4,
 
-// Types
-#pragma pack on
+	MAP_ANON	= 0x20,
+	MAP_PRIVATE	= 0x2,
+	MAP_FIXED	= 0x10,
+
+	SA_RESTART	= 0x10000000,
+	SA_ONSTACK	= 0x8000000,
+	SA_RESTORER	= 0x4000000,
+	SA_SIGINFO	= 0x4,
+
+	SIGHUP		= 0x1,
+	SIGINT		= 0x2,
+	SIGQUIT		= 0x3,
+	SIGILL		= 0x4,
+	SIGTRAP		= 0x5,
+	SIGABRT		= 0x6,
+	SIGBUS		= 0x7,
+	SIGFPE		= 0x8,
+	SIGKILL		= 0x9,
+	SIGUSR1		= 0xa,
+	SIGSEGV		= 0xb,
+	SIGUSR2		= 0xc,
+	SIGPIPE		= 0xd,
+	SIGALRM		= 0xe,
+	SIGSTKFLT	= 0x10,
+	SIGCHLD		= 0x11,
+	SIGCONT		= 0x12,
+	SIGSTOP		= 0x13,
+	SIGTSTP		= 0x14,
+	SIGTTIN		= 0x15,
+	SIGTTOU		= 0x16,
+	SIGURG		= 0x17,
+	SIGXCPU		= 0x18,
+	SIGXFSZ		= 0x19,
+	SIGVTALRM	= 0x1a,
+	SIGPROF		= 0x1b,
+	SIGWINCH	= 0x1c,
+	SIGIO		= 0x1d,
+	SIGPWR		= 0x1e,
+	SIGSYS		= 0x1f,
+
+	FPE_INTDIV	= 0x1,
+	FPE_INTOVF	= 0x2,
+	FPE_FLTDIV	= 0x3,
+	FPE_FLTOVF	= 0x4,
+	FPE_FLTUND	= 0x5,
+	FPE_FLTRES	= 0x6,
+	FPE_FLTINV	= 0x7,
+	FPE_FLTSUB	= 0x8,
+
+	BUS_ADRALN	= 0x1,
+	BUS_ADRERR	= 0x2,
+	BUS_OBJERR	= 0x3,
+
+	SEGV_MAPERR	= 0x1,
+	SEGV_ACCERR	= 0x2,
+
+	ITIMER_REAL	= 0x0,
+	ITIMER_VIRTUAL	= 0x1,
+	ITIMER_PROF	= 0x2,
+};
 
 typedef struct Timespec Timespec;
-struct Timespec {
-	int64 tv_sec;
-	int64 tv_nsec;
-};
-
 typedef struct Timeval Timeval;
-struct Timeval {
-	int64 tv_sec;
-	int64 tv_usec;
-};
-
 typedef struct Sigaction Sigaction;
-struct Sigaction {
-	void *sa_handler;
-	uint64 sa_flags;
-	void *sa_restorer;
-	uint64 sa_mask;
-};
-
 typedef struct Siginfo Siginfo;
-struct Siginfo {
-	int32 si_signo;
-	int32 si_errno;
-	int32 si_code;
-	byte pad_godefs_0[4];
-	byte _sifields[112];
-};
-
 typedef struct Itimerval Itimerval;
-struct Itimerval {
-	Timeval it_interval;
-	Timeval it_value;
-};
-#pragma pack off
-// godefs -f -m64 defs1.c
 
-// MACHINE GENERATED - DO NOT EDIT.
-
-// Constants
-
-// Types
 #pragma pack on
 
+struct Timespec {
+	int64	tv_sec;
+	int64	tv_nsec;
+};
+struct Timeval {
+	int64	tv_sec;
+	int64	tv_usec;
+};
+struct Sigaction {
+	void	*sa_handler;
+	uint64	sa_flags;
+	void	*sa_restorer;
+	uint64	sa_mask;
+};
+struct Siginfo {
+	int32	si_signo;
+	int32	si_errno;
+	int32	si_code;
+	byte	Pad_godefs_0[4];
+	byte	_sifields[112];
+};
+struct Itimerval {
+	Timeval	it_interval;
+	Timeval	it_value;
+};
+
+
+#pragma pack off
+// Created by cgo -cdefs - DO NOT EDIT
+// cgo -cdefs defs.go defs1.go
+
+
+enum {
+	O_RDONLY	= 0x0,
+	O_CLOEXEC	= 0x80000,
+};
+
 typedef struct Usigset Usigset;
-struct Usigset {
-	uint64 __val[16];
-};
-
 typedef struct Fpxreg Fpxreg;
-struct Fpxreg {
-	uint16 significand[4];
-	uint16 exponent;
-	uint16 padding[3];
-};
-
 typedef struct Xmmreg Xmmreg;
-struct Xmmreg {
-	uint32 element[4];
-};
-
 typedef struct Fpstate Fpstate;
-struct Fpstate {
-	uint16 cwd;
-	uint16 swd;
-	uint16 ftw;
-	uint16 fop;
-	uint64 rip;
-	uint64 rdp;
-	uint32 mxcsr;
-	uint32 mxcr_mask;
-	Fpxreg _st[8];
-	Xmmreg _xmm[16];
-	uint32 padding[24];
-};
-
 typedef struct Fpxreg1 Fpxreg1;
-struct Fpxreg1 {
-	uint16 significand[4];
-	uint16 exponent;
-	uint16 padding[3];
-};
-
 typedef struct Xmmreg1 Xmmreg1;
-struct Xmmreg1 {
-	uint32 element[4];
-};
-
 typedef struct Fpstate1 Fpstate1;
-struct Fpstate1 {
-	uint16 cwd;
-	uint16 swd;
-	uint16 ftw;
-	uint16 fop;
-	uint64 rip;
-	uint64 rdp;
-	uint32 mxcsr;
-	uint32 mxcr_mask;
-	Fpxreg1 _st[8];
-	Xmmreg1 _xmm[16];
-	uint32 padding[24];
-};
-
 typedef struct Fpreg1 Fpreg1;
-struct Fpreg1 {
-	uint16 significand[4];
-	uint16 exponent;
-};
-
 typedef struct Sigaltstack Sigaltstack;
-struct Sigaltstack {
-	void *ss_sp;
-	int32 ss_flags;
-	byte pad_godefs_0[4];
-	uint64 ss_size;
-};
-
 typedef struct Mcontext Mcontext;
-struct Mcontext {
-	int64 gregs[23];
-	Fpstate *fpregs;
-	uint64 __reserved1[8];
-};
-
 typedef struct Ucontext Ucontext;
+typedef struct Sigcontext Sigcontext;
+
+#pragma pack on
+
+struct Usigset {
+	uint64	__val[16];
+};
+struct Fpxreg {
+	uint16	significand[4];
+	uint16	exponent;
+	uint16	padding[3];
+};
+struct Xmmreg {
+	uint32	element[4];
+};
+struct Fpstate {
+	uint16	cwd;
+	uint16	swd;
+	uint16	ftw;
+	uint16	fop;
+	uint64	rip;
+	uint64	rdp;
+	uint32	mxcsr;
+	uint32	mxcr_mask;
+	Fpxreg	_st[8];
+	Xmmreg	_xmm[16];
+	uint32	padding[24];
+};
+struct Fpxreg1 {
+	uint16	significand[4];
+	uint16	exponent;
+	uint16	padding[3];
+};
+struct Xmmreg1 {
+	uint32	element[4];
+};
+struct Fpstate1 {
+	uint16	cwd;
+	uint16	swd;
+	uint16	ftw;
+	uint16	fop;
+	uint64	rip;
+	uint64	rdp;
+	uint32	mxcsr;
+	uint32	mxcr_mask;
+	Fpxreg1	_st[8];
+	Xmmreg1	_xmm[16];
+	uint32	padding[24];
+};
+struct Fpreg1 {
+	uint16	significand[4];
+	uint16	exponent;
+};
+struct Sigaltstack {
+	byte	*ss_sp;
+	int32	ss_flags;
+	byte	Pad_godefs_0[4];
+	uint64	ss_size;
+};
+struct Mcontext {
+	int64	gregs[23];
+	Fpstate	*fpregs;
+	uint64	__reserved1[8];
+};
 struct Ucontext {
-	uint64 uc_flags;
-	Ucontext *uc_link;
-	Sigaltstack uc_stack;
-	Mcontext uc_mcontext;
-	Usigset uc_sigmask;
-	Fpstate __fpregs_mem;
+	uint64	uc_flags;
+	Ucontext	*uc_link;
+	Sigaltstack	uc_stack;
+	Mcontext	uc_mcontext;
+	Usigset	uc_sigmask;
+	Fpstate	__fpregs_mem;
+};
+struct Sigcontext {
+	uint64	r8;
+	uint64	r9;
+	uint64	r10;
+	uint64	r11;
+	uint64	r12;
+	uint64	r13;
+	uint64	r14;
+	uint64	r15;
+	uint64	rdi;
+	uint64	rsi;
+	uint64	rbp;
+	uint64	rbx;
+	uint64	rdx;
+	uint64	rax;
+	uint64	rcx;
+	uint64	rsp;
+	uint64	rip;
+	uint64	eflags;
+	uint16	cs;
+	uint16	gs;
+	uint16	fs;
+	uint16	__pad0;
+	uint64	err;
+	uint64	trapno;
+	uint64	oldmask;
+	uint64	cr2;
+	Fpstate1	*fpstate;
+	uint64	__reserved1[8];
 };
 
-typedef struct Sigcontext Sigcontext;
-struct Sigcontext {
-	uint64 r8;
-	uint64 r9;
-	uint64 r10;
-	uint64 r11;
-	uint64 r12;
-	uint64 r13;
-	uint64 r14;
-	uint64 r15;
-	uint64 rdi;
-	uint64 rsi;
-	uint64 rbp;
-	uint64 rbx;
-	uint64 rdx;
-	uint64 rax;
-	uint64 rcx;
-	uint64 rsp;
-	uint64 rip;
-	uint64 eflags;
-	uint16 cs;
-	uint16 gs;
-	uint16 fs;
-	uint16 __pad0;
-	uint64 err;
-	uint64 trapno;
-	uint64 oldmask;
-	uint64 cr2;
-	Fpstate1 *fpstate;
-	uint64 __reserved1[8];
-};
+
 #pragma pack off
diff --git a/src/pkg/runtime/linux/defs.c b/src/pkg/runtime/linux/defs.c
deleted file mode 100644
index 5dda787..0000000
--- a/src/pkg/runtime/linux/defs.c
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs
-	godefs -f -m64 defs.c >amd64/defs.h
-	godefs -f -m64 defs1.c >>amd64/defs.h
- */
-
-// Linux glibc and Linux kernel define different and conflicting
-// definitions for struct sigaction, struct timespec, etc.
-// We want the kernel ones, which are in the asm/* headers.
-// But then we'd get conflicts when we include the system
-// headers for things like ucontext_t, so that happens in
-// a separate file, defs1.c.
-
-#include <asm/posix_types.h>
-#define size_t __kernel_size_t
-#include <asm/signal.h>
-#include <asm/siginfo.h>
-#include <asm/mman.h>
-
-enum {
-	$PROT_NONE = PROT_NONE,
-	$PROT_READ = PROT_READ,
-	$PROT_WRITE = PROT_WRITE,
-	$PROT_EXEC = PROT_EXEC,
-
-	$MAP_ANON = MAP_ANONYMOUS,
-	$MAP_PRIVATE = MAP_PRIVATE,
-	$MAP_FIXED = MAP_FIXED,
-
-	$SA_RESTART = SA_RESTART,
-	$SA_ONSTACK = SA_ONSTACK,
-	$SA_RESTORER = SA_RESTORER,
-	$SA_SIGINFO = SA_SIGINFO,
-	
-	$SIGHUP = SIGHUP,
-	$SIGINT = SIGINT,
-	$SIGQUIT = SIGQUIT,
-	$SIGILL = SIGILL,
-	$SIGTRAP = SIGTRAP,
-	$SIGABRT = SIGABRT,
-	$SIGBUS = SIGBUS,
-	$SIGFPE = SIGFPE,
-	$SIGKILL = SIGKILL,
-	$SIGUSR1 = SIGUSR1,
-	$SIGSEGV = SIGSEGV,
-	$SIGUSR2 = SIGUSR2,
-	$SIGPIPE = SIGPIPE,
-	$SIGALRM = SIGALRM,
-	$SIGSTKFLT = SIGSTKFLT,
-	$SIGCHLD = SIGCHLD,
-	$SIGCONT = SIGCONT,
-	$SIGSTOP = SIGSTOP,
-	$SIGTSTP = SIGTSTP,
-	$SIGTTIN = SIGTTIN,
-	$SIGTTOU = SIGTTOU,
-	$SIGURG = SIGURG,
-	$SIGXCPU = SIGXCPU,
-	$SIGXFSZ = SIGXFSZ,
-	$SIGVTALRM = SIGVTALRM,
-	$SIGPROF = SIGPROF,
-	$SIGWINCH = SIGWINCH,
-	$SIGIO = SIGIO,
-	$SIGPWR = SIGPWR,
-	$SIGSYS = SIGSYS,
-	
-	$FPE_INTDIV = FPE_INTDIV,
-	$FPE_INTOVF = FPE_INTOVF,
-	$FPE_FLTDIV = FPE_FLTDIV,
-	$FPE_FLTOVF = FPE_FLTOVF,
-	$FPE_FLTUND = FPE_FLTUND,
-	$FPE_FLTRES = FPE_FLTRES,
-	$FPE_FLTINV = FPE_FLTINV,
-	$FPE_FLTSUB = FPE_FLTSUB,
-	
-	$BUS_ADRALN = BUS_ADRALN,
-	$BUS_ADRERR = BUS_ADRERR,
-	$BUS_OBJERR = BUS_OBJERR,
-	
-	$SEGV_MAPERR = SEGV_MAPERR,
-	$SEGV_ACCERR = SEGV_ACCERR,
-	
-	$ITIMER_REAL = ITIMER_REAL,
-	$ITIMER_VIRTUAL = ITIMER_VIRTUAL,
-	$ITIMER_PROF = ITIMER_PROF,
-};
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-typedef struct sigaction $Sigaction;
-typedef siginfo_t $Siginfo;
-typedef struct itimerval $Itimerval;
diff --git a/src/pkg/runtime/linux/defs.go b/src/pkg/runtime/linux/defs.go
new file mode 100644
index 0000000..85f99db
--- /dev/null
+++ b/src/pkg/runtime/linux/defs.go
@@ -0,0 +1,100 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo -cdefs
+
+GOARCH=amd64 cgo -cdefs defs.go defs1.go >amd64/defs.h
+*/
+
+package runtime
+
+/*
+// Linux glibc and Linux kernel define different and conflicting
+// definitions for struct sigaction, struct timespec, etc.
+// We want the kernel ones, which are in the asm/* headers.
+// But then we'd get conflicts when we include the system
+// headers for things like ucontext_t, so that happens in
+// a separate file, defs1.go.
+
+#include <asm/posix_types.h>
+#define size_t __kernel_size_t
+#include <asm/signal.h>
+#include <asm/siginfo.h>
+#include <asm/mman.h>
+*/
+import "C"
+
+const (
+	PROT_NONE  = C.PROT_NONE
+	PROT_READ  = C.PROT_READ
+	PROT_WRITE = C.PROT_WRITE
+	PROT_EXEC  = C.PROT_EXEC
+
+	MAP_ANON    = C.MAP_ANONYMOUS
+	MAP_PRIVATE = C.MAP_PRIVATE
+	MAP_FIXED   = C.MAP_FIXED
+
+	SA_RESTART  = C.SA_RESTART
+	SA_ONSTACK  = C.SA_ONSTACK
+	SA_RESTORER = C.SA_RESTORER
+	SA_SIGINFO  = C.SA_SIGINFO
+
+	SIGHUP    = C.SIGHUP
+	SIGINT    = C.SIGINT
+	SIGQUIT   = C.SIGQUIT
+	SIGILL    = C.SIGILL
+	SIGTRAP   = C.SIGTRAP
+	SIGABRT   = C.SIGABRT
+	SIGBUS    = C.SIGBUS
+	SIGFPE    = C.SIGFPE
+	SIGKILL   = C.SIGKILL
+	SIGUSR1   = C.SIGUSR1
+	SIGSEGV   = C.SIGSEGV
+	SIGUSR2   = C.SIGUSR2
+	SIGPIPE   = C.SIGPIPE
+	SIGALRM   = C.SIGALRM
+	SIGSTKFLT = C.SIGSTKFLT
+	SIGCHLD   = C.SIGCHLD
+	SIGCONT   = C.SIGCONT
+	SIGSTOP   = C.SIGSTOP
+	SIGTSTP   = C.SIGTSTP
+	SIGTTIN   = C.SIGTTIN
+	SIGTTOU   = C.SIGTTOU
+	SIGURG    = C.SIGURG
+	SIGXCPU   = C.SIGXCPU
+	SIGXFSZ   = C.SIGXFSZ
+	SIGVTALRM = C.SIGVTALRM
+	SIGPROF   = C.SIGPROF
+	SIGWINCH  = C.SIGWINCH
+	SIGIO     = C.SIGIO
+	SIGPWR    = C.SIGPWR
+	SIGSYS    = C.SIGSYS
+
+	FPE_INTDIV = C.FPE_INTDIV
+	FPE_INTOVF = C.FPE_INTOVF
+	FPE_FLTDIV = C.FPE_FLTDIV
+	FPE_FLTOVF = C.FPE_FLTOVF
+	FPE_FLTUND = C.FPE_FLTUND
+	FPE_FLTRES = C.FPE_FLTRES
+	FPE_FLTINV = C.FPE_FLTINV
+	FPE_FLTSUB = C.FPE_FLTSUB
+
+	BUS_ADRALN = C.BUS_ADRALN
+	BUS_ADRERR = C.BUS_ADRERR
+	BUS_OBJERR = C.BUS_OBJERR
+
+	SEGV_MAPERR = C.SEGV_MAPERR
+	SEGV_ACCERR = C.SEGV_ACCERR
+
+	ITIMER_REAL    = C.ITIMER_REAL
+	ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
+	ITIMER_PROF    = C.ITIMER_PROF
+)
+
+type Timespec C.struct_timespec
+type Timeval C.struct_timeval
+type Sigaction C.struct_sigaction
+type Siginfo C.siginfo_t
+type Itimerval C.struct_itimerval
diff --git a/src/pkg/runtime/linux/defs1.c b/src/pkg/runtime/linux/defs1.c
deleted file mode 100644
index e737f8e..0000000
--- a/src/pkg/runtime/linux/defs1.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs
-	godefs -f -m64 defs.c >amd64/defs.h
-	godefs -f -m64 defs1.c >>amd64/defs.h
- */
-
-#include <ucontext.h>
-
-typedef __sigset_t $Usigset;
-typedef struct _libc_fpxreg $Fpxreg;
-typedef struct _libc_xmmreg $Xmmreg;
-typedef struct _libc_fpstate $Fpstate;
-typedef struct _fpxreg $Fpxreg1;
-typedef struct _xmmreg $Xmmreg1;
-typedef struct _fpstate $Fpstate1;
-typedef struct _fpreg $Fpreg1;
-typedef struct sigaltstack $Sigaltstack;
-typedef mcontext_t $Mcontext;
-typedef ucontext_t $Ucontext;
-typedef struct sigcontext $Sigcontext;
diff --git a/src/pkg/runtime/linux/defs1.go b/src/pkg/runtime/linux/defs1.go
new file mode 100644
index 0000000..6d84e84
--- /dev/null
+++ b/src/pkg/runtime/linux/defs1.go
@@ -0,0 +1,35 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo -cdefs
+
+GOARCH=amd64 cgo -cdefs defs.go defs1.go >amd64/defs.h
+*/
+
+package runtime
+
+/*
+#include <ucontext.h>
+#include <fcntl.h>
+*/
+import "C"
+
+const (
+	O_RDONLY  = C.O_RDONLY
+	O_CLOEXEC = C.O_CLOEXEC
+)
+
+type Usigset C.__sigset_t
+type Fpxreg C.struct__libc_fpxreg
+type Xmmreg C.struct__libc_xmmreg
+type Fpstate C.struct__libc_fpstate
+type Fpxreg1 C.struct__fpxreg
+type Xmmreg1 C.struct__xmmreg
+type Fpstate1 C.struct__fpstate
+type Fpreg1 C.struct__fpreg
+type Sigaltstack C.struct_sigaltstack
+type Mcontext C.mcontext_t
+type Ucontext C.ucontext_t
+type Sigcontext C.struct_sigcontext
diff --git a/src/pkg/runtime/linux/defs2.c b/src/pkg/runtime/linux/defs2.c
deleted file mode 100644
index ff641ff..0000000
--- a/src/pkg/runtime/linux/defs2.c
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs
-	godefs -f -m32 \
-		-f -I/home/rsc/pub/linux-2.6/arch/x86/include \
-		-f -I/home/rsc/pub/linux-2.6/include \
-		-f -D_LOOSE_KERNEL_NAMES \
-		-f -D__ARCH_SI_UID_T'='__kernel_uid32_t \
-		defs2.c >386/defs.h
-
- * The asm header tricks we have to use for Linux on amd64
- * (see defs.c and defs1.c) don't work here, so this is yet another
- * file.  Sigh.
- */
-
-#include <asm/signal.h>
-#include <asm/mman.h>
-#include <asm/sigcontext.h>
-#include <asm/ucontext.h>
-#include <asm/siginfo.h>
-
-/*
-#include <sys/signal.h>
-#include <sys/mman.h>
-#include <ucontext.h>
-*/
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel which
-   is used with the rt_sigaction system call.  For 386 this is not
-   defined in any public header file.  */
-
-struct kernel_sigaction {
-	__sighandler_t k_sa_handler;
-	unsigned long sa_flags;
-	void (*sa_restorer) (void);
-	sigset_t sa_mask;
-};
-
-enum {
-	$PROT_NONE = PROT_NONE,
-	$PROT_READ = PROT_READ,
-	$PROT_WRITE = PROT_WRITE,
-	$PROT_EXEC = PROT_EXEC,
-
-	$MAP_ANON = MAP_ANONYMOUS,
-	$MAP_PRIVATE = MAP_PRIVATE,
-	$MAP_FIXED = MAP_FIXED,
-
-	$SA_RESTART = SA_RESTART,
-	$SA_ONSTACK = SA_ONSTACK,
-	$SA_RESTORER = SA_RESTORER,
-	$SA_SIGINFO = SA_SIGINFO,
-
-	$SIGHUP = SIGHUP,
-	$SIGINT = SIGINT,
-	$SIGQUIT = SIGQUIT,
-	$SIGILL = SIGILL,
-	$SIGTRAP = SIGTRAP,
-	$SIGABRT = SIGABRT,
-	$SIGBUS = SIGBUS,
-	$SIGFPE = SIGFPE,
-	$SIGKILL = SIGKILL,
-	$SIGUSR1 = SIGUSR1,
-	$SIGSEGV = SIGSEGV,
-	$SIGUSR2 = SIGUSR2,
-	$SIGPIPE = SIGPIPE,
-	$SIGALRM = SIGALRM,
-	$SIGSTKFLT = SIGSTKFLT,
-	$SIGCHLD = SIGCHLD,
-	$SIGCONT = SIGCONT,
-	$SIGSTOP = SIGSTOP,
-	$SIGTSTP = SIGTSTP,
-	$SIGTTIN = SIGTTIN,
-	$SIGTTOU = SIGTTOU,
-	$SIGURG = SIGURG,
-	$SIGXCPU = SIGXCPU,
-	$SIGXFSZ = SIGXFSZ,
-	$SIGVTALRM = SIGVTALRM,
-	$SIGPROF = SIGPROF,
-	$SIGWINCH = SIGWINCH,
-	$SIGIO = SIGIO,
-	$SIGPWR = SIGPWR,
-	$SIGSYS = SIGSYS,
-	
-	$FPE_INTDIV = FPE_INTDIV,
-	$FPE_INTOVF = FPE_INTOVF,
-	$FPE_FLTDIV = FPE_FLTDIV,
-	$FPE_FLTOVF = FPE_FLTOVF,
-	$FPE_FLTUND = FPE_FLTUND,
-	$FPE_FLTRES = FPE_FLTRES,
-	$FPE_FLTINV = FPE_FLTINV,
-	$FPE_FLTSUB = FPE_FLTSUB,
-	
-	$BUS_ADRALN = BUS_ADRALN,
-	$BUS_ADRERR = BUS_ADRERR,
-	$BUS_OBJERR = BUS_OBJERR,
-	
-	$SEGV_MAPERR = SEGV_MAPERR,
-	$SEGV_ACCERR = SEGV_ACCERR,
-	
-	$ITIMER_REAL = ITIMER_REAL,
-	$ITIMER_VIRTUAL = ITIMER_VIRTUAL,
-	$ITIMER_PROF = ITIMER_PROF,
-};
-
-typedef struct _fpreg $Fpreg;
-typedef struct _fpxreg $Fpxreg;
-typedef struct _xmmreg $Xmmreg;
-typedef struct _fpstate $Fpstate;
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-typedef struct kernel_sigaction $Sigaction;
-typedef siginfo_t $Siginfo;
-typedef struct sigaltstack $Sigaltstack;
-typedef struct sigcontext $Sigcontext;
-typedef struct ucontext $Ucontext;
-typedef struct itimerval $Itimerval;
diff --git a/src/pkg/runtime/linux/defs2.go b/src/pkg/runtime/linux/defs2.go
new file mode 100644
index 0000000..56da642
--- /dev/null
+++ b/src/pkg/runtime/linux/defs2.go
@@ -0,0 +1,121 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+ * Input to cgo -cdefs
+
+GOARCH=386 cgo -cdefs defs2.go >386/defs.h
+
+The asm header tricks we have to use for Linux on amd64
+(see defs.c and defs1.c) don't work here, so this is yet another
+file.  Sigh.
+*/
+
+package runtime
+
+/*
+#cgo CFLAGS: -I/home/rsc/pub/linux-2.6/arch/x86/include -I/home/rsc/pub/linux-2.6/include -D_LOOSE_KERNEL_NAMES -D__ARCH_SI_UID_T=__kernel_uid32_t
+
+#include <asm/signal.h>
+#include <asm/mman.h>
+#include <asm/sigcontext.h>
+#include <asm/ucontext.h>
+#include <asm/siginfo.h>
+#include <asm-generic/fcntl.h>
+
+// This is the sigaction structure from the Linux 2.1.68 kernel which
+//   is used with the rt_sigaction system call.  For 386 this is not
+//   defined in any public header file.
+
+struct kernel_sigaction {
+	__sighandler_t k_sa_handler;
+	unsigned long sa_flags;
+	void (*sa_restorer) (void);
+	sigset_t sa_mask;
+};
+*/
+import "C"
+
+const (
+	PROT_NONE  = C.PROT_NONE
+	PROT_READ  = C.PROT_READ
+	PROT_WRITE = C.PROT_WRITE
+	PROT_EXEC  = C.PROT_EXEC
+
+	MAP_ANON    = C.MAP_ANONYMOUS
+	MAP_PRIVATE = C.MAP_PRIVATE
+	MAP_FIXED   = C.MAP_FIXED
+
+	SA_RESTART  = C.SA_RESTART
+	SA_ONSTACK  = C.SA_ONSTACK
+	SA_RESTORER = C.SA_RESTORER
+	SA_SIGINFO  = C.SA_SIGINFO
+
+	SIGHUP    = C.SIGHUP
+	SIGINT    = C.SIGINT
+	SIGQUIT   = C.SIGQUIT
+	SIGILL    = C.SIGILL
+	SIGTRAP   = C.SIGTRAP
+	SIGABRT   = C.SIGABRT
+	SIGBUS    = C.SIGBUS
+	SIGFPE    = C.SIGFPE
+	SIGKILL   = C.SIGKILL
+	SIGUSR1   = C.SIGUSR1
+	SIGSEGV   = C.SIGSEGV
+	SIGUSR2   = C.SIGUSR2
+	SIGPIPE   = C.SIGPIPE
+	SIGALRM   = C.SIGALRM
+	SIGSTKFLT = C.SIGSTKFLT
+	SIGCHLD   = C.SIGCHLD
+	SIGCONT   = C.SIGCONT
+	SIGSTOP   = C.SIGSTOP
+	SIGTSTP   = C.SIGTSTP
+	SIGTTIN   = C.SIGTTIN
+	SIGTTOU   = C.SIGTTOU
+	SIGURG    = C.SIGURG
+	SIGXCPU   = C.SIGXCPU
+	SIGXFSZ   = C.SIGXFSZ
+	SIGVTALRM = C.SIGVTALRM
+	SIGPROF   = C.SIGPROF
+	SIGWINCH  = C.SIGWINCH
+	SIGIO     = C.SIGIO
+	SIGPWR    = C.SIGPWR
+	SIGSYS    = C.SIGSYS
+
+	FPE_INTDIV = C.FPE_INTDIV
+	FPE_INTOVF = C.FPE_INTOVF
+	FPE_FLTDIV = C.FPE_FLTDIV
+	FPE_FLTOVF = C.FPE_FLTOVF
+	FPE_FLTUND = C.FPE_FLTUND
+	FPE_FLTRES = C.FPE_FLTRES
+	FPE_FLTINV = C.FPE_FLTINV
+	FPE_FLTSUB = C.FPE_FLTSUB
+
+	BUS_ADRALN = C.BUS_ADRALN
+	BUS_ADRERR = C.BUS_ADRERR
+	BUS_OBJERR = C.BUS_OBJERR
+
+	SEGV_MAPERR = C.SEGV_MAPERR
+	SEGV_ACCERR = C.SEGV_ACCERR
+
+	ITIMER_REAL    = C.ITIMER_REAL
+	ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
+	ITIMER_PROF    = C.ITIMER_PROF
+
+	O_RDONLY  = C.O_RDONLY
+	O_CLOEXEC = C.O_CLOEXEC
+)
+
+type Fpreg C.struct__fpreg
+type Fpxreg C.struct__fpxreg
+type Xmmreg C.struct__xmmreg
+type Fpstate C.struct__fpstate
+type Timespec C.struct_timespec
+type Timeval C.struct_timeval
+type Sigaction C.struct_kernel_sigaction
+type Siginfo C.siginfo_t
+type Sigaltstack C.struct_sigaltstack
+type Sigcontext C.struct_sigcontext
+type Ucontext C.struct_ucontext
+type Itimerval C.struct_itimerval
diff --git a/src/pkg/runtime/linux/defs_arm.c b/src/pkg/runtime/linux/defs_arm.c
deleted file mode 100644
index 1f93504..0000000
--- a/src/pkg/runtime/linux/defs_arm.c
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs
- * On a Debian Lenny arm linux distribution:
-	godefs -f-I/usr/src/linux-headers-2.6.26-2-versatile/include defs_arm.c
- */
-
-#define __ARCH_SI_UID_T int
-
-#include <asm/signal.h>
-#include <asm/mman.h>
-#include <asm/sigcontext.h>
-#include <asm/ucontext.h>
-#include <asm/siginfo.h>
-#include <linux/time.h>
-
-/*
-#include <sys/signal.h>
-#include <sys/mman.h>
-#include <ucontext.h>
-*/
-
-enum {
-	$PROT_NONE = PROT_NONE,
-	$PROT_READ = PROT_READ,
-	$PROT_WRITE = PROT_WRITE,
-	$PROT_EXEC = PROT_EXEC,
-
-	$MAP_ANON = MAP_ANONYMOUS,
-	$MAP_PRIVATE = MAP_PRIVATE,
-	$MAP_FIXED = MAP_FIXED,
-
-	$SA_RESTART = SA_RESTART,
-	$SA_ONSTACK = SA_ONSTACK,
-	$SA_RESTORER = SA_RESTORER,
-	$SA_SIGINFO = SA_SIGINFO,
-
-	$SIGHUP = SIGHUP,
-	$SIGINT = SIGINT,
-	$SIGQUIT = SIGQUIT,
-	$SIGILL = SIGILL,
-	$SIGTRAP = SIGTRAP,
-	$SIGABRT = SIGABRT,
-	$SIGBUS = SIGBUS,
-	$SIGFPE = SIGFPE,
-	$SIGKILL = SIGKILL,
-	$SIGUSR1 = SIGUSR1,
-	$SIGSEGV = SIGSEGV,
-	$SIGUSR2 = SIGUSR2,
-	$SIGPIPE = SIGPIPE,
-	$SIGALRM = SIGALRM,
-	$SIGSTKFLT = SIGSTKFLT,
-	$SIGCHLD = SIGCHLD,
-	$SIGCONT = SIGCONT,
-	$SIGSTOP = SIGSTOP,
-	$SIGTSTP = SIGTSTP,
-	$SIGTTIN = SIGTTIN,
-	$SIGTTOU = SIGTTOU,
-	$SIGURG = SIGURG,
-	$SIGXCPU = SIGXCPU,
-	$SIGXFSZ = SIGXFSZ,
-	$SIGVTALRM = SIGVTALRM,
-	$SIGPROF = SIGPROF,
-	$SIGWINCH = SIGWINCH,
-	$SIGIO = SIGIO,
-	$SIGPWR = SIGPWR,
-	$SIGSYS = SIGSYS,
-
-	$FPE_INTDIV = FPE_INTDIV & 0xFFFF,
-	$FPE_INTOVF = FPE_INTOVF & 0xFFFF,
-	$FPE_FLTDIV = FPE_FLTDIV & 0xFFFF,
-	$FPE_FLTOVF = FPE_FLTOVF & 0xFFFF,
-	$FPE_FLTUND = FPE_FLTUND & 0xFFFF,
-	$FPE_FLTRES = FPE_FLTRES & 0xFFFF,
-	$FPE_FLTINV = FPE_FLTINV & 0xFFFF,
-	$FPE_FLTSUB = FPE_FLTSUB & 0xFFFF,
-	
-	$BUS_ADRALN = BUS_ADRALN & 0xFFFF,
-	$BUS_ADRERR = BUS_ADRERR & 0xFFFF,
-	$BUS_OBJERR = BUS_OBJERR & 0xFFFF,
-	
-	$SEGV_MAPERR = SEGV_MAPERR & 0xFFFF,
-	$SEGV_ACCERR = SEGV_ACCERR & 0xFFFF,
-
-	$ITIMER_REAL = ITIMER_REAL,
-	$ITIMER_PROF = ITIMER_PROF,
-	$ITIMER_VIRTUAL = ITIMER_VIRTUAL,
-};
-
-typedef sigset_t $Sigset;
-typedef struct timespec $Timespec;
-typedef struct sigaltstack $Sigaltstack;
-typedef struct sigcontext $Sigcontext;
-typedef struct ucontext $Ucontext;
-typedef struct timeval $Timeval;
-typedef struct itimerval $Itimerval;
-
-struct xsiginfo {
-	int si_signo;
-	int si_errno;
-	int si_code;
-	char _sifields[4];
-};
-
-typedef struct xsiginfo $Siginfo;
-
-#undef sa_handler
-#undef sa_flags
-#undef sa_restorer
-#undef sa_mask
-
-struct xsigaction {
-	void (*sa_handler)(void);
-	unsigned long sa_flags;
-	void (*sa_restorer)(void);
-	unsigned int sa_mask;		/* mask last for extensibility */
-};
-
-typedef struct xsigaction $Sigaction;
diff --git a/src/pkg/runtime/linux/defs_arm.go b/src/pkg/runtime/linux/defs_arm.go
new file mode 100644
index 0000000..3312d36
--- /dev/null
+++ b/src/pkg/runtime/linux/defs_arm.go
@@ -0,0 +1,121 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo.
+On a Debian Lenny arm linux distribution:
+
+cgo -cdefs defs_arm.c >arm/defs.h
+*/
+
+package runtime
+
+/*
+#cgo CFLAGS: -I/usr/src/linux-headers-2.6.26-2-versatile/include
+
+#define __ARCH_SI_UID_T int
+#include <asm/signal.h>
+#include <asm/mman.h>
+#include <asm/sigcontext.h>
+#include <asm/ucontext.h>
+#include <asm/siginfo.h>
+#include <linux/time.h>
+
+struct xsiginfo {
+	int si_signo;
+	int si_errno;
+	int si_code;
+	char _sifields[4];
+};
+
+#undef sa_handler
+#undef sa_flags
+#undef sa_restorer
+#undef sa_mask
+
+struct xsigaction {
+	void (*sa_handler)(void);
+	unsigned long sa_flags;
+	void (*sa_restorer)(void);
+	unsigned int sa_mask;		// mask last for extensibility
+};
+*/
+import "C"
+
+const (
+	PROT_NONE  = C.PROT_NONE
+	PROT_READ  = C.PROT_READ
+	PROT_WRITE = C.PROT_WRITE
+	PROT_EXEC  = C.PROT_EXEC
+
+	MAP_ANON    = C.MAP_ANONYMOUS
+	MAP_PRIVATE = C.MAP_PRIVATE
+	MAP_FIXED   = C.MAP_FIXED
+
+	SA_RESTART  = C.SA_RESTART
+	SA_ONSTACK  = C.SA_ONSTACK
+	SA_RESTORER = C.SA_RESTORER
+	SA_SIGINFO  = C.SA_SIGINFO
+
+	SIGHUP    = C.SIGHUP
+	SIGINT    = C.SIGINT
+	SIGQUIT   = C.SIGQUIT
+	SIGILL    = C.SIGILL
+	SIGTRAP   = C.SIGTRAP
+	SIGABRT   = C.SIGABRT
+	SIGBUS    = C.SIGBUS
+	SIGFPE    = C.SIGFPE
+	SIGKILL   = C.SIGKILL
+	SIGUSR1   = C.SIGUSR1
+	SIGSEGV   = C.SIGSEGV
+	SIGUSR2   = C.SIGUSR2
+	SIGPIPE   = C.SIGPIPE
+	SIGALRM   = C.SIGALRM
+	SIGSTKFLT = C.SIGSTKFLT
+	SIGCHLD   = C.SIGCHLD
+	SIGCONT   = C.SIGCONT
+	SIGSTOP   = C.SIGSTOP
+	SIGTSTP   = C.SIGTSTP
+	SIGTTIN   = C.SIGTTIN
+	SIGTTOU   = C.SIGTTOU
+	SIGURG    = C.SIGURG
+	SIGXCPU   = C.SIGXCPU
+	SIGXFSZ   = C.SIGXFSZ
+	SIGVTALRM = C.SIGVTALRM
+	SIGPROF   = C.SIGPROF
+	SIGWINCH  = C.SIGWINCH
+	SIGIO     = C.SIGIO
+	SIGPWR    = C.SIGPWR
+	SIGSYS    = C.SIGSYS
+
+	FPE_INTDIV = C.FPE_INTDIV & 0xFFFF
+	FPE_INTOVF = C.FPE_INTOVF & 0xFFFF
+	FPE_FLTDIV = C.FPE_FLTDIV & 0xFFFF
+	FPE_FLTOVF = C.FPE_FLTOVF & 0xFFFF
+	FPE_FLTUND = C.FPE_FLTUND & 0xFFFF
+	FPE_FLTRES = C.FPE_FLTRES & 0xFFFF
+	FPE_FLTINV = C.FPE_FLTINV & 0xFFFF
+	FPE_FLTSUB = C.FPE_FLTSUB & 0xFFFF
+
+	BUS_ADRALN = C.BUS_ADRALN & 0xFFFF
+	BUS_ADRERR = C.BUS_ADRERR & 0xFFFF
+	BUS_OBJERR = C.BUS_OBJERR & 0xFFFF
+
+	SEGV_MAPERR = C.SEGV_MAPERR & 0xFFFF
+	SEGV_ACCERR = C.SEGV_ACCERR & 0xFFFF
+
+	ITIMER_REAL    = C.ITIMER_REAL
+	ITIMER_PROF    = C.ITIMER_PROF
+	ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
+)
+
+type Sigset C.sigset_t
+type Timespec C.struct_timespec
+type Sigaltstack C.struct_sigaltstack
+type Sigcontext C.struct_sigcontext
+type Ucontext C.struct_ucontext
+type Timeval C.struct_timeval
+type Itimerval C.struct_itimerval
+type Siginfo C.struct_xsiginfo
+type Sigaction C.struct_xsigaction
diff --git a/src/pkg/runtime/openbsd/defs.c b/src/pkg/runtime/openbsd/defs.c
deleted file mode 100644
index 9806c80..0000000
--- a/src/pkg/runtime/openbsd/defs.c
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * Input to godefs.
- *
-	godefs -f -m64 defs.c >amd64/defs.h
-	godefs -f -m32 defs.c >386/defs.h
- */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <sys/unistd.h>
-#include <sys/signal.h>
-#include <errno.h>
-#include <signal.h>
-
-enum {
-	$PROT_NONE = PROT_NONE,
-	$PROT_READ = PROT_READ,
-	$PROT_WRITE = PROT_WRITE,
-	$PROT_EXEC = PROT_EXEC,
-
-	$MAP_ANON = MAP_ANON,
-	$MAP_PRIVATE = MAP_PRIVATE,
-	$MAP_FIXED = MAP_FIXED,
-
-	$SA_SIGINFO = SA_SIGINFO,
-	$SA_RESTART = SA_RESTART,
-	$SA_ONSTACK = SA_ONSTACK,
-
-	$EINTR = EINTR,
-	
-	$SIGHUP = SIGHUP,
-	$SIGINT = SIGINT,
-	$SIGQUIT = SIGQUIT,
-	$SIGILL = SIGILL,
-	$SIGTRAP = SIGTRAP,
-	$SIGABRT = SIGABRT,
-	$SIGEMT = SIGEMT,
-	$SIGFPE = SIGFPE,
-	$SIGKILL = SIGKILL,
-	$SIGBUS = SIGBUS,
-	$SIGSEGV = SIGSEGV,
-	$SIGSYS = SIGSYS,
-	$SIGPIPE = SIGPIPE,
-	$SIGALRM = SIGALRM,
-	$SIGTERM = SIGTERM,
-	$SIGURG = SIGURG,
-	$SIGSTOP = SIGSTOP,
-	$SIGTSTP = SIGTSTP,
-	$SIGCONT = SIGCONT,
-	$SIGCHLD = SIGCHLD,
-	$SIGTTIN = SIGTTIN,
-	$SIGTTOU = SIGTTOU,
-	$SIGIO = SIGIO,
-	$SIGXCPU = SIGXCPU,
-	$SIGXFSZ = SIGXFSZ,
-	$SIGVTALRM = SIGVTALRM,
-	$SIGPROF = SIGPROF,
-	$SIGWINCH = SIGWINCH,
-	$SIGINFO = SIGINFO,
-	$SIGUSR1 = SIGUSR1,
-	$SIGUSR2 = SIGUSR2,
-	
-	$FPE_INTDIV = FPE_INTDIV,
-	$FPE_INTOVF = FPE_INTOVF,
-	$FPE_FLTDIV = FPE_FLTDIV,
-	$FPE_FLTOVF = FPE_FLTOVF,
-	$FPE_FLTUND = FPE_FLTUND,
-	$FPE_FLTRES = FPE_FLTRES,
-	$FPE_FLTINV = FPE_FLTINV,
-	$FPE_FLTSUB = FPE_FLTSUB,
-	
-	$BUS_ADRALN = BUS_ADRALN,
-	$BUS_ADRERR = BUS_ADRERR,
-	$BUS_OBJERR = BUS_OBJERR,
-	
-	$SEGV_MAPERR = SEGV_MAPERR,
-	$SEGV_ACCERR = SEGV_ACCERR,
-	
-	$ITIMER_REAL = ITIMER_REAL,
-	$ITIMER_VIRTUAL = ITIMER_VIRTUAL,
-	$ITIMER_PROF = ITIMER_PROF,
-};
-
-typedef struct sigaltstack $Sigaltstack;
-typedef sigset_t $Sigset;
-typedef siginfo_t $Siginfo;
-typedef union sigval $Sigval;
-
-typedef stack_t $StackT;
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-typedef struct itimerval $Itimerval;
-
-// This is a hack to avoid pulling in machine/fpu.h.
-typedef void $sfxsave64;
-typedef void $usavefpu;
-
-typedef struct sigcontext $Sigcontext;
diff --git a/src/pkg/runtime/openbsd/defs.go b/src/pkg/runtime/openbsd/defs.go
new file mode 100644
index 0000000..4fb3a04
--- /dev/null
+++ b/src/pkg/runtime/openbsd/defs.go
@@ -0,0 +1,109 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo.
+
+GOARCH=amd64 cgo -cdefs defs.go >amd64/defs.h
+GOARCH=386 cgo -cdefs defs.go >386/defs.h
+*/
+
+package runtime
+
+/*
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/unistd.h>
+#include <sys/signal.h>
+#include <errno.h>
+#include <signal.h>
+*/
+import "C"
+
+const (
+	PROT_NONE  = C.PROT_NONE
+	PROT_READ  = C.PROT_READ
+	PROT_WRITE = C.PROT_WRITE
+	PROT_EXEC  = C.PROT_EXEC
+
+	MAP_ANON    = C.MAP_ANON
+	MAP_PRIVATE = C.MAP_PRIVATE
+	MAP_FIXED   = C.MAP_FIXED
+
+	SA_SIGINFO = C.SA_SIGINFO
+	SA_RESTART = C.SA_RESTART
+	SA_ONSTACK = C.SA_ONSTACK
+
+	EINTR = C.EINTR
+
+	SIGHUP    = C.SIGHUP
+	SIGINT    = C.SIGINT
+	SIGQUIT   = C.SIGQUIT
+	SIGILL    = C.SIGILL
+	SIGTRAP   = C.SIGTRAP
+	SIGABRT   = C.SIGABRT
+	SIGEMT    = C.SIGEMT
+	SIGFPE    = C.SIGFPE
+	SIGKILL   = C.SIGKILL
+	SIGBUS    = C.SIGBUS
+	SIGSEGV   = C.SIGSEGV
+	SIGSYS    = C.SIGSYS
+	SIGPIPE   = C.SIGPIPE
+	SIGALRM   = C.SIGALRM
+	SIGTERM   = C.SIGTERM
+	SIGURG    = C.SIGURG
+	SIGSTOP   = C.SIGSTOP
+	SIGTSTP   = C.SIGTSTP
+	SIGCONT   = C.SIGCONT
+	SIGCHLD   = C.SIGCHLD
+	SIGTTIN   = C.SIGTTIN
+	SIGTTOU   = C.SIGTTOU
+	SIGIO     = C.SIGIO
+	SIGXCPU   = C.SIGXCPU
+	SIGXFSZ   = C.SIGXFSZ
+	SIGVTALRM = C.SIGVTALRM
+	SIGPROF   = C.SIGPROF
+	SIGWINCH  = C.SIGWINCH
+	SIGINFO   = C.SIGINFO
+	SIGUSR1   = C.SIGUSR1
+	SIGUSR2   = C.SIGUSR2
+
+	FPE_INTDIV = C.FPE_INTDIV
+	FPE_INTOVF = C.FPE_INTOVF
+	FPE_FLTDIV = C.FPE_FLTDIV
+	FPE_FLTOVF = C.FPE_FLTOVF
+	FPE_FLTUND = C.FPE_FLTUND
+	FPE_FLTRES = C.FPE_FLTRES
+	FPE_FLTINV = C.FPE_FLTINV
+	FPE_FLTSUB = C.FPE_FLTSUB
+
+	BUS_ADRALN = C.BUS_ADRALN
+	BUS_ADRERR = C.BUS_ADRERR
+	BUS_OBJERR = C.BUS_OBJERR
+
+	SEGV_MAPERR = C.SEGV_MAPERR
+	SEGV_ACCERR = C.SEGV_ACCERR
+
+	ITIMER_REAL    = C.ITIMER_REAL
+	ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
+	ITIMER_PROF    = C.ITIMER_PROF
+)
+
+type Sigaltstack C.struct_sigaltstack
+type Sigset C.sigset_t
+type Siginfo C.siginfo_t
+type Sigval C.union_sigval
+
+type StackT C.stack_t
+
+type Timespec C.struct_timespec
+type Timeval C.struct_timeval
+type Itimerval C.struct_itimerval
+
+// This is a hack to avoid pulling in machine/fpu.h.
+type sfxsave64 struct{}
+type usavefpu struct{}
+
+type Sigcontext C.struct_sigcontext
diff --git a/src/pkg/runtime/windows/defs.c b/src/pkg/runtime/windows/defs.c
deleted file mode 100644
index 7cfd9ad..0000000
--- a/src/pkg/runtime/windows/defs.c
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include <signal.h>
-#include <stdarg.h>
-#include <windef.h>
-#include <winbase.h>
-#include <wincon.h>
-
-enum {
-	$PROT_NONE = 0,
-	$PROT_READ = 1,
-	$PROT_WRITE = 2,
-	$PROT_EXEC = 4,
-
-	$MAP_ANON = 1,
-	$MAP_PRIVATE = 2,
-
-	$DUPLICATE_SAME_ACCESS = DUPLICATE_SAME_ACCESS,
-	$THREAD_PRIORITY_HIGHEST = THREAD_PRIORITY_HIGHEST,
-
-	$SIGINT = SIGINT,
-	$CTRL_C_EVENT = CTRL_C_EVENT,
-	$CTRL_BREAK_EVENT = CTRL_BREAK_EVENT,
-
-	$CONTEXT_CONTROL = CONTEXT_CONTROL,
-	$CONTEXT_FULL = CONTEXT_FULL,
-
-	$EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION,
-	$EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT,
-	$EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND,
-	$EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO,
-	$EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT,
-	$EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW,
-	$EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW,
-	$EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO,
-	$EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW,
-};
-
-typedef SYSTEM_INFO $SystemInfo;
-typedef EXCEPTION_RECORD $ExceptionRecord;
-#ifdef _X86_
-typedef FLOATING_SAVE_AREA $FloatingSaveArea;
-#endif
-#ifdef _AMD64_
-typedef M128A $M128a;
-#endif
-typedef CONTEXT $Context;
diff --git a/src/pkg/runtime/windows/defs.go b/src/pkg/runtime/windows/defs.go
new file mode 100644
index 0000000..e23e420
--- /dev/null
+++ b/src/pkg/runtime/windows/defs.go
@@ -0,0 +1,64 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo.
+
+GOARCH=amd64 cgo -cdefs defs.go >amd64/defs.h
+GOARCH=386 cgo -cdefs defs.go >386/defs.h
+*/
+
+package runtime
+
+/*
+#include <signal.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <wincon.h>
+
+#ifndef _X86_
+typedef struct {} FLOATING_SAVE_AREA;
+#endif
+#ifndef _AMD64_
+typedef struct {} M128A;
+#endif
+*/
+import "C"
+
+const (
+	PROT_NONE  = 0
+	PROT_READ  = 1
+	PROT_WRITE = 2
+	PROT_EXEC  = 4
+
+	MAP_ANON    = 1
+	MAP_PRIVATE = 2
+
+	DUPLICATE_SAME_ACCESS   = C.DUPLICATE_SAME_ACCESS
+	THREAD_PRIORITY_HIGHEST = C.THREAD_PRIORITY_HIGHEST
+
+	SIGINT           = C.SIGINT
+	CTRL_C_EVENT     = C.CTRL_C_EVENT
+	CTRL_BREAK_EVENT = C.CTRL_BREAK_EVENT
+
+	CONTEXT_CONTROL = C.CONTEXT_CONTROL
+	CONTEXT_FULL    = C.CONTEXT_FULL
+
+	EXCEPTION_ACCESS_VIOLATION     = C.STATUS_ACCESS_VIOLATION
+	EXCEPTION_BREAKPOINT           = C.STATUS_BREAKPOINT
+	EXCEPTION_FLT_DENORMAL_OPERAND = C.STATUS_FLOAT_DENORMAL_OPERAND
+	EXCEPTION_FLT_DIVIDE_BY_ZERO   = C.STATUS_FLOAT_DIVIDE_BY_ZERO
+	EXCEPTION_FLT_INEXACT_RESULT   = C.STATUS_FLOAT_INEXACT_RESULT
+	EXCEPTION_FLT_OVERFLOW         = C.STATUS_FLOAT_OVERFLOW
+	EXCEPTION_FLT_UNDERFLOW        = C.STATUS_FLOAT_UNDERFLOW
+	EXCEPTION_INT_DIVIDE_BY_ZERO   = C.STATUS_INTEGER_DIVIDE_BY_ZERO
+	EXCEPTION_INT_OVERFLOW         = C.STATUS_INTEGER_OVERFLOW
+)
+
+type SystemInfo C.SYSTEM_INFO
+type ExceptionRecord C.EXCEPTION_RECORD
+type FloatingSaveArea C.FLOATING_SAVE_AREA
+type M128a C.M128A
+type Context C.CONTEXT
diff --git a/src/pkg/syscall/mkall.sh b/src/pkg/syscall/mkall.sh
index 8d1d639..893b5bd 100755
--- a/src/pkg/syscall/mkall.sh
+++ b/src/pkg/syscall/mkall.sh
@@ -108,75 +108,75 @@
 	exit 1
 	;;
 freebsd_386)
-	mkerrors="$mkerrors -f -m32"
+	mkerrors="$mkerrors -m32"
 	mksyscall="./mksyscall.pl -l32"
 	mksysnum="curl -s 'http://svn.freebsd.org/base/head/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
-	mktypes="godefs -gsyscall -f-m32"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 freebsd_amd64)
-	mkerrors="$mkerrors -f -m64"
+	mkerrors="$mkerrors -m64"
 	mksysnum="curl -s 'http://svn.freebsd.org/base/head/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
-	mktypes="godefs -gsyscall -f-m64"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 darwin_386)
-	mkerrors="$mkerrors -f -m32"
+	mkerrors="$mkerrors -m32"
 	mksyscall="./mksyscall.pl -l32"
 	mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
-	mktypes="godefs -gsyscall -f-m32"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 darwin_amd64)
-	mkerrors="$mkerrors -f -m64"
+	mkerrors="$mkerrors -m64"
 	mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
-	mktypes="godefs -gsyscall -f-m64"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 linux_386)
-	mkerrors="$mkerrors -f -m32"
+	mkerrors="$mkerrors -m32"
 	mksyscall="./mksyscall.pl -l32"
 	mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd_32.h"
-	mktypes="godefs -gsyscall -f-m32"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 linux_amd64)
-	mkerrors="$mkerrors -f -m64"
+	mkerrors="$mkerrors -m64"
 	mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd_64.h"
-	mktypes="godefs -gsyscall -f-m64"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 linux_arm)
 	mkerrors="$mkerrors"
 	mksyscall="./mksyscall.pl -b32"
 	mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd.h"
-	mktypes="godefs -gsyscall"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 windows_386)
 	mksyscall="./mksyscall_windows.pl -l32"
 	mksysnum=
 	mktypes=
-	mkerrors="./mkerrors_windows.sh -f -m32"
+	mkerrors="./mkerrors_windows.sh -m32"
 	zerrors="zerrors_windows.go"
 	;;
 windows_amd64)
 	mksyscall="./mksyscall_windows.pl"
 	mksysnum=
 	mktypes=
-	mkerrors="./mkerrors_windows.sh -f -m32"
+	mkerrors="./mkerrors_windows.sh -m32"
 	zerrors="zerrors_windows.go"
 	;;
 plan9_386)
 	mkerrors=
 	mksyscall="./mksyscall.pl -l32 -plan9"
 	mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
-	mktypes="godefs -gsyscall -f -m32"
+	mktypes="XXX"
 	;;
 openbsd_386)
-	mkerrors="$mkerrors -f -m32"
+	mkerrors="$mkerrors -m32"
 	mksyscall="./mksyscall.pl -l32 -openbsd"
 	mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
-	mktypes="godefs -gsyscall -f-m32"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 openbsd_amd64)
-	mkerrors="$mkerrors -f -m64"
+	mkerrors="$mkerrors -m64"
 	mksyscall="./mksyscall.pl -openbsd"
 	mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
-	mktypes="godefs -gsyscall -f-m64"
+	mktypes="GOARCH=$GOARCH cgo -godefs"
 	;;
 *)
 	echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
@@ -194,5 +194,5 @@
 	esac
 	if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi
 	if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
-	if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.c |gofmt >ztypes_$GOOSARCH.go"; fi
+	if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go |gofmt >ztypes_$GOOSARCH.go"; fi
 ) | $run
diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh
index 9936b11..3ae11aa 100755
--- a/src/pkg/syscall/mkerrors.sh
+++ b/src/pkg/syscall/mkerrors.sh
@@ -120,24 +120,19 @@
 #include <signal.h>
 '
 
-ccflags=""
-next=false
-for i
-do
-	if $next; then
-		ccflags="$ccflags $i"
-		next=false
-	elif [ "$i" = "-f" ]; then
-		next=true
-	fi
-done
+ccflags="$@"
 
-# Write godefs input.
+# Write cgo -godefs input.
 (
+	echo package syscall
+	echo
+	echo '/*'
 	indirect="includes_$(uname)"
 	echo "${!indirect} $includes"
+	echo '*/'
+	echo 'import "C"'
 	echo
-	echo 'enum {'
+	echo 'const ('
 
 	# The gcc command line prints all the #defines
 	# it encounters while processing the input
@@ -177,15 +172,15 @@
 		$2 !~ /^(BPF_TIMEVAL)$/ &&
 		$2 ~ /^(BPF|DLT)_/ ||
 		$2 !~ "WMESGLEN" &&
-		$2 ~ /^W[A-Z0-9]+$/ {printf("\t$%s = %s,\n", $2, $2)}
+		$2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
 		$2 ~ /^__WCOREFLAG$/ {next}
-		$2 ~ /^__W[A-Z0-9]+$/ {printf("\t$%s = %s,\n", substr($2,3), $2)}
+		$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
 
 		{next}
 	' | sort
 
-	echo '};'
-) >_const.c
+	echo ')'
+) >_const.go
 
 # Pull out just the error names for later.
 errors=$(
@@ -197,7 +192,7 @@
 echo '// mkerrors.sh' "$@"
 echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
 echo
-godefs -c $GCC "$@" -gsyscall "$@" _const.c
+cgo -godefs -- "$@" _const.go
 
 # Run C program to print error strings.
 (
@@ -255,4 +250,4 @@
 '
 ) >_errors.c
 
-$GCC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.c
+$GCC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go
diff --git a/src/pkg/syscall/types_darwin.c b/src/pkg/syscall/types_darwin.c
deleted file mode 100644
index 730d7f7..0000000
--- a/src/pkg/syscall/types_darwin.c
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Input to godefs.  See also mkerrors.sh and mkall.sh
- */
-
-#define __DARWIN_UNIX03 0
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include <dirent.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <unistd.h>
-#include <mach/mach.h>
-#include <mach/message.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_var.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
-// Machine characteristics; for internal use.
-
-enum {
-	$sizeofPtr = sizeof(void*),
-	$sizeofShort = sizeof(short),
-	$sizeofInt = sizeof(int),
-	$sizeofLong = sizeof(long),
-	$sizeofLongLong = sizeof(long long),
-};
-
-// Basic types
-
-typedef short $_C_short;
-typedef int $_C_int;
-typedef long $_C_long;
-typedef long long $_C_long_long;
-
-// Time
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-typedef struct timeval32 $Timeval32;
-
-// Processes
-
-typedef struct rusage $Rusage;
-typedef struct rlimit $Rlimit;
-
-typedef gid_t $_Gid_t;
-
-// Files
-
-enum {
-	$O_CLOEXEC = 0,	// not supported
-};
-
-typedef struct stat64 $Stat_t;
-typedef struct statfs64 $Statfs_t;
-typedef struct flock $Flock_t;
-typedef struct fstore $Fstore_t;
-typedef struct radvisory $Radvisory_t;
-typedef struct fbootstraptransfer $Fbootstraptransfer_t;
-typedef struct log2phys $Log2phys_t;
-
-typedef struct dirent $Dirent;
-
-// Sockets
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-typedef struct sockaddr_in $RawSockaddrInet4;
-typedef struct sockaddr_in6 $RawSockaddrInet6;
-typedef struct sockaddr_un $RawSockaddrUnix;
-typedef struct sockaddr_dl $RawSockaddrDatalink;
-typedef struct sockaddr $RawSockaddr;
-typedef struct sockaddr_any $RawSockaddrAny;
-typedef socklen_t $_Socklen;
-typedef struct linger $Linger;
-typedef struct iovec $Iovec;
-typedef struct ip_mreq $IPMreq;
-typedef struct ipv6_mreq $IPv6Mreq;
-typedef struct msghdr $Msghdr;
-typedef struct cmsghdr $Cmsghdr;
-typedef struct in6_pktinfo $Inet6Pktinfo;
-
-enum {
-	$SizeofSockaddrInet4 = sizeof(struct sockaddr_in),
-	$SizeofSockaddrInet6 = sizeof(struct sockaddr_in6),
-	$SizeofSockaddrAny = sizeof(struct sockaddr_any),
-	$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
-	$SizeofSockaddrDatalink = sizeof(struct sockaddr_dl),
-	$SizeofLinger = sizeof(struct linger),
-	$SizeofIPMreq = sizeof(struct ip_mreq),
-	$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
-	$SizeofMsghdr = sizeof(struct msghdr),
-	$SizeofCmsghdr = sizeof(struct cmsghdr),
-	$SizeofInet6Pktinfo = sizeof(struct in6_pktinfo),
-};
-
-// Ptrace requests
-
-enum {
-	$PTRACE_TRACEME = PT_TRACE_ME,
-	$PTRACE_CONT = PT_CONTINUE,
-	$PTRACE_KILL = PT_KILL,
-};
-
-// Events (kqueue, kevent)
-
-typedef struct kevent $Kevent_t;
-
-// Select
-
-typedef fd_set $FdSet;
-
-// Routing and interface messages
-
-enum {
-	$SizeofIfMsghdr = sizeof(struct if_msghdr),
-	$SizeofIfData = sizeof(struct if_data),
-	$SizeofIfaMsghdr = sizeof(struct ifa_msghdr),
-	$SizeofIfmaMsghdr = sizeof(struct ifma_msghdr),
-	$SizeofIfmaMsghdr2 = sizeof(struct ifma_msghdr2),
-	$SizeofRtMsghdr = sizeof(struct rt_msghdr),
-	$SizeofRtMetrics = sizeof(struct rt_metrics),
-};
-
-typedef struct if_msghdr $IfMsghdr;
-typedef struct if_data $IfData;
-typedef struct ifa_msghdr $IfaMsghdr;
-typedef struct ifma_msghdr $IfmaMsghdr;
-typedef struct ifma_msghdr2 $IfmaMsghdr2;
-typedef struct rt_msghdr $RtMsghdr;
-typedef struct rt_metrics $RtMetrics;
-
-// Berkeley packet filter
-
-enum {
-	$SizeofBpfVersion = sizeof(struct bpf_version),
-	$SizeofBpfStat = sizeof(struct bpf_stat),
-	$SizeofBpfProgram = sizeof(struct bpf_program),
-	$SizeofBpfInsn = sizeof(struct bpf_insn),
-	$SizeofBpfHdr = sizeof(struct bpf_hdr),
-};
-
-typedef struct bpf_version $BpfVersion;
-typedef struct bpf_stat $BpfStat;
-typedef struct bpf_program $BpfProgram;
-typedef struct bpf_insn $BpfInsn;
-typedef struct bpf_hdr $BpfHdr;
diff --git a/src/pkg/syscall/types_darwin.go b/src/pkg/syscall/types_darwin.go
new file mode 100644
index 0000000..006d320
--- /dev/null
+++ b/src/pkg/syscall/types_darwin.go
@@ -0,0 +1,232 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo -godefs.  See also mkerrors.sh and mkall.sh
+*/
+
+// +build ignore
+
+// +godefs map struct_in_addr [4]byte /* in_addr */
+// +godefs map struct_in6_addr [16]byte /* in6_addr */
+
+package syscall
+
+/*
+#define __DARWIN_UNIX03 0
+#define KERNEL
+#define _DARWIN_USE_64_BIT_INODE
+#include <dirent.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <unistd.h>
+#include <mach/mach.h>
+#include <mach/message.h>
+#include <sys/event.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/param.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/select.h>
+#include <sys/signal.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_var.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+enum {
+	sizeofPtr = sizeof(void*),
+};
+
+union sockaddr_all {
+	struct sockaddr s1;	// this one gets used for fields
+	struct sockaddr_in s2;	// these pad it out
+	struct sockaddr_in6 s3;
+	struct sockaddr_un s4;
+	struct sockaddr_dl s5;
+};
+
+struct sockaddr_any {
+	struct sockaddr addr;
+	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
+};
+
+*/
+import "C"
+
+// Machine characteristics; for internal use.
+
+const (
+	sizeofPtr      = C.sizeofPtr
+	sizeofShort    = C.sizeof_short
+	sizeofInt      = C.sizeof_int
+	sizeofLong     = C.sizeof_long
+	sizeofLongLong = C.sizeof_longlong
+)
+
+// Basic types
+
+type (
+	_C_short     C.short
+	_C_int       C.int
+	_C_long      C.long
+	_C_long_long C.longlong
+)
+
+// Time
+
+type Timespec C.struct_timespec
+
+type Timeval C.struct_timeval
+
+type Timeval32 C.struct_timeval32
+
+// Processes
+
+type Rusage C.struct_rusage
+
+type Rlimit C.struct_rlimit
+
+type _Gid_t C.gid_t
+
+// Files
+
+const (
+	O_CLOEXEC = 0 // not supported
+)
+
+type Stat_t C.struct_stat64
+
+type Statfs_t C.struct_statfs64
+
+type Flock_t C.struct_flock
+
+type Fstore_t C.struct_fstore
+
+type Radvisory_t C.struct_radvisory
+
+type Fbootstraptransfer_t C.struct_fbootstraptransfer
+
+type Log2phys_t C.struct_log2phys
+
+type Fsid C.struct_fsid
+
+type Dirent C.struct_dirent
+
+// Sockets
+
+type RawSockaddrInet4 C.struct_sockaddr_in
+
+type RawSockaddrInet6 C.struct_sockaddr_in6
+
+type RawSockaddrUnix C.struct_sockaddr_un
+
+type RawSockaddrDatalink C.struct_sockaddr_dl
+
+type RawSockaddr C.struct_sockaddr
+
+type RawSockaddrAny C.struct_sockaddr_any
+
+type _Socklen C.socklen_t
+
+type Linger C.struct_linger
+
+type Iovec C.struct_iovec
+
+type IPMreq C.struct_ip_mreq
+
+type IPv6Mreq C.struct_ipv6_mreq
+
+type Msghdr C.struct_msghdr
+
+type Cmsghdr C.struct_cmsghdr
+
+type Inet6Pktinfo C.struct_in6_pktinfo
+
+const (
+	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
+	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
+	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
+	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
+	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
+	SizeofLinger           = C.sizeof_struct_linger
+	SizeofIPMreq           = C.sizeof_struct_ip_mreq
+	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
+	SizeofMsghdr           = C.sizeof_struct_msghdr
+	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
+	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
+)
+
+// Ptrace requests
+
+const (
+	PTRACE_TRACEME = C.PT_TRACE_ME
+	PTRACE_CONT    = C.PT_CONTINUE
+	PTRACE_KILL    = C.PT_KILL
+)
+
+// Events (kqueue, kevent)
+
+type Kevent_t C.struct_kevent
+
+// Select
+
+type FdSet C.fd_set
+
+// Routing and interface messages
+
+const (
+	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
+	SizeofIfData      = C.sizeof_struct_if_data
+	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
+	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
+	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
+	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
+	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
+)
+
+type IfMsghdr C.struct_if_msghdr
+
+type IfData C.struct_if_data
+
+type IfaMsghdr C.struct_ifa_msghdr
+
+type IfmaMsghdr C.struct_ifma_msghdr
+
+type IfmaMsghdr2 C.struct_ifma_msghdr2
+
+type RtMsghdr C.struct_rt_msghdr
+
+type RtMetrics C.struct_rt_metrics
+
+// Berkeley packet filter
+
+const (
+	SizeofBpfVersion = C.sizeof_struct_bpf_version
+	SizeofBpfStat    = C.sizeof_struct_bpf_stat
+	SizeofBpfProgram = C.sizeof_struct_bpf_program
+	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
+	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
+)
+
+type BpfVersion C.struct_bpf_version
+
+type BpfStat C.struct_bpf_stat
+
+type BpfProgram C.struct_bpf_program
+
+type BpfInsn C.struct_bpf_insn
+
+type BpfHdr C.struct_bpf_hdr
diff --git a/src/pkg/syscall/types_freebsd.c b/src/pkg/syscall/types_freebsd.c
deleted file mode 100644
index 792886e..0000000
--- a/src/pkg/syscall/types_freebsd.c
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Input to godefs.  See also mkerrors.sh and mkall.sh
- */
-
-#define KERNEL
-#include <dirent.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
-// Machine characteristics; for internal use.
-
-enum {
-	$sizeofPtr = sizeof(void*),
-	$sizeofShort = sizeof(short),
-	$sizeofInt = sizeof(int),
-	$sizeofLong = sizeof(long),
-	$sizeofLongLong = sizeof(long long),
-};
-
-// Basic types
-
-typedef short $_C_short;
-typedef int $_C_int;
-typedef long $_C_long;
-typedef long long $_C_long_long;
-
-// Time
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-
-// Processes
-
-typedef struct rusage $Rusage;
-typedef struct rlimit $Rlimit;
-
-typedef gid_t $_Gid_t;
-
-// Files
-
-enum {
-	$O_CLOEXEC = 0,	// not supported
-};
-
-enum {	// Directory mode bits
-	$S_IFMT = S_IFMT,
-	$S_IFIFO = S_IFIFO,
-	$S_IFCHR = S_IFCHR,
-	$S_IFDIR = S_IFDIR,
-	$S_IFBLK = S_IFBLK,
-	$S_IFREG = S_IFREG,
-	$S_IFLNK = S_IFLNK,
-	$S_IFSOCK = S_IFSOCK,
-	$S_ISUID = S_ISUID,
-	$S_ISGID = S_ISGID,
-	$S_ISVTX = S_ISVTX,
-	$S_IRUSR = S_IRUSR,
-	$S_IWUSR = S_IWUSR,
-	$S_IXUSR = S_IXUSR,
-};
-
-typedef struct stat $Stat_t;
-typedef struct statfs $Statfs_t;
-typedef struct flock $Flock_t;
-
-typedef struct dirent $Dirent;
-
-// Sockets
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-typedef struct sockaddr_in $RawSockaddrInet4;
-typedef struct sockaddr_in6 $RawSockaddrInet6;
-typedef struct sockaddr_un $RawSockaddrUnix;
-typedef struct sockaddr_dl $RawSockaddrDatalink;
-typedef struct sockaddr $RawSockaddr;
-typedef struct sockaddr_any $RawSockaddrAny;
-typedef socklen_t $_Socklen;
-typedef struct linger $Linger;
-typedef struct iovec $Iovec;
-typedef struct ip_mreq $IPMreq;
-typedef struct ip_mreqn $IPMreqn;
-typedef struct ipv6_mreq $IPv6Mreq;
-typedef struct msghdr $Msghdr;
-typedef struct cmsghdr $Cmsghdr;
-typedef struct in6_pktinfo $Inet6Pktinfo;
-
-enum {
-	$SizeofSockaddrInet4 = sizeof(struct sockaddr_in),
-	$SizeofSockaddrInet6 = sizeof(struct sockaddr_in6),
-	$SizeofSockaddrAny = sizeof(struct sockaddr_any),
-	$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
-	$SizeofSockaddrDatalink = sizeof(struct sockaddr_dl),
-	$SizeofLinger = sizeof(struct linger),
-	$SizeofIPMreq = sizeof(struct ip_mreq),
-	$SizeofIPMreqn = sizeof(struct ip_mreqn),
-	$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
-	$SizeofMsghdr = sizeof(struct msghdr),
-	$SizeofCmsghdr = sizeof(struct cmsghdr),
-	$SizeofInet6Pktinfo = sizeof(struct in6_pktinfo),
-};
-
-// Ptrace requests
-
-enum {
-	$PTRACE_TRACEME = PT_TRACE_ME,
-	$PTRACE_CONT = PT_CONTINUE,
-	$PTRACE_KILL = PT_KILL,
-};
-
-// Events (kqueue, kevent)
-
-typedef struct kevent $Kevent_t;
-
-// Select
-
-typedef fd_set $FdSet;
-
-// Routing and interface messages
-
-enum {
-	$SizeofIfMsghdr = sizeof(struct if_msghdr),
-	$SizeofIfData = sizeof(struct if_data),
-	$SizeofIfaMsghdr = sizeof(struct ifa_msghdr),
-	$SizeofIfmaMsghdr = sizeof(struct ifma_msghdr),
-	$SizeofRtMsghdr = sizeof(struct rt_msghdr),
-	$SizeofRtMetrics = sizeof(struct rt_metrics),
-};
-
-typedef struct if_msghdr $IfMsghdr;
-typedef struct if_data $IfData;
-typedef struct ifa_msghdr $IfaMsghdr;
-typedef struct ifma_msghdr $IfmaMsghdr;
-typedef struct rt_msghdr $RtMsghdr;
-typedef struct rt_metrics $RtMetrics;
-
-// Berkeley packet filter
-
-enum {
-	$SizeofBpfVersion = sizeof(struct bpf_version),
-	$SizeofBpfStat = sizeof(struct bpf_stat),
-	$SizeofBpfZbuf = sizeof(struct bpf_zbuf),
-	$SizeofBpfProgram = sizeof(struct bpf_program),
-	$SizeofBpfInsn = sizeof(struct bpf_insn),
-	$SizeofBpfHdr = sizeof(struct bpf_hdr),
-	$SizeofBpfZbufHeader = sizeof(struct bpf_zbuf_header),
-};
-
-typedef struct bpf_version $BpfVersion;
-typedef struct bpf_stat $BpfStat;
-typedef struct bpf_zbuf $BpfZbuf;
-typedef struct bpf_program $BpfProgram;
-typedef struct bpf_insn $BpfInsn;
-typedef struct bpf_hdr $BpfHdr;
-typedef struct bpf_zbuf_header $BpfZbufHeader;
diff --git a/src/pkg/syscall/types_freebsd.go b/src/pkg/syscall/types_freebsd.go
new file mode 100644
index 0000000..f54b6c4
--- /dev/null
+++ b/src/pkg/syscall/types_freebsd.go
@@ -0,0 +1,240 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo -godefs.  See also mkerrors.sh and mkall.sh
+*/
+
+// +build ignore
+
+// +godefs map struct_in_addr [4]byte /* in_addr */
+// +godefs map struct_in6_addr [16]byte /* in6_addr */
+
+package syscall
+
+/*
+#define KERNEL
+#include <dirent.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/event.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/param.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/select.h>
+#include <sys/signal.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+enum {
+	sizeofPtr = sizeof(void*),
+};
+
+union sockaddr_all {
+	struct sockaddr s1;	// this one gets used for fields
+	struct sockaddr_in s2;	// these pad it out
+	struct sockaddr_in6 s3;
+	struct sockaddr_un s4;
+	struct sockaddr_dl s5;
+};
+
+struct sockaddr_any {
+	struct sockaddr addr;
+	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
+};
+
+*/
+import "C"
+
+// Machine characteristics; for internal use.
+
+const (
+	sizeofPtr      = C.sizeofPtr
+	sizeofShort    = C.sizeof_short
+	sizeofInt      = C.sizeof_int
+	sizeofLong     = C.sizeof_long
+	sizeofLongLong = C.sizeof_longlong
+)
+
+// Basic types
+
+type (
+	_C_short     C.short
+	_C_int       C.int
+	_C_long      C.long
+	_C_long_long C.longlong
+)
+
+// Time
+
+type Timespec C.struct_timespec
+
+type Timeval C.struct_timeval
+
+// Processes
+
+type Rusage C.struct_rusage
+
+type Rlimit C.struct_rlimit
+
+type _Gid_t C.gid_t
+
+// Files
+
+const (
+	O_CLOEXEC = 0 // not supported
+)
+
+const ( // Directory mode bits
+	S_IFMT   = C.S_IFMT
+	S_IFIFO  = C.S_IFIFO
+	S_IFCHR  = C.S_IFCHR
+	S_IFDIR  = C.S_IFDIR
+	S_IFBLK  = C.S_IFBLK
+	S_IFREG  = C.S_IFREG
+	S_IFLNK  = C.S_IFLNK
+	S_IFSOCK = C.S_IFSOCK
+	S_ISUID  = C.S_ISUID
+	S_ISGID  = C.S_ISGID
+	S_ISVTX  = C.S_ISVTX
+	S_IRUSR  = C.S_IRUSR
+	S_IWUSR  = C.S_IWUSR
+	S_IXUSR  = C.S_IXUSR
+)
+
+type Stat_t C.struct_stat
+
+type Statfs_t C.struct_statfs
+
+type Flock_t C.struct_flock
+
+type Dirent C.struct_dirent
+
+type Fsid C.struct_fsid
+
+// Sockets
+
+type RawSockaddrInet4 C.struct_sockaddr_in
+
+type RawSockaddrInet6 C.struct_sockaddr_in6
+
+type RawSockaddrUnix C.struct_sockaddr_un
+
+type RawSockaddrDatalink C.struct_sockaddr_dl
+
+type RawSockaddr C.struct_sockaddr
+
+type RawSockaddrAny C.struct_sockaddr_any
+
+type _Socklen C.socklen_t
+
+type Linger C.struct_linger
+
+type Iovec C.struct_iovec
+
+type IPMreq C.struct_ip_mreq
+
+type IPMreqn C.struct_ip_mreqn
+
+type IPv6Mreq C.struct_ipv6_mreq
+
+type Msghdr C.struct_msghdr
+
+type Cmsghdr C.struct_cmsghdr
+
+type Inet6Pktinfo C.struct_in6_pktinfo
+
+const (
+	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
+	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
+	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
+	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
+	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
+	SizeofLinger           = C.sizeof_struct_linger
+	SizeofIPMreq           = C.sizeof_struct_ip_mreq
+	SizeofIPMreqn          = C.sizeof_struct_ip_mreqn
+	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
+	SizeofMsghdr           = C.sizeof_struct_msghdr
+	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
+	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
+)
+
+// Ptrace requests
+
+const (
+	PTRACE_TRACEME = C.PT_TRACE_ME
+	PTRACE_CONT    = C.PT_CONTINUE
+	PTRACE_KILL    = C.PT_KILL
+)
+
+// Events (kqueue, kevent)
+
+type Kevent_t C.struct_kevent
+
+// Select
+
+type FdSet C.fd_set
+
+// Routing and interface messages
+
+const (
+	SizeofIfMsghdr   = C.sizeof_struct_if_msghdr
+	SizeofIfData     = C.sizeof_struct_if_data
+	SizeofIfaMsghdr  = C.sizeof_struct_ifa_msghdr
+	SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr
+	SizeofRtMsghdr   = C.sizeof_struct_rt_msghdr
+	SizeofRtMetrics  = C.sizeof_struct_rt_metrics
+)
+
+type IfMsghdr C.struct_if_msghdr
+
+type IfData C.struct_if_data
+
+type IfaMsghdr C.struct_ifa_msghdr
+
+type IfmaMsghdr C.struct_ifma_msghdr
+
+type RtMsghdr C.struct_rt_msghdr
+
+type RtMetrics C.struct_rt_metrics
+
+// Berkeley packet filter
+
+const (
+	SizeofBpfVersion    = C.sizeof_struct_bpf_version
+	SizeofBpfStat       = C.sizeof_struct_bpf_stat
+	SizeofBpfZbuf       = C.sizeof_struct_bpf_zbuf
+	SizeofBpfProgram    = C.sizeof_struct_bpf_program
+	SizeofBpfInsn       = C.sizeof_struct_bpf_insn
+	SizeofBpfHdr        = C.sizeof_struct_bpf_hdr
+	SizeofBpfZbufHeader = C.sizeof_struct_bpf_zbuf_header
+)
+
+type BpfVersion C.struct_bpf_version
+
+type BpfStat C.struct_bpf_stat
+
+type BpfZbuf C.struct_bpf_zbuf
+
+type BpfProgram C.struct_bpf_program
+
+type BpfInsn C.struct_bpf_insn
+
+type BpfHdr C.struct_bpf_hdr
+
+type BpfZbufHeader C.struct_bpf_zbuf_header
diff --git a/src/pkg/syscall/types_linux.c b/src/pkg/syscall/types_linux.c
deleted file mode 100644
index 57a95da..0000000
--- a/src/pkg/syscall/types_linux.c
+++ /dev/null
@@ -1,397 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Input to godefs.  See also mkerrors.sh and mkall.sh
- */
-
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#define _FILE_OFFSET_BITS 64
-#define _GNU_SOURCE
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netpacket/packet.h>
-#include <signal.h>
-#include <stdio.h>
-#include <sys/epoll.h>
-#include <sys/inotify.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <sys/sysinfo.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/timex.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/user.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <linux/filter.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <termios.h>
-#include <time.h>
-#include <unistd.h>
-#include <ustat.h>
-#include <utime.h>
-
-// Machine characteristics; for internal use.
-
-enum {
-	$sizeofPtr = sizeof(void*),
-	$sizeofShort = sizeof(short),
-	$sizeofInt = sizeof(int),
-	$sizeofLong = sizeof(long),
-	$sizeofLongLong = sizeof(long long),
-	$PathMax = PATH_MAX,
-};
-
-// Basic types
-
-typedef short $_C_short;
-typedef int $_C_int;
-typedef long $_C_long;
-typedef long long $_C_long_long;
-
-// Time
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-typedef struct timex $Timex;
-typedef time_t $Time_t;
-typedef struct tms $Tms;
-typedef struct utimbuf $Utimbuf;
-
-// Processes
-
-typedef struct rusage $Rusage;
-typedef struct rlimit $Rlimit;
-
-typedef gid_t $_Gid_t;
-
-// Files
-
-typedef struct stat $Stat_t;
-typedef struct statfs $Statfs_t;
-
-typedef struct dirent $Dirent;
-
-// Sockets
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_ll s5;
-	struct sockaddr_nl s6;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-// copied from /usr/include/linux/un.h 
-struct my_sockaddr_un {
-	sa_family_t sun_family;
-#ifdef __ARM_EABI__
-	// on ARM char is by default unsigned
-	signed char sun_path[108];
-#else
-	char sun_path[108];
-#endif
-};
-
-typedef struct sockaddr_in $RawSockaddrInet4;
-typedef struct sockaddr_in6 $RawSockaddrInet6;
-typedef struct my_sockaddr_un $RawSockaddrUnix;
-typedef struct sockaddr_ll $RawSockaddrLinklayer;
-typedef struct sockaddr_nl $RawSockaddrNetlink;
-typedef struct sockaddr $RawSockaddr;
-typedef struct sockaddr_any $RawSockaddrAny;
-typedef socklen_t $_Socklen;
-typedef struct linger $Linger;
-typedef struct iovec $Iovec;
-typedef struct ip_mreq $IPMreq;
-typedef struct ip_mreqn $IPMreqn;
-typedef struct ipv6_mreq $IPv6Mreq;
-typedef struct msghdr $Msghdr;
-typedef struct cmsghdr $Cmsghdr;
-typedef struct in_pktinfo $Inet4Pktinfo;
-typedef struct in6_pktinfo $Inet6Pktinfo;
-typedef struct ucred $Ucred;
-
-enum {
-	$SizeofSockaddrInet4 = sizeof(struct sockaddr_in),
-	$SizeofSockaddrInet6 = sizeof(struct sockaddr_in6),
-	$SizeofSockaddrAny = sizeof(struct sockaddr_any),
-	$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
-	$SizeofSockaddrLinklayer = sizeof(struct sockaddr_ll),
-	$SizeofSockaddrNetlink = sizeof(struct sockaddr_nl),
-	$SizeofLinger = sizeof(struct linger),
-	$SizeofIPMreq = sizeof(struct ip_mreq),
-	$SizeofIPMreqn = sizeof(struct ip_mreqn),
-	$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
-	$SizeofMsghdr = sizeof(struct msghdr),
-	$SizeofCmsghdr = sizeof(struct cmsghdr),
-	$SizeofInet4Pktinfo = sizeof(struct in_pktinfo),
-	$SizeofInet6Pktinfo = sizeof(struct in6_pktinfo),
-	$SizeofUcred = sizeof(struct ucred),
-};
-
-// Netlink routing and interface messages
-
-enum {
-	$IFA_UNSPEC = IFA_UNSPEC,
-	$IFA_ADDRESS = IFA_ADDRESS,
-	$IFA_LOCAL = IFA_LOCAL,
-	$IFA_LABEL = IFA_LABEL,
-	$IFA_BROADCAST = IFA_BROADCAST,
-	$IFA_ANYCAST = IFA_ANYCAST,
-	$IFA_CACHEINFO = IFA_CACHEINFO,
-	$IFA_MULTICAST = IFA_MULTICAST,
-	$IFLA_UNSPEC = IFLA_UNSPEC,
-	$IFLA_ADDRESS = IFLA_ADDRESS,
-	$IFLA_BROADCAST = IFLA_BROADCAST,
-	$IFLA_IFNAME = IFLA_IFNAME,
-	$IFLA_MTU = IFLA_MTU,
-	$IFLA_LINK = IFLA_LINK,
-	$IFLA_QDISC = IFLA_QDISC,
-	$IFLA_STATS = IFLA_STATS,
-	$IFLA_COST = IFLA_COST,
-	$IFLA_PRIORITY = IFLA_PRIORITY,
-	$IFLA_MASTER = IFLA_MASTER,
-	$IFLA_WIRELESS = IFLA_WIRELESS,
-	$IFLA_PROTINFO = IFLA_PROTINFO,
-	$IFLA_TXQLEN = IFLA_TXQLEN,
-	$IFLA_MAP = IFLA_MAP,
-	$IFLA_WEIGHT = IFLA_WEIGHT,
-	$IFLA_OPERSTATE = IFLA_OPERSTATE,
-	$IFLA_LINKMODE = IFLA_LINKMODE,
-	$IFLA_LINKINFO = IFLA_LINKINFO,
-	$IFLA_NET_NS_PID = IFLA_NET_NS_PID,
-	$IFLA_IFALIAS = IFLA_IFALIAS,
-	$IFLA_MAX = IFLA_MAX,
-	$RT_SCOPE_UNIVERSE = RT_SCOPE_UNIVERSE,
-	$RT_SCOPE_SITE = RT_SCOPE_SITE,
-	$RT_SCOPE_LINK = RT_SCOPE_LINK,
-	$RT_SCOPE_HOST = RT_SCOPE_HOST,
-	$RT_SCOPE_NOWHERE = RT_SCOPE_NOWHERE,
-	$RT_TABLE_UNSPEC = RT_TABLE_UNSPEC,
-	$RT_TABLE_COMPAT = RT_TABLE_COMPAT,
-	$RT_TABLE_DEFAULT = RT_TABLE_DEFAULT,
-	$RT_TABLE_MAIN = RT_TABLE_MAIN,
-	$RT_TABLE_LOCAL = RT_TABLE_LOCAL,
-	$RT_TABLE_MAX = RT_TABLE_MAX,
-	$RTA_UNSPEC = RTA_UNSPEC,
-	$RTA_DST = RTA_DST,
-	$RTA_SRC = RTA_SRC,
-	$RTA_IIF = RTA_IIF,
-	$RTA_OIF = RTA_OIF,
-	$RTA_GATEWAY = RTA_GATEWAY,
-	$RTA_PRIORITY = RTA_PRIORITY,
-	$RTA_PREFSRC = RTA_PREFSRC,
-	$RTA_METRICS = RTA_METRICS,
-	$RTA_MULTIPATH = RTA_MULTIPATH,
-	$RTA_FLOW = RTA_FLOW,
-	$RTA_CACHEINFO = RTA_CACHEINFO,
-	$RTA_TABLE = RTA_TABLE,
-	$RTN_UNSPEC = RTN_UNSPEC,
-	$RTN_UNICAST = RTN_UNICAST,
-	$RTN_LOCAL = RTN_LOCAL,
-	$RTN_BROADCAST = RTN_BROADCAST,
-	$RTN_ANYCAST = RTN_ANYCAST,
-	$RTN_MULTICAST = RTN_MULTICAST,
-	$RTN_BLACKHOLE = RTN_BLACKHOLE,
-	$RTN_UNREACHABLE = RTN_UNREACHABLE,
-	$RTN_PROHIBIT = RTN_PROHIBIT,
-	$RTN_THROW = RTN_THROW,
-	$RTN_NAT = RTN_NAT,
-	$RTN_XRESOLVE = RTN_XRESOLVE,
-	$SizeofNlMsghdr = sizeof(struct nlmsghdr),
-	$SizeofNlMsgerr = sizeof(struct nlmsgerr),
-	$SizeofRtGenmsg = sizeof(struct rtgenmsg),
-	$SizeofNlAttr = sizeof(struct nlattr),
-	$SizeofRtAttr = sizeof(struct rtattr),
-	$SizeofIfInfomsg = sizeof(struct ifinfomsg),
-	$SizeofIfAddrmsg = sizeof(struct ifaddrmsg),
-	$SizeofRtMsg = sizeof(struct rtmsg),
-	$SizeofRtNexthop = sizeof(struct rtnexthop),
-};
-
-typedef struct nlmsghdr $NlMsghdr;
-typedef struct nlmsgerr $NlMsgerr;
-typedef struct rtgenmsg $RtGenmsg;
-typedef struct nlattr $NlAttr;
-typedef struct rtattr $RtAttr;
-typedef struct ifinfomsg $IfInfomsg;
-typedef struct ifaddrmsg $IfAddrmsg;
-typedef struct rtmsg $RtMsg;
-typedef struct rtnexthop $RtNexthop;
-
-// Linux socket filter
-
-enum {
-	$SizeofSockFilter = sizeof(struct sock_filter),
-	$SizeofSockFprog = sizeof(struct sock_fprog),
-};
-
-typedef struct sock_filter $SockFilter;
-typedef struct sock_fprog $SockFprog;
-
-// Inotify
-
-typedef struct inotify_event $InotifyEvent;
-
-enum {
-	$SizeofInotifyEvent = sizeof(struct inotify_event)
-};
-
-// Ptrace
-
-// Register structures
-#ifdef __ARM_EABI__
-	typedef struct user_regs $PtraceRegs;
-#else
-	typedef struct user_regs_struct $PtraceRegs;
-#endif
-
-// Misc
-
-typedef fd_set $FdSet;
-typedef struct sysinfo $Sysinfo_t;
-typedef struct utsname $Utsname;
-typedef struct ustat $Ustat_t;
-
-// The real epoll_event is a union, and godefs doesn't handle it well.
-struct my_epoll_event {
-	uint32_t events;
-#ifdef __ARM_EABI__
-	// padding is not specified in linux/eventpoll.h but added to conform to the
-	// alignment requirements of EABI
-	int32_t padFd;
-#endif
-	int32_t fd;
-	int32_t pad;
-};
-
-typedef struct my_epoll_event $EpollEvent;
-
-// Terminal handling
-
-typedef struct termios $Termios;
-
-enum {
-	$VINTR = VINTR,
-	$VQUIT = VQUIT,
-	$VERASE = VERASE,
-	$VKILL = VKILL,
-	$VEOF = VEOF,
-	$VTIME = VTIME,
-	$VMIN = VMIN,
-	$VSWTC = VSWTC,
-	$VSTART = VSTART,
-	$VSTOP = VSTOP,
-	$VSUSP = VSUSP,
-	$VEOL = VEOL,
-	$VREPRINT = VREPRINT,
-	$VDISCARD = VDISCARD,
-	$VWERASE = VWERASE,
-	$VLNEXT = VLNEXT,
-	$VEOL2 = VEOL2,
-	$IGNBRK = IGNBRK,
-	$BRKINT = BRKINT,
-	$IGNPAR = IGNPAR,
-	$PARMRK = PARMRK,
-	$INPCK = INPCK,
-	$ISTRIP = ISTRIP,
-	$INLCR = INLCR,
-	$IGNCR = IGNCR,
-	$ICRNL = ICRNL,
-	$IUCLC = IUCLC,
-	$IXON = IXON,
-	$IXANY = IXANY,
-	$IXOFF = IXOFF,
-	$IMAXBEL = IMAXBEL,
-	$IUTF8 = IUTF8,
-	$OPOST = OPOST,
-	$OLCUC = OLCUC,
-	$ONLCR = ONLCR,
-	$OCRNL = OCRNL,
-	$ONOCR = ONOCR,
-	$ONLRET = ONLRET,
-	$OFILL = OFILL,
-	$OFDEL = OFDEL,
-	$B0 = B0,
-	$B50 = B50,
-	$B75 = B75,
-	$B110 = B110,
-	$B134 = B134,
-	$B150 = B150,
-	$B200 = B200,
-	$B300 = B300,
-	$B600 = B600,
-	$B1200 = B1200,
-	$B1800 = B1800,
-	$B2400 = B2400,
-	$B4800 = B4800,
-	$B9600 = B9600,
-	$B19200 = B19200,
-	$B38400 = B38400,
-	$CSIZE = CSIZE,
-	$CS5 = CS5,
-	$CS6 = CS6,
-	$CS7 = CS7,
-	$CS8 = CS8,
-	$CSTOPB = CSTOPB,
-	$CREAD = CREAD,
-	$PARENB = PARENB,
-	$PARODD = PARODD,
-	$HUPCL = HUPCL,
-	$CLOCAL = CLOCAL,
-	$B57600 = B57600,
-	$B115200 = B115200,
-	$B230400 = B230400,
-	$B460800 = B460800,
-	$B500000 = B500000,
-	$B576000 = B576000,
-	$B921600 = B921600,
-	$B1000000 = B1000000,
-	$B1152000 = B1152000,
-	$B1500000 = B1500000,
-	$B2000000 = B2000000,
-	$B2500000 = B2500000,
-	$B3000000 = B3000000,
-	$B3500000 = B3500000,
-	$B4000000 = B4000000,
-	$ISIG = ISIG,
-	$ICANON = ICANON,
-	$XCASE = XCASE,
-	$ECHO = ECHO,
-	$ECHOE = ECHOE,
-	$ECHOK = ECHOK,
-	$ECHONL = ECHONL,
-	$NOFLSH = NOFLSH,
-	$TOSTOP = TOSTOP,
-	$ECHOCTL = ECHOCTL,
-	$ECHOPRT = ECHOPRT,
-	$ECHOKE = ECHOKE,
-	$FLUSHO = FLUSHO,
-	$PENDIN = PENDIN,
-	$IEXTEN = IEXTEN,
-	$TCGETS = TCGETS,
-	$TCSETS = TCSETS,
-};
diff --git a/src/pkg/syscall/types_linux.go b/src/pkg/syscall/types_linux.go
new file mode 100644
index 0000000..a02f218
--- /dev/null
+++ b/src/pkg/syscall/types_linux.go
@@ -0,0 +1,452 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo -godefs.  See also mkerrors.sh and mkall.sh
+*/
+
+// +build ignore
+
+// +godefs map struct_in_addr [4]byte /* in_addr */
+// +godefs map struct_in6_addr [16]byte /* in6_addr */
+
+package syscall
+
+/*
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#define _FILE_OFFSET_BITS 64
+#define _GNU_SOURCE
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netpacket/packet.h>
+#include <signal.h>
+#include <stdio.h>
+#include <sys/epoll.h>
+#include <sys/inotify.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/param.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/select.h>
+#include <sys/signal.h>
+#include <sys/stat.h>
+#include <sys/statfs.h>
+#include <sys/sysinfo.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <sys/timex.h>
+#include <sys/types.h>
+#include <sys/un.h>
+#include <sys/user.h>
+#include <sys/utsname.h>
+#include <sys/wait.h>
+#include <linux/filter.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+#include <ustat.h>
+#include <utime.h>
+
+enum {
+	sizeofPtr = sizeof(void*),
+};
+
+union sockaddr_all {
+	struct sockaddr s1;	// this one gets used for fields
+	struct sockaddr_in s2;	// these pad it out
+	struct sockaddr_in6 s3;
+	struct sockaddr_un s4;
+	struct sockaddr_ll s5;
+	struct sockaddr_nl s6;
+};
+
+struct sockaddr_any {
+	struct sockaddr addr;
+	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
+};
+
+// copied from /usr/include/linux/un.h 
+struct my_sockaddr_un {
+	sa_family_t sun_family;
+#ifdef __ARM_EABI__
+	// on ARM char is by default unsigned
+	signed char sun_path[108];
+#else
+	char sun_path[108];
+#endif
+};
+
+#ifdef __ARM_EABI__
+typedef struct user_regs PtraceRegs;
+#else
+typedef struct user_regs_struct PtraceRegs;
+#endif
+
+// The real epoll_event is a union, and godefs doesn't handle it well.
+struct my_epoll_event {
+	uint32_t events;
+#ifdef __ARM_EABI__
+	// padding is not specified in linux/eventpoll.h but added to conform to the
+	// alignment requirements of EABI
+	int32_t padFd;
+#endif
+	int32_t fd;
+	int32_t pad;
+};
+
+*/
+import "C"
+
+// Machine characteristics; for internal use.
+
+const (
+	sizeofPtr      = C.sizeofPtr
+	sizeofShort    = C.sizeof_short
+	sizeofInt      = C.sizeof_int
+	sizeofLong     = C.sizeof_long
+	sizeofLongLong = C.sizeof_longlong
+	PathMax        = C.PATH_MAX
+)
+
+// Basic types
+
+type (
+	_C_short     C.short
+	_C_int       C.int
+	_C_long      C.long
+	_C_long_long C.longlong
+)
+
+// Time
+
+type Timespec C.struct_timespec
+
+type Timeval C.struct_timeval
+
+type Timex C.struct_timex
+
+type Time_t C.time_t
+
+type Tms C.struct_tms
+
+type Utimbuf C.struct_utimbuf
+
+// Processes
+
+type Rusage C.struct_rusage
+
+type Rlimit C.struct_rlimit
+
+type _Gid_t C.gid_t
+
+// Files
+
+type Stat_t C.struct_stat
+
+type Statfs_t C.struct_statfs
+
+type Dirent C.struct_dirent
+
+type Fsid C.fsid_t
+
+// Sockets
+
+type RawSockaddrInet4 C.struct_sockaddr_in
+
+type RawSockaddrInet6 C.struct_sockaddr_in6
+
+type RawSockaddrUnix C.struct_my_sockaddr_un
+
+type RawSockaddrLinklayer C.struct_sockaddr_ll
+
+type RawSockaddrNetlink C.struct_sockaddr_nl
+
+type RawSockaddr C.struct_sockaddr
+
+type RawSockaddrAny C.struct_sockaddr_any
+
+type _Socklen C.socklen_t
+
+type Linger C.struct_linger
+
+type Iovec C.struct_iovec
+
+type IPMreq C.struct_ip_mreq
+
+type IPMreqn C.struct_ip_mreqn
+
+type IPv6Mreq C.struct_ipv6_mreq
+
+type Msghdr C.struct_msghdr
+
+type Cmsghdr C.struct_cmsghdr
+
+type Inet4Pktinfo C.struct_in_pktinfo
+
+type Inet6Pktinfo C.struct_in6_pktinfo
+
+type Ucred C.struct_ucred
+
+const (
+	SizeofSockaddrInet4     = C.sizeof_struct_sockaddr_in
+	SizeofSockaddrInet6     = C.sizeof_struct_sockaddr_in6
+	SizeofSockaddrAny       = C.sizeof_struct_sockaddr_any
+	SizeofSockaddrUnix      = C.sizeof_struct_sockaddr_un
+	SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll
+	SizeofSockaddrNetlink   = C.sizeof_struct_sockaddr_nl
+	SizeofLinger            = C.sizeof_struct_linger
+	SizeofIPMreq            = C.sizeof_struct_ip_mreq
+	SizeofIPMreqn           = C.sizeof_struct_ip_mreqn
+	SizeofIPv6Mreq          = C.sizeof_struct_ipv6_mreq
+	SizeofMsghdr            = C.sizeof_struct_msghdr
+	SizeofCmsghdr           = C.sizeof_struct_cmsghdr
+	SizeofInet4Pktinfo      = C.sizeof_struct_in_pktinfo
+	SizeofInet6Pktinfo      = C.sizeof_struct_in6_pktinfo
+	SizeofUcred             = C.sizeof_struct_ucred
+)
+
+// Netlink routing and interface messages
+
+const (
+	IFA_UNSPEC        = C.IFA_UNSPEC
+	IFA_ADDRESS       = C.IFA_ADDRESS
+	IFA_LOCAL         = C.IFA_LOCAL
+	IFA_LABEL         = C.IFA_LABEL
+	IFA_BROADCAST     = C.IFA_BROADCAST
+	IFA_ANYCAST       = C.IFA_ANYCAST
+	IFA_CACHEINFO     = C.IFA_CACHEINFO
+	IFA_MULTICAST     = C.IFA_MULTICAST
+	IFLA_UNSPEC       = C.IFLA_UNSPEC
+	IFLA_ADDRESS      = C.IFLA_ADDRESS
+	IFLA_BROADCAST    = C.IFLA_BROADCAST
+	IFLA_IFNAME       = C.IFLA_IFNAME
+	IFLA_MTU          = C.IFLA_MTU
+	IFLA_LINK         = C.IFLA_LINK
+	IFLA_QDISC        = C.IFLA_QDISC
+	IFLA_STATS        = C.IFLA_STATS
+	IFLA_COST         = C.IFLA_COST
+	IFLA_PRIORITY     = C.IFLA_PRIORITY
+	IFLA_MASTER       = C.IFLA_MASTER
+	IFLA_WIRELESS     = C.IFLA_WIRELESS
+	IFLA_PROTINFO     = C.IFLA_PROTINFO
+	IFLA_TXQLEN       = C.IFLA_TXQLEN
+	IFLA_MAP          = C.IFLA_MAP
+	IFLA_WEIGHT       = C.IFLA_WEIGHT
+	IFLA_OPERSTATE    = C.IFLA_OPERSTATE
+	IFLA_LINKMODE     = C.IFLA_LINKMODE
+	IFLA_LINKINFO     = C.IFLA_LINKINFO
+	IFLA_NET_NS_PID   = C.IFLA_NET_NS_PID
+	IFLA_IFALIAS      = C.IFLA_IFALIAS
+	IFLA_MAX          = C.IFLA_MAX
+	RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE
+	RT_SCOPE_SITE     = C.RT_SCOPE_SITE
+	RT_SCOPE_LINK     = C.RT_SCOPE_LINK
+	RT_SCOPE_HOST     = C.RT_SCOPE_HOST
+	RT_SCOPE_NOWHERE  = C.RT_SCOPE_NOWHERE
+	RT_TABLE_UNSPEC   = C.RT_TABLE_UNSPEC
+	RT_TABLE_COMPAT   = C.RT_TABLE_COMPAT
+	RT_TABLE_DEFAULT  = C.RT_TABLE_DEFAULT
+	RT_TABLE_MAIN     = C.RT_TABLE_MAIN
+	RT_TABLE_LOCAL    = C.RT_TABLE_LOCAL
+	RT_TABLE_MAX      = C.RT_TABLE_MAX
+	RTA_UNSPEC        = C.RTA_UNSPEC
+	RTA_DST           = C.RTA_DST
+	RTA_SRC           = C.RTA_SRC
+	RTA_IIF           = C.RTA_IIF
+	RTA_OIF           = C.RTA_OIF
+	RTA_GATEWAY       = C.RTA_GATEWAY
+	RTA_PRIORITY      = C.RTA_PRIORITY
+	RTA_PREFSRC       = C.RTA_PREFSRC
+	RTA_METRICS       = C.RTA_METRICS
+	RTA_MULTIPATH     = C.RTA_MULTIPATH
+	RTA_FLOW          = C.RTA_FLOW
+	RTA_CACHEINFO     = C.RTA_CACHEINFO
+	RTA_TABLE         = C.RTA_TABLE
+	RTN_UNSPEC        = C.RTN_UNSPEC
+	RTN_UNICAST       = C.RTN_UNICAST
+	RTN_LOCAL         = C.RTN_LOCAL
+	RTN_BROADCAST     = C.RTN_BROADCAST
+	RTN_ANYCAST       = C.RTN_ANYCAST
+	RTN_MULTICAST     = C.RTN_MULTICAST
+	RTN_BLACKHOLE     = C.RTN_BLACKHOLE
+	RTN_UNREACHABLE   = C.RTN_UNREACHABLE
+	RTN_PROHIBIT      = C.RTN_PROHIBIT
+	RTN_THROW         = C.RTN_THROW
+	RTN_NAT           = C.RTN_NAT
+	RTN_XRESOLVE      = C.RTN_XRESOLVE
+	SizeofNlMsghdr    = C.sizeof_struct_nlmsghdr
+	SizeofNlMsgerr    = C.sizeof_struct_nlmsgerr
+	SizeofRtGenmsg    = C.sizeof_struct_rtgenmsg
+	SizeofNlAttr      = C.sizeof_struct_nlattr
+	SizeofRtAttr      = C.sizeof_struct_rtattr
+	SizeofIfInfomsg   = C.sizeof_struct_ifinfomsg
+	SizeofIfAddrmsg   = C.sizeof_struct_ifaddrmsg
+	SizeofRtMsg       = C.sizeof_struct_rtmsg
+	SizeofRtNexthop   = C.sizeof_struct_rtnexthop
+)
+
+type NlMsghdr C.struct_nlmsghdr
+
+type NlMsgerr C.struct_nlmsgerr
+
+type RtGenmsg C.struct_rtgenmsg
+
+type NlAttr C.struct_nlattr
+
+type RtAttr C.struct_rtattr
+
+type IfInfomsg C.struct_ifinfomsg
+
+type IfAddrmsg C.struct_ifaddrmsg
+
+type RtMsg C.struct_rtmsg
+
+type RtNexthop C.struct_rtnexthop
+
+// Linux socket filter
+
+const (
+	SizeofSockFilter = C.sizeof_struct_sock_filter
+	SizeofSockFprog  = C.sizeof_struct_sock_fprog
+)
+
+type SockFilter C.struct_sock_filter
+
+type SockFprog C.struct_sock_fprog
+
+// Inotify
+
+type InotifyEvent C.struct_inotify_event
+
+const SizeofInotifyEvent = C.sizeof_struct_inotify_event
+
+// Ptrace
+
+// Register structures
+type PtraceRegs C.PtraceRegs
+
+// Misc
+
+type FdSet C.fd_set
+
+type Sysinfo_t C.struct_sysinfo
+
+type Utsname C.struct_utsname
+
+type Ustat_t C.struct_ustat
+
+type EpollEvent C.struct_my_epoll_event
+
+// Terminal handling
+
+type Termios C.struct_termios
+
+const (
+	VINTR    = C.VINTR
+	VQUIT    = C.VQUIT
+	VERASE   = C.VERASE
+	VKILL    = C.VKILL
+	VEOF     = C.VEOF
+	VTIME    = C.VTIME
+	VMIN     = C.VMIN
+	VSWTC    = C.VSWTC
+	VSTART   = C.VSTART
+	VSTOP    = C.VSTOP
+	VSUSP    = C.VSUSP
+	VEOL     = C.VEOL
+	VREPRINT = C.VREPRINT
+	VDISCARD = C.VDISCARD
+	VWERASE  = C.VWERASE
+	VLNEXT   = C.VLNEXT
+	VEOL2    = C.VEOL2
+	IGNBRK   = C.IGNBRK
+	BRKINT   = C.BRKINT
+	IGNPAR   = C.IGNPAR
+	PARMRK   = C.PARMRK
+	INPCK    = C.INPCK
+	ISTRIP   = C.ISTRIP
+	INLCR    = C.INLCR
+	IGNCR    = C.IGNCR
+	ICRNL    = C.ICRNL
+	IUCLC    = C.IUCLC
+	IXON     = C.IXON
+	IXANY    = C.IXANY
+	IXOFF    = C.IXOFF
+	IMAXBEL  = C.IMAXBEL
+	IUTF8    = C.IUTF8
+	OPOST    = C.OPOST
+	OLCUC    = C.OLCUC
+	ONLCR    = C.ONLCR
+	OCRNL    = C.OCRNL
+	ONOCR    = C.ONOCR
+	ONLRET   = C.ONLRET
+	OFILL    = C.OFILL
+	OFDEL    = C.OFDEL
+	B0       = C.B0
+	B50      = C.B50
+	B75      = C.B75
+	B110     = C.B110
+	B134     = C.B134
+	B150     = C.B150
+	B200     = C.B200
+	B300     = C.B300
+	B600     = C.B600
+	B1200    = C.B1200
+	B1800    = C.B1800
+	B2400    = C.B2400
+	B4800    = C.B4800
+	B9600    = C.B9600
+	B19200   = C.B19200
+	B38400   = C.B38400
+	CSIZE    = C.CSIZE
+	CS5      = C.CS5
+	CS6      = C.CS6
+	CS7      = C.CS7
+	CS8      = C.CS8
+	CSTOPB   = C.CSTOPB
+	CREAD    = C.CREAD
+	PARENB   = C.PARENB
+	PARODD   = C.PARODD
+	HUPCL    = C.HUPCL
+	CLOCAL   = C.CLOCAL
+	B57600   = C.B57600
+	B115200  = C.B115200
+	B230400  = C.B230400
+	B460800  = C.B460800
+	B500000  = C.B500000
+	B576000  = C.B576000
+	B921600  = C.B921600
+	B1000000 = C.B1000000
+	B1152000 = C.B1152000
+	B1500000 = C.B1500000
+	B2000000 = C.B2000000
+	B2500000 = C.B2500000
+	B3000000 = C.B3000000
+	B3500000 = C.B3500000
+	B4000000 = C.B4000000
+	ISIG     = C.ISIG
+	ICANON   = C.ICANON
+	XCASE    = C.XCASE
+	ECHO     = C.ECHO
+	ECHOE    = C.ECHOE
+	ECHOK    = C.ECHOK
+	ECHONL   = C.ECHONL
+	NOFLSH   = C.NOFLSH
+	TOSTOP   = C.TOSTOP
+	ECHOCTL  = C.ECHOCTL
+	ECHOPRT  = C.ECHOPRT
+	ECHOKE   = C.ECHOKE
+	FLUSHO   = C.FLUSHO
+	PENDIN   = C.PENDIN
+	IEXTEN   = C.IEXTEN
+	TCGETS   = C.TCGETS
+	TCSETS   = C.TCSETS
+)
diff --git a/src/pkg/syscall/types_openbsd.c b/src/pkg/syscall/types_openbsd.c
deleted file mode 100644
index e51c64e..0000000
--- a/src/pkg/syscall/types_openbsd.c
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Input to godefs.  See also mkerrors.sh and mkall.sh
- */
-
-#define KERNEL
-#include <dirent.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
-// Machine characteristics; for internal use.
-
-enum {
-	$sizeofPtr = sizeof(void*),
-	$sizeofShort = sizeof(short),
-	$sizeofInt = sizeof(int),
-	$sizeofLong = sizeof(long),
-	$sizeofLongLong = sizeof(long long),
-};
-
-// Basic types
-
-typedef short $_C_short;
-typedef int $_C_int;
-typedef long $_C_long;
-typedef long long $_C_long_long;
-
-// Time
-
-typedef struct timespec $Timespec;
-typedef struct timeval $Timeval;
-
-// Processes
-
-typedef struct rusage $Rusage;
-typedef struct rlimit $Rlimit;
-
-typedef gid_t $_Gid_t;
-
-// Files
-
-enum {	// Directory mode bits
-	$S_IFMT = S_IFMT,
-	$S_IFIFO = S_IFIFO,
-	$S_IFCHR = S_IFCHR,
-	$S_IFDIR = S_IFDIR,
-	$S_IFBLK = S_IFBLK,
-	$S_IFREG = S_IFREG,
-	$S_IFLNK = S_IFLNK,
-	$S_IFSOCK = S_IFSOCK,
-	$S_ISUID = S_ISUID,
-	$S_ISGID = S_ISGID,
-	$S_ISVTX = S_ISVTX,
-	$S_IRUSR = S_IRUSR,
-	$S_IWUSR = S_IWUSR,
-	$S_IXUSR = S_IXUSR,
-};
-
-typedef struct stat $Stat_t;
-typedef struct statfs $Statfs_t;
-typedef struct flock $Flock_t;
-
-typedef struct dirent $Dirent;
-
-// Sockets
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-typedef struct sockaddr_in $RawSockaddrInet4;
-typedef struct sockaddr_in6 $RawSockaddrInet6;
-typedef struct sockaddr_un $RawSockaddrUnix;
-typedef struct sockaddr_dl $RawSockaddrDatalink;
-typedef struct sockaddr $RawSockaddr;
-typedef struct sockaddr_any $RawSockaddrAny;
-typedef socklen_t $_Socklen;
-typedef struct linger $Linger;
-typedef struct iovec $Iovec;
-typedef struct ip_mreq $IPMreq;
-typedef struct ipv6_mreq $IPv6Mreq;
-typedef struct msghdr $Msghdr;
-typedef struct cmsghdr $Cmsghdr;
-typedef struct in6_pktinfo $Inet6Pktinfo;
-
-enum {
-	$SizeofSockaddrInet4 = sizeof(struct sockaddr_in),
-	$SizeofSockaddrInet6 = sizeof(struct sockaddr_in6),
-	$SizeofSockaddrAny = sizeof(struct sockaddr_any),
-	$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
-	$SizeofSockaddrDatalink = sizeof(struct sockaddr_dl),
-	$SizeofLinger = sizeof(struct linger),
-	$SizeofIPMreq = sizeof(struct ip_mreq),
-	$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
-	$SizeofMsghdr = sizeof(struct msghdr),
-	$SizeofCmsghdr = sizeof(struct cmsghdr),
-	$SizeofInet6Pktinfo = sizeof(struct in6_pktinfo),
-};
-
-// Ptrace requests
-
-enum {
-	$PTRACE_TRACEME = PT_TRACE_ME,
-	$PTRACE_CONT = PT_CONTINUE,
-	$PTRACE_KILL = PT_KILL,
-};
-
-// Events (kqueue, kevent)
-
-typedef struct kevent $Kevent_t;
-
-// Select
-
-typedef fd_set $FdSet;
-
-// Routing and interface messages
-
-enum {
-	$SizeofIfMsghdr = sizeof(struct if_msghdr),
-	$SizeofIfData = sizeof(struct if_data),
-	$SizeofIfaMsghdr = sizeof(struct ifa_msghdr),
-	$SizeofRtMsghdr = sizeof(struct rt_msghdr),
-	$SizeofRtMetrics = sizeof(struct rt_metrics),
-};
-
-typedef struct if_msghdr $IfMsghdr;
-typedef struct if_data $IfData;
-typedef struct ifa_msghdr $IfaMsghdr;
-typedef struct rt_msghdr $RtMsghdr;
-typedef struct rt_metrics $RtMetrics;
-
-// Berkeley packet filter
-
-enum {
-	$SizeofBpfVersion = sizeof(struct bpf_version),
-	$SizeofBpfStat = sizeof(struct bpf_stat),
-	$SizeofBpfProgram = sizeof(struct bpf_program),
-	$SizeofBpfInsn = sizeof(struct bpf_insn),
-	$SizeofBpfHdr = sizeof(struct bpf_hdr),
-};
-
-typedef struct bpf_version $BpfVersion;
-typedef struct bpf_stat $BpfStat;
-typedef struct bpf_program $BpfProgram;
-typedef struct bpf_insn $BpfInsn;
-typedef struct bpf_hdr $BpfHdr;
-typedef struct bpf_timeval $BpfTimeval;
diff --git a/src/pkg/syscall/types_openbsd.go b/src/pkg/syscall/types_openbsd.go
new file mode 100644
index 0000000..6f7ef35
--- /dev/null
+++ b/src/pkg/syscall/types_openbsd.go
@@ -0,0 +1,229 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Input to cgo -godefs.  See also mkerrors.sh and mkall.sh
+*/
+
+// +build ignore
+
+// +godefs map struct_in_addr [4]byte /* in_addr */
+// +godefs map struct_in6_addr [16]byte /* in6_addr */
+
+package syscall
+
+/*
+#define KERNEL
+#include <dirent.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/select.h>
+#include <sys/signal.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+enum {
+	sizeofPtr = sizeof(void*),
+};
+
+union sockaddr_all {
+	struct sockaddr s1;	// this one gets used for fields
+	struct sockaddr_in s2;	// these pad it out
+	struct sockaddr_in6 s3;
+	struct sockaddr_un s4;
+	struct sockaddr_dl s5;
+};
+
+struct sockaddr_any {
+	struct sockaddr addr;
+	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
+};
+
+*/
+import "C"
+
+// Machine characteristics; for internal use.
+
+const (
+	sizeofPtr      = C.sizeofPtr
+	sizeofShort    = C.sizeof_short
+	sizeofInt      = C.sizeof_int
+	sizeofLong     = C.sizeof_long
+	sizeofLongLong = C.sizeof_longlong
+)
+
+// Basic types
+
+type (
+	_C_short     C.short
+	_C_int       C.int
+	_C_long      C.long
+	_C_long_long C.longlong
+)
+
+// Time
+
+type Timespec C.struct_timespec
+
+type Timeval C.struct_timeval
+
+// Processes
+
+type Rusage C.struct_rusage
+
+type Rlimit C.struct_rlimit
+
+type _Gid_t C.gid_t
+
+// Files
+
+const ( // Directory mode bits
+	S_IFMT   = C.S_IFMT
+	S_IFIFO  = C.S_IFIFO
+	S_IFCHR  = C.S_IFCHR
+	S_IFDIR  = C.S_IFDIR
+	S_IFBLK  = C.S_IFBLK
+	S_IFREG  = C.S_IFREG
+	S_IFLNK  = C.S_IFLNK
+	S_IFSOCK = C.S_IFSOCK
+	S_ISUID  = C.S_ISUID
+	S_ISGID  = C.S_ISGID
+	S_ISVTX  = C.S_ISVTX
+	S_IRUSR  = C.S_IRUSR
+	S_IWUSR  = C.S_IWUSR
+	S_IXUSR  = C.S_IXUSR
+)
+
+type Stat_t C.struct_stat
+
+type Statfs_t C.struct_statfs
+
+type Flock_t C.struct_flock
+
+type Dirent C.struct_dirent
+
+type Fsid C.fsid_t
+
+// Sockets
+
+type RawSockaddrInet4 C.struct_sockaddr_in
+
+type RawSockaddrInet6 C.struct_sockaddr_in6
+
+type RawSockaddrUnix C.struct_sockaddr_un
+
+type RawSockaddrDatalink C.struct_sockaddr_dl
+
+type RawSockaddr C.struct_sockaddr
+
+type RawSockaddrAny C.struct_sockaddr_any
+
+type _Socklen C.socklen_t
+
+type Linger C.struct_linger
+
+type Iovec C.struct_iovec
+
+type IPMreq C.struct_ip_mreq
+
+type IPv6Mreq C.struct_ipv6_mreq
+
+type Msghdr C.struct_msghdr
+
+type Cmsghdr C.struct_cmsghdr
+
+type Inet6Pktinfo C.struct_in6_pktinfo
+
+const (
+	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
+	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
+	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
+	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
+	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
+	SizeofLinger           = C.sizeof_struct_linger
+	SizeofIPMreq           = C.sizeof_struct_ip_mreq
+	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
+	SizeofMsghdr           = C.sizeof_struct_msghdr
+	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
+	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
+)
+
+// Ptrace requests
+
+const (
+	PTRACE_TRACEME = C.PT_TRACE_ME
+	PTRACE_CONT    = C.PT_CONTINUE
+	PTRACE_KILL    = C.PT_KILL
+)
+
+// Events (kqueue, kevent)
+
+type Kevent_t C.struct_kevent
+
+// Select
+
+type FdSet C.fd_set
+
+// Routing and interface messages
+
+const (
+	SizeofIfMsghdr  = C.sizeof_struct_if_msghdr
+	SizeofIfData    = C.sizeof_struct_if_data
+	SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
+	SizeofRtMsghdr  = C.sizeof_struct_rt_msghdr
+	SizeofRtMetrics = C.sizeof_struct_rt_metrics
+)
+
+type IfMsghdr C.struct_if_msghdr
+
+type IfData C.struct_if_data
+
+type IfaMsghdr C.struct_ifa_msghdr
+
+type RtMsghdr C.struct_rt_msghdr
+
+type RtMetrics C.struct_rt_metrics
+
+type Mclpool C.struct_mclpool
+
+// Berkeley packet filter
+
+const (
+	SizeofBpfVersion = C.sizeof_struct_bpf_version
+	SizeofBpfStat    = C.sizeof_struct_bpf_stat
+	SizeofBpfProgram = C.sizeof_struct_bpf_program
+	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
+	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
+)
+
+type BpfVersion C.struct_bpf_version
+
+type BpfStat C.struct_bpf_stat
+
+type BpfProgram C.struct_bpf_program
+
+type BpfInsn C.struct_bpf_insn
+
+type BpfHdr C.struct_bpf_hdr
+
+type BpfTimeval C.struct_bpf_timeval
diff --git a/src/pkg/syscall/zerrors_darwin_386.go b/src/pkg/syscall/zerrors_darwin_386.go
index a769fd3..57b5222 100644
--- a/src/pkg/syscall/zerrors_darwin_386.go
+++ b/src/pkg/syscall/zerrors_darwin_386.go
@@ -1,13 +1,11 @@
-// mkerrors.sh -f -m32
+// mkerrors.sh -m32
 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 
-// godefs -c gcc -f -m32 -gsyscall -f -m32 _const.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs -- -m32 _const.go
 
 package syscall
 
-// Constants
 const (
 	AF_APPLETALK                = 0x10
 	AF_CCITT                    = 0xa
@@ -44,7 +42,7 @@
 	AF_SNA                      = 0xb
 	AF_SYSTEM                   = 0x20
 	AF_UNIX                     = 0x1
-	AF_UNSPEC                   = 0
+	AF_UNSPEC                   = 0x0
 	BIOCFLUSH                   = 0x20004268
 	BIOCGBLEN                   = 0x40044266
 	BIOCGDLT                    = 0x4004426a
@@ -68,23 +66,23 @@
 	BIOCVERSION                 = 0x40044271
 	BPF_A                       = 0x10
 	BPF_ABS                     = 0x20
-	BPF_ADD                     = 0
+	BPF_ADD                     = 0x0
 	BPF_ALIGNMENT               = 0x4
 	BPF_ALU                     = 0x4
 	BPF_AND                     = 0x50
 	BPF_B                       = 0x10
 	BPF_DIV                     = 0x30
 	BPF_H                       = 0x8
-	BPF_IMM                     = 0
+	BPF_IMM                     = 0x0
 	BPF_IND                     = 0x40
-	BPF_JA                      = 0
+	BPF_JA                      = 0x0
 	BPF_JEQ                     = 0x10
 	BPF_JGE                     = 0x30
 	BPF_JGT                     = 0x20
 	BPF_JMP                     = 0x5
 	BPF_JSET                    = 0x40
-	BPF_K                       = 0
-	BPF_LD                      = 0
+	BPF_K                       = 0x0
+	BPF_LD                      = 0x0
 	BPF_LDX                     = 0x1
 	BPF_LEN                     = 0x80
 	BPF_LSH                     = 0x60
@@ -106,9 +104,9 @@
 	BPF_ST                      = 0x2
 	BPF_STX                     = 0x3
 	BPF_SUB                     = 0x10
-	BPF_TAX                     = 0
+	BPF_TAX                     = 0x0
 	BPF_TXA                     = 0x80
-	BPF_W                       = 0
+	BPF_W                       = 0x0
 	BPF_X                       = 0x8
 	CTL_MAXNAME                 = 0xc
 	CTL_NET                     = 0x4
@@ -129,7 +127,7 @@
 	DLT_IEEE802_11_RADIO_AVS    = 0xa3
 	DLT_LINUX_SLL               = 0x71
 	DLT_LOOP                    = 0x6c
-	DLT_NULL                    = 0
+	DLT_NULL                    = 0x0
 	DLT_PFLOG                   = 0x75
 	DLT_PFSYNC                  = 0x12
 	DLT_PPP                     = 0x9
@@ -146,7 +144,7 @@
 	DT_LNK                      = 0xa
 	DT_REG                      = 0x8
 	DT_SOCK                     = 0xc
-	DT_UNKNOWN                  = 0
+	DT_UNKNOWN                  = 0x0
 	DT_WHT                      = 0xe
 	E2BIG                       = 0x7
 	EACCES                      = 0xd
@@ -299,7 +297,7 @@
 	F_ALLOCATEALL               = 0x4
 	F_ALLOCATECONTIG            = 0x2
 	F_CHKCLEAN                  = 0x29
-	F_DUPFD                     = 0
+	F_DUPFD                     = 0x0
 	F_FREEZE_FS                 = 0x35
 	F_FULLFSYNC                 = 0x33
 	F_GETFD                     = 0x1
@@ -463,7 +461,7 @@
 	IPPROTO_GRE                 = 0x2f
 	IPPROTO_HELLO               = 0x3f
 	IPPROTO_HMP                 = 0x14
-	IPPROTO_HOPOPTS             = 0
+	IPPROTO_HOPOPTS             = 0x0
 	IPPROTO_ICMP                = 0x1
 	IPPROTO_ICMPV6              = 0x3a
 	IPPROTO_IDP                 = 0x16
@@ -475,7 +473,7 @@
 	IPPROTO_IL                  = 0x28
 	IPPROTO_INLSP               = 0x34
 	IPPROTO_INP                 = 0x20
-	IPPROTO_IP                  = 0
+	IPPROTO_IP                  = 0x0
 	IPPROTO_IPCOMP              = 0x6c
 	IPPROTO_IPCV                = 0x47
 	IPPROTO_IPEIP               = 0x5e
@@ -569,14 +567,14 @@
 	IPV6_PKTINFO                = 0x13
 	IPV6_PKTOPTIONS             = 0x19
 	IPV6_PORTRANGE              = 0xe
-	IPV6_PORTRANGE_DEFAULT      = 0
+	IPV6_PORTRANGE_DEFAULT      = 0x0
 	IPV6_PORTRANGE_HIGH         = 0x1
 	IPV6_PORTRANGE_LOW          = 0x2
 	IPV6_RECVTCLASS             = 0x23
 	IPV6_RTHDR                  = 0x18
-	IPV6_RTHDR_LOOSE            = 0
+	IPV6_RTHDR_LOOSE            = 0x0
 	IPV6_RTHDR_STRICT           = 0x1
-	IPV6_RTHDR_TYPE_0           = 0
+	IPV6_RTHDR_TYPE_0           = 0x0
 	IPV6_SOCKOPT_RESERVED1      = 0x3
 	IPV6_TCLASS                 = 0x24
 	IPV6_UNICAST_HOPS           = 0x4
@@ -620,7 +618,7 @@
 	IP_OLD_FW_ZERO              = 0x35
 	IP_OPTIONS                  = 0x1
 	IP_PORTRANGE                = 0x13
-	IP_PORTRANGE_DEFAULT        = 0
+	IP_PORTRANGE_DEFAULT        = 0x0
 	IP_PORTRANGE_HIGH           = 0x1
 	IP_PORTRANGE_LOW            = 0x2
 	IP_RECVDSTADDR              = 0x7
@@ -643,14 +641,14 @@
 	MADV_FREE                   = 0x5
 	MADV_FREE_REUSABLE          = 0x7
 	MADV_FREE_REUSE             = 0x8
-	MADV_NORMAL                 = 0
+	MADV_NORMAL                 = 0x0
 	MADV_RANDOM                 = 0x1
 	MADV_SEQUENTIAL             = 0x2
 	MADV_WILLNEED               = 0x3
 	MADV_ZERO_WIRED_PAGES       = 0x6
 	MAP_ANON                    = 0x1000
 	MAP_COPY                    = 0x2
-	MAP_FILE                    = 0
+	MAP_FILE                    = 0x0
 	MAP_FIXED                   = 0x10
 	MAP_HASSEMAPHORE            = 0x200
 	MAP_NOCACHE                 = 0x400
@@ -708,7 +706,7 @@
 	O_NOFOLLOW                  = 0x100
 	O_NONBLOCK                  = 0x4
 	O_POPUP                     = 0x80000000
-	O_RDONLY                    = 0
+	O_RDONLY                    = 0x0
 	O_RDWR                      = 0x2
 	O_SHLOCK                    = 0x10
 	O_SYMLINK                   = 0x200000
@@ -716,7 +714,7 @@
 	O_TRUNC                     = 0x400
 	O_WRONLY                    = 0x1
 	PROT_EXEC                   = 0x4
-	PROT_NONE                   = 0
+	PROT_NONE                   = 0x0
 	PROT_READ                   = 0x1
 	PROT_WRITE                  = 0x2
 	PT_ATTACH                   = 0xa
@@ -733,13 +731,13 @@
 	PT_SIGEXC                   = 0xc
 	PT_STEP                     = 0x9
 	PT_THUPDATE                 = 0xd
-	PT_TRACE_ME                 = 0
+	PT_TRACE_ME                 = 0x0
 	PT_WRITE_D                  = 0x5
 	PT_WRITE_I                  = 0x4
 	PT_WRITE_U                  = 0x6
 	RTAX_AUTHOR                 = 0x6
 	RTAX_BRD                    = 0x7
-	RTAX_DST                    = 0
+	RTAX_DST                    = 0x0
 	RTAX_GATEWAY                = 0x1
 	RTAX_GENMASK                = 0x3
 	RTAX_IFA                    = 0x5
@@ -811,7 +809,7 @@
 	SCM_CREDS                   = 0x3
 	SCM_RIGHTS                  = 0x1
 	SCM_TIMESTAMP               = 0x2
-	SHUT_RD                     = 0
+	SHUT_RD                     = 0x0
 	SHUT_RDWR                   = 0x2
 	SHUT_WR                     = 0x1
 	SIGABRT                     = 0x6
@@ -1045,7 +1043,7 @@
 	TIOCNXCL                    = 0x2000740e
 	TIOCOUTQ                    = 0x40047473
 	TIOCPKT                     = 0x80047470
-	TIOCPKT_DATA                = 0
+	TIOCPKT_DATA                = 0x0
 	TIOCPKT_DOSTOP              = 0x20
 	TIOCPKT_FLUSHREAD           = 0x1
 	TIOCPKT_FLUSHWRITE          = 0x2
@@ -1085,8 +1083,6 @@
 	WUNTRACED                   = 0x2
 )
 
-// Types
-
 // Error table
 var errors = [...]string{
 	1:   "operation not permitted",
diff --git a/src/pkg/syscall/zerrors_darwin_amd64.go b/src/pkg/syscall/zerrors_darwin_amd64.go
index 3165fee..4976c32 100644
--- a/src/pkg/syscall/zerrors_darwin_amd64.go
+++ b/src/pkg/syscall/zerrors_darwin_amd64.go
@@ -1,13 +1,11 @@
-// mkerrors.sh -f -m64
+// mkerrors.sh -m64
 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 
-// godefs -c gcc -f -m64 -gsyscall -f -m64 _const.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs -- -m64 _const.go
 
 package syscall
 
-// Constants
 const (
 	AF_APPLETALK                = 0x10
 	AF_CCITT                    = 0xa
@@ -44,7 +42,7 @@
 	AF_SNA                      = 0xb
 	AF_SYSTEM                   = 0x20
 	AF_UNIX                     = 0x1
-	AF_UNSPEC                   = 0
+	AF_UNSPEC                   = 0x0
 	BIOCFLUSH                   = 0x20004268
 	BIOCGBLEN                   = 0x40044266
 	BIOCGDLT                    = 0x4004426a
@@ -68,23 +66,23 @@
 	BIOCVERSION                 = 0x40044271
 	BPF_A                       = 0x10
 	BPF_ABS                     = 0x20
-	BPF_ADD                     = 0
+	BPF_ADD                     = 0x0
 	BPF_ALIGNMENT               = 0x4
 	BPF_ALU                     = 0x4
 	BPF_AND                     = 0x50
 	BPF_B                       = 0x10
 	BPF_DIV                     = 0x30
 	BPF_H                       = 0x8
-	BPF_IMM                     = 0
+	BPF_IMM                     = 0x0
 	BPF_IND                     = 0x40
-	BPF_JA                      = 0
+	BPF_JA                      = 0x0
 	BPF_JEQ                     = 0x10
 	BPF_JGE                     = 0x30
 	BPF_JGT                     = 0x20
 	BPF_JMP                     = 0x5
 	BPF_JSET                    = 0x40
-	BPF_K                       = 0
-	BPF_LD                      = 0
+	BPF_K                       = 0x0
+	BPF_LD                      = 0x0
 	BPF_LDX                     = 0x1
 	BPF_LEN                     = 0x80
 	BPF_LSH                     = 0x60
@@ -106,9 +104,9 @@
 	BPF_ST                      = 0x2
 	BPF_STX                     = 0x3
 	BPF_SUB                     = 0x10
-	BPF_TAX                     = 0
+	BPF_TAX                     = 0x0
 	BPF_TXA                     = 0x80
-	BPF_W                       = 0
+	BPF_W                       = 0x0
 	BPF_X                       = 0x8
 	CTL_MAXNAME                 = 0xc
 	CTL_NET                     = 0x4
@@ -129,7 +127,7 @@
 	DLT_IEEE802_11_RADIO_AVS    = 0xa3
 	DLT_LINUX_SLL               = 0x71
 	DLT_LOOP                    = 0x6c
-	DLT_NULL                    = 0
+	DLT_NULL                    = 0x0
 	DLT_PFLOG                   = 0x75
 	DLT_PFSYNC                  = 0x12
 	DLT_PPP                     = 0x9
@@ -146,7 +144,7 @@
 	DT_LNK                      = 0xa
 	DT_REG                      = 0x8
 	DT_SOCK                     = 0xc
-	DT_UNKNOWN                  = 0
+	DT_UNKNOWN                  = 0x0
 	DT_WHT                      = 0xe
 	E2BIG                       = 0x7
 	EACCES                      = 0xd
@@ -299,7 +297,7 @@
 	F_ALLOCATEALL               = 0x4
 	F_ALLOCATECONTIG            = 0x2
 	F_CHKCLEAN                  = 0x29
-	F_DUPFD                     = 0
+	F_DUPFD                     = 0x0
 	F_FREEZE_FS                 = 0x35
 	F_FULLFSYNC                 = 0x33
 	F_GETFD                     = 0x1
@@ -463,7 +461,7 @@
 	IPPROTO_GRE                 = 0x2f
 	IPPROTO_HELLO               = 0x3f
 	IPPROTO_HMP                 = 0x14
-	IPPROTO_HOPOPTS             = 0
+	IPPROTO_HOPOPTS             = 0x0
 	IPPROTO_ICMP                = 0x1
 	IPPROTO_ICMPV6              = 0x3a
 	IPPROTO_IDP                 = 0x16
@@ -475,7 +473,7 @@
 	IPPROTO_IL                  = 0x28
 	IPPROTO_INLSP               = 0x34
 	IPPROTO_INP                 = 0x20
-	IPPROTO_IP                  = 0
+	IPPROTO_IP                  = 0x0
 	IPPROTO_IPCOMP              = 0x6c
 	IPPROTO_IPCV                = 0x47
 	IPPROTO_IPEIP               = 0x5e
@@ -569,14 +567,14 @@
 	IPV6_PKTINFO                = 0x13
 	IPV6_PKTOPTIONS             = 0x19
 	IPV6_PORTRANGE              = 0xe
-	IPV6_PORTRANGE_DEFAULT      = 0
+	IPV6_PORTRANGE_DEFAULT      = 0x0
 	IPV6_PORTRANGE_HIGH         = 0x1
 	IPV6_PORTRANGE_LOW          = 0x2
 	IPV6_RECVTCLASS             = 0x23
 	IPV6_RTHDR                  = 0x18
-	IPV6_RTHDR_LOOSE            = 0
+	IPV6_RTHDR_LOOSE            = 0x0
 	IPV6_RTHDR_STRICT           = 0x1
-	IPV6_RTHDR_TYPE_0           = 0
+	IPV6_RTHDR_TYPE_0           = 0x0
 	IPV6_SOCKOPT_RESERVED1      = 0x3
 	IPV6_TCLASS                 = 0x24
 	IPV6_UNICAST_HOPS           = 0x4
@@ -620,7 +618,7 @@
 	IP_OLD_FW_ZERO              = 0x35
 	IP_OPTIONS                  = 0x1
 	IP_PORTRANGE                = 0x13
-	IP_PORTRANGE_DEFAULT        = 0
+	IP_PORTRANGE_DEFAULT        = 0x0
 	IP_PORTRANGE_HIGH           = 0x1
 	IP_PORTRANGE_LOW            = 0x2
 	IP_RECVDSTADDR              = 0x7
@@ -643,14 +641,14 @@
 	MADV_FREE                   = 0x5
 	MADV_FREE_REUSABLE          = 0x7
 	MADV_FREE_REUSE             = 0x8
-	MADV_NORMAL                 = 0
+	MADV_NORMAL                 = 0x0
 	MADV_RANDOM                 = 0x1
 	MADV_SEQUENTIAL             = 0x2
 	MADV_WILLNEED               = 0x3
 	MADV_ZERO_WIRED_PAGES       = 0x6
 	MAP_ANON                    = 0x1000
 	MAP_COPY                    = 0x2
-	MAP_FILE                    = 0
+	MAP_FILE                    = 0x0
 	MAP_FIXED                   = 0x10
 	MAP_HASSEMAPHORE            = 0x200
 	MAP_NOCACHE                 = 0x400
@@ -708,7 +706,7 @@
 	O_NOFOLLOW                  = 0x100
 	O_NONBLOCK                  = 0x4
 	O_POPUP                     = 0x80000000
-	O_RDONLY                    = 0
+	O_RDONLY                    = 0x0
 	O_RDWR                      = 0x2
 	O_SHLOCK                    = 0x10
 	O_SYMLINK                   = 0x200000
@@ -716,7 +714,7 @@
 	O_TRUNC                     = 0x400
 	O_WRONLY                    = 0x1
 	PROT_EXEC                   = 0x4
-	PROT_NONE                   = 0
+	PROT_NONE                   = 0x0
 	PROT_READ                   = 0x1
 	PROT_WRITE                  = 0x2
 	PT_ATTACH                   = 0xa
@@ -733,13 +731,13 @@
 	PT_SIGEXC                   = 0xc
 	PT_STEP                     = 0x9
 	PT_THUPDATE                 = 0xd
-	PT_TRACE_ME                 = 0
+	PT_TRACE_ME                 = 0x0
 	PT_WRITE_D                  = 0x5
 	PT_WRITE_I                  = 0x4
 	PT_WRITE_U                  = 0x6
 	RTAX_AUTHOR                 = 0x6
 	RTAX_BRD                    = 0x7
-	RTAX_DST                    = 0
+	RTAX_DST                    = 0x0
 	RTAX_GATEWAY                = 0x1
 	RTAX_GENMASK                = 0x3
 	RTAX_IFA                    = 0x5
@@ -811,7 +809,7 @@
 	SCM_CREDS                   = 0x3
 	SCM_RIGHTS                  = 0x1
 	SCM_TIMESTAMP               = 0x2
-	SHUT_RD                     = 0
+	SHUT_RD                     = 0x0
 	SHUT_RDWR                   = 0x2
 	SHUT_WR                     = 0x1
 	SIGABRT                     = 0x6
@@ -1045,7 +1043,7 @@
 	TIOCNXCL                    = 0x2000740e
 	TIOCOUTQ                    = 0x40047473
 	TIOCPKT                     = 0x80047470
-	TIOCPKT_DATA                = 0
+	TIOCPKT_DATA                = 0x0
 	TIOCPKT_DOSTOP              = 0x20
 	TIOCPKT_FLUSHREAD           = 0x1
 	TIOCPKT_FLUSHWRITE          = 0x2
@@ -1085,8 +1083,6 @@
 	WUNTRACED                   = 0x2
 )
 
-// Types
-
 // Error table
 var errors = [...]string{
 	1:   "operation not permitted",
diff --git a/src/pkg/syscall/zerrors_linux_386.go b/src/pkg/syscall/zerrors_linux_386.go
index dba66e6..a206672 100644
--- a/src/pkg/syscall/zerrors_linux_386.go
+++ b/src/pkg/syscall/zerrors_linux_386.go
@@ -1,14 +1,13 @@
-// mkerrors.sh -f -m32
+// mkerrors.sh -m32
 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 
-// godefs -c gcc -f -m32 -gsyscall -f -m32 _const.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs -- -m32 _const.go
 
 package syscall
 
-// Constants
 const (
+	AF_ALG                           = 0x26
 	AF_APPLETALK                     = 0x5
 	AF_ASH                           = 0x12
 	AF_ATMPVC                        = 0x8
@@ -16,6 +15,7 @@
 	AF_AX25                          = 0x3
 	AF_BLUETOOTH                     = 0x1f
 	AF_BRIDGE                        = 0x7
+	AF_CAIF                          = 0x25
 	AF_CAN                           = 0x1d
 	AF_DECnet                        = 0xc
 	AF_ECONET                        = 0x13
@@ -30,7 +30,7 @@
 	AF_KEY                           = 0xf
 	AF_LLC                           = 0x1a
 	AF_LOCAL                         = 0x1
-	AF_MAX                           = 0x25
+	AF_MAX                           = 0x27
 	AF_NETBEUI                       = 0xd
 	AF_NETLINK                       = 0x10
 	AF_NETROM                        = 0x6
@@ -45,7 +45,7 @@
 	AF_SNA                           = 0x16
 	AF_TIPC                          = 0x1e
 	AF_UNIX                          = 0x1
-	AF_UNSPEC                        = 0
+	AF_UNSPEC                        = 0x0
 	AF_WANPIPE                       = 0x19
 	AF_X25                           = 0x9
 	ARPHRD_ADAPT                     = 0x108
@@ -90,7 +90,7 @@
 	ARPHRD_LOCALTLK                  = 0x305
 	ARPHRD_LOOPBACK                  = 0x304
 	ARPHRD_METRICOM                  = 0x17
-	ARPHRD_NETROM                    = 0
+	ARPHRD_NETROM                    = 0x0
 	ARPHRD_NONE                      = 0xfffe
 	ARPHRD_PIMREG                    = 0x30b
 	ARPHRD_PPP                       = 0x200
@@ -108,22 +108,22 @@
 	ARPHRD_X25                       = 0x10f
 	BPF_A                            = 0x10
 	BPF_ABS                          = 0x20
-	BPF_ADD                          = 0
+	BPF_ADD                          = 0x0
 	BPF_ALU                          = 0x4
 	BPF_AND                          = 0x50
 	BPF_B                            = 0x10
 	BPF_DIV                          = 0x30
 	BPF_H                            = 0x8
-	BPF_IMM                          = 0
+	BPF_IMM                          = 0x0
 	BPF_IND                          = 0x40
-	BPF_JA                           = 0
+	BPF_JA                           = 0x0
 	BPF_JEQ                          = 0x10
 	BPF_JGE                          = 0x30
 	BPF_JGT                          = 0x20
 	BPF_JMP                          = 0x5
 	BPF_JSET                         = 0x40
-	BPF_K                            = 0
-	BPF_LD                           = 0
+	BPF_K                            = 0x0
+	BPF_LD                           = 0x0
 	BPF_LDX                          = 0x1
 	BPF_LEN                          = 0x80
 	BPF_LSH                          = 0x60
@@ -142,9 +142,9 @@
 	BPF_ST                           = 0x2
 	BPF_STX                          = 0x3
 	BPF_SUB                          = 0x10
-	BPF_TAX                          = 0
+	BPF_TAX                          = 0x0
 	BPF_TXA                          = 0x80
-	BPF_W                            = 0
+	BPF_W                            = 0x0
 	BPF_X                            = 0x8
 	DT_BLK                           = 0x6
 	DT_CHR                           = 0x2
@@ -153,7 +153,7 @@
 	DT_LNK                           = 0xa
 	DT_REG                           = 0x8
 	DT_SOCK                          = 0xc
-	DT_UNKNOWN                       = 0
+	DT_UNKNOWN                       = 0x0
 	DT_WHT                           = 0xe
 	E2BIG                            = 0x7
 	EACCES                           = 0xd
@@ -310,6 +310,7 @@
 	ETH_P_ATMMPOA                    = 0x884c
 	ETH_P_AX25                       = 0x2
 	ETH_P_BPQ                        = 0x8ff
+	ETH_P_CAIF                       = 0xf7
 	ETH_P_CAN                        = 0xc
 	ETH_P_CONTROL                    = 0x16
 	ETH_P_CUST                       = 0x6006
@@ -333,6 +334,7 @@
 	ETH_P_IPX                        = 0x8137
 	ETH_P_IRDA                       = 0x17
 	ETH_P_LAT                        = 0x6004
+	ETH_P_LINK_CTL                   = 0x886c
 	ETH_P_LOCALTALK                  = 0x9
 	ETH_P_LOOP                       = 0x60
 	ETH_P_MOBITEX                    = 0x15
@@ -370,7 +372,7 @@
 	EXFULL                           = 0x36
 	FD_CLOEXEC                       = 0x1
 	FD_SETSIZE                       = 0x400
-	F_DUPFD                          = 0
+	F_DUPFD                          = 0x0
 	F_DUPFD_CLOEXEC                  = 0x406
 	F_EXLCK                          = 0x4
 	F_GETFD                          = 0x1
@@ -380,11 +382,12 @@
 	F_GETLK64                        = 0xc
 	F_GETOWN                         = 0x9
 	F_GETOWN_EX                      = 0x10
+	F_GETPIPE_SZ                     = 0x408
 	F_GETSIG                         = 0xb
 	F_LOCK                           = 0x1
 	F_NOTIFY                         = 0x402
-	F_OK                             = 0
-	F_RDLCK                          = 0
+	F_OK                             = 0x0
+	F_RDLCK                          = 0x0
 	F_SETFD                          = 0x2
 	F_SETFL                          = 0x4
 	F_SETLEASE                       = 0x400
@@ -394,11 +397,12 @@
 	F_SETLKW64                       = 0xe
 	F_SETOWN                         = 0x8
 	F_SETOWN_EX                      = 0xf
+	F_SETPIPE_SZ                     = 0x407
 	F_SETSIG                         = 0xa
 	F_SHLCK                          = 0x8
 	F_TEST                           = 0x3
 	F_TLOCK                          = 0x2
-	F_ULOCK                          = 0
+	F_ULOCK                          = 0x0
 	F_UNLCK                          = 0x2
 	F_WRLCK                          = 0x1
 	IFA_F_DADFAILED                  = 0x8
@@ -456,6 +460,7 @@
 	IN_DELETE                        = 0x200
 	IN_DELETE_SELF                   = 0x400
 	IN_DONT_FOLLOW                   = 0x2000000
+	IN_EXCL_UNLINK                   = 0x4000000
 	IN_IGNORED                       = 0x8000
 	IN_ISDIR                         = 0x40000000
 	IN_LOOPBACKNET                   = 0x7f
@@ -480,12 +485,12 @@
 	IPPROTO_ESP                      = 0x32
 	IPPROTO_FRAGMENT                 = 0x2c
 	IPPROTO_GRE                      = 0x2f
-	IPPROTO_HOPOPTS                  = 0
+	IPPROTO_HOPOPTS                  = 0x0
 	IPPROTO_ICMP                     = 0x1
 	IPPROTO_ICMPV6                   = 0x3a
 	IPPROTO_IDP                      = 0x16
 	IPPROTO_IGMP                     = 0x2
-	IPPROTO_IP                       = 0
+	IPPROTO_IP                       = 0x0
 	IPPROTO_IPIP                     = 0x4
 	IPPROTO_IPV6                     = 0x29
 	IPPROTO_MTP                      = 0x5c
@@ -527,7 +532,7 @@
 	IPV6_NEXTHOP                     = 0x9
 	IPV6_PKTINFO                     = 0x32
 	IPV6_PMTUDISC_DO                 = 0x2
-	IPV6_PMTUDISC_DONT               = 0
+	IPV6_PMTUDISC_DONT               = 0x0
 	IPV6_PMTUDISC_PROBE              = 0x3
 	IPV6_PMTUDISC_WANT               = 0x1
 	IPV6_RECVDSTOPTS                 = 0x3a
@@ -540,9 +545,9 @@
 	IPV6_ROUTER_ALERT                = 0x16
 	IPV6_RTHDR                       = 0x39
 	IPV6_RTHDRDSTOPTS                = 0x37
-	IPV6_RTHDR_LOOSE                 = 0
+	IPV6_RTHDR_LOOSE                 = 0x0
 	IPV6_RTHDR_STRICT                = 0x1
-	IPV6_RTHDR_TYPE_0                = 0
+	IPV6_RTHDR_TYPE_0                = 0x0
 	IPV6_RXDSTOPTS                   = 0x3b
 	IPV6_RXHOPOPTS                   = 0x36
 	IPV6_TCLASS                      = 0x43
@@ -557,27 +562,34 @@
 	IP_DF                            = 0x4000
 	IP_DROP_MEMBERSHIP               = 0x24
 	IP_DROP_SOURCE_MEMBERSHIP        = 0x28
+	IP_FREEBIND                      = 0xf
 	IP_HDRINCL                       = 0x3
+	IP_IPSEC_POLICY                  = 0x10
 	IP_MAXPACKET                     = 0xffff
 	IP_MAX_MEMBERSHIPS               = 0x14
 	IP_MF                            = 0x2000
+	IP_MINTTL                        = 0x15
 	IP_MSFILTER                      = 0x29
 	IP_MSS                           = 0x240
+	IP_MTU                           = 0xe
 	IP_MTU_DISCOVER                  = 0xa
 	IP_MULTICAST_IF                  = 0x20
 	IP_MULTICAST_LOOP                = 0x22
 	IP_MULTICAST_TTL                 = 0x21
 	IP_OFFMASK                       = 0x1fff
 	IP_OPTIONS                       = 0x4
+	IP_ORIGDSTADDR                   = 0x14
+	IP_PASSSEC                       = 0x12
 	IP_PKTINFO                       = 0x8
 	IP_PKTOPTIONS                    = 0x9
 	IP_PMTUDISC                      = 0xa
 	IP_PMTUDISC_DO                   = 0x2
-	IP_PMTUDISC_DONT                 = 0
+	IP_PMTUDISC_DONT                 = 0x0
 	IP_PMTUDISC_PROBE                = 0x3
 	IP_PMTUDISC_WANT                 = 0x1
 	IP_RECVERR                       = 0xb
 	IP_RECVOPTS                      = 0x6
+	IP_RECVORIGDSTADDR               = 0x14
 	IP_RECVRETOPTS                   = 0x7
 	IP_RECVTOS                       = 0xd
 	IP_RECVTTL                       = 0xc
@@ -585,9 +597,11 @@
 	IP_RF                            = 0x8000
 	IP_ROUTER_ALERT                  = 0x5
 	IP_TOS                           = 0x1
+	IP_TRANSPARENT                   = 0x13
 	IP_TTL                           = 0x2
 	IP_UNBLOCK_SOURCE                = 0x25
-	LINUX_REBOOT_CMD_CAD_OFF         = 0
+	IP_XFRM_POLICY                   = 0x11
+	LINUX_REBOOT_CMD_CAD_OFF         = 0x0
 	LINUX_REBOOT_CMD_CAD_ON          = 0x89abcdef
 	LINUX_REBOOT_CMD_HALT            = 0xcdef0123
 	LINUX_REBOOT_CMD_KEXEC           = 0x45584543
@@ -600,9 +614,11 @@
 	MADV_DOFORK                      = 0xb
 	MADV_DONTFORK                    = 0xa
 	MADV_DONTNEED                    = 0x4
+	MADV_HUGEPAGE                    = 0xe
 	MADV_HWPOISON                    = 0x64
 	MADV_MERGEABLE                   = 0xc
-	MADV_NORMAL                      = 0
+	MADV_NOHUGEPAGE                  = 0xf
+	MADV_NORMAL                      = 0x0
 	MADV_RANDOM                      = 0x1
 	MADV_REMOVE                      = 0x9
 	MADV_SEQUENTIAL                  = 0x2
@@ -613,9 +629,10 @@
 	MAP_ANONYMOUS                    = 0x20
 	MAP_DENYWRITE                    = 0x800
 	MAP_EXECUTABLE                   = 0x1000
-	MAP_FILE                         = 0
+	MAP_FILE                         = 0x0
 	MAP_FIXED                        = 0x10
 	MAP_GROWSDOWN                    = 0x100
+	MAP_HUGETLB                      = 0x40000
 	MAP_LOCKED                       = 0x2000
 	MAP_NONBLOCK                     = 0x10000
 	MAP_NORESERVE                    = 0x4000
@@ -647,22 +664,38 @@
 	MSG_TRUNC                        = 0x20
 	MSG_TRYHARD                      = 0x4
 	MSG_WAITALL                      = 0x100
+	MSG_WAITFORONE                   = 0x10000
+	MS_ACTIVE                        = 0x40000000
 	MS_ASYNC                         = 0x1
 	MS_BIND                          = 0x1000
+	MS_DIRSYNC                       = 0x80
 	MS_INVALIDATE                    = 0x2
+	MS_I_VERSION                     = 0x800000
+	MS_KERNMOUNT                     = 0x400000
 	MS_MANDLOCK                      = 0x40
 	MS_MGC_MSK                       = 0xffff0000
 	MS_MGC_VAL                       = 0xc0ed0000
+	MS_MOVE                          = 0x2000
 	MS_NOATIME                       = 0x400
 	MS_NODEV                         = 0x4
 	MS_NODIRATIME                    = 0x800
 	MS_NOEXEC                        = 0x8
 	MS_NOSUID                        = 0x2
+	MS_NOUSER                        = -0x80000000
+	MS_POSIXACL                      = 0x10000
+	MS_PRIVATE                       = 0x40000
 	MS_RDONLY                        = 0x1
+	MS_REC                           = 0x4000
+	MS_RELATIME                      = 0x200000
 	MS_REMOUNT                       = 0x20
-	MS_RMT_MASK                      = 0xc51
+	MS_RMT_MASK                      = 0x800051
+	MS_SHARED                        = 0x100000
+	MS_SILENT                        = 0x8000
+	MS_SLAVE                         = 0x80000
+	MS_STRICTATIME                   = 0x1000000
 	MS_SYNC                          = 0x4
 	MS_SYNCHRONOUS                   = 0x10
+	MS_UNBINDABLE                    = 0x20000
 	NAME_MAX                         = 0xff
 	NETLINK_ADD_MEMBERSHIP           = 0x1
 	NETLINK_AUDIT                    = 0x9
@@ -682,7 +715,7 @@
 	NETLINK_NFLOG                    = 0x5
 	NETLINK_NO_ENOBUFS               = 0x5
 	NETLINK_PKTINFO                  = 0x3
-	NETLINK_ROUTE                    = 0
+	NETLINK_ROUTE                    = 0x0
 	NETLINK_SCSITRANSPORT            = 0x12
 	NETLINK_SELINUX                  = 0x7
 	NETLINK_UNUSED                   = 0x1
@@ -720,27 +753,27 @@
 	O_DIRECTORY                      = 0x10000
 	O_DSYNC                          = 0x1000
 	O_EXCL                           = 0x80
-	O_FSYNC                          = 0x1000
+	O_FSYNC                          = 0x101000
 	O_LARGEFILE                      = 0x8000
 	O_NDELAY                         = 0x800
 	O_NOATIME                        = 0x40000
 	O_NOCTTY                         = 0x100
 	O_NOFOLLOW                       = 0x20000
 	O_NONBLOCK                       = 0x800
-	O_RDONLY                         = 0
+	O_RDONLY                         = 0x0
 	O_RDWR                           = 0x2
-	O_RSYNC                          = 0x1000
-	O_SYNC                           = 0x1000
+	O_RSYNC                          = 0x101000
+	O_SYNC                           = 0x101000
 	O_TRUNC                          = 0x200
 	O_WRONLY                         = 0x1
 	PACKET_ADD_MEMBERSHIP            = 0x1
 	PACKET_BROADCAST                 = 0x1
 	PACKET_DROP_MEMBERSHIP           = 0x2
 	PACKET_FASTROUTE                 = 0x6
-	PACKET_HOST                      = 0
+	PACKET_HOST                      = 0x0
 	PACKET_LOOPBACK                  = 0x5
 	PACKET_MR_ALLMULTI               = 0x2
-	PACKET_MR_MULTICAST              = 0
+	PACKET_MR_MULTICAST              = 0x0
 	PACKET_MR_PROMISC                = 0x1
 	PACKET_MULTICAST                 = 0x2
 	PACKET_OTHERHOST                 = 0x3
@@ -751,20 +784,10 @@
 	PROT_EXEC                        = 0x4
 	PROT_GROWSDOWN                   = 0x1000000
 	PROT_GROWSUP                     = 0x2000000
-	PROT_NONE                        = 0
+	PROT_NONE                        = 0x0
 	PROT_READ                        = 0x1
 	PROT_WRITE                       = 0x2
 	PTRACE_ATTACH                    = 0x10
-	PTRACE_BTS_CLEAR                 = 0x2c
-	PTRACE_BTS_CONFIG                = 0x28
-	PTRACE_BTS_DRAIN                 = 0x2d
-	PTRACE_BTS_GET                   = 0x2b
-	PTRACE_BTS_O_ALLOC               = 0x8
-	PTRACE_BTS_O_SCHED               = 0x2
-	PTRACE_BTS_O_SIGNAL              = 0x4
-	PTRACE_BTS_O_TRACE               = 0x1
-	PTRACE_BTS_SIZE                  = 0x2a
-	PTRACE_BTS_STATUS                = 0x29
 	PTRACE_CONT                      = 0x7
 	PTRACE_DETACH                    = 0x11
 	PTRACE_EVENT_CLONE               = 0x3
@@ -777,6 +800,7 @@
 	PTRACE_GETFPREGS                 = 0xe
 	PTRACE_GETFPXREGS                = 0x12
 	PTRACE_GETREGS                   = 0xc
+	PTRACE_GETREGSET                 = 0x4204
 	PTRACE_GETSIGINFO                = 0x4202
 	PTRACE_GET_THREAD_AREA           = 0x19
 	PTRACE_KILL                      = 0x8
@@ -799,6 +823,7 @@
 	PTRACE_SETFPXREGS                = 0x13
 	PTRACE_SETOPTIONS                = 0x4200
 	PTRACE_SETREGS                   = 0xd
+	PTRACE_SETREGSET                 = 0x4205
 	PTRACE_SETSIGINFO                = 0x4203
 	PTRACE_SET_THREAD_AREA           = 0x1a
 	PTRACE_SINGLEBLOCK               = 0x21
@@ -806,7 +831,7 @@
 	PTRACE_SYSCALL                   = 0x18
 	PTRACE_SYSEMU                    = 0x1f
 	PTRACE_SYSEMU_SINGLESTEP         = 0x20
-	PTRACE_TRACEME                   = 0
+	PTRACE_TRACEME                   = 0x0
 	RTAX_ADVMSS                      = 0x8
 	RTAX_CWND                        = 0x7
 	RTAX_FEATURES                    = 0xc
@@ -816,18 +841,19 @@
 	RTAX_FEATURE_TIMESTAMP           = 0x4
 	RTAX_HOPLIMIT                    = 0xa
 	RTAX_INITCWND                    = 0xb
+	RTAX_INITRWND                    = 0xe
 	RTAX_LOCK                        = 0x1
-	RTAX_MAX                         = 0xd
+	RTAX_MAX                         = 0xe
 	RTAX_MTU                         = 0x2
 	RTAX_REORDERING                  = 0x9
 	RTAX_RTO_MIN                     = 0xd
 	RTAX_RTT                         = 0x4
 	RTAX_RTTVAR                      = 0x5
 	RTAX_SSTHRESH                    = 0x6
-	RTAX_UNSPEC                      = 0
+	RTAX_UNSPEC                      = 0x0
 	RTAX_WINDOW                      = 0x3
 	RTA_ALIGNTO                      = 0x4
-	RTA_MAX                          = 0xf
+	RTA_MAX                          = 0x10
 	RTCF_DIRECTSRC                   = 0x4000000
 	RTCF_DOREDIRECT                  = 0x1000000
 	RTCF_LOG                         = 0x2000000
@@ -928,20 +954,20 @@
 	RTPROT_RA                        = 0x9
 	RTPROT_REDIRECT                  = 0x1
 	RTPROT_STATIC                    = 0x4
-	RTPROT_UNSPEC                    = 0
+	RTPROT_UNSPEC                    = 0x0
 	RTPROT_XORP                      = 0xe
 	RTPROT_ZEBRA                     = 0xb
 	RT_CLASS_DEFAULT                 = 0xfd
 	RT_CLASS_LOCAL                   = 0xff
 	RT_CLASS_MAIN                    = 0xfe
 	RT_CLASS_MAX                     = 0xff
-	RT_CLASS_UNSPEC                  = 0
+	RT_CLASS_UNSPEC                  = 0x0
 	SCM_CREDENTIALS                  = 0x2
 	SCM_RIGHTS                       = 0x1
 	SCM_TIMESTAMP                    = 0x1d
 	SCM_TIMESTAMPING                 = 0x25
 	SCM_TIMESTAMPNS                  = 0x23
-	SHUT_RD                          = 0
+	SHUT_RD                          = 0x0
 	SHUT_RDWR                        = 0x2
 	SHUT_WR                          = 0x1
 	SIGABRT                          = 0x6
@@ -1050,7 +1076,7 @@
 	SOL_ATM                          = 0x108
 	SOL_DECNET                       = 0x105
 	SOL_ICMPV6                       = 0x3a
-	SOL_IP                           = 0
+	SOL_IP                           = 0x0
 	SOL_IPV6                         = 0x29
 	SOL_IRDA                         = 0x10a
 	SOL_PACKET                       = 0x107
@@ -1086,6 +1112,7 @@
 	SO_RCVLOWAT                      = 0x12
 	SO_RCVTIMEO                      = 0x14
 	SO_REUSEADDR                     = 0x2
+	SO_RXQ_OVFL                      = 0x28
 	SO_SECURITY_AUTHENTICATION       = 0x16
 	SO_SECURITY_ENCRYPTION_NETWORK   = 0x18
 	SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
@@ -1097,7 +1124,6 @@
 	SO_TIMESTAMPING                  = 0x25
 	SO_TIMESTAMPNS                   = 0x23
 	SO_TYPE                          = 0x3
-	S_APPEND                         = 0x100
 	S_BLKSIZE                        = 0x200
 	S_IEXEC                          = 0x40
 	S_IFBLK                          = 0x6000
@@ -1108,7 +1134,6 @@
 	S_IFMT                           = 0xf000
 	S_IFREG                          = 0x8000
 	S_IFSOCK                         = 0xc000
-	S_IMMUTABLE                      = 0x200
 	S_IREAD                          = 0x100
 	S_IRGRP                          = 0x20
 	S_IROTH                          = 0x4
@@ -1126,7 +1151,6 @@
 	S_IXGRP                          = 0x8
 	S_IXOTH                          = 0x1
 	S_IXUSR                          = 0x40
-	S_WRITE                          = 0x80
 	TCP_CONGESTION                   = 0xd
 	TCP_CORK                         = 0x3
 	TCP_DEFER_ACCEPT                 = 0x9
@@ -1148,8 +1172,8 @@
 	TIOCCBRK                         = 0x5428
 	TIOCCONS                         = 0x541d
 	TIOCEXCL                         = 0x540c
+	TIOCGDEV                         = 0x80045432
 	TIOCGETD                         = 0x5424
-	TIOCGHAYESESP                    = 0x545e
 	TIOCGICOUNT                      = 0x545d
 	TIOCGLCKTRMIOS                   = 0x5456
 	TIOCGPGRP                        = 0x540f
@@ -1181,10 +1205,11 @@
 	TIOCNXCL                         = 0x540d
 	TIOCOUTQ                         = 0x5411
 	TIOCPKT                          = 0x5420
-	TIOCPKT_DATA                     = 0
+	TIOCPKT_DATA                     = 0x0
 	TIOCPKT_DOSTOP                   = 0x20
 	TIOCPKT_FLUSHREAD                = 0x1
 	TIOCPKT_FLUSHWRITE               = 0x2
+	TIOCPKT_IOCTL                    = 0x40
 	TIOCPKT_NOSTOP                   = 0x10
 	TIOCPKT_START                    = 0x8
 	TIOCPKT_STOP                     = 0x4
@@ -1199,7 +1224,7 @@
 	TIOCSERSWILD                     = 0x5455
 	TIOCSER_TEMT                     = 0x1
 	TIOCSETD                         = 0x5423
-	TIOCSHAYESESP                    = 0x545f
+	TIOCSIG                          = 0x40045436
 	TIOCSLCKTRMIOS                   = 0x5457
 	TIOCSPGRP                        = 0x5410
 	TIOCSPTLCK                       = 0x40045431
@@ -1208,9 +1233,12 @@
 	TIOCSSOFTCAR                     = 0x541a
 	TIOCSTI                          = 0x5412
 	TIOCSWINSZ                       = 0x5414
+	TUNATTACHFILTER                  = 0x400854d5
+	TUNDETACHFILTER                  = 0x400854d6
 	TUNGETFEATURES                   = 0x800454cf
 	TUNGETIFF                        = 0x800454d2
 	TUNGETSNDBUF                     = 0x800454d3
+	TUNGETVNETHDRSZ                  = 0x800454d7
 	TUNSETDEBUG                      = 0x400454c9
 	TUNSETGROUP                      = 0x400454ce
 	TUNSETIFF                        = 0x400454ca
@@ -1221,6 +1249,7 @@
 	TUNSETPERSIST                    = 0x400454cb
 	TUNSETSNDBUF                     = 0x400454d4
 	TUNSETTXFILTER                   = 0x400454d1
+	TUNSETVNETHDRSZ                  = 0x400454d8
 	WALL                             = 0x40000000
 	WCLONE                           = 0x80000000
 	WCONTINUED                       = 0x8
@@ -1233,8 +1262,6 @@
 	WUNTRACED                        = 0x2
 )
 
-// Types
-
 // Error table
 var errors = [...]string{
 	1:   "operation not permitted",
@@ -1366,5 +1393,5 @@
 	129: "key was rejected by service",
 	130: "owner died",
 	131: "state not recoverable",
-	132: "unknown error 132",
+	132: "operation not possible due to RF-kill",
 }
diff --git a/src/pkg/syscall/zerrors_linux_amd64.go b/src/pkg/syscall/zerrors_linux_amd64.go
index 1f29287..0624690 100644
--- a/src/pkg/syscall/zerrors_linux_amd64.go
+++ b/src/pkg/syscall/zerrors_linux_amd64.go
@@ -1,14 +1,13 @@
-// mkerrors.sh -f -m64
+// mkerrors.sh -m64
 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 
-// godefs -c gcc -f -m64 -gsyscall -f -m64 _const.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs -- -m64 _const.go
 
 package syscall
 
-// Constants
 const (
+	AF_ALG                           = 0x26
 	AF_APPLETALK                     = 0x5
 	AF_ASH                           = 0x12
 	AF_ATMPVC                        = 0x8
@@ -16,6 +15,7 @@
 	AF_AX25                          = 0x3
 	AF_BLUETOOTH                     = 0x1f
 	AF_BRIDGE                        = 0x7
+	AF_CAIF                          = 0x25
 	AF_CAN                           = 0x1d
 	AF_DECnet                        = 0xc
 	AF_ECONET                        = 0x13
@@ -30,7 +30,7 @@
 	AF_KEY                           = 0xf
 	AF_LLC                           = 0x1a
 	AF_LOCAL                         = 0x1
-	AF_MAX                           = 0x25
+	AF_MAX                           = 0x27
 	AF_NETBEUI                       = 0xd
 	AF_NETLINK                       = 0x10
 	AF_NETROM                        = 0x6
@@ -45,7 +45,7 @@
 	AF_SNA                           = 0x16
 	AF_TIPC                          = 0x1e
 	AF_UNIX                          = 0x1
-	AF_UNSPEC                        = 0
+	AF_UNSPEC                        = 0x0
 	AF_WANPIPE                       = 0x19
 	AF_X25                           = 0x9
 	ARPHRD_ADAPT                     = 0x108
@@ -90,7 +90,7 @@
 	ARPHRD_LOCALTLK                  = 0x305
 	ARPHRD_LOOPBACK                  = 0x304
 	ARPHRD_METRICOM                  = 0x17
-	ARPHRD_NETROM                    = 0
+	ARPHRD_NETROM                    = 0x0
 	ARPHRD_NONE                      = 0xfffe
 	ARPHRD_PIMREG                    = 0x30b
 	ARPHRD_PPP                       = 0x200
@@ -108,22 +108,22 @@
 	ARPHRD_X25                       = 0x10f
 	BPF_A                            = 0x10
 	BPF_ABS                          = 0x20
-	BPF_ADD                          = 0
+	BPF_ADD                          = 0x0
 	BPF_ALU                          = 0x4
 	BPF_AND                          = 0x50
 	BPF_B                            = 0x10
 	BPF_DIV                          = 0x30
 	BPF_H                            = 0x8
-	BPF_IMM                          = 0
+	BPF_IMM                          = 0x0
 	BPF_IND                          = 0x40
-	BPF_JA                           = 0
+	BPF_JA                           = 0x0
 	BPF_JEQ                          = 0x10
 	BPF_JGE                          = 0x30
 	BPF_JGT                          = 0x20
 	BPF_JMP                          = 0x5
 	BPF_JSET                         = 0x40
-	BPF_K                            = 0
-	BPF_LD                           = 0
+	BPF_K                            = 0x0
+	BPF_LD                           = 0x0
 	BPF_LDX                          = 0x1
 	BPF_LEN                          = 0x80
 	BPF_LSH                          = 0x60
@@ -142,9 +142,9 @@
 	BPF_ST                           = 0x2
 	BPF_STX                          = 0x3
 	BPF_SUB                          = 0x10
-	BPF_TAX                          = 0
+	BPF_TAX                          = 0x0
 	BPF_TXA                          = 0x80
-	BPF_W                            = 0
+	BPF_W                            = 0x0
 	BPF_X                            = 0x8
 	DT_BLK                           = 0x6
 	DT_CHR                           = 0x2
@@ -153,7 +153,7 @@
 	DT_LNK                           = 0xa
 	DT_REG                           = 0x8
 	DT_SOCK                          = 0xc
-	DT_UNKNOWN                       = 0
+	DT_UNKNOWN                       = 0x0
 	DT_WHT                           = 0xe
 	E2BIG                            = 0x7
 	EACCES                           = 0xd
@@ -310,6 +310,7 @@
 	ETH_P_ATMMPOA                    = 0x884c
 	ETH_P_AX25                       = 0x2
 	ETH_P_BPQ                        = 0x8ff
+	ETH_P_CAIF                       = 0xf7
 	ETH_P_CAN                        = 0xc
 	ETH_P_CONTROL                    = 0x16
 	ETH_P_CUST                       = 0x6006
@@ -333,6 +334,7 @@
 	ETH_P_IPX                        = 0x8137
 	ETH_P_IRDA                       = 0x17
 	ETH_P_LAT                        = 0x6004
+	ETH_P_LINK_CTL                   = 0x886c
 	ETH_P_LOCALTALK                  = 0x9
 	ETH_P_LOOP                       = 0x60
 	ETH_P_MOBITEX                    = 0x15
@@ -370,7 +372,7 @@
 	EXFULL                           = 0x36
 	FD_CLOEXEC                       = 0x1
 	FD_SETSIZE                       = 0x400
-	F_DUPFD                          = 0
+	F_DUPFD                          = 0x0
 	F_DUPFD_CLOEXEC                  = 0x406
 	F_EXLCK                          = 0x4
 	F_GETFD                          = 0x1
@@ -380,11 +382,12 @@
 	F_GETLK64                        = 0x5
 	F_GETOWN                         = 0x9
 	F_GETOWN_EX                      = 0x10
+	F_GETPIPE_SZ                     = 0x408
 	F_GETSIG                         = 0xb
 	F_LOCK                           = 0x1
 	F_NOTIFY                         = 0x402
-	F_OK                             = 0
-	F_RDLCK                          = 0
+	F_OK                             = 0x0
+	F_RDLCK                          = 0x0
 	F_SETFD                          = 0x2
 	F_SETFL                          = 0x4
 	F_SETLEASE                       = 0x400
@@ -394,11 +397,12 @@
 	F_SETLKW64                       = 0x7
 	F_SETOWN                         = 0x8
 	F_SETOWN_EX                      = 0xf
+	F_SETPIPE_SZ                     = 0x407
 	F_SETSIG                         = 0xa
 	F_SHLCK                          = 0x8
 	F_TEST                           = 0x3
 	F_TLOCK                          = 0x2
-	F_ULOCK                          = 0
+	F_ULOCK                          = 0x0
 	F_UNLCK                          = 0x2
 	F_WRLCK                          = 0x1
 	IFA_F_DADFAILED                  = 0x8
@@ -456,6 +460,7 @@
 	IN_DELETE                        = 0x200
 	IN_DELETE_SELF                   = 0x400
 	IN_DONT_FOLLOW                   = 0x2000000
+	IN_EXCL_UNLINK                   = 0x4000000
 	IN_IGNORED                       = 0x8000
 	IN_ISDIR                         = 0x40000000
 	IN_LOOPBACKNET                   = 0x7f
@@ -480,12 +485,12 @@
 	IPPROTO_ESP                      = 0x32
 	IPPROTO_FRAGMENT                 = 0x2c
 	IPPROTO_GRE                      = 0x2f
-	IPPROTO_HOPOPTS                  = 0
+	IPPROTO_HOPOPTS                  = 0x0
 	IPPROTO_ICMP                     = 0x1
 	IPPROTO_ICMPV6                   = 0x3a
 	IPPROTO_IDP                      = 0x16
 	IPPROTO_IGMP                     = 0x2
-	IPPROTO_IP                       = 0
+	IPPROTO_IP                       = 0x0
 	IPPROTO_IPIP                     = 0x4
 	IPPROTO_IPV6                     = 0x29
 	IPPROTO_MTP                      = 0x5c
@@ -527,7 +532,7 @@
 	IPV6_NEXTHOP                     = 0x9
 	IPV6_PKTINFO                     = 0x32
 	IPV6_PMTUDISC_DO                 = 0x2
-	IPV6_PMTUDISC_DONT               = 0
+	IPV6_PMTUDISC_DONT               = 0x0
 	IPV6_PMTUDISC_PROBE              = 0x3
 	IPV6_PMTUDISC_WANT               = 0x1
 	IPV6_RECVDSTOPTS                 = 0x3a
@@ -540,9 +545,9 @@
 	IPV6_ROUTER_ALERT                = 0x16
 	IPV6_RTHDR                       = 0x39
 	IPV6_RTHDRDSTOPTS                = 0x37
-	IPV6_RTHDR_LOOSE                 = 0
+	IPV6_RTHDR_LOOSE                 = 0x0
 	IPV6_RTHDR_STRICT                = 0x1
-	IPV6_RTHDR_TYPE_0                = 0
+	IPV6_RTHDR_TYPE_0                = 0x0
 	IPV6_RXDSTOPTS                   = 0x3b
 	IPV6_RXHOPOPTS                   = 0x36
 	IPV6_TCLASS                      = 0x43
@@ -557,27 +562,34 @@
 	IP_DF                            = 0x4000
 	IP_DROP_MEMBERSHIP               = 0x24
 	IP_DROP_SOURCE_MEMBERSHIP        = 0x28
+	IP_FREEBIND                      = 0xf
 	IP_HDRINCL                       = 0x3
+	IP_IPSEC_POLICY                  = 0x10
 	IP_MAXPACKET                     = 0xffff
 	IP_MAX_MEMBERSHIPS               = 0x14
 	IP_MF                            = 0x2000
+	IP_MINTTL                        = 0x15
 	IP_MSFILTER                      = 0x29
 	IP_MSS                           = 0x240
+	IP_MTU                           = 0xe
 	IP_MTU_DISCOVER                  = 0xa
 	IP_MULTICAST_IF                  = 0x20
 	IP_MULTICAST_LOOP                = 0x22
 	IP_MULTICAST_TTL                 = 0x21
 	IP_OFFMASK                       = 0x1fff
 	IP_OPTIONS                       = 0x4
+	IP_ORIGDSTADDR                   = 0x14
+	IP_PASSSEC                       = 0x12
 	IP_PKTINFO                       = 0x8
 	IP_PKTOPTIONS                    = 0x9
 	IP_PMTUDISC                      = 0xa
 	IP_PMTUDISC_DO                   = 0x2
-	IP_PMTUDISC_DONT                 = 0
+	IP_PMTUDISC_DONT                 = 0x0
 	IP_PMTUDISC_PROBE                = 0x3
 	IP_PMTUDISC_WANT                 = 0x1
 	IP_RECVERR                       = 0xb
 	IP_RECVOPTS                      = 0x6
+	IP_RECVORIGDSTADDR               = 0x14
 	IP_RECVRETOPTS                   = 0x7
 	IP_RECVTOS                       = 0xd
 	IP_RECVTTL                       = 0xc
@@ -585,9 +597,11 @@
 	IP_RF                            = 0x8000
 	IP_ROUTER_ALERT                  = 0x5
 	IP_TOS                           = 0x1
+	IP_TRANSPARENT                   = 0x13
 	IP_TTL                           = 0x2
 	IP_UNBLOCK_SOURCE                = 0x25
-	LINUX_REBOOT_CMD_CAD_OFF         = 0
+	IP_XFRM_POLICY                   = 0x11
+	LINUX_REBOOT_CMD_CAD_OFF         = 0x0
 	LINUX_REBOOT_CMD_CAD_ON          = 0x89abcdef
 	LINUX_REBOOT_CMD_HALT            = 0xcdef0123
 	LINUX_REBOOT_CMD_KEXEC           = 0x45584543
@@ -600,9 +614,11 @@
 	MADV_DOFORK                      = 0xb
 	MADV_DONTFORK                    = 0xa
 	MADV_DONTNEED                    = 0x4
+	MADV_HUGEPAGE                    = 0xe
 	MADV_HWPOISON                    = 0x64
 	MADV_MERGEABLE                   = 0xc
-	MADV_NORMAL                      = 0
+	MADV_NOHUGEPAGE                  = 0xf
+	MADV_NORMAL                      = 0x0
 	MADV_RANDOM                      = 0x1
 	MADV_REMOVE                      = 0x9
 	MADV_SEQUENTIAL                  = 0x2
@@ -613,9 +629,10 @@
 	MAP_ANONYMOUS                    = 0x20
 	MAP_DENYWRITE                    = 0x800
 	MAP_EXECUTABLE                   = 0x1000
-	MAP_FILE                         = 0
+	MAP_FILE                         = 0x0
 	MAP_FIXED                        = 0x10
 	MAP_GROWSDOWN                    = 0x100
+	MAP_HUGETLB                      = 0x40000
 	MAP_LOCKED                       = 0x2000
 	MAP_NONBLOCK                     = 0x10000
 	MAP_NORESERVE                    = 0x4000
@@ -647,22 +664,38 @@
 	MSG_TRUNC                        = 0x20
 	MSG_TRYHARD                      = 0x4
 	MSG_WAITALL                      = 0x100
+	MSG_WAITFORONE                   = 0x10000
+	MS_ACTIVE                        = 0x40000000
 	MS_ASYNC                         = 0x1
 	MS_BIND                          = 0x1000
+	MS_DIRSYNC                       = 0x80
 	MS_INVALIDATE                    = 0x2
+	MS_I_VERSION                     = 0x800000
+	MS_KERNMOUNT                     = 0x400000
 	MS_MANDLOCK                      = 0x40
 	MS_MGC_MSK                       = 0xffff0000
 	MS_MGC_VAL                       = 0xc0ed0000
+	MS_MOVE                          = 0x2000
 	MS_NOATIME                       = 0x400
 	MS_NODEV                         = 0x4
 	MS_NODIRATIME                    = 0x800
 	MS_NOEXEC                        = 0x8
 	MS_NOSUID                        = 0x2
+	MS_NOUSER                        = -0x80000000
+	MS_POSIXACL                      = 0x10000
+	MS_PRIVATE                       = 0x40000
 	MS_RDONLY                        = 0x1
+	MS_REC                           = 0x4000
+	MS_RELATIME                      = 0x200000
 	MS_REMOUNT                       = 0x20
-	MS_RMT_MASK                      = 0xc51
+	MS_RMT_MASK                      = 0x800051
+	MS_SHARED                        = 0x100000
+	MS_SILENT                        = 0x8000
+	MS_SLAVE                         = 0x80000
+	MS_STRICTATIME                   = 0x1000000
 	MS_SYNC                          = 0x4
 	MS_SYNCHRONOUS                   = 0x10
+	MS_UNBINDABLE                    = 0x20000
 	NAME_MAX                         = 0xff
 	NETLINK_ADD_MEMBERSHIP           = 0x1
 	NETLINK_AUDIT                    = 0x9
@@ -682,7 +715,7 @@
 	NETLINK_NFLOG                    = 0x5
 	NETLINK_NO_ENOBUFS               = 0x5
 	NETLINK_PKTINFO                  = 0x3
-	NETLINK_ROUTE                    = 0
+	NETLINK_ROUTE                    = 0x0
 	NETLINK_SCSITRANSPORT            = 0x12
 	NETLINK_SELINUX                  = 0x7
 	NETLINK_UNUSED                   = 0x1
@@ -720,27 +753,27 @@
 	O_DIRECTORY                      = 0x10000
 	O_DSYNC                          = 0x1000
 	O_EXCL                           = 0x80
-	O_FSYNC                          = 0x1000
-	O_LARGEFILE                      = 0
+	O_FSYNC                          = 0x101000
+	O_LARGEFILE                      = 0x0
 	O_NDELAY                         = 0x800
 	O_NOATIME                        = 0x40000
 	O_NOCTTY                         = 0x100
 	O_NOFOLLOW                       = 0x20000
 	O_NONBLOCK                       = 0x800
-	O_RDONLY                         = 0
+	O_RDONLY                         = 0x0
 	O_RDWR                           = 0x2
-	O_RSYNC                          = 0x1000
-	O_SYNC                           = 0x1000
+	O_RSYNC                          = 0x101000
+	O_SYNC                           = 0x101000
 	O_TRUNC                          = 0x200
 	O_WRONLY                         = 0x1
 	PACKET_ADD_MEMBERSHIP            = 0x1
 	PACKET_BROADCAST                 = 0x1
 	PACKET_DROP_MEMBERSHIP           = 0x2
 	PACKET_FASTROUTE                 = 0x6
-	PACKET_HOST                      = 0
+	PACKET_HOST                      = 0x0
 	PACKET_LOOPBACK                  = 0x5
 	PACKET_MR_ALLMULTI               = 0x2
-	PACKET_MR_MULTICAST              = 0
+	PACKET_MR_MULTICAST              = 0x0
 	PACKET_MR_PROMISC                = 0x1
 	PACKET_MULTICAST                 = 0x2
 	PACKET_OTHERHOST                 = 0x3
@@ -751,21 +784,11 @@
 	PROT_EXEC                        = 0x4
 	PROT_GROWSDOWN                   = 0x1000000
 	PROT_GROWSUP                     = 0x2000000
-	PROT_NONE                        = 0
+	PROT_NONE                        = 0x0
 	PROT_READ                        = 0x1
 	PROT_WRITE                       = 0x2
 	PTRACE_ARCH_PRCTL                = 0x1e
 	PTRACE_ATTACH                    = 0x10
-	PTRACE_BTS_CLEAR                 = 0x2c
-	PTRACE_BTS_CONFIG                = 0x28
-	PTRACE_BTS_DRAIN                 = 0x2d
-	PTRACE_BTS_GET                   = 0x2b
-	PTRACE_BTS_O_ALLOC               = 0x8
-	PTRACE_BTS_O_SCHED               = 0x2
-	PTRACE_BTS_O_SIGNAL              = 0x4
-	PTRACE_BTS_O_TRACE               = 0x1
-	PTRACE_BTS_SIZE                  = 0x2a
-	PTRACE_BTS_STATUS                = 0x29
 	PTRACE_CONT                      = 0x7
 	PTRACE_DETACH                    = 0x11
 	PTRACE_EVENT_CLONE               = 0x3
@@ -778,6 +801,7 @@
 	PTRACE_GETFPREGS                 = 0xe
 	PTRACE_GETFPXREGS                = 0x12
 	PTRACE_GETREGS                   = 0xc
+	PTRACE_GETREGSET                 = 0x4204
 	PTRACE_GETSIGINFO                = 0x4202
 	PTRACE_GET_THREAD_AREA           = 0x19
 	PTRACE_KILL                      = 0x8
@@ -800,6 +824,7 @@
 	PTRACE_SETFPXREGS                = 0x13
 	PTRACE_SETOPTIONS                = 0x4200
 	PTRACE_SETREGS                   = 0xd
+	PTRACE_SETREGSET                 = 0x4205
 	PTRACE_SETSIGINFO                = 0x4203
 	PTRACE_SET_THREAD_AREA           = 0x1a
 	PTRACE_SINGLEBLOCK               = 0x21
@@ -807,7 +832,7 @@
 	PTRACE_SYSCALL                   = 0x18
 	PTRACE_SYSEMU                    = 0x1f
 	PTRACE_SYSEMU_SINGLESTEP         = 0x20
-	PTRACE_TRACEME                   = 0
+	PTRACE_TRACEME                   = 0x0
 	RTAX_ADVMSS                      = 0x8
 	RTAX_CWND                        = 0x7
 	RTAX_FEATURES                    = 0xc
@@ -817,18 +842,19 @@
 	RTAX_FEATURE_TIMESTAMP           = 0x4
 	RTAX_HOPLIMIT                    = 0xa
 	RTAX_INITCWND                    = 0xb
+	RTAX_INITRWND                    = 0xe
 	RTAX_LOCK                        = 0x1
-	RTAX_MAX                         = 0xd
+	RTAX_MAX                         = 0xe
 	RTAX_MTU                         = 0x2
 	RTAX_REORDERING                  = 0x9
 	RTAX_RTO_MIN                     = 0xd
 	RTAX_RTT                         = 0x4
 	RTAX_RTTVAR                      = 0x5
 	RTAX_SSTHRESH                    = 0x6
-	RTAX_UNSPEC                      = 0
+	RTAX_UNSPEC                      = 0x0
 	RTAX_WINDOW                      = 0x3
 	RTA_ALIGNTO                      = 0x4
-	RTA_MAX                          = 0xf
+	RTA_MAX                          = 0x10
 	RTCF_DIRECTSRC                   = 0x4000000
 	RTCF_DOREDIRECT                  = 0x1000000
 	RTCF_LOG                         = 0x2000000
@@ -929,20 +955,20 @@
 	RTPROT_RA                        = 0x9
 	RTPROT_REDIRECT                  = 0x1
 	RTPROT_STATIC                    = 0x4
-	RTPROT_UNSPEC                    = 0
+	RTPROT_UNSPEC                    = 0x0
 	RTPROT_XORP                      = 0xe
 	RTPROT_ZEBRA                     = 0xb
 	RT_CLASS_DEFAULT                 = 0xfd
 	RT_CLASS_LOCAL                   = 0xff
 	RT_CLASS_MAIN                    = 0xfe
 	RT_CLASS_MAX                     = 0xff
-	RT_CLASS_UNSPEC                  = 0
+	RT_CLASS_UNSPEC                  = 0x0
 	SCM_CREDENTIALS                  = 0x2
 	SCM_RIGHTS                       = 0x1
 	SCM_TIMESTAMP                    = 0x1d
 	SCM_TIMESTAMPING                 = 0x25
 	SCM_TIMESTAMPNS                  = 0x23
-	SHUT_RD                          = 0
+	SHUT_RD                          = 0x0
 	SHUT_RDWR                        = 0x2
 	SHUT_WR                          = 0x1
 	SIGABRT                          = 0x6
@@ -1051,7 +1077,7 @@
 	SOL_ATM                          = 0x108
 	SOL_DECNET                       = 0x105
 	SOL_ICMPV6                       = 0x3a
-	SOL_IP                           = 0
+	SOL_IP                           = 0x0
 	SOL_IPV6                         = 0x29
 	SOL_IRDA                         = 0x10a
 	SOL_PACKET                       = 0x107
@@ -1087,6 +1113,7 @@
 	SO_RCVLOWAT                      = 0x12
 	SO_RCVTIMEO                      = 0x14
 	SO_REUSEADDR                     = 0x2
+	SO_RXQ_OVFL                      = 0x28
 	SO_SECURITY_AUTHENTICATION       = 0x16
 	SO_SECURITY_ENCRYPTION_NETWORK   = 0x18
 	SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
@@ -1098,7 +1125,6 @@
 	SO_TIMESTAMPING                  = 0x25
 	SO_TIMESTAMPNS                   = 0x23
 	SO_TYPE                          = 0x3
-	S_APPEND                         = 0x100
 	S_BLKSIZE                        = 0x200
 	S_IEXEC                          = 0x40
 	S_IFBLK                          = 0x6000
@@ -1109,7 +1135,6 @@
 	S_IFMT                           = 0xf000
 	S_IFREG                          = 0x8000
 	S_IFSOCK                         = 0xc000
-	S_IMMUTABLE                      = 0x200
 	S_IREAD                          = 0x100
 	S_IRGRP                          = 0x20
 	S_IROTH                          = 0x4
@@ -1127,7 +1152,6 @@
 	S_IXGRP                          = 0x8
 	S_IXOTH                          = 0x1
 	S_IXUSR                          = 0x40
-	S_WRITE                          = 0x80
 	TCP_CONGESTION                   = 0xd
 	TCP_CORK                         = 0x3
 	TCP_DEFER_ACCEPT                 = 0x9
@@ -1149,8 +1173,8 @@
 	TIOCCBRK                         = 0x5428
 	TIOCCONS                         = 0x541d
 	TIOCEXCL                         = 0x540c
+	TIOCGDEV                         = 0x80045432
 	TIOCGETD                         = 0x5424
-	TIOCGHAYESESP                    = 0x545e
 	TIOCGICOUNT                      = 0x545d
 	TIOCGLCKTRMIOS                   = 0x5456
 	TIOCGPGRP                        = 0x540f
@@ -1182,10 +1206,11 @@
 	TIOCNXCL                         = 0x540d
 	TIOCOUTQ                         = 0x5411
 	TIOCPKT                          = 0x5420
-	TIOCPKT_DATA                     = 0
+	TIOCPKT_DATA                     = 0x0
 	TIOCPKT_DOSTOP                   = 0x20
 	TIOCPKT_FLUSHREAD                = 0x1
 	TIOCPKT_FLUSHWRITE               = 0x2
+	TIOCPKT_IOCTL                    = 0x40
 	TIOCPKT_NOSTOP                   = 0x10
 	TIOCPKT_START                    = 0x8
 	TIOCPKT_STOP                     = 0x4
@@ -1200,7 +1225,7 @@
 	TIOCSERSWILD                     = 0x5455
 	TIOCSER_TEMT                     = 0x1
 	TIOCSETD                         = 0x5423
-	TIOCSHAYESESP                    = 0x545f
+	TIOCSIG                          = 0x40045436
 	TIOCSLCKTRMIOS                   = 0x5457
 	TIOCSPGRP                        = 0x5410
 	TIOCSPTLCK                       = 0x40045431
@@ -1209,9 +1234,12 @@
 	TIOCSSOFTCAR                     = 0x541a
 	TIOCSTI                          = 0x5412
 	TIOCSWINSZ                       = 0x5414
+	TUNATTACHFILTER                  = 0x401054d5
+	TUNDETACHFILTER                  = 0x401054d6
 	TUNGETFEATURES                   = 0x800454cf
 	TUNGETIFF                        = 0x800454d2
 	TUNGETSNDBUF                     = 0x800454d3
+	TUNGETVNETHDRSZ                  = 0x800454d7
 	TUNSETDEBUG                      = 0x400454c9
 	TUNSETGROUP                      = 0x400454ce
 	TUNSETIFF                        = 0x400454ca
@@ -1222,6 +1250,7 @@
 	TUNSETPERSIST                    = 0x400454cb
 	TUNSETSNDBUF                     = 0x400454d4
 	TUNSETTXFILTER                   = 0x400454d1
+	TUNSETVNETHDRSZ                  = 0x400454d8
 	WALL                             = 0x40000000
 	WCLONE                           = 0x80000000
 	WCONTINUED                       = 0x8
@@ -1234,8 +1263,6 @@
 	WUNTRACED                        = 0x2
 )
 
-// Types
-
 // Error table
 var errors = [...]string{
 	1:   "operation not permitted",
@@ -1367,5 +1394,5 @@
 	129: "key was rejected by service",
 	130: "owner died",
 	131: "state not recoverable",
-	132: "unknown error 132",
+	132: "operation not possible due to RF-kill",
 }
diff --git a/src/pkg/syscall/zsysnum_linux_386.go b/src/pkg/syscall/zsysnum_linux_386.go
index 71e21c7..c40b5f1 100644
--- a/src/pkg/syscall/zsysnum_linux_386.go
+++ b/src/pkg/syscall/zsysnum_linux_386.go
@@ -338,4 +338,8 @@
 	SYS_PWRITEV                = 334
 	SYS_RT_TGSIGQUEUEINFO      = 335
 	SYS_PERF_EVENT_OPEN        = 336
+	SYS_RECVMMSG               = 337
+	SYS_FANOTIFY_INIT          = 338
+	SYS_FANOTIFY_MARK          = 339
+	SYS_PRLIMIT64              = 340
 )
diff --git a/src/pkg/syscall/zsysnum_linux_amd64.go b/src/pkg/syscall/zsysnum_linux_amd64.go
index 77d4eea..7cf70a4 100644
--- a/src/pkg/syscall/zsysnum_linux_amd64.go
+++ b/src/pkg/syscall/zsysnum_linux_amd64.go
@@ -303,4 +303,8 @@
 	SYS_PWRITEV                = 296
 	SYS_RT_TGSIGQUEUEINFO      = 297
 	SYS_PERF_EVENT_OPEN        = 298
+	SYS_RECVMMSG               = 299
+	SYS_FANOTIFY_INIT          = 300
+	SYS_FANOTIFY_MARK          = 301
+	SYS_PRLIMIT64              = 302
 )
diff --git a/src/pkg/syscall/ztypes_darwin_386.go b/src/pkg/syscall/ztypes_darwin_386.go
index 0ec74f3..914534c 100644
--- a/src/pkg/syscall/ztypes_darwin_386.go
+++ b/src/pkg/syscall/ztypes_darwin_386.go
@@ -1,54 +1,22 @@
-// godefs -gsyscall -f-m32 types_darwin.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_darwin.go
 
 package syscall
 
-// Constants
 const (
-	sizeofPtr              = 0x4
-	sizeofShort            = 0x2
-	sizeofInt              = 0x4
-	sizeofLong             = 0x4
-	sizeofLongLong         = 0x8
-	O_CLOEXEC              = 0
-	SizeofSockaddrInet4    = 0x10
-	SizeofSockaddrInet6    = 0x1c
-	SizeofSockaddrAny      = 0x6c
-	SizeofSockaddrUnix     = 0x6a
-	SizeofSockaddrDatalink = 0x14
-	SizeofLinger           = 0x8
-	SizeofIPMreq           = 0x8
-	SizeofIPv6Mreq         = 0x14
-	SizeofMsghdr           = 0x1c
-	SizeofCmsghdr          = 0xc
-	SizeofInet6Pktinfo     = 0x14
-	PTRACE_TRACEME         = 0
-	PTRACE_CONT            = 0x7
-	PTRACE_KILL            = 0x8
-	SizeofIfMsghdr         = 0x70
-	SizeofIfData           = 0x60
-	SizeofIfaMsghdr        = 0x14
-	SizeofIfmaMsghdr       = 0x10
-	SizeofIfmaMsghdr2      = 0x14
-	SizeofRtMsghdr         = 0x5c
-	SizeofRtMetrics        = 0x38
-	SizeofBpfVersion       = 0x4
-	SizeofBpfStat          = 0x8
-	SizeofBpfProgram       = 0x8
-	SizeofBpfInsn          = 0x8
-	SizeofBpfHdr           = 0x14
+	sizeofPtr      = 0x4
+	sizeofShort    = 0x2
+	sizeofInt      = 0x4
+	sizeofLong     = 0x4
+	sizeofLongLong = 0x8
 )
 
-// Types
-
-type _C_short int16
-
-type _C_int int32
-
-type _C_long int32
-
-type _C_long_long int64
+type (
+	_C_short     int16
+	_C_int       int32
+	_C_long      int32
+	_C_long_long int64
+)
 
 type Timespec struct {
 	Sec  int32
@@ -60,6 +28,8 @@
 	Usec int32
 }
 
+type Timeval32 [0]byte
+
 type Rusage struct {
 	Utime    Timeval
 	Stime    Timeval
@@ -86,6 +56,10 @@
 
 type _Gid_t uint32
 
+const (
+	O_CLOEXEC = 0
+)
+
 type Stat_t struct {
 	Dev           int32
 	Mode          uint16
@@ -115,7 +89,7 @@
 	Bavail      uint64
 	Files       uint64
 	Ffree       uint64
-	Fsid        [8]byte /* fsid */
+	Fsid        Fsid
 	Owner       uint32
 	Type        uint32
 	Flags       uint32
@@ -159,6 +133,10 @@
 	Devoffset   int64
 }
 
+type Fsid struct {
+	Val [2]int32
+}
+
 type Dirent struct {
 	Ino          uint64
 	Seekoff      uint64
@@ -257,6 +235,26 @@
 	Ifindex uint32
 }
 
+const (
+	SizeofSockaddrInet4    = 0x10
+	SizeofSockaddrInet6    = 0x1c
+	SizeofSockaddrAny      = 0x6c
+	SizeofSockaddrUnix     = 0x6a
+	SizeofSockaddrDatalink = 0x14
+	SizeofLinger           = 0x8
+	SizeofIPMreq           = 0x8
+	SizeofIPv6Mreq         = 0x14
+	SizeofMsghdr           = 0x1c
+	SizeofCmsghdr          = 0xc
+	SizeofInet6Pktinfo     = 0x14
+)
+
+const (
+	PTRACE_TRACEME = 0x0
+	PTRACE_CONT    = 0x7
+	PTRACE_KILL    = 0x8
+)
+
 type Kevent_t struct {
 	Ident  uint32
 	Filter int16
@@ -270,6 +268,16 @@
 	Bits [32]int32
 }
 
+const (
+	SizeofIfMsghdr    = 0x70
+	SizeofIfData      = 0x60
+	SizeofIfaMsghdr   = 0x14
+	SizeofIfmaMsghdr  = 0x10
+	SizeofIfmaMsghdr2 = 0x14
+	SizeofRtMsghdr    = 0x5c
+	SizeofRtMetrics   = 0x38
+)
+
 type IfMsghdr struct {
 	Msglen       uint16
 	Version      uint8
@@ -375,6 +383,14 @@
 	Filler   [4]uint32
 }
 
+const (
+	SizeofBpfVersion = 0x4
+	SizeofBpfStat    = 0x8
+	SizeofBpfProgram = 0x8
+	SizeofBpfInsn    = 0x8
+	SizeofBpfHdr     = 0x14
+)
+
 type BpfVersion struct {
 	Major uint16
 	Minor uint16
diff --git a/src/pkg/syscall/ztypes_darwin_amd64.go b/src/pkg/syscall/ztypes_darwin_amd64.go
index f0e8a92..fbbb503 100644
--- a/src/pkg/syscall/ztypes_darwin_amd64.go
+++ b/src/pkg/syscall/ztypes_darwin_amd64.go
@@ -1,54 +1,22 @@
-// godefs -gsyscall -f-m64 types_darwin.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_darwin.go
 
 package syscall
 
-// Constants
 const (
-	sizeofPtr              = 0x8
-	sizeofShort            = 0x2
-	sizeofInt              = 0x4
-	sizeofLong             = 0x8
-	sizeofLongLong         = 0x8
-	O_CLOEXEC              = 0
-	SizeofSockaddrInet4    = 0x10
-	SizeofSockaddrInet6    = 0x1c
-	SizeofSockaddrAny      = 0x6c
-	SizeofSockaddrUnix     = 0x6a
-	SizeofSockaddrDatalink = 0x14
-	SizeofLinger           = 0x8
-	SizeofIPMreq           = 0x8
-	SizeofIPv6Mreq         = 0x14
-	SizeofMsghdr           = 0x30
-	SizeofCmsghdr          = 0xc
-	SizeofInet6Pktinfo     = 0x14
-	PTRACE_TRACEME         = 0
-	PTRACE_CONT            = 0x7
-	PTRACE_KILL            = 0x8
-	SizeofIfMsghdr         = 0x70
-	SizeofIfData           = 0x60
-	SizeofIfaMsghdr        = 0x14
-	SizeofIfmaMsghdr       = 0x10
-	SizeofIfmaMsghdr2      = 0x14
-	SizeofRtMsghdr         = 0x5c
-	SizeofRtMetrics        = 0x38
-	SizeofBpfVersion       = 0x4
-	SizeofBpfStat          = 0x8
-	SizeofBpfProgram       = 0x10
-	SizeofBpfInsn          = 0x8
-	SizeofBpfHdr           = 0x14
+	sizeofPtr      = 0x8
+	sizeofShort    = 0x2
+	sizeofInt      = 0x4
+	sizeofLong     = 0x8
+	sizeofLongLong = 0x8
 )
 
-// Types
-
-type _C_short int16
-
-type _C_int int32
-
-type _C_long int64
-
-type _C_long_long int64
+type (
+	_C_short     int16
+	_C_int       int32
+	_C_long      int64
+	_C_long_long int64
+)
 
 type Timespec struct {
 	Sec  int64
@@ -92,6 +60,10 @@
 
 type _Gid_t uint32
 
+const (
+	O_CLOEXEC = 0
+)
+
 type Stat_t struct {
 	Dev           int32
 	Mode          uint16
@@ -122,7 +94,7 @@
 	Bavail      uint64
 	Files       uint64
 	Ffree       uint64
-	Fsid        [8]byte /* fsid */
+	Fsid        Fsid
 	Owner       uint32
 	Type        uint32
 	Flags       uint32
@@ -167,6 +139,10 @@
 	Devoffset   int64
 }
 
+type Fsid struct {
+	Val [2]int32
+}
+
 type Dirent struct {
 	Ino          uint64
 	Seekoff      uint64
@@ -267,6 +243,26 @@
 	Ifindex uint32
 }
 
+const (
+	SizeofSockaddrInet4    = 0x10
+	SizeofSockaddrInet6    = 0x1c
+	SizeofSockaddrAny      = 0x6c
+	SizeofSockaddrUnix     = 0x6a
+	SizeofSockaddrDatalink = 0x14
+	SizeofLinger           = 0x8
+	SizeofIPMreq           = 0x8
+	SizeofIPv6Mreq         = 0x14
+	SizeofMsghdr           = 0x30
+	SizeofCmsghdr          = 0xc
+	SizeofInet6Pktinfo     = 0x14
+)
+
+const (
+	PTRACE_TRACEME = 0x0
+	PTRACE_CONT    = 0x7
+	PTRACE_KILL    = 0x8
+)
+
 type Kevent_t struct {
 	Ident  uint64
 	Filter int16
@@ -280,6 +276,16 @@
 	Bits [32]int32
 }
 
+const (
+	SizeofIfMsghdr    = 0x70
+	SizeofIfData      = 0x60
+	SizeofIfaMsghdr   = 0x14
+	SizeofIfmaMsghdr  = 0x10
+	SizeofIfmaMsghdr2 = 0x14
+	SizeofRtMsghdr    = 0x5c
+	SizeofRtMetrics   = 0x38
+)
+
 type IfMsghdr struct {
 	Msglen       uint16
 	Version      uint8
@@ -385,6 +391,14 @@
 	Filler   [4]uint32
 }
 
+const (
+	SizeofBpfVersion = 0x4
+	SizeofBpfStat    = 0x8
+	SizeofBpfProgram = 0x10
+	SizeofBpfInsn    = 0x8
+	SizeofBpfHdr     = 0x14
+)
+
 type BpfVersion struct {
 	Major uint16
 	Minor uint16
diff --git a/src/pkg/syscall/ztypes_linux_386.go b/src/pkg/syscall/ztypes_linux_386.go
index a6d51d6..aab3d32 100644
--- a/src/pkg/syscall/ztypes_linux_386.go
+++ b/src/pkg/syscall/ztypes_linux_386.go
@@ -1,220 +1,23 @@
-// godefs -gsyscall -f-m32 types_linux.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_linux.go
 
 package syscall
 
-// Constants
 const (
-	sizeofPtr               = 0x4
-	sizeofShort             = 0x2
-	sizeofInt               = 0x4
-	sizeofLong              = 0x4
-	sizeofLongLong          = 0x8
-	PathMax                 = 0x1000
-	SizeofSockaddrInet4     = 0x10
-	SizeofSockaddrInet6     = 0x1c
-	SizeofSockaddrAny       = 0x70
-	SizeofSockaddrUnix      = 0x6e
-	SizeofSockaddrLinklayer = 0x14
-	SizeofSockaddrNetlink   = 0xc
-	SizeofLinger            = 0x8
-	SizeofIPMreq            = 0x8
-	SizeofIPMreqn           = 0xc
-	SizeofIPv6Mreq          = 0x14
-	SizeofMsghdr            = 0x1c
-	SizeofCmsghdr           = 0xc
-	SizeofInet4Pktinfo      = 0xc
-	SizeofInet6Pktinfo      = 0x14
-	SizeofUcred             = 0xc
-	IFA_UNSPEC              = 0
-	IFA_ADDRESS             = 0x1
-	IFA_LOCAL               = 0x2
-	IFA_LABEL               = 0x3
-	IFA_BROADCAST           = 0x4
-	IFA_ANYCAST             = 0x5
-	IFA_CACHEINFO           = 0x6
-	IFA_MULTICAST           = 0x7
-	IFLA_UNSPEC             = 0
-	IFLA_ADDRESS            = 0x1
-	IFLA_BROADCAST          = 0x2
-	IFLA_IFNAME             = 0x3
-	IFLA_MTU                = 0x4
-	IFLA_LINK               = 0x5
-	IFLA_QDISC              = 0x6
-	IFLA_STATS              = 0x7
-	IFLA_COST               = 0x8
-	IFLA_PRIORITY           = 0x9
-	IFLA_MASTER             = 0xa
-	IFLA_WIRELESS           = 0xb
-	IFLA_PROTINFO           = 0xc
-	IFLA_TXQLEN             = 0xd
-	IFLA_MAP                = 0xe
-	IFLA_WEIGHT             = 0xf
-	IFLA_OPERSTATE          = 0x10
-	IFLA_LINKMODE           = 0x11
-	IFLA_LINKINFO           = 0x12
-	IFLA_NET_NS_PID         = 0x13
-	IFLA_IFALIAS            = 0x14
-	IFLA_MAX                = 0x14
-	RT_SCOPE_UNIVERSE       = 0
-	RT_SCOPE_SITE           = 0xc8
-	RT_SCOPE_LINK           = 0xfd
-	RT_SCOPE_HOST           = 0xfe
-	RT_SCOPE_NOWHERE        = 0xff
-	RT_TABLE_UNSPEC         = 0
-	RT_TABLE_COMPAT         = 0xfc
-	RT_TABLE_DEFAULT        = 0xfd
-	RT_TABLE_MAIN           = 0xfe
-	RT_TABLE_LOCAL          = 0xff
-	RT_TABLE_MAX            = 0xffffffff
-	RTA_UNSPEC              = 0
-	RTA_DST                 = 0x1
-	RTA_SRC                 = 0x2
-	RTA_IIF                 = 0x3
-	RTA_OIF                 = 0x4
-	RTA_GATEWAY             = 0x5
-	RTA_PRIORITY            = 0x6
-	RTA_PREFSRC             = 0x7
-	RTA_METRICS             = 0x8
-	RTA_MULTIPATH           = 0x9
-	RTA_FLOW                = 0xb
-	RTA_CACHEINFO           = 0xc
-	RTA_TABLE               = 0xf
-	RTN_UNSPEC              = 0
-	RTN_UNICAST             = 0x1
-	RTN_LOCAL               = 0x2
-	RTN_BROADCAST           = 0x3
-	RTN_ANYCAST             = 0x4
-	RTN_MULTICAST           = 0x5
-	RTN_BLACKHOLE           = 0x6
-	RTN_UNREACHABLE         = 0x7
-	RTN_PROHIBIT            = 0x8
-	RTN_THROW               = 0x9
-	RTN_NAT                 = 0xa
-	RTN_XRESOLVE            = 0xb
-	SizeofNlMsghdr          = 0x10
-	SizeofNlMsgerr          = 0x14
-	SizeofRtGenmsg          = 0x1
-	SizeofNlAttr            = 0x4
-	SizeofRtAttr            = 0x4
-	SizeofIfInfomsg         = 0x10
-	SizeofIfAddrmsg         = 0x8
-	SizeofRtMsg             = 0xc
-	SizeofRtNexthop         = 0x8
-	SizeofSockFilter        = 0x8
-	SizeofSockFprog         = 0x8
-	SizeofInotifyEvent      = 0x10
-	VINTR                   = 0
-	VQUIT                   = 0x1
-	VERASE                  = 0x2
-	VKILL                   = 0x3
-	VEOF                    = 0x4
-	VTIME                   = 0x5
-	VMIN                    = 0x6
-	VSWTC                   = 0x7
-	VSTART                  = 0x8
-	VSTOP                   = 0x9
-	VSUSP                   = 0xa
-	VEOL                    = 0xb
-	VREPRINT                = 0xc
-	VDISCARD                = 0xd
-	VWERASE                 = 0xe
-	VLNEXT                  = 0xf
-	VEOL2                   = 0x10
-	IGNBRK                  = 0x1
-	BRKINT                  = 0x2
-	IGNPAR                  = 0x4
-	PARMRK                  = 0x8
-	INPCK                   = 0x10
-	ISTRIP                  = 0x20
-	INLCR                   = 0x40
-	IGNCR                   = 0x80
-	ICRNL                   = 0x100
-	IUCLC                   = 0x200
-	IXON                    = 0x400
-	IXANY                   = 0x800
-	IXOFF                   = 0x1000
-	IMAXBEL                 = 0x2000
-	IUTF8                   = 0x4000
-	OPOST                   = 0x1
-	OLCUC                   = 0x2
-	ONLCR                   = 0x4
-	OCRNL                   = 0x8
-	ONOCR                   = 0x10
-	ONLRET                  = 0x20
-	OFILL                   = 0x40
-	OFDEL                   = 0x80
-	B0                      = 0
-	B50                     = 0x1
-	B75                     = 0x2
-	B110                    = 0x3
-	B134                    = 0x4
-	B150                    = 0x5
-	B200                    = 0x6
-	B300                    = 0x7
-	B600                    = 0x8
-	B1200                   = 0x9
-	B1800                   = 0xa
-	B2400                   = 0xb
-	B4800                   = 0xc
-	B9600                   = 0xd
-	B19200                  = 0xe
-	B38400                  = 0xf
-	CSIZE                   = 0x30
-	CS5                     = 0
-	CS6                     = 0x10
-	CS7                     = 0x20
-	CS8                     = 0x30
-	CSTOPB                  = 0x40
-	CREAD                   = 0x80
-	PARENB                  = 0x100
-	PARODD                  = 0x200
-	HUPCL                   = 0x400
-	CLOCAL                  = 0x800
-	B57600                  = 0x1001
-	B115200                 = 0x1002
-	B230400                 = 0x1003
-	B460800                 = 0x1004
-	B500000                 = 0x1005
-	B576000                 = 0x1006
-	B921600                 = 0x1007
-	B1000000                = 0x1008
-	B1152000                = 0x1009
-	B1500000                = 0x100a
-	B2000000                = 0x100b
-	B2500000                = 0x100c
-	B3000000                = 0x100d
-	B3500000                = 0x100e
-	B4000000                = 0x100f
-	ISIG                    = 0x1
-	ICANON                  = 0x2
-	XCASE                   = 0x4
-	ECHO                    = 0x8
-	ECHOE                   = 0x10
-	ECHOK                   = 0x20
-	ECHONL                  = 0x40
-	NOFLSH                  = 0x80
-	TOSTOP                  = 0x100
-	ECHOCTL                 = 0x200
-	ECHOPRT                 = 0x400
-	ECHOKE                  = 0x800
-	FLUSHO                  = 0x1000
-	PENDIN                  = 0x4000
-	IEXTEN                  = 0x8000
-	TCGETS                  = 0x5401
-	TCSETS                  = 0x5402
+	sizeofPtr      = 0x4
+	sizeofShort    = 0x2
+	sizeofInt      = 0x4
+	sizeofLong     = 0x4
+	sizeofLongLong = 0x8
+	PathMax        = 0x1000
 )
 
-// Types
-
-type _C_short int16
-
-type _C_int int32
-
-type _C_long int32
-
-type _C_long_long int64
+type (
+	_C_short     int16
+	_C_int       int32
+	_C_long      int32
+	_C_long_long int64
+)
 
 type Timespec struct {
 	Sec  int32
@@ -227,37 +30,27 @@
 }
 
 type Timex struct {
-	Modes         uint32
-	Offset        int32
-	Freq          int32
-	Maxerror      int32
-	Esterror      int32
-	Status        int32
-	Constant      int32
-	Precision     int32
-	Tolerance     int32
-	Time          Timeval
-	Tick          int32
-	Ppsfreq       int32
-	Jitter        int32
-	Shift         int32
-	Stabil        int32
-	Jitcnt        int32
-	Calcnt        int32
-	Errcnt        int32
-	Stbcnt        int32
-	Tai           int32
-	Pad_godefs_0  int32
-	Pad_godefs_1  int32
-	Pad_godefs_2  int32
-	Pad_godefs_3  int32
-	Pad_godefs_4  int32
-	Pad_godefs_5  int32
-	Pad_godefs_6  int32
-	Pad_godefs_7  int32
-	Pad_godefs_8  int32
-	Pad_godefs_9  int32
-	Pad_godefs_10 int32
+	Modes     uint32
+	Offset    int32
+	Freq      int32
+	Maxerror  int32
+	Esterror  int32
+	Status    int32
+	Constant  int32
+	Precision int32
+	Tolerance int32
+	Time      Timeval
+	Tick      int32
+	Ppsfreq   int32
+	Jitter    int32
+	Shift     int32
+	Stabil    int32
+	Jitcnt    int32
+	Calcnt    int32
+	Errcnt    int32
+	Stbcnt    int32
+	Tai       int32
+	Pad_cgo_0 [44]byte
 }
 
 type Time_t int32
@@ -301,24 +94,24 @@
 type _Gid_t uint32
 
 type Stat_t struct {
-	Dev          uint64
-	X__pad1      uint16
-	Pad_godefs_0 [2]byte
-	X__st_ino    uint32
-	Mode         uint32
-	Nlink        uint32
-	Uid          uint32
-	Gid          uint32
-	Rdev         uint64
-	X__pad2      uint16
-	Pad_godefs_1 [2]byte
-	Size         int64
-	Blksize      int32
-	Blocks       int64
-	Atim         Timespec
-	Mtim         Timespec
-	Ctim         Timespec
-	Ino          uint64
+	Dev       uint64
+	X__pad1   uint16
+	Pad_cgo_0 [2]byte
+	X__st_ino uint32
+	Mode      uint32
+	Nlink     uint32
+	Uid       uint32
+	Gid       uint32
+	Rdev      uint64
+	X__pad2   uint16
+	Pad_cgo_1 [2]byte
+	Size      int64
+	Blksize   int32
+	Blocks    int64
+	Atim      Timespec
+	Mtim      Timespec
+	Ctim      Timespec
+	Ino       uint64
 }
 
 type Statfs_t struct {
@@ -329,19 +122,24 @@
 	Bavail  uint64
 	Files   uint64
 	Ffree   uint64
-	Fsid    [8]byte /* __fsid_t */
+	Fsid    Fsid
 	Namelen int32
 	Frsize  int32
-	Spare   [5]int32
+	Flags   int32
+	Spare   [4]int32
 }
 
 type Dirent struct {
-	Ino          uint64
-	Off          int64
-	Reclen       uint16
-	Type         uint8
-	Name         [256]int8
-	Pad_godefs_0 [1]byte
+	Ino       uint64
+	Off       int64
+	Reclen    uint16
+	Type      uint8
+	Name      [256]int8
+	Pad_cgo_0 [1]byte
+}
+
+type Fsid struct {
+	X__val [2]int32
 }
 
 type RawSockaddrInet4 struct {
@@ -430,9 +228,10 @@
 }
 
 type Cmsghdr struct {
-	Len   uint32
-	Level int32
-	Type  int32
+	Len          uint32
+	Level        int32
+	Type         int32
+	X__cmsg_data [0]byte
 }
 
 type Inet4Pktinfo struct {
@@ -452,6 +251,102 @@
 	Gid uint32
 }
 
+const (
+	SizeofSockaddrInet4     = 0x10
+	SizeofSockaddrInet6     = 0x1c
+	SizeofSockaddrAny       = 0x70
+	SizeofSockaddrUnix      = 0x6e
+	SizeofSockaddrLinklayer = 0x14
+	SizeofSockaddrNetlink   = 0xc
+	SizeofLinger            = 0x8
+	SizeofIPMreq            = 0x8
+	SizeofIPMreqn           = 0xc
+	SizeofIPv6Mreq          = 0x14
+	SizeofMsghdr            = 0x1c
+	SizeofCmsghdr           = 0xc
+	SizeofInet4Pktinfo      = 0xc
+	SizeofInet6Pktinfo      = 0x14
+	SizeofUcred             = 0xc
+)
+
+const (
+	IFA_UNSPEC        = 0x0
+	IFA_ADDRESS       = 0x1
+	IFA_LOCAL         = 0x2
+	IFA_LABEL         = 0x3
+	IFA_BROADCAST     = 0x4
+	IFA_ANYCAST       = 0x5
+	IFA_CACHEINFO     = 0x6
+	IFA_MULTICAST     = 0x7
+	IFLA_UNSPEC       = 0x0
+	IFLA_ADDRESS      = 0x1
+	IFLA_BROADCAST    = 0x2
+	IFLA_IFNAME       = 0x3
+	IFLA_MTU          = 0x4
+	IFLA_LINK         = 0x5
+	IFLA_QDISC        = 0x6
+	IFLA_STATS        = 0x7
+	IFLA_COST         = 0x8
+	IFLA_PRIORITY     = 0x9
+	IFLA_MASTER       = 0xa
+	IFLA_WIRELESS     = 0xb
+	IFLA_PROTINFO     = 0xc
+	IFLA_TXQLEN       = 0xd
+	IFLA_MAP          = 0xe
+	IFLA_WEIGHT       = 0xf
+	IFLA_OPERSTATE    = 0x10
+	IFLA_LINKMODE     = 0x11
+	IFLA_LINKINFO     = 0x12
+	IFLA_NET_NS_PID   = 0x13
+	IFLA_IFALIAS      = 0x14
+	IFLA_MAX          = 0x1a
+	RT_SCOPE_UNIVERSE = 0x0
+	RT_SCOPE_SITE     = 0xc8
+	RT_SCOPE_LINK     = 0xfd
+	RT_SCOPE_HOST     = 0xfe
+	RT_SCOPE_NOWHERE  = 0xff
+	RT_TABLE_UNSPEC   = 0x0
+	RT_TABLE_COMPAT   = 0xfc
+	RT_TABLE_DEFAULT  = 0xfd
+	RT_TABLE_MAIN     = 0xfe
+	RT_TABLE_LOCAL    = 0xff
+	RT_TABLE_MAX      = 0xffffffff
+	RTA_UNSPEC        = 0x0
+	RTA_DST           = 0x1
+	RTA_SRC           = 0x2
+	RTA_IIF           = 0x3
+	RTA_OIF           = 0x4
+	RTA_GATEWAY       = 0x5
+	RTA_PRIORITY      = 0x6
+	RTA_PREFSRC       = 0x7
+	RTA_METRICS       = 0x8
+	RTA_MULTIPATH     = 0x9
+	RTA_FLOW          = 0xb
+	RTA_CACHEINFO     = 0xc
+	RTA_TABLE         = 0xf
+	RTN_UNSPEC        = 0x0
+	RTN_UNICAST       = 0x1
+	RTN_LOCAL         = 0x2
+	RTN_BROADCAST     = 0x3
+	RTN_ANYCAST       = 0x4
+	RTN_MULTICAST     = 0x5
+	RTN_BLACKHOLE     = 0x6
+	RTN_UNREACHABLE   = 0x7
+	RTN_PROHIBIT      = 0x8
+	RTN_THROW         = 0x9
+	RTN_NAT           = 0xa
+	RTN_XRESOLVE      = 0xb
+	SizeofNlMsghdr    = 0x10
+	SizeofNlMsgerr    = 0x14
+	SizeofRtGenmsg    = 0x1
+	SizeofNlAttr      = 0x4
+	SizeofRtAttr      = 0x4
+	SizeofIfInfomsg   = 0x10
+	SizeofIfAddrmsg   = 0x8
+	SizeofRtMsg       = 0xc
+	SizeofRtNexthop   = 0x8
+)
+
 type NlMsghdr struct {
 	Len   uint32
 	Type  uint16
@@ -515,6 +410,11 @@
 	Ifindex int32
 }
 
+const (
+	SizeofSockFilter = 0x8
+	SizeofSockFprog  = 0x8
+)
+
 type SockFilter struct {
 	Code uint16
 	Jt   uint8
@@ -523,9 +423,9 @@
 }
 
 type SockFprog struct {
-	Len          uint16
-	Pad_godefs_0 [2]byte
-	Filter       *SockFilter
+	Len       uint16
+	Pad_cgo_0 [2]byte
+	Filter    *SockFilter
 }
 
 type InotifyEvent struct {
@@ -533,8 +433,11 @@
 	Mask   uint32
 	Cookie uint32
 	Len    uint32
+	Name   [0]byte
 }
 
+const SizeofInotifyEvent = 0x10
+
 type PtraceRegs struct {
 	Ebx      int32
 	Ecx      int32
@@ -599,13 +502,115 @@
 }
 
 type Termios struct {
-	Iflag        uint32
-	Oflag        uint32
-	Cflag        uint32
-	Lflag        uint32
-	Line         uint8
-	Cc           [32]uint8
-	Pad_godefs_0 [3]byte
-	Ispeed       uint32
-	Ospeed       uint32
+	Iflag     uint32
+	Oflag     uint32
+	Cflag     uint32
+	Lflag     uint32
+	Line      uint8
+	Cc        [32]uint8
+	Pad_cgo_0 [3]byte
+	Ispeed    uint32
+	Ospeed    uint32
 }
+
+const (
+	VINTR    = 0x0
+	VQUIT    = 0x1
+	VERASE   = 0x2
+	VKILL    = 0x3
+	VEOF     = 0x4
+	VTIME    = 0x5
+	VMIN     = 0x6
+	VSWTC    = 0x7
+	VSTART   = 0x8
+	VSTOP    = 0x9
+	VSUSP    = 0xa
+	VEOL     = 0xb
+	VREPRINT = 0xc
+	VDISCARD = 0xd
+	VWERASE  = 0xe
+	VLNEXT   = 0xf
+	VEOL2    = 0x10
+	IGNBRK   = 0x1
+	BRKINT   = 0x2
+	IGNPAR   = 0x4
+	PARMRK   = 0x8
+	INPCK    = 0x10
+	ISTRIP   = 0x20
+	INLCR    = 0x40
+	IGNCR    = 0x80
+	ICRNL    = 0x100
+	IUCLC    = 0x200
+	IXON     = 0x400
+	IXANY    = 0x800
+	IXOFF    = 0x1000
+	IMAXBEL  = 0x2000
+	IUTF8    = 0x4000
+	OPOST    = 0x1
+	OLCUC    = 0x2
+	ONLCR    = 0x4
+	OCRNL    = 0x8
+	ONOCR    = 0x10
+	ONLRET   = 0x20
+	OFILL    = 0x40
+	OFDEL    = 0x80
+	B0       = 0x0
+	B50      = 0x1
+	B75      = 0x2
+	B110     = 0x3
+	B134     = 0x4
+	B150     = 0x5
+	B200     = 0x6
+	B300     = 0x7
+	B600     = 0x8
+	B1200    = 0x9
+	B1800    = 0xa
+	B2400    = 0xb
+	B4800    = 0xc
+	B9600    = 0xd
+	B19200   = 0xe
+	B38400   = 0xf
+	CSIZE    = 0x30
+	CS5      = 0x0
+	CS6      = 0x10
+	CS7      = 0x20
+	CS8      = 0x30
+	CSTOPB   = 0x40
+	CREAD    = 0x80
+	PARENB   = 0x100
+	PARODD   = 0x200
+	HUPCL    = 0x400
+	CLOCAL   = 0x800
+	B57600   = 0x1001
+	B115200  = 0x1002
+	B230400  = 0x1003
+	B460800  = 0x1004
+	B500000  = 0x1005
+	B576000  = 0x1006
+	B921600  = 0x1007
+	B1000000 = 0x1008
+	B1152000 = 0x1009
+	B1500000 = 0x100a
+	B2000000 = 0x100b
+	B2500000 = 0x100c
+	B3000000 = 0x100d
+	B3500000 = 0x100e
+	B4000000 = 0x100f
+	ISIG     = 0x1
+	ICANON   = 0x2
+	XCASE    = 0x4
+	ECHO     = 0x8
+	ECHOE    = 0x10
+	ECHOK    = 0x20
+	ECHONL   = 0x40
+	NOFLSH   = 0x80
+	TOSTOP   = 0x100
+	ECHOCTL  = 0x200
+	ECHOPRT  = 0x400
+	ECHOKE   = 0x800
+	FLUSHO   = 0x1000
+	PENDIN   = 0x4000
+	IEXTEN   = 0x8000
+	TCGETS   = 0x5401
+	TCSETS   = 0x5402
+)
diff --git a/src/pkg/syscall/ztypes_linux_amd64.go b/src/pkg/syscall/ztypes_linux_amd64.go
index add9130..940076d 100644
--- a/src/pkg/syscall/ztypes_linux_amd64.go
+++ b/src/pkg/syscall/ztypes_linux_amd64.go
@@ -1,220 +1,23 @@
-// godefs -gsyscall -f-m64 types_linux.c
-
-// MACHINE GENERATED - DO NOT EDIT.
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs types_linux.go
 
 package syscall
 
-// Constants
 const (
-	sizeofPtr               = 0x8
-	sizeofShort             = 0x2
-	sizeofInt               = 0x4
-	sizeofLong              = 0x8
-	sizeofLongLong          = 0x8
-	PathMax                 = 0x1000
-	SizeofSockaddrInet4     = 0x10
-	SizeofSockaddrInet6     = 0x1c
-	SizeofSockaddrAny       = 0x70
-	SizeofSockaddrUnix      = 0x6e
-	SizeofSockaddrLinklayer = 0x14
-	SizeofSockaddrNetlink   = 0xc
-	SizeofLinger            = 0x8
-	SizeofIPMreq            = 0x8
-	SizeofIPMreqn           = 0xc
-	SizeofIPv6Mreq          = 0x14
-	SizeofMsghdr            = 0x38
-	SizeofCmsghdr           = 0x10
-	SizeofInet4Pktinfo      = 0xc
-	SizeofInet6Pktinfo      = 0x14
-	SizeofUcred             = 0xc
-	IFA_UNSPEC              = 0
-	IFA_ADDRESS             = 0x1
-	IFA_LOCAL               = 0x2
-	IFA_LABEL               = 0x3
-	IFA_BROADCAST           = 0x4
-	IFA_ANYCAST             = 0x5
-	IFA_CACHEINFO           = 0x6
-	IFA_MULTICAST           = 0x7
-	IFLA_UNSPEC             = 0
-	IFLA_ADDRESS            = 0x1
-	IFLA_BROADCAST          = 0x2
-	IFLA_IFNAME             = 0x3
-	IFLA_MTU                = 0x4
-	IFLA_LINK               = 0x5
-	IFLA_QDISC              = 0x6
-	IFLA_STATS              = 0x7
-	IFLA_COST               = 0x8
-	IFLA_PRIORITY           = 0x9
-	IFLA_MASTER             = 0xa
-	IFLA_WIRELESS           = 0xb
-	IFLA_PROTINFO           = 0xc
-	IFLA_TXQLEN             = 0xd
-	IFLA_MAP                = 0xe
-	IFLA_WEIGHT             = 0xf
-	IFLA_OPERSTATE          = 0x10
-	IFLA_LINKMODE           = 0x11
-	IFLA_LINKINFO           = 0x12
-	IFLA_NET_NS_PID         = 0x13
-	IFLA_IFALIAS            = 0x14
-	IFLA_MAX                = 0x14
-	RT_SCOPE_UNIVERSE       = 0
-	RT_SCOPE_SITE           = 0xc8
-	RT_SCOPE_LINK           = 0xfd
-	RT_SCOPE_HOST           = 0xfe
-	RT_SCOPE_NOWHERE        = 0xff
-	RT_TABLE_UNSPEC         = 0
-	RT_TABLE_COMPAT         = 0xfc
-	RT_TABLE_DEFAULT        = 0xfd
-	RT_TABLE_MAIN           = 0xfe
-	RT_TABLE_LOCAL          = 0xff
-	RT_TABLE_MAX            = 0xffffffff
-	RTA_UNSPEC              = 0
-	RTA_DST                 = 0x1
-	RTA_SRC                 = 0x2
-	RTA_IIF                 = 0x3
-	RTA_OIF                 = 0x4
-	RTA_GATEWAY             = 0x5
-	RTA_PRIORITY            = 0x6
-	RTA_PREFSRC             = 0x7
-	RTA_METRICS             = 0x8
-	RTA_MULTIPATH           = 0x9
-	RTA_FLOW                = 0xb
-	RTA_CACHEINFO           = 0xc
-	RTA_TABLE               = 0xf
-	RTN_UNSPEC              = 0
-	RTN_UNICAST             = 0x1
-	RTN_LOCAL               = 0x2
-	RTN_BROADCAST           = 0x3
-	RTN_ANYCAST             = 0x4
-	RTN_MULTICAST           = 0x5
-	RTN_BLACKHOLE           = 0x6
-	RTN_UNREACHABLE         = 0x7
-	RTN_PROHIBIT            = 0x8
-	RTN_THROW               = 0x9
-	RTN_NAT                 = 0xa
-	RTN_XRESOLVE            = 0xb
-	SizeofNlMsghdr          = 0x10
-	SizeofNlMsgerr          = 0x14
-	SizeofRtGenmsg          = 0x1
-	SizeofNlAttr            = 0x4
-	SizeofRtAttr            = 0x4
-	SizeofIfInfomsg         = 0x10
-	SizeofIfAddrmsg         = 0x8
-	SizeofRtMsg             = 0xc
-	SizeofRtNexthop         = 0x8
-	SizeofSockFilter        = 0x8
-	SizeofSockFprog         = 0x10
-	SizeofInotifyEvent      = 0x10
-	VINTR                   = 0
-	VQUIT                   = 0x1
-	VERASE                  = 0x2
-	VKILL                   = 0x3
-	VEOF                    = 0x4
-	VTIME                   = 0x5
-	VMIN                    = 0x6
-	VSWTC                   = 0x7
-	VSTART                  = 0x8
-	VSTOP                   = 0x9
-	VSUSP                   = 0xa
-	VEOL                    = 0xb
-	VREPRINT                = 0xc
-	VDISCARD                = 0xd
-	VWERASE                 = 0xe
-	VLNEXT                  = 0xf
-	VEOL2                   = 0x10
-	IGNBRK                  = 0x1
-	BRKINT                  = 0x2
-	IGNPAR                  = 0x4
-	PARMRK                  = 0x8
-	INPCK                   = 0x10
-	ISTRIP                  = 0x20
-	INLCR                   = 0x40
-	IGNCR                   = 0x80
-	ICRNL                   = 0x100
-	IUCLC                   = 0x200
-	IXON                    = 0x400
-	IXANY                   = 0x800
-	IXOFF                   = 0x1000
-	IMAXBEL                 = 0x2000
-	IUTF8                   = 0x4000
-	OPOST                   = 0x1
-	OLCUC                   = 0x2
-	ONLCR                   = 0x4
-	OCRNL                   = 0x8
-	ONOCR                   = 0x10
-	ONLRET                  = 0x20
-	OFILL                   = 0x40
-	OFDEL                   = 0x80
-	B0                      = 0
-	B50                     = 0x1
-	B75                     = 0x2
-	B110                    = 0x3
-	B134                    = 0x4
-	B150                    = 0x5
-	B200                    = 0x6
-	B300                    = 0x7
-	B600                    = 0x8
-	B1200                   = 0x9
-	B1800                   = 0xa
-	B2400                   = 0xb
-	B4800                   = 0xc
-	B9600                   = 0xd
-	B19200                  = 0xe
-	B38400                  = 0xf
-	CSIZE                   = 0x30
-	CS5                     = 0
-	CS6                     = 0x10
-	CS7                     = 0x20
-	CS8                     = 0x30
-	CSTOPB                  = 0x40
-	CREAD                   = 0x80
-	PARENB                  = 0x100
-	PARODD                  = 0x200
-	HUPCL                   = 0x400
-	CLOCAL                  = 0x800
-	B57600                  = 0x1001
-	B115200                 = 0x1002
-	B230400                 = 0x1003
-	B460800                 = 0x1004
-	B500000                 = 0x1005
-	B576000                 = 0x1006
-	B921600                 = 0x1007
-	B1000000                = 0x1008
-	B1152000                = 0x1009
-	B1500000                = 0x100a
-	B2000000                = 0x100b
-	B2500000                = 0x100c
-	B3000000                = 0x100d
-	B3500000                = 0x100e
-	B4000000                = 0x100f
-	ISIG                    = 0x1
-	ICANON                  = 0x2
-	XCASE                   = 0x4
-	ECHO                    = 0x8
-	ECHOE                   = 0x10
-	ECHOK                   = 0x20
-	ECHONL                  = 0x40
-	NOFLSH                  = 0x80
-	TOSTOP                  = 0x100
-	ECHOCTL                 = 0x200
-	ECHOPRT                 = 0x400
-	ECHOKE                  = 0x800
-	FLUSHO                  = 0x1000
-	PENDIN                  = 0x4000
-	IEXTEN                  = 0x8000
-	TCGETS                  = 0x5401
-	TCSETS                  = 0x5402
+	sizeofPtr      = 0x8
+	sizeofShort    = 0x2
+	sizeofInt      = 0x4
+	sizeofLong     = 0x8
+	sizeofLongLong = 0x8
+	PathMax        = 0x1000
 )
 
-// Types
-
-type _C_short int16
-
-type _C_int int32
-
-type _C_long int64
-
-type _C_long_long int64
+type (
+	_C_short     int16
+	_C_int       int32
+	_C_long      int64
+	_C_long_long int64
+)
 
 type Timespec struct {
 	Sec  int64
@@ -227,40 +30,30 @@
 }
 
 type Timex struct {
-	Modes         uint32
-	Pad_godefs_0  [4]byte
-	Offset        int64
-	Freq          int64
-	Maxerror      int64
-	Esterror      int64
-	Status        int32
-	Pad_godefs_1  [4]byte
-	Constant      int64
-	Precision     int64
-	Tolerance     int64
-	Time          Timeval
-	Tick          int64
-	Ppsfreq       int64
-	Jitter        int64
-	Shift         int32
-	Pad_godefs_2  [4]byte
-	Stabil        int64
-	Jitcnt        int64
-	Calcnt        int64
-	Errcnt        int64
-	Stbcnt        int64
-	Tai           int32
-	Pad_godefs_3  int32
-	Pad_godefs_4  int32
-	Pad_godefs_5  int32
-	Pad_godefs_6  int32
-	Pad_godefs_7  int32
-	Pad_godefs_8  int32
-	Pad_godefs_9  int32
-	Pad_godefs_10 int32
-	Pad_godefs_11 int32
-	Pad_godefs_12 int32
-	Pad_godefs_13 int32
+	Modes     uint32
+	Pad_cgo_0 [4]byte
+	Offset    int64
+	Freq      int64
+	Maxerror  int64
+	Esterror  int64
+	Status    int32
+	Pad_cgo_1 [4]byte
+	Constant  int64
+	Precision int64
+	Tolerance int64
+	Time      Timeval
+	Tick      int64
+	Ppsfreq   int64
+	Jitter    int64
+	Shift     int32
+	Pad_cgo_2 [4]byte
+	Stabil    int64
+	Jitcnt    int64
+	Calcnt    int64
+	Errcnt    int64
+	Stbcnt    int64
+	Tai       int32
+	Pad_cgo_3 [44]byte
 }
 
 type Time_t int64
@@ -329,19 +122,24 @@
 	Bavail  uint64
 	Files   uint64
 	Ffree   uint64
-	Fsid    [8]byte /* __fsid_t */
+	Fsid    Fsid
 	Namelen int64
 	Frsize  int64
-	Spare   [5]int64
+	Flags   int64
+	Spare   [4]int64
 }
 
 type Dirent struct {
-	Ino          uint64
-	Off          int64
-	Reclen       uint16
-	Type         uint8
-	Name         [256]int8
-	Pad_godefs_0 [5]byte
+	Ino       uint64
+	Off       int64
+	Reclen    uint16
+	Type      uint8
+	Name      [256]int8
+	Pad_cgo_0 [5]byte
+}
+
+type Fsid struct {
+	X__val [2]int32
 }
 
 type RawSockaddrInet4 struct {
@@ -420,21 +218,22 @@
 }
 
 type Msghdr struct {
-	Name         *byte
-	Namelen      uint32
-	Pad_godefs_0 [4]byte
-	Iov          *Iovec
-	Iovlen       uint64
-	Control      *byte
-	Controllen   uint64
-	Flags        int32
-	Pad_godefs_1 [4]byte
+	Name       *byte
+	Namelen    uint32
+	Pad_cgo_0  [4]byte
+	Iov        *Iovec
+	Iovlen     uint64
+	Control    *byte
+	Controllen uint64
+	Flags      int32
+	Pad_cgo_1  [4]byte
 }
 
 type Cmsghdr struct {
-	Len   uint64
-	Level int32
-	Type  int32
+	Len          uint64
+	Level        int32
+	Type         int32
+	X__cmsg_data [0]byte
 }
 
 type Inet4Pktinfo struct {
@@ -454,6 +253,102 @@
 	Gid uint32
 }
 
+const (
+	SizeofSockaddrInet4     = 0x10
+	SizeofSockaddrInet6     = 0x1c
+	SizeofSockaddrAny       = 0x70
+	SizeofSockaddrUnix      = 0x6e
+	SizeofSockaddrLinklayer = 0x14
+	SizeofSockaddrNetlink   = 0xc
+	SizeofLinger            = 0x8
+	SizeofIPMreq            = 0x8
+	SizeofIPMreqn           = 0xc
+	SizeofIPv6Mreq          = 0x14
+	SizeofMsghdr            = 0x38
+	SizeofCmsghdr           = 0x10
+	SizeofInet4Pktinfo      = 0xc
+	SizeofInet6Pktinfo      = 0x14
+	SizeofUcred             = 0xc
+)
+
+const (
+	IFA_UNSPEC        = 0x0
+	IFA_ADDRESS       = 0x1
+	IFA_LOCAL         = 0x2
+	IFA_LABEL         = 0x3
+	IFA_BROADCAST     = 0x4
+	IFA_ANYCAST       = 0x5
+	IFA_CACHEINFO     = 0x6
+	IFA_MULTICAST     = 0x7
+	IFLA_UNSPEC       = 0x0
+	IFLA_ADDRESS      = 0x1
+	IFLA_BROADCAST    = 0x2
+	IFLA_IFNAME       = 0x3
+	IFLA_MTU          = 0x4
+	IFLA_LINK         = 0x5
+	IFLA_QDISC        = 0x6
+	IFLA_STATS        = 0x7
+	IFLA_COST         = 0x8
+	IFLA_PRIORITY     = 0x9
+	IFLA_MASTER       = 0xa
+	IFLA_WIRELESS     = 0xb
+	IFLA_PROTINFO     = 0xc
+	IFLA_TXQLEN       = 0xd
+	IFLA_MAP          = 0xe
+	IFLA_WEIGHT       = 0xf
+	IFLA_OPERSTATE    = 0x10
+	IFLA_LINKMODE     = 0x11
+	IFLA_LINKINFO     = 0x12
+	IFLA_NET_NS_PID   = 0x13
+	IFLA_IFALIAS      = 0x14
+	IFLA_MAX          = 0x1a
+	RT_SCOPE_UNIVERSE = 0x0
+	RT_SCOPE_SITE     = 0xc8
+	RT_SCOPE_LINK     = 0xfd
+	RT_SCOPE_HOST     = 0xfe
+	RT_SCOPE_NOWHERE  = 0xff
+	RT_TABLE_UNSPEC   = 0x0
+	RT_TABLE_COMPAT   = 0xfc
+	RT_TABLE_DEFAULT  = 0xfd
+	RT_TABLE_MAIN     = 0xfe
+	RT_TABLE_LOCAL    = 0xff
+	RT_TABLE_MAX      = 0xffffffff
+	RTA_UNSPEC        = 0x0
+	RTA_DST           = 0x1
+	RTA_SRC           = 0x2
+	RTA_IIF           = 0x3
+	RTA_OIF           = 0x4
+	RTA_GATEWAY       = 0x5
+	RTA_PRIORITY      = 0x6
+	RTA_PREFSRC       = 0x7
+	RTA_METRICS       = 0x8
+	RTA_MULTIPATH     = 0x9
+	RTA_FLOW          = 0xb
+	RTA_CACHEINFO     = 0xc
+	RTA_TABLE         = 0xf
+	RTN_UNSPEC        = 0x0
+	RTN_UNICAST       = 0x1
+	RTN_LOCAL         = 0x2
+	RTN_BROADCAST     = 0x3
+	RTN_ANYCAST       = 0x4
+	RTN_MULTICAST     = 0x5
+	RTN_BLACKHOLE     = 0x6
+	RTN_UNREACHABLE   = 0x7
+	RTN_PROHIBIT      = 0x8
+	RTN_THROW         = 0x9
+	RTN_NAT           = 0xa
+	RTN_XRESOLVE      = 0xb
+	SizeofNlMsghdr    = 0x10
+	SizeofNlMsgerr    = 0x14
+	SizeofRtGenmsg    = 0x1
+	SizeofNlAttr      = 0x4
+	SizeofRtAttr      = 0x4
+	SizeofIfInfomsg   = 0x10
+	SizeofIfAddrmsg   = 0x8
+	SizeofRtMsg       = 0xc
+	SizeofRtNexthop   = 0x8
+)
+
 type NlMsghdr struct {
 	Len   uint32
 	Type  uint16
@@ -517,6 +412,11 @@
 	Ifindex int32
 }
 
+const (
+	SizeofSockFilter = 0x8
+	SizeofSockFprog  = 0x10
+)
+
 type SockFilter struct {
 	Code uint16
 	Jt   uint8
@@ -525,9 +425,9 @@
 }
 
 type SockFprog struct {
-	Len          uint16
-	Pad_godefs_0 [6]byte
-	Filter       *SockFilter
+	Len       uint16
+	Pad_cgo_0 [6]byte
+	Filter    *SockFilter
 }
 
 type InotifyEvent struct {
@@ -535,8 +435,11 @@
 	Mask   uint32
 	Cookie uint32
 	Len    uint32
+	Name   [0]byte
 }
 
+const SizeofInotifyEvent = 0x10
+
 type PtraceRegs struct {
 	R15      uint64
 	R14      uint64
@@ -572,22 +475,22 @@
 }
 
 type Sysinfo_t struct {
-	Uptime       int64
-	Loads        [3]uint64
-	Totalram     uint64
-	Freeram      uint64
-	Sharedram    uint64
-	Bufferram    uint64
-	Totalswap    uint64
-	Freeswap     uint64
-	Procs        uint16
-	Pad          uint16
-	Pad_godefs_0 [4]byte
-	Totalhigh    uint64
-	Freehigh     uint64
-	Unit         uint32
-	X_f          [0]int8
-	Pad_godefs_1 [4]byte
+	Uptime    int64
+	Loads     [3]uint64
+	Totalram  uint64
+	Freeram   uint64
+	Sharedram uint64
+	Bufferram uint64
+	Totalswap uint64
+	Freeswap  uint64
+	Procs     uint16
+	Pad       uint16
+	Pad_cgo_0 [4]byte
+	Totalhigh uint64
+	Freehigh  uint64
+	Unit      uint32
+	X_f       [0]byte
+	Pad_cgo_1 [4]byte
 }
 
 type Utsname struct {
@@ -600,12 +503,12 @@
 }
 
 type Ustat_t struct {
-	Tfree        int32
-	Pad_godefs_0 [4]byte
-	Tinode       uint64
-	Fname        [6]int8
-	Fpack        [6]int8
-	Pad_godefs_1 [4]byte
+	Tfree     int32
+	Pad_cgo_0 [4]byte
+	Tinode    uint64
+	Fname     [6]int8
+	Fpack     [6]int8
+	Pad_cgo_1 [4]byte
 }
 
 type EpollEvent struct {
@@ -615,13 +518,115 @@
 }
 
 type Termios struct {
-	Iflag        uint32
-	Oflag        uint32
-	Cflag        uint32
-	Lflag        uint32
-	Line         uint8
-	Cc           [32]uint8
-	Pad_godefs_0 [3]byte
-	Ispeed       uint32
-	Ospeed       uint32
+	Iflag     uint32
+	Oflag     uint32
+	Cflag     uint32
+	Lflag     uint32
+	Line      uint8
+	Cc        [32]uint8
+	Pad_cgo_0 [3]byte
+	Ispeed    uint32
+	Ospeed    uint32
 }
+
+const (
+	VINTR    = 0x0
+	VQUIT    = 0x1
+	VERASE   = 0x2
+	VKILL    = 0x3
+	VEOF     = 0x4
+	VTIME    = 0x5
+	VMIN     = 0x6
+	VSWTC    = 0x7
+	VSTART   = 0x8
+	VSTOP    = 0x9
+	VSUSP    = 0xa
+	VEOL     = 0xb
+	VREPRINT = 0xc
+	VDISCARD = 0xd
+	VWERASE  = 0xe
+	VLNEXT   = 0xf
+	VEOL2    = 0x10
+	IGNBRK   = 0x1
+	BRKINT   = 0x2
+	IGNPAR   = 0x4
+	PARMRK   = 0x8
+	INPCK    = 0x10
+	ISTRIP   = 0x20
+	INLCR    = 0x40
+	IGNCR    = 0x80
+	ICRNL    = 0x100
+	IUCLC    = 0x200
+	IXON     = 0x400
+	IXANY    = 0x800
+	IXOFF    = 0x1000
+	IMAXBEL  = 0x2000
+	IUTF8    = 0x4000
+	OPOST    = 0x1
+	OLCUC    = 0x2
+	ONLCR    = 0x4
+	OCRNL    = 0x8
+	ONOCR    = 0x10
+	ONLRET   = 0x20
+	OFILL    = 0x40
+	OFDEL    = 0x80
+	B0       = 0x0
+	B50      = 0x1
+	B75      = 0x2
+	B110     = 0x3
+	B134     = 0x4
+	B150     = 0x5
+	B200     = 0x6
+	B300     = 0x7
+	B600     = 0x8
+	B1200    = 0x9
+	B1800    = 0xa
+	B2400    = 0xb
+	B4800    = 0xc
+	B9600    = 0xd
+	B19200   = 0xe
+	B38400   = 0xf
+	CSIZE    = 0x30
+	CS5      = 0x0
+	CS6      = 0x10
+	CS7      = 0x20
+	CS8      = 0x30
+	CSTOPB   = 0x40
+	CREAD    = 0x80
+	PARENB   = 0x100
+	PARODD   = 0x200
+	HUPCL    = 0x400
+	CLOCAL   = 0x800
+	B57600   = 0x1001
+	B115200  = 0x1002
+	B230400  = 0x1003
+	B460800  = 0x1004
+	B500000  = 0x1005
+	B576000  = 0x1006
+	B921600  = 0x1007
+	B1000000 = 0x1008
+	B1152000 = 0x1009
+	B1500000 = 0x100a
+	B2000000 = 0x100b
+	B2500000 = 0x100c
+	B3000000 = 0x100d
+	B3500000 = 0x100e
+	B4000000 = 0x100f
+	ISIG     = 0x1
+	ICANON   = 0x2
+	XCASE    = 0x4
+	ECHO     = 0x8
+	ECHOE    = 0x10
+	ECHOK    = 0x20
+	ECHONL   = 0x40
+	NOFLSH   = 0x80
+	TOSTOP   = 0x100
+	ECHOCTL  = 0x200
+	ECHOPRT  = 0x400
+	ECHOKE   = 0x800
+	FLUSHO   = 0x1000
+	PENDIN   = 0x4000
+	IEXTEN   = 0x8000
+	TCGETS   = 0x5401
+	TCSETS   = 0x5402
+)