From 9a75c748367c2ff84de355b136c33760a6b6928a Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 29 Aug 2014 16:00:31 -0400 Subject: runtime: include constants and defs_*_*.h types in generated Go defs I had to rename Kevent and Sigaction to avoid the functions of the same (lowercase) name. LGTM=iant, r R=golang-codereviews, r, iant, aram.h CC=dvyukov, golang-codereviews, khr https://golang.org/cl/140740043 --- src/pkg/runtime/defs.c | 1 + src/pkg/runtime/defs_darwin_386.h | 8 ++++---- src/pkg/runtime/defs_darwin_amd64.h | 8 ++++---- src/pkg/runtime/defs_dragonfly_386.h | 4 ++-- src/pkg/runtime/defs_dragonfly_amd64.h | 4 ++-- src/pkg/runtime/defs_freebsd_386.h | 4 ++-- src/pkg/runtime/defs_freebsd_amd64.h | 4 ++-- src/pkg/runtime/defs_freebsd_arm.h | 4 ++-- src/pkg/runtime/defs_linux_386.h | 4 ++-- src/pkg/runtime/defs_linux_amd64.h | 4 ++-- src/pkg/runtime/defs_linux_arm.h | 4 ++-- src/pkg/runtime/defs_netbsd_386.h | 4 ++-- src/pkg/runtime/defs_netbsd_amd64.h | 4 ++-- src/pkg/runtime/defs_netbsd_arm.h | 4 ++-- src/pkg/runtime/defs_openbsd_386.h | 4 ++-- src/pkg/runtime/defs_openbsd_amd64.h | 4 ++-- src/pkg/runtime/defs_solaris_amd64.h | 4 ++-- src/pkg/runtime/malloc.go | 16 +++++++--------- src/pkg/runtime/netpoll_kqueue.c | 6 +++--- src/pkg/runtime/os_darwin.c | 4 ++-- src/pkg/runtime/os_darwin.h | 4 ++-- src/pkg/runtime/os_dragonfly.c | 6 +++--- src/pkg/runtime/os_freebsd.c | 6 +++--- src/pkg/runtime/os_linux.c | 4 ++-- src/pkg/runtime/os_linux.h | 4 ++-- src/pkg/runtime/os_netbsd.c | 6 +++--- src/pkg/runtime/os_openbsd.c | 6 +++--- src/pkg/runtime/os_solaris.c | 6 +++--- src/pkg/runtime/os_solaris.h | 2 +- 29 files changed, 71 insertions(+), 72 deletions(-) (limited to 'src/pkg') diff --git a/src/pkg/runtime/defs.c b/src/pkg/runtime/defs.c index 7563344578..b6ed9c8115 100644 --- a/src/pkg/runtime/defs.c +++ b/src/pkg/runtime/defs.c @@ -12,3 +12,4 @@ #include "race.h" #include "chan.h" #include "mprof.h" +#include "defs_GOOS_GOARCH.h" diff --git a/src/pkg/runtime/defs_darwin_386.h b/src/pkg/runtime/defs_darwin_386.h index 7b210eebf8..0e0b4fbf79 100644 --- a/src/pkg/runtime/defs_darwin_386.h +++ b/src/pkg/runtime/defs_darwin_386.h @@ -124,7 +124,7 @@ typedef struct MachHeader MachHeader; typedef struct MachNDR MachNDR; typedef struct MachPort MachPort; typedef struct StackT StackT; -typedef struct Sigaction Sigaction; +typedef struct SigactionT SigactionT; typedef struct Siginfo Siginfo; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; @@ -142,7 +142,7 @@ typedef struct FloatState32 FloatState32; typedef struct ExceptionState32 ExceptionState32; typedef struct Mcontext32 Mcontext32; typedef struct Ucontext Ucontext; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -182,7 +182,7 @@ struct StackT { }; typedef byte Sighandler[4]; -struct Sigaction { +struct SigactionT { byte __sigaction_u[4]; void *sa_tramp; uint32 sa_mask; @@ -379,7 +379,7 @@ struct Ucontext { Mcontext32 *uc_mcontext; }; -struct Kevent { +struct KeventT { uint32 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_darwin_amd64.h b/src/pkg/runtime/defs_darwin_amd64.h index 2d464a9e50..4bf83c1cb9 100644 --- a/src/pkg/runtime/defs_darwin_amd64.h +++ b/src/pkg/runtime/defs_darwin_amd64.h @@ -124,7 +124,7 @@ typedef struct MachHeader MachHeader; typedef struct MachNDR MachNDR; typedef struct MachPort MachPort; typedef struct StackT StackT; -typedef struct Sigaction Sigaction; +typedef struct SigactionT SigactionT; typedef struct Siginfo Siginfo; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; @@ -142,7 +142,7 @@ typedef struct FloatState32 FloatState32; typedef struct ExceptionState32 ExceptionState32; typedef struct Mcontext32 Mcontext32; typedef struct Ucontext Ucontext; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -183,7 +183,7 @@ struct StackT { }; typedef byte Sighandler[8]; -struct Sigaction { +struct SigactionT { byte __sigaction_u[8]; void *sa_tramp; uint32 sa_mask; @@ -382,7 +382,7 @@ struct Ucontext { Mcontext64 *uc_mcontext; }; -struct Kevent { +struct KeventT { uint64 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_dragonfly_386.h b/src/pkg/runtime/defs_dragonfly_386.h index 696dcd887d..032b23574e 100644 --- a/src/pkg/runtime/defs_dragonfly_386.h +++ b/src/pkg/runtime/defs_dragonfly_386.h @@ -94,7 +94,7 @@ typedef struct Ucontext Ucontext; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -185,7 +185,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint32 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_dragonfly_amd64.h b/src/pkg/runtime/defs_dragonfly_amd64.h index 74581cc94c..c37a72e729 100644 --- a/src/pkg/runtime/defs_dragonfly_amd64.h +++ b/src/pkg/runtime/defs_dragonfly_amd64.h @@ -94,7 +94,7 @@ typedef struct Ucontext Ucontext; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -195,7 +195,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint64 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_freebsd_386.h b/src/pkg/runtime/defs_freebsd_386.h index fab9385269..e625079bc7 100644 --- a/src/pkg/runtime/defs_freebsd_386.h +++ b/src/pkg/runtime/defs_freebsd_386.h @@ -98,7 +98,7 @@ typedef struct Ucontext Ucontext; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -200,7 +200,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint32 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_freebsd_amd64.h b/src/pkg/runtime/defs_freebsd_amd64.h index c1db91803e..40476f9e4f 100644 --- a/src/pkg/runtime/defs_freebsd_amd64.h +++ b/src/pkg/runtime/defs_freebsd_amd64.h @@ -98,7 +98,7 @@ typedef struct Ucontext Ucontext; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -211,7 +211,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint64 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_freebsd_arm.h b/src/pkg/runtime/defs_freebsd_arm.h index 4fc452e457..927d3a48b5 100644 --- a/src/pkg/runtime/defs_freebsd_arm.h +++ b/src/pkg/runtime/defs_freebsd_arm.h @@ -98,7 +98,7 @@ typedef struct Ucontext Ucontext; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -173,7 +173,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint32 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_linux_386.h b/src/pkg/runtime/defs_linux_386.h index 27dae9e82b..2df3f66d80 100644 --- a/src/pkg/runtime/defs_linux_386.h +++ b/src/pkg/runtime/defs_linux_386.h @@ -95,7 +95,7 @@ typedef struct Xmmreg Xmmreg; typedef struct Fpstate Fpstate; typedef struct Timespec Timespec; typedef struct Timeval Timeval; -typedef struct Sigaction Sigaction; +typedef struct SigactionT SigactionT; typedef struct Siginfo Siginfo; typedef struct Sigaltstack Sigaltstack; typedef struct Sigcontext Sigcontext; @@ -144,7 +144,7 @@ struct Timeval { int32 tv_sec; int32 tv_usec; }; -struct Sigaction { +struct SigactionT { void *k_sa_handler; uint32 sa_flags; void *sa_restorer; diff --git a/src/pkg/runtime/defs_linux_amd64.h b/src/pkg/runtime/defs_linux_amd64.h index 3e87df68a1..42826c39ee 100644 --- a/src/pkg/runtime/defs_linux_amd64.h +++ b/src/pkg/runtime/defs_linux_amd64.h @@ -88,7 +88,7 @@ enum { typedef struct Timespec Timespec; typedef struct Timeval Timeval; -typedef struct Sigaction Sigaction; +typedef struct SigactionT SigactionT; typedef struct Siginfo Siginfo; typedef struct Itimerval Itimerval; typedef struct EpollEvent EpollEvent; @@ -103,7 +103,7 @@ struct Timeval { int64 tv_sec; int64 tv_usec; }; -struct Sigaction { +struct SigactionT { void *sa_handler; uint64 sa_flags; void *sa_restorer; diff --git a/src/pkg/runtime/defs_linux_arm.h b/src/pkg/runtime/defs_linux_arm.h index 05a17af64b..8c17e3805b 100644 --- a/src/pkg/runtime/defs_linux_arm.h +++ b/src/pkg/runtime/defs_linux_arm.h @@ -151,8 +151,8 @@ struct Siginfo { uint8 _sifields[4]; }; -typedef struct Sigaction Sigaction; -struct Sigaction { +typedef struct SigactionT SigactionT; +struct SigactionT { void *sa_handler; uint32 sa_flags; void *sa_restorer; diff --git a/src/pkg/runtime/defs_netbsd_386.h b/src/pkg/runtime/defs_netbsd_386.h index 7fd66959f3..fb23611990 100644 --- a/src/pkg/runtime/defs_netbsd_386.h +++ b/src/pkg/runtime/defs_netbsd_386.h @@ -91,7 +91,7 @@ typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; typedef struct McontextT McontextT; typedef struct UcontextT UcontextT; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -143,7 +143,7 @@ struct UcontextT { int32 __uc_pad[4]; }; -struct Kevent { +struct KeventT { uint32 ident; uint32 filter; uint32 flags; diff --git a/src/pkg/runtime/defs_netbsd_amd64.h b/src/pkg/runtime/defs_netbsd_amd64.h index 972af165b7..f6ba3db189 100644 --- a/src/pkg/runtime/defs_netbsd_amd64.h +++ b/src/pkg/runtime/defs_netbsd_amd64.h @@ -91,7 +91,7 @@ typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; typedef struct McontextT McontextT; typedef struct UcontextT UcontextT; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -147,7 +147,7 @@ struct UcontextT { McontextT uc_mcontext; }; -struct Kevent { +struct KeventT { uint64 ident; uint32 filter; uint32 flags; diff --git a/src/pkg/runtime/defs_netbsd_arm.h b/src/pkg/runtime/defs_netbsd_arm.h index c6f5b1c47c..815d54749b 100644 --- a/src/pkg/runtime/defs_netbsd_arm.h +++ b/src/pkg/runtime/defs_netbsd_arm.h @@ -91,7 +91,7 @@ typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; typedef struct McontextT McontextT; typedef struct UcontextT UcontextT; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -147,7 +147,7 @@ struct UcontextT { int32 __uc_pad[2]; }; -struct Kevent { +struct KeventT { uint32 ident; uint32 filter; uint32 flags; diff --git a/src/pkg/runtime/defs_openbsd_386.h b/src/pkg/runtime/defs_openbsd_386.h index b8f993e2b8..a63b182a04 100644 --- a/src/pkg/runtime/defs_openbsd_386.h +++ b/src/pkg/runtime/defs_openbsd_386.h @@ -89,7 +89,7 @@ typedef struct StackT StackT; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -155,7 +155,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint32 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_openbsd_amd64.h b/src/pkg/runtime/defs_openbsd_amd64.h index a1ae2ef65c..818ac35207 100644 --- a/src/pkg/runtime/defs_openbsd_amd64.h +++ b/src/pkg/runtime/defs_openbsd_amd64.h @@ -89,7 +89,7 @@ typedef struct StackT StackT; typedef struct Timespec Timespec; typedef struct Timeval Timeval; typedef struct Itimerval Itimerval; -typedef struct Kevent Kevent; +typedef struct KeventT KeventT; #pragma pack on @@ -166,7 +166,7 @@ struct Itimerval { Timeval it_value; }; -struct Kevent { +struct KeventT { uint64 ident; int16 filter; uint16 flags; diff --git a/src/pkg/runtime/defs_solaris_amd64.h b/src/pkg/runtime/defs_solaris_amd64.h index 799724fadc..08727b017e 100644 --- a/src/pkg/runtime/defs_solaris_amd64.h +++ b/src/pkg/runtime/defs_solaris_amd64.h @@ -105,7 +105,7 @@ typedef struct Sigaltstack Sigaltstack; typedef struct Sigset Sigset; typedef struct StackT StackT; typedef struct Siginfo Siginfo; -typedef struct Sigaction Sigaction; +typedef struct SigactionT SigactionT; typedef struct Fpregset Fpregset; typedef struct Mcontext Mcontext; typedef struct Ucontext Ucontext; @@ -149,7 +149,7 @@ struct Siginfo { int32 si_pad; byte __data[240]; }; -struct Sigaction { +struct SigactionT { int32 sa_flags; byte Pad_cgo_0[4]; byte _funcptr[8]; diff --git a/src/pkg/runtime/malloc.go b/src/pkg/runtime/malloc.go index e95bdbbf97..49afc67364 100644 --- a/src/pkg/runtime/malloc.go +++ b/src/pkg/runtime/malloc.go @@ -22,15 +22,13 @@ const ( pageSize = 1 << pageShift pageMask = pageSize - 1 - gcBits = 4 - wordsPerBitmapByte = 8 / gcBits - bitsPerPointer = 2 - bitsMask = 1<