diff --git a/internal/build/build.go b/internal/build/build.go index b12d16ce..f079450f 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -205,12 +205,11 @@ func Do(args []string, conf *Config) ([]Package, error) { cfg.Mode |= packages.NeedForTest } - if len(llruntime.OverlayFiles) > 0 { - cfg.Overlay = make(map[string][]byte) - for file, src := range llruntime.OverlayFiles { - overlay := unsafe.Slice(unsafe.StringData(src), len(src)) - cfg.Overlay[filepath.Join(env.GOROOT(), "src", file)] = overlay - } + cfg.Overlay = make(map[string][]byte) + clearRuntime(cfg.Overlay, filepath.Join(env.GOROOT(), "src", "runtime")) + for file, src := range llruntime.OverlayFiles { + overlay := unsafe.Slice(unsafe.StringData(src), len(src)) + cfg.Overlay[filepath.Join(env.GOROOT(), "src", file)] = overlay } cl.EnableDebug(IsDbgEnabled()) @@ -322,6 +321,23 @@ func Do(args []string, conf *Config) ([]Package, error) { return dpkg, nil } +func clearRuntime(overlay map[string][]byte, runtimePath string) { + files, err := filepath.Glob(runtimePath + "/*.go") + if err != nil { + panic(err) + } + for _, file := range files { + overlay[file] = []byte("package runtime\n") + } + files, err = filepath.Glob(runtimePath + "/*.s") + if err != nil { + panic(err) + } + for _, file := range files { + overlay[file] = []byte("\n") + } +} + func needLink(pkg *packages.Package, mode Mode) bool { if mode == ModeTest { return strings.HasSuffix(pkg.ID, ".test") diff --git a/runtime/_overlay/net/textproto/textproto.go b/runtime/_overlay/net/textproto/textproto.go index 559d3a4f..cf41b725 100644 --- a/runtime/_overlay/net/textproto/textproto.go +++ b/runtime/_overlay/net/textproto/textproto.go @@ -24,11 +24,6 @@ // with a single network connection. package textproto -/* -#include -*/ -import "C" - import ( "bufio" "errors" @@ -97,55 +92,55 @@ const ( type SockAddr struct { Len uint8 Family uint8 - Data [14]C.char + Data [14]uint8 } type AddrInfo struct { - Flags C.int - Family C.int - SockType C.int - Protocol C.int - AddrLen C.uint - CanOnName *C.char + Flags int32 + Family int32 + SockType int32 + Protocol int32 + AddrLen uint32 + CanOnName *uint8 Addr *SockAddr Next *AddrInfo } //go:linkname Getaddrinfo C.getaddrinfo -func Getaddrinfo(host *C.char, port *C.char, addrInfo *AddrInfo, result **AddrInfo) C.int +func Getaddrinfo(host *uint8, port *uint8, addrInfo *AddrInfo, result **AddrInfo) int32 //go:linkname Freeaddrinfo C.freeaddrinfo -func Freeaddrinfo(addrInfo *AddrInfo) C.int +func Freeaddrinfo(addrInfo *AddrInfo) int32 //go:linkname GoString llgo.string -func GoString(cstr *C.char, __llgo_va_list /* n */ ...any) string +func GoString(cstr *uint8, __llgo_va_list /* n */ ...any) string //go:linkname AllocaCStr llgo.allocaCStr -func AllocaCStr(s string) *C.char +func AllocaCStr(s string) *uint8 //go:linkname Memset C.memset -func Memset(s unsafe.Pointer, c C.int, n uintptr) unsafe.Pointer +func Memset(s unsafe.Pointer, c int32, n uintptr) unsafe.Pointer //go:linkname Read C.read -func Read(fd C.int, buf unsafe.Pointer, count uintptr) int +func Read(fd int32, buf unsafe.Pointer, count uintptr) int //go:linkname Write C.write -func Write(fd C.int, buf unsafe.Pointer, count uintptr) int +func Write(fd int32, buf unsafe.Pointer, count uintptr) int //go:linkname Close C.close -func Close(fd C.int) C.int +func Close(fd int32) int32 //go:linkname Strerror strerror -func Strerror(errnum C.int) *C.char +func Strerror(errnum int32) *uint8 //go:linkname Errno C.cliteErrno -func Errno() C.int +func Errno() int32 //go:linkname Socket C.socket -func Socket(domain C.int, typ C.int, protocol C.int) C.int +func Socket(domain int32, typ int32, protocol int32) int32 //go:linkname Connect C.connect -func Connect(sockfd C.int, addr *SockAddr, addrlen C.uint) C.int +func Connect(sockfd int32, addr *SockAddr, addrlen uint32) int32 // ----------------------------------------------------------------------------- @@ -204,7 +199,7 @@ func Dial(network, addr string) (*Conn, error) { } type cConn struct { - socketFd C.int + socketFd int32 closed bool } @@ -218,7 +213,7 @@ func (conn *cConn) Read(p []byte) (n int, err error) { for n < len(p) { result := Read(conn.socketFd, unsafe.Pointer(&p[n:][0]), uintptr(len(p)-n)) if result < 0 { - if Errno() == C.int(syscall.EINTR) { + if Errno() == int32(syscall.EINTR) { continue } return n, errors.New("read error") @@ -238,7 +233,7 @@ func (conn *cConn) Write(p []byte) (n int, err error) { for n < len(p) { result := Write(conn.socketFd, unsafe.Pointer(&p[n:][0]), uintptr(len(p)-n)) if result < 0 { - if Errno() == C.int(syscall.EINTR) { + if Errno() == int32(syscall.EINTR) { continue } return n, errors.New("write error") diff --git a/runtime/_overlay/runtime/runtime.go b/runtime/_overlay/runtime/runtime.go new file mode 100644 index 00000000..f4e1ce63 --- /dev/null +++ b/runtime/_overlay/runtime/runtime.go @@ -0,0 +1,482 @@ +package runtime + +func Goexit() { + panic("todo") +} + +func KeepAlive(x any) { + panic("todo") +} + +func SetFinalizer(obj any, finalizer any) { + panic("todo") +} + +const GOOS = "" +const GOARCH = "" + +func GOMAXPROCS(n int) int { + panic("todo") +} + +func GC() { + panic("todo") +} + +func GOROOT() string { + panic("todo") +} + +func Caller(skip int) (pc uintptr, file string, line int, ok bool) { + panic("todo") +} + +func Callers(skip int, pc []uintptr) int { + panic("todo") +} + +type Func struct { + opaque struct{} // unexported field to disallow conversions +} + +func (f *Func) Name() string { + panic("todo") +} + +func FuncForPC(pc uintptr) *Func { + panic("todo") +} + +type nih struct{} + +type NotInHeap struct{ _ nih } + +type FuncID uint8 + +type FuncFlag uint8 + +type _func struct { + NotInHeap // Only in static data + + entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart + nameOff int32 // function name, as index into moduledata.funcnametab. + + args int32 // in/out args size + deferreturn uint32 // offset of start of a deferreturn call instruction from entry, if any. + + pcsp uint32 + pcfile uint32 + pcln uint32 + npcdata uint32 + cuOffset uint32 // runtime.cutab offset of this function's CU + startLine int32 // line number of start of function (func keyword/TEXT directive) + funcID FuncID // set for certain special runtime functions + flag FuncFlag + _ [1]byte // pad + nfuncdata uint8 // must be last, must end on a uint32-aligned boundary +} + +type moduledata struct{} + +type funcInfo struct { + *_func + datap *moduledata +} + +type Frame struct { + PC uintptr + Func *Func + Function string + File string + Line int + startLine int + Entry uintptr + funcInfo funcInfo +} + +type Frames struct { + callers []uintptr + nextPC uintptr + frames []Frame + frameStore [2]Frame +} + +func (ci *Frames) Next() (frame Frame, more bool) { + panic("todo") +} + +func CallersFrames(callers []uintptr) *Frames { + panic("todo") +} + +func Stack(buf []byte, all bool) int { + panic("todo") +} + +func Version() string { + panic("todo") +} + +type MemStats struct { + // General statistics. + + // Alloc is bytes of allocated heap objects. + // + // This is the same as HeapAlloc (see below). + Alloc uint64 + + // TotalAlloc is cumulative bytes allocated for heap objects. + // + // TotalAlloc increases as heap objects are allocated, but + // unlike Alloc and HeapAlloc, it does not decrease when + // objects are freed. + TotalAlloc uint64 + + // Sys is the total bytes of memory obtained from the OS. + // + // Sys is the sum of the XSys fields below. Sys measures the + // virtual address space reserved by the Go runtime for the + // heap, stacks, and other internal data structures. It's + // likely that not all of the virtual address space is backed + // by physical memory at any given moment, though in general + // it all was at some point. + Sys uint64 + + // Lookups is the number of pointer lookups performed by the + // runtime. + // + // This is primarily useful for debugging runtime internals. + Lookups uint64 + + // Mallocs is the cumulative count of heap objects allocated. + // The number of live objects is Mallocs - Frees. + Mallocs uint64 + + // Frees is the cumulative count of heap objects freed. + Frees uint64 + + // Heap memory statistics. + // + // Interpreting the heap statistics requires some knowledge of + // how Go organizes memory. Go divides the virtual address + // space of the heap into "spans", which are contiguous + // regions of memory 8K or larger. A span may be in one of + // three states: + // + // An "idle" span contains no objects or other data. The + // physical memory backing an idle span can be released back + // to the OS (but the virtual address space never is), or it + // can be converted into an "in use" or "stack" span. + // + // An "in use" span contains at least one heap object and may + // have free space available to allocate more heap objects. + // + // A "stack" span is used for goroutine stacks. Stack spans + // are not considered part of the heap. A span can change + // between heap and stack memory; it is never used for both + // simultaneously. + + // HeapAlloc is bytes of allocated heap objects. + // + // "Allocated" heap objects include all reachable objects, as + // well as unreachable objects that the garbage collector has + // not yet freed. Specifically, HeapAlloc increases as heap + // objects are allocated and decreases as the heap is swept + // and unreachable objects are freed. Sweeping occurs + // incrementally between GC cycles, so these two processes + // occur simultaneously, and as a result HeapAlloc tends to + // change smoothly (in contrast with the sawtooth that is + // typical of stop-the-world garbage collectors). + HeapAlloc uint64 + + // HeapSys is bytes of heap memory obtained from the OS. + // + // HeapSys measures the amount of virtual address space + // reserved for the heap. This includes virtual address space + // that has been reserved but not yet used, which consumes no + // physical memory, but tends to be small, as well as virtual + // address space for which the physical memory has been + // returned to the OS after it became unused (see HeapReleased + // for a measure of the latter). + // + // HeapSys estimates the largest size the heap has had. + HeapSys uint64 + + // HeapIdle is bytes in idle (unused) spans. + // + // Idle spans have no objects in them. These spans could be + // (and may already have been) returned to the OS, or they can + // be reused for heap allocations, or they can be reused as + // stack memory. + // + // HeapIdle minus HeapReleased estimates the amount of memory + // that could be returned to the OS, but is being retained by + // the runtime so it can grow the heap without requesting more + // memory from the OS. If this difference is significantly + // larger than the heap size, it indicates there was a recent + // transient spike in live heap size. + HeapIdle uint64 + + // HeapInuse is bytes in in-use spans. + // + // In-use spans have at least one object in them. These spans + // can only be used for other objects of roughly the same + // size. + // + // HeapInuse minus HeapAlloc estimates the amount of memory + // that has been dedicated to particular size classes, but is + // not currently being used. This is an upper bound on + // fragmentation, but in general this memory can be reused + // efficiently. + HeapInuse uint64 + + // HeapReleased is bytes of physical memory returned to the OS. + // + // This counts heap memory from idle spans that was returned + // to the OS and has not yet been reacquired for the heap. + HeapReleased uint64 + + // HeapObjects is the number of allocated heap objects. + // + // Like HeapAlloc, this increases as objects are allocated and + // decreases as the heap is swept and unreachable objects are + // freed. + HeapObjects uint64 + + // Stack memory statistics. + // + // Stacks are not considered part of the heap, but the runtime + // can reuse a span of heap memory for stack memory, and + // vice-versa. + + // StackInuse is bytes in stack spans. + // + // In-use stack spans have at least one stack in them. These + // spans can only be used for other stacks of the same size. + // + // There is no StackIdle because unused stack spans are + // returned to the heap (and hence counted toward HeapIdle). + StackInuse uint64 + + // StackSys is bytes of stack memory obtained from the OS. + // + // StackSys is StackInuse, plus any memory obtained directly + // from the OS for OS thread stacks. + // + // In non-cgo programs this metric is currently equal to StackInuse + // (but this should not be relied upon, and the value may change in + // the future). + // + // In cgo programs this metric includes OS thread stacks allocated + // directly from the OS. Currently, this only accounts for one stack in + // c-shared and c-archive build modes and other sources of stacks from + // the OS (notably, any allocated by C code) are not currently measured. + // Note this too may change in the future. + StackSys uint64 + + // Off-heap memory statistics. + // + // The following statistics measure runtime-internal + // structures that are not allocated from heap memory (usually + // because they are part of implementing the heap). Unlike + // heap or stack memory, any memory allocated to these + // structures is dedicated to these structures. + // + // These are primarily useful for debugging runtime memory + // overheads. + + // MSpanInuse is bytes of allocated mspan structures. + MSpanInuse uint64 + + // MSpanSys is bytes of memory obtained from the OS for mspan + // structures. + MSpanSys uint64 + + // MCacheInuse is bytes of allocated mcache structures. + MCacheInuse uint64 + + // MCacheSys is bytes of memory obtained from the OS for + // mcache structures. + MCacheSys uint64 + + // BuckHashSys is bytes of memory in profiling bucket hash tables. + BuckHashSys uint64 + + // GCSys is bytes of memory in garbage collection metadata. + GCSys uint64 + + // OtherSys is bytes of memory in miscellaneous off-heap + // runtime allocations. + OtherSys uint64 + + // Garbage collector statistics. + + // NextGC is the target heap size of the next GC cycle. + // + // The garbage collector's goal is to keep HeapAlloc ≤ NextGC. + // At the end of each GC cycle, the target for the next cycle + // is computed based on the amount of reachable data and the + // value of GOGC. + NextGC uint64 + + // LastGC is the time the last garbage collection finished, as + // nanoseconds since 1970 (the UNIX epoch). + LastGC uint64 + + // PauseTotalNs is the cumulative nanoseconds in GC + // stop-the-world pauses since the program started. + // + // During a stop-the-world pause, all goroutines are paused + // and only the garbage collector can run. + PauseTotalNs uint64 + + // PauseNs is a circular buffer of recent GC stop-the-world + // pause times in nanoseconds. + // + // The most recent pause is at PauseNs[(NumGC+255)%256]. In + // general, PauseNs[N%256] records the time paused in the most + // recent N%256th GC cycle. There may be multiple pauses per + // GC cycle; this is the sum of all pauses during a cycle. + PauseNs [256]uint64 + + // PauseEnd is a circular buffer of recent GC pause end times, + // as nanoseconds since 1970 (the UNIX epoch). + // + // This buffer is filled the same way as PauseNs. There may be + // multiple pauses per GC cycle; this records the end of the + // last pause in a cycle. + PauseEnd [256]uint64 + + // NumGC is the number of completed GC cycles. + NumGC uint32 + + // NumForcedGC is the number of GC cycles that were forced by + // the application calling the GC function. + NumForcedGC uint32 + + // GCCPUFraction is the fraction of this program's available + // CPU time used by the GC since the program started. + // + // GCCPUFraction is expressed as a number between 0 and 1, + // where 0 means GC has consumed none of this program's CPU. A + // program's available CPU time is defined as the integral of + // GOMAXPROCS since the program started. That is, if + // GOMAXPROCS is 2 and a program has been running for 10 + // seconds, its "available CPU" is 20 seconds. GCCPUFraction + // does not include CPU time used for write barrier activity. + // + // This is the same as the fraction of CPU reported by + // GODEBUG=gctrace=1. + GCCPUFraction float64 + + // EnableGC indicates that GC is enabled. It is always true, + // even if GOGC=off. + EnableGC bool + + // DebugGC is currently unused. + DebugGC bool + + // BySize reports per-size class allocation statistics. + // + // BySize[N] gives statistics for allocations of size S where + // BySize[N-1].Size < S ≤ BySize[N].Size. + // + // This does not report allocations larger than BySize[60].Size. + BySize [61]struct { + // Size is the maximum byte size of an object in this + // size class. + Size uint32 + + // Mallocs is the cumulative count of heap objects + // allocated in this size class. The cumulative bytes + // of allocation is Size*Mallocs. The number of live + // objects in this size class is Mallocs - Frees. + Mallocs uint64 + + // Frees is the cumulative count of heap objects freed + // in this size class. + Frees uint64 + } +} + +func ReadMemStats(m *MemStats) { + panic("todo") +} + +type MemProfileRecord struct { + AllocBytes, FreeBytes int64 // number of bytes allocated, freed + AllocObjects, FreeObjects int64 // number of objects allocated, freed + Stack0 [32]uintptr // stack trace for this record; ends at first 0 entry +} + +// InUseBytes returns the number of bytes in use (AllocBytes - FreeBytes). +func (r *MemProfileRecord) InUseBytes() int64 { return r.AllocBytes - r.FreeBytes } + +// InUseObjects returns the number of objects in use (AllocObjects - FreeObjects). +func (r *MemProfileRecord) InUseObjects() int64 { + return r.AllocObjects - r.FreeObjects +} + +var MemProfileRate int = 512 * 1024 + +func MemProfile(p []MemProfileRecord, inuseZero bool) (n int, ok bool) { + panic("todo") +} + +func StartTrace() error { + panic("todo") +} + +func StopTrace() { + panic("todo") +} + +func ReadTrace() []byte { + panic("todo") +} + +func SetBlockProfileRate(rate int) { + panic("todo") +} + +func SetMutexProfileFraction(rate int) int { + panic("todo") +} + +func LockOSThread() { + panic("todo") +} + +func UnlockOSThread() { + panic("todo") +} + +type StackRecord struct { + Stack0 [32]uintptr // stack trace for this record; ends at first 0 entry +} + +func ThreadCreateProfile(p []StackRecord) (n int, ok bool) { + panic("todo") +} + +func NumGoroutine() int { + panic("todo") +} + +func SetCPUProfileRate(hz int) { + panic("todo") +} + +type BlockProfileRecord struct { + Count int64 + Cycles int64 + StackRecord +} + +func BlockProfile(p []BlockProfileRecord) (n int, ok bool) { + panic("todo") +} + +func MutexProfile(p []BlockProfileRecord) (n int, ok bool) { + panic("todo") +} diff --git a/runtime/build.go b/runtime/build.go index 381bd46d..1604e559 100644 --- a/runtime/build.go +++ b/runtime/build.go @@ -26,12 +26,17 @@ var hasAltPkg = map[string]none{ "hash/crc32": {}, "internal/abi": {}, "internal/bytealg": {}, + "internal/chacha8rand": {}, "internal/cpu": {}, "internal/itoa": {}, "internal/godebug": {}, "internal/oserror": {}, "internal/poll": {}, "internal/reflectlite": {}, + "internal/runtime/atomic": {}, + "internal/runtime/maps": {}, + "internal/runtime/sys": {}, + "internal/sync": {}, "internal/syscall/execenv": {}, "internal/syscall/unix": {}, "math": {}, @@ -52,4 +57,5 @@ var hasAltPkg = map[string]none{ "runtime/trace": {}, "runtime/internal/syscall": {}, "io": {}, + "io/fs": {}, } diff --git a/runtime/go.mod b/runtime/go.mod index b9302881..e138fdbe 100644 --- a/runtime/go.mod +++ b/runtime/go.mod @@ -2,4 +2,7 @@ module github.com/goplus/llgo/runtime go 1.20 -require github.com/qiniu/x v1.13.12 +require ( + github.com/goplus/llgo v0.10.1 + github.com/qiniu/x v1.13.12 +) diff --git a/runtime/go.sum b/runtime/go.sum index 3b5a82b2..5dd43fce 100644 --- a/runtime/go.sum +++ b/runtime/go.sum @@ -1,2 +1,4 @@ +github.com/goplus/llgo v0.10.1 h1:Cla7Rv6S67SnAknMm8nNvHhxFf9Fo/daHRcs3w3rS6s= +github.com/goplus/llgo v0.10.1/go.mod h1:YfOHsT/g3lc9b4GclLj812YzdSsJr0kd3CCB830TqHE= github.com/qiniu/x v1.13.12 h1:UyAwja6dgKUOYWZMzzc02wLodwnZ7wmK/0XzRd0e78g= github.com/qiniu/x v1.13.12/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E= diff --git a/runtime/internal/clite/bitcast/_cast/cast.c b/runtime/internal/clite/bitcast/_cast/cast.c index 2d7eeffc..ea567ce5 100644 --- a/runtime/internal/clite/bitcast/_cast/cast.c +++ b/runtime/internal/clite/bitcast/_cast/cast.c @@ -1,28 +1,34 @@ -typedef union { +typedef union +{ double d; - float f; - long v; + float f; + long v; + long long ll; } castUnion; -double llgoToFloat64(long v) { +double llgoToFloat64(long long v) +{ castUnion k; - k.v = v; + k.ll = v; return k.d; } -float llgoToFloat32(long v) { +float llgoToFloat32(int v) +{ castUnion k; k.v = v; return k.f; } -long llgoFromFloat64(double v) { +long long llgoFromFloat64(double v) +{ castUnion k; k.d = v; - return k.v; + return k.ll; } -long llgoFromFloat32(float v) { +int llgoFromFloat32(float v) +{ castUnion k; k.f = v; return k.v; diff --git a/runtime/internal/clite/bitcast/bitcast.go b/runtime/internal/clite/bitcast/bitcast.go index f988fa90..3fa7f6fa 100644 --- a/runtime/internal/clite/bitcast/bitcast.go +++ b/runtime/internal/clite/bitcast/bitcast.go @@ -24,13 +24,13 @@ const ( ) //go:linkname ToFloat64 C.llgoToFloat64 -func ToFloat64(v uintptr) float64 +func ToFloat64(v int64) float64 //go:linkname ToFloat32 C.llgoToFloat32 -func ToFloat32(v uintptr) float32 +func ToFloat32(v int32) float32 //go:linkname FromFloat64 C.llgoFromFloat64 -func FromFloat64(v float64) uintptr +func FromFloat64(v float64) int64 //go:linkname FromFloat32 C.llgoFromFloat32 -func FromFloat32(v float32) uintptr +func FromFloat32(v float32) int32 diff --git a/runtime/internal/clite/byteorder/byteorder.go b/runtime/internal/clite/byteorder/byteorder.go new file mode 100644 index 00000000..01500a87 --- /dev/null +++ b/runtime/internal/clite/byteorder/byteorder.go @@ -0,0 +1,149 @@ +// Copyright 2024 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. + +// Package byteorder provides functions for decoding and encoding +// little and big endian integer types from/to byte slices. +package byteorder + +func LEUint16(b []byte) uint16 { + _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 + return uint16(b[0]) | uint16(b[1])<<8 +} + +func LEPutUint16(b []byte, v uint16) { + _ = b[1] // early bounds check to guarantee safety of writes below + b[0] = byte(v) + b[1] = byte(v >> 8) +} + +func LEAppendUint16(b []byte, v uint16) []byte { + return append(b, + byte(v), + byte(v>>8), + ) +} + +func LEUint32(b []byte) uint32 { + _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func LEPutUint32(b []byte, v uint32) { + _ = b[3] // early bounds check to guarantee safety of writes below + b[0] = byte(v) + b[1] = byte(v >> 8) + b[2] = byte(v >> 16) + b[3] = byte(v >> 24) +} + +func LEAppendUint32(b []byte, v uint32) []byte { + return append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24), + ) +} + +func LEUint64(b []byte) uint64 { + _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} + +func LEPutUint64(b []byte, v uint64) { + _ = b[7] // early bounds check to guarantee safety of writes below + b[0] = byte(v) + b[1] = byte(v >> 8) + b[2] = byte(v >> 16) + b[3] = byte(v >> 24) + b[4] = byte(v >> 32) + b[5] = byte(v >> 40) + b[6] = byte(v >> 48) + b[7] = byte(v >> 56) +} + +func LEAppendUint64(b []byte, v uint64) []byte { + return append(b, + byte(v), + byte(v>>8), + byte(v>>16), + byte(v>>24), + byte(v>>32), + byte(v>>40), + byte(v>>48), + byte(v>>56), + ) +} + +func BEUint16(b []byte) uint16 { + _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 + return uint16(b[1]) | uint16(b[0])<<8 +} + +func BEPutUint16(b []byte, v uint16) { + _ = b[1] // early bounds check to guarantee safety of writes below + b[0] = byte(v >> 8) + b[1] = byte(v) +} + +func BEAppendUint16(b []byte, v uint16) []byte { + return append(b, + byte(v>>8), + byte(v), + ) +} + +func BEUint32(b []byte) uint32 { + _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 + return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 +} + +func BEPutUint32(b []byte, v uint32) { + _ = b[3] // early bounds check to guarantee safety of writes below + b[0] = byte(v >> 24) + b[1] = byte(v >> 16) + b[2] = byte(v >> 8) + b[3] = byte(v) +} + +func BEAppendUint32(b []byte, v uint32) []byte { + return append(b, + byte(v>>24), + byte(v>>16), + byte(v>>8), + byte(v), + ) +} + +func BEUint64(b []byte) uint64 { + _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | + uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 +} + +func BEPutUint64(b []byte, v uint64) { + _ = b[7] // early bounds check to guarantee safety of writes below + b[0] = byte(v >> 56) + b[1] = byte(v >> 48) + b[2] = byte(v >> 40) + b[3] = byte(v >> 32) + b[4] = byte(v >> 24) + b[5] = byte(v >> 16) + b[6] = byte(v >> 8) + b[7] = byte(v) +} + +func BEAppendUint64(b []byte, v uint64) []byte { + return append(b, + byte(v>>56), + byte(v>>48), + byte(v>>40), + byte(v>>32), + byte(v>>24), + byte(v>>16), + byte(v>>8), + byte(v), + ) +} diff --git a/runtime/internal/clite/c.go b/runtime/internal/clite/c.go index 65323f74..8408dd97 100644 --- a/runtime/internal/clite/c.go +++ b/runtime/internal/clite/c.go @@ -14,14 +14,11 @@ * limitations under the License. */ -package clite +package c -// typedef unsigned int uint; -// typedef unsigned long ulong; -// typedef unsigned long long ulonglong; -// typedef long long longlong; -import "C" -import "unsafe" +import ( + "unsafe" +) const ( LLGoPackage = "decl" @@ -41,14 +38,16 @@ type FILE struct { } type ( - Int C.int - Uint C.uint + Int = int32 + Uint = uint32 - Long C.long - Ulong C.ulong + // Long and Ulong are defined in platform-specific files + // Windows (both 32-bit and 64-bit): int32/uint32 + // Unix/Linux/macOS 32-bit: int32/uint32 + // Unix/Linux/macOS 64-bit: int64/uint64 - LongLong C.longlong - UlongLong C.ulonglong + LongLong = int64 + UlongLong = uint64 ) type integer interface { @@ -56,6 +55,7 @@ type integer interface { } type SizeT = uintptr +type SsizeT = Long type IntptrT = uintptr type UintptrT = uintptr @@ -72,6 +72,8 @@ type Uint64T = uint64 type IntmaxT = LongLong type UintmaxT = UlongLong +type VaList = Pointer + //go:linkname Str llgo.cstr func Str(string) *Char @@ -257,6 +259,14 @@ func Perror(s *Char) // ----------------------------------------------------------------------------- +type IconvT = Pointer + +// ----------------------------------------------------------------------------- + +type LocaleT = Pointer + +// ----------------------------------------------------------------------------- + //go:linkname Usleep C.usleep func Usleep(useconds Uint) Int @@ -297,6 +307,3 @@ func GetoptLong(argc Int, argv **Char, optstring *Char, longopts *Option, longin func GetoptLongOnly(argc Int, argv **Char, optstring *Char, longopts *Option, longindex *Int) Int // ----------------------------------------------------------------------------- - -//go:linkname Sysconf C.sysconf -func Sysconf(name Int) Long diff --git a/runtime/internal/clite/ctypes_32bit.go b/runtime/internal/clite/ctypes_32bit.go new file mode 100644 index 00000000..4b4335b7 --- /dev/null +++ b/runtime/internal/clite/ctypes_32bit.go @@ -0,0 +1,27 @@ +//go:build (linux || darwin || freebsd || netbsd || openbsd || solaris) && (386 || arm || mips || mipsle) +// +build linux darwin freebsd netbsd openbsd solaris +// +build 386 arm mips mipsle + +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package c + +// For 32-bit Unix/Linux/macOS, Long is 32-bit +type ( + Long = int32 + Ulong = uint32 +) diff --git a/runtime/internal/clite/ctypes_unix64.go b/runtime/internal/clite/ctypes_unix64.go new file mode 100644 index 00000000..1cbbd578 --- /dev/null +++ b/runtime/internal/clite/ctypes_unix64.go @@ -0,0 +1,27 @@ +//go:build (linux || darwin || freebsd || netbsd || openbsd || solaris) && (amd64 || arm64 || ppc64 || ppc64le || mips64 || mips64le || s390x || riscv64) +// +build linux darwin freebsd netbsd openbsd solaris +// +build amd64 arm64 ppc64 ppc64le mips64 mips64le s390x riscv64 + +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package c + +// For 64-bit Unix/Linux/macOS, Long is 64-bit +type ( + Long = int64 + Ulong = uint64 +) diff --git a/runtime/internal/clite/os/os_linux.go b/runtime/internal/clite/ctypes_wasm.go similarity index 81% rename from runtime/internal/clite/os/os_linux.go rename to runtime/internal/clite/ctypes_wasm.go index 6886a3f2..1c243746 100644 --- a/runtime/internal/clite/os/os_linux.go +++ b/runtime/internal/clite/ctypes_wasm.go @@ -1,4 +1,5 @@ -//go:build linux +//go:build wasip1 || js +// +build wasip1 js /* * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. @@ -16,14 +17,10 @@ * limitations under the License. */ -package os +package c -import "C" - -const ( - LLGoFiles = "_os/os.c" - LLGoPackage = "link" +// For WebAssembly targets, Long is 32-bit per the spec +type ( + Long = int32 + Ulong = uint32 ) - -//go:linkname Clearenv C.clearenv -func Clearenv() diff --git a/runtime/internal/clite/ctypes_windows.go b/runtime/internal/clite/ctypes_windows.go new file mode 100644 index 00000000..19fb0dcc --- /dev/null +++ b/runtime/internal/clite/ctypes_windows.go @@ -0,0 +1,26 @@ +//go:build windows +// +build windows + +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package c + +// For Windows (LLP64 model), Long is 32-bit, regardless of architecture +type ( + Long = int32 + Ulong = uint32 +) diff --git a/runtime/internal/clite/debug/debug.go b/runtime/internal/clite/debug/debug.go index 10e3a41e..f762cb4d 100644 --- a/runtime/internal/clite/debug/debug.go +++ b/runtime/internal/clite/debug/debug.go @@ -1,9 +1,7 @@ +//go:build !wasm + package debug -/* -#cgo linux LDFLAGS: -lunwind -*/ -import "C" import ( "unsafe" @@ -11,8 +9,7 @@ import ( ) const ( - LLGoPackage = "link" - LLGoFiles = "_wrap/debug.c" + LLGoFiles = "_wrap/debug.c" ) type Info struct { diff --git a/runtime/internal/clite/debug/debug_wasm.go b/runtime/internal/clite/debug/debug_wasm.go new file mode 100644 index 00000000..a4d6e4c6 --- /dev/null +++ b/runtime/internal/clite/debug/debug_wasm.go @@ -0,0 +1,33 @@ +package debug + +import ( + "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) + +type Info struct { + Fname *c.Char + Fbase c.Pointer + Sname *c.Char + Saddr c.Pointer +} + +func Address() unsafe.Pointer { + panic("not implemented") +} + +func Addrinfo(addr unsafe.Pointer, info *Info) c.Int { + panic("not implemented") +} + +type Frame struct { + PC uintptr + Offset uintptr + SP unsafe.Pointer + Name string +} + +func StackTrace(skip int, fn func(fr *Frame) bool) { + panic("not implemented") +} diff --git a/runtime/internal/clite/debug/libunwind.go b/runtime/internal/clite/debug/libunwind.go new file mode 100644 index 00000000..f9eaed95 --- /dev/null +++ b/runtime/internal/clite/debug/libunwind.go @@ -0,0 +1,7 @@ +//go:build !linux + +package debug + +const ( + LLGoPackage = "link" +) diff --git a/runtime/internal/clite/debug/libunwind_linux.go b/runtime/internal/clite/debug/libunwind_linux.go new file mode 100644 index 00000000..f8b377ca --- /dev/null +++ b/runtime/internal/clite/debug/libunwind_linux.go @@ -0,0 +1,7 @@ +//go:build linux + +package debug + +const ( + LLGoPackage = "link: -lunwind" +) diff --git a/runtime/internal/clite/ffi/abi.go b/runtime/internal/clite/ffi/abi.go index a693166e..a20bfa9f 100644 --- a/runtime/internal/clite/ffi/abi.go +++ b/runtime/internal/clite/ffi/abi.go @@ -1,4 +1,4 @@ -//go:build ((freebsd || linux || darwin) && arm64) || (windows && (amd64 || arm64)) +//go:build !amd64 package ffi diff --git a/runtime/internal/clite/ffi/abi_amd64.go b/runtime/internal/clite/ffi/abi_amd64.go index 89078adb..c9656557 100644 --- a/runtime/internal/clite/ffi/abi_amd64.go +++ b/runtime/internal/clite/ffi/abi_amd64.go @@ -1,5 +1,3 @@ -//go:build freebsd || linux || darwin - package ffi const ( diff --git a/runtime/internal/clite/goarch/endian_big.go b/runtime/internal/clite/goarch/endian_big.go new file mode 100644 index 00000000..244b2abf --- /dev/null +++ b/runtime/internal/clite/goarch/endian_big.go @@ -0,0 +1,7 @@ +//go:build 386 || amd64 || arm || arm64 || ppc64le || mips64le || mipsle || riscv64 || wasm +// +build 386 amd64 arm arm64 ppc64le mips64le mipsle riscv64 wasm + +package goarch + +const BigEndian = true +const LittleEndian = false diff --git a/runtime/internal/clite/goarch/endian_little.go b/runtime/internal/clite/goarch/endian_little.go new file mode 100644 index 00000000..9ce6b871 --- /dev/null +++ b/runtime/internal/clite/goarch/endian_little.go @@ -0,0 +1,9 @@ +//go:build ppc64 || s390x || mips || mips64 +// +build ppc64 s390x mips mips64 + +package goarch + +const ( + BigEndian = false + LittleEndian = true +) diff --git a/runtime/internal/clite/goarch/goarch.go b/runtime/internal/clite/goarch/goarch.go new file mode 100644 index 00000000..24c0de95 --- /dev/null +++ b/runtime/internal/clite/goarch/goarch.go @@ -0,0 +1,3 @@ +package goarch + +const PtrSize = 4 << (^uintptr(0) >> 63) diff --git a/runtime/internal/clite/libuv/_demo/async/async.go b/runtime/internal/clite/libuv/_demo/async/async.go index 978b4acb..eb97ba0d 100644 --- a/runtime/internal/clite/libuv/_demo/async/async.go +++ b/runtime/internal/clite/libuv/_demo/async/async.go @@ -1,8 +1,8 @@ package main import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/libuv" + "github.com/goplus/llgo/c" + "github.com/goplus/llgo/c/libuv" ) func ensure(b bool, msg string) { diff --git a/runtime/internal/clite/libuv/_demo/async_fs/async_fs.go b/runtime/internal/clite/libuv/_demo/async_fs/async_fs.go index 5c41ee4d..36acff75 100644 --- a/runtime/internal/clite/libuv/_demo/async_fs/async_fs.go +++ b/runtime/internal/clite/libuv/_demo/async_fs/async_fs.go @@ -3,9 +3,9 @@ package main import ( "unsafe" - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/libuv" - "github.com/goplus/lib/c/os" + "github.com/goplus/llgo/c" + "github.com/goplus/llgo/c/libuv" + "github.com/goplus/llgo/c/os" ) const BUFFER_SIZE = 1024 diff --git a/runtime/internal/clite/libuv/_demo/echo_server/echo_server.go b/runtime/internal/clite/libuv/_demo/echo_server/echo_server.go index 1265ebf1..9a208a76 100644 --- a/runtime/internal/clite/libuv/_demo/echo_server/echo_server.go +++ b/runtime/internal/clite/libuv/_demo/echo_server/echo_server.go @@ -1,9 +1,9 @@ package main import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/libuv" - "github.com/goplus/lib/c/net" + "github.com/goplus/llgo/c" + "github.com/goplus/llgo/c/libuv" + "github.com/goplus/llgo/c/net" ) var DEFAULT_PORT c.Int = 8080 diff --git a/runtime/internal/clite/os/os.go b/runtime/internal/clite/os/os.go index c87c6590..cdfd5f66 100644 --- a/runtime/internal/clite/os/os.go +++ b/runtime/internal/clite/os/os.go @@ -16,10 +16,6 @@ package os -// #include -// #include -import "C" - import ( _ "unsafe" @@ -27,10 +23,6 @@ import ( "github.com/goplus/llgo/runtime/internal/clite/syscall" ) -const ( - PATH_MAX = C.PATH_MAX -) - const ( /* get file status flags */ F_GETFL = 3 @@ -58,14 +50,6 @@ const ( EAGAIN = 35 ) -type ( - ModeT C.mode_t - UidT C.uid_t - GidT C.gid_t - OffT C.off_t - DevT C.dev_t -) - type ( StatT = syscall.Stat_t ) @@ -115,12 +99,6 @@ func Truncate(path *c.Char, length OffT) c.Int //go:linkname Chmod C.chmod func Chmod(path *c.Char, mode ModeT) c.Int -//go:linkname Chown C.chown -func Chown(path *c.Char, owner UidT, group GidT) c.Int - -//go:linkname Lchown C.lchown -func Lchown(path *c.Char, owner UidT, group GidT) c.Int - // ----------------------------------------------------------------------------- //go:linkname Getcwd C.getcwd @@ -189,16 +167,6 @@ func Dup2(oldfd c.Int, newfd c.Int) c.Int //go:linkname Dup3 C.dup3 func Dup3(oldfd c.Int, newfd c.Int, flags c.Int) c.Int -/* TODO(xsw): -On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64, pipe() has the following prototype: -struct fd_pair { - long fd[2]; -}; -struct fd_pair pipe(void); -*/ -//go:linkname Pipe C.pipe -func Pipe(fds *[2]c.Int) c.Int - //go:linkname Mkfifo C.mkfifo func Mkfifo(path *c.Char, mode ModeT) c.Int @@ -270,9 +238,6 @@ func Execvp(file *c.Char, argv **c.Char) c.Int type PidT c.Int -//go:linkname Fork C.fork -func Fork() PidT - //go:linkname Getpid C.getpid func Getpid() PidT @@ -293,9 +258,6 @@ func Getppid() PidT //go:linkname Syscall C.syscall func Syscall(sysno c.Long, __llgo_va_list ...any) c.Long -//go:linkname Kill C.kill -func Kill(pid PidT, sig c.Int) c.Int - // If wait() returns due to a stopped or terminated child process, the process ID // of the child is returned to the calling process. Otherwise, a value of -1 is // returned and errno is set to indicate the error. @@ -313,9 +275,6 @@ func Wait(statLoc *c.Int) PidT //go:linkname Wait3 C.wait3 func Wait3(statLoc *c.Int, options c.Int, rusage *syscall.Rusage) PidT -//go:linkname Wait4 C.wait4 -func Wait4(pid PidT, statLoc *c.Int, options c.Int, rusage *syscall.Rusage) PidT - //go:linkname Waitpid C.waitpid func Waitpid(pid PidT, statLoc *c.Int, options c.Int) PidT @@ -324,26 +283,6 @@ func Waitpid(pid PidT, statLoc *c.Int, options c.Int) PidT //go:linkname Exit C.exit func Exit(c.Int) -//go:linkname Getuid C.getuid -func Getuid() UidT - -//go:linkname Geteuid C.geteuid -func Geteuid() UidT - -//go:linkname Getgid C.getgid -func Getgid() GidT - -//go:linkname Getegid C.getegid -func Getegid() GidT - -// ----------------------------------------------------------------------------- - -//go:linkname Getrlimit C.getrlimit -func Getrlimit(resource c.Int, rlp *syscall.Rlimit) c.Int - -//go:linkname Setrlimit C.setrlimit -func Setrlimit(resource c.Int, rlp *syscall.Rlimit) c.Int - // ----------------------------------------------------------------------------- // Upon successful completion, the value 0 is returned; otherwise the value -1 diff --git a/runtime/internal/clite/os/os_darwin.go b/runtime/internal/clite/os/os_darwin.go new file mode 100644 index 00000000..3de6684e --- /dev/null +++ b/runtime/internal/clite/os/os_darwin.go @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package os + +import ( + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) + +const ( + LLGoFiles = "_os/os.c" + LLGoPackage = "link" +) + +const ( + PATH_MAX = 1024 +) + +type ( + ModeT uint16 + UidT uint32 + GidT uint32 + OffT int64 + DevT int32 +) + +//go:linkname Clearenv C.cliteClearenv +func Clearenv() c.Int diff --git a/runtime/internal/clite/os/os_nonwasm.go b/runtime/internal/clite/os/os_nonwasm.go new file mode 100644 index 00000000..c691fee9 --- /dev/null +++ b/runtime/internal/clite/os/os_nonwasm.go @@ -0,0 +1,69 @@ +//go:build !wasm + +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package os + +import ( + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" + "github.com/goplus/llgo/runtime/internal/clite/syscall" +) + +//go:linkname Getuid C.getuid +func Getuid() UidT + +//go:linkname Geteuid C.geteuid +func Geteuid() UidT + +//go:linkname Getgid C.getgid +func Getgid() GidT + +//go:linkname Getegid C.getegid +func Getegid() GidT + +//go:linkname Chown C.chown +func Chown(path *c.Char, owner UidT, group GidT) c.Int + +//go:linkname Lchown C.lchown +func Lchown(path *c.Char, owner UidT, group GidT) c.Int + +//go:linkname Getrlimit C.getrlimit +func Getrlimit(resource c.Int, rlp *syscall.Rlimit) c.Int + +//go:linkname Setrlimit C.setrlimit +func Setrlimit(resource c.Int, rlp *syscall.Rlimit) c.Int + +//go:linkname Wait4 C.wait4 +func Wait4(pid PidT, statLoc *c.Int, options c.Int, rusage *syscall.Rusage) PidT + +/* TODO(xsw): + On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64, pipe() has the following prototype: + struct fd_pair { + long fd[2]; + }; + struct fd_pair pipe(void); +*/ +//go:linkname Pipe C.pipe +func Pipe(fds *[2]c.Int) c.Int + +//go:linkname Fork C.fork +func Fork() PidT + +//go:linkname Kill C.kill +func Kill(pid PidT, sig c.Int) c.Int diff --git a/runtime/internal/clite/os/os_other.go b/runtime/internal/clite/os/os_other.go index 5f489058..55bf6132 100644 --- a/runtime/internal/clite/os/os_other.go +++ b/runtime/internal/clite/os/os_other.go @@ -1,4 +1,4 @@ -//go:build !linux +//go:build !darwin /* * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. @@ -18,12 +18,28 @@ package os -import "C" +import ( + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) const ( LLGoFiles = "_os/os.c" LLGoPackage = "link" ) -//go:linkname Clearenv C.cliteClearenv -func Clearenv() +const ( + PATH_MAX = 4096 +) + +type ( + ModeT uint32 + UidT uint32 + GidT uint32 + OffT int64 + DevT uint64 +) + +//go:linkname Clearenv C.clearenv +func Clearenv() c.Int diff --git a/runtime/internal/clite/os/os_wasm.go b/runtime/internal/clite/os/os_wasm.go new file mode 100644 index 00000000..cf1f67e0 --- /dev/null +++ b/runtime/internal/clite/os/os_wasm.go @@ -0,0 +1 @@ +package os diff --git a/runtime/internal/clite/pthread/sync/_wrap/pthd.c b/runtime/internal/clite/pthread/sync/_wrap/pthd.c deleted file mode 100644 index 0ba77d69..00000000 --- a/runtime/internal/clite/pthread/sync/_wrap/pthd.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -// ----------------------------------------------------------------------------- - -pthread_once_t cliteSyncOnceInitVal = PTHREAD_ONCE_INIT; - -// ----------------------------------------------------------------------------- - -// wrap return type to void -void clite_wrap_pthread_mutex_lock(pthread_mutex_t *mutex) -{ - pthread_mutex_lock(mutex); -} - -// wrap return type to void -void clite_wrap_pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - pthread_mutex_unlock(mutex); -} - -// ----------------------------------------------------------------------------- diff --git a/runtime/internal/clite/pthread/sync/sync.go b/runtime/internal/clite/pthread/sync/sync.go index c74d3214..1e07e152 100644 --- a/runtime/internal/clite/pthread/sync/sync.go +++ b/runtime/internal/clite/pthread/sync/sync.go @@ -16,9 +16,6 @@ package sync -// #include -import "C" - import ( _ "unsafe" @@ -27,16 +24,25 @@ import ( ) const ( - LLGoFiles = "_wrap/pthd.c" LLGoPackage = "link" ) +const ( + PTHREAD_MUTEX_NORMAL = 0 + PTHREAD_MUTEX_ERRORCHECK = 1 + PTHREAD_MUTEX_RECURSIVE = 2 + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +) + // ----------------------------------------------------------------------------- // Once is an object that will perform exactly one action. -type Once C.pthread_once_t +// pthread_once_t +type Once struct { + Unused [PthreadOnceSize]c.Char +} -//go:linkname OnceInit cliteSyncOnceInitVal +//go:linkname OnceInit once_control var OnceInit Once // llgo:link (*Once).Do C.pthread_once @@ -47,14 +53,17 @@ func (o *Once) Do(f func()) c.Int { return 0 } type MutexType c.Int const ( - MUTEX_NORMAL MutexType = C.PTHREAD_MUTEX_NORMAL - MUTEX_ERRORCHECK MutexType = C.PTHREAD_MUTEX_ERRORCHECK - MUTEX_RECURSIVE MutexType = C.PTHREAD_MUTEX_RECURSIVE - MUTEX_DEFAULT MutexType = C.PTHREAD_MUTEX_DEFAULT + MUTEX_NORMAL MutexType = PTHREAD_MUTEX_NORMAL + MUTEX_ERRORCHECK MutexType = PTHREAD_MUTEX_ERRORCHECK + MUTEX_RECURSIVE MutexType = PTHREAD_MUTEX_RECURSIVE + MUTEX_DEFAULT MutexType = PTHREAD_MUTEX_DEFAULT ) // MutexAttr is a mutex attribute object. -type MutexAttr C.pthread_mutexattr_t +// pthread_mutexattr_t +type MutexAttr struct { + Unused [PthreadMutexAttrSize]c.Char +} // llgo:link (*MutexAttr).Init C.pthread_mutexattr_init func (a *MutexAttr) Init(attr *MutexAttr) c.Int { return 0 } @@ -67,28 +76,54 @@ func (a *MutexAttr) SetType(typ MutexType) c.Int { return 0 } // ----------------------------------------------------------------------------- +//go:linkname c_pthread_mutex_init C.pthread_mutex_init +func c_pthread_mutex_init(m *Mutex, attr *MutexAttr) c.Int + +//go:linkname c_pthread_mutex_destroy C.pthread_mutex_destroy +func c_pthread_mutex_destroy(m *Mutex) c.Int + +//go:linkname c_pthread_mutex_lock C.pthread_mutex_lock +func c_pthread_mutex_lock(m *Mutex) c.Int + +//go:linkname c_pthread_mutex_unlock C.pthread_mutex_unlock +func c_pthread_mutex_unlock(m *Mutex) c.Int + +//go:linkname c_pthread_mutex_trylock C.pthread_mutex_trylock +func c_pthread_mutex_trylock(m *Mutex) c.Int + // Mutex is a mutual exclusion lock. -type Mutex C.pthread_mutex_t +// pthread_mutex_t +type Mutex struct { + Unused [PthreadMutexSize]c.Char +} -// llgo:link (*Mutex).Init C.pthread_mutex_init -func (m *Mutex) Init(attr *MutexAttr) c.Int { return 0 } +func (m *Mutex) Init(attr *MutexAttr) c.Int { + return c_pthread_mutex_init(m, attr) +} -// llgo:link (*Mutex).Destroy C.pthread_mutex_destroy -func (m *Mutex) Destroy() {} +func (m *Mutex) Destroy() { + c_pthread_mutex_destroy(m) +} -// llgo:link (*Mutex).TryLock C.pthread_mutex_trylock -func (m *Mutex) TryLock() c.Int { return 0 } +func (m *Mutex) TryLock() c.Int { + return c_pthread_mutex_trylock(m) +} -// llgo:link (*Mutex).Lock C.clite_wrap_pthread_mutex_lock -func (m *Mutex) Lock() {} +func (m *Mutex) Lock() { + c_pthread_mutex_lock(m) +} -// llgo:link (*Mutex).Unlock C.clite_wrap_pthread_mutex_unlock -func (m *Mutex) Unlock() {} +func (m *Mutex) Unlock() { + c_pthread_mutex_unlock(m) +} // ----------------------------------------------------------------------------- // RWLockAttr is a read-write lock attribute object. -type RWLockAttr C.pthread_rwlockattr_t +// pthread_rwlockattr_t +type RWLockAttr struct { + Unused [PthreadRWLockAttrSize]c.Char +} // llgo:link (*RWLockAttr).Init C.pthread_rwlockattr_init func (a *RWLockAttr) Init(attr *RWLockAttr) c.Int { return 0 } @@ -104,37 +139,69 @@ func (a *RWLockAttr) GetPShared(pshared *c.Int) c.Int { return 0 } // ----------------------------------------------------------------------------- +//go:linkname c_pthread_rwlock_init C.pthread_rwlock_init +func c_pthread_rwlock_init(rw *RWLock, attr *RWLockAttr) c.Int + +//go:linkname c_pthread_rwlock_destroy C.pthread_rwlock_destroy +func c_pthread_rwlock_destroy(rw *RWLock) c.Int + +//go:linkname c_pthread_rwlock_rdlock C.pthread_rwlock_rdlock +func c_pthread_rwlock_rdlock(rw *RWLock) c.Int + +//go:linkname c_pthread_rwlock_wrlock C.pthread_rwlock_wrlock +func c_pthread_rwlock_wrlock(rw *RWLock) c.Int + +//go:linkname c_pthread_rwlock_unlock C.pthread_rwlock_unlock +func c_pthread_rwlock_unlock(rw *RWLock) c.Int + +//go:linkname c_pthread_rwlock_tryrdlock C.pthread_rwlock_tryrdlock +func c_pthread_rwlock_tryrdlock(rw *RWLock) c.Int + +//go:linkname c_pthread_rwlock_trywrlock C.pthread_rwlock_trywrlock +func c_pthread_rwlock_trywrlock(rw *RWLock) c.Int + // RWLock is a read-write lock. -type RWLock C.pthread_rwlock_t +// pthread_rwlock_t +type RWLock struct { + Unused [PthreadRWLockSize]c.Char +} // llgo:link (*RWLock).Init C.pthread_rwlock_init func (rw *RWLock) Init(attr *RWLockAttr) c.Int { return 0 } -// llgo:link (*RWLock).Destroy C.pthread_rwlock_destroy -func (rw *RWLock) Destroy() {} +func (rw *RWLock) Destroy() { + c_pthread_rwlock_destroy(rw) +} -// llgo:link (*RWLock).RLock C.pthread_rwlock_rdlock -func (rw *RWLock) RLock() {} +func (rw *RWLock) RLock() { + c_pthread_rwlock_rdlock(rw) +} // llgo:link (*RWLock).TryRLock C.pthread_rwlock_tryrdlock func (rw *RWLock) TryRLock() c.Int { return 0 } -// llgo:link (*RWLock).RUnlock C.pthread_rwlock_unlock -func (rw *RWLock) RUnlock() {} +func (rw *RWLock) RUnlock() { + c_pthread_rwlock_unlock(rw) +} -// llgo:link (*RWLock).Lock C.pthread_rwlock_wrlock -func (rw *RWLock) Lock() {} +func (rw *RWLock) Lock() { + c_pthread_rwlock_wrlock(rw) +} // llgo:link (*RWLock).TryLock C.pthread_rwlock_trywrlock func (rw *RWLock) TryLock() c.Int { return 0 } -// llgo:link (*RWLock).Unlock C.pthread_rwlock_unlock -func (rw *RWLock) Unlock() {} +func (rw *RWLock) Unlock() { + c_pthread_rwlock_unlock(rw) +} // ----------------------------------------------------------------------------- // CondAttr is a condition variable attribute object. -type CondAttr C.pthread_condattr_t +// pthread_condattr_t +type CondAttr struct { + Unused [PthreadCondAttrSize]c.Char +} // llgo:link (*CondAttr).Init C.pthread_condattr_init func (a *CondAttr) Init(attr *CondAttr) c.Int { return 0 } @@ -150,25 +217,52 @@ func (a *CondAttr) Destroy() {} // ----------------------------------------------------------------------------- +//go:linkname c_pthread_cond_init C.pthread_cond_init +func c_pthread_cond_init(c *Cond, attr *CondAttr) c.Int + +//go:linkname c_pthread_cond_destroy C.pthread_cond_destroy +func c_pthread_cond_destroy(c *Cond) c.Int + +//go:linkname c_pthread_cond_signal C.pthread_cond_signal +func c_pthread_cond_signal(c *Cond) c.Int + +//go:linkname c_pthread_cond_broadcast C.pthread_cond_broadcast +func c_pthread_cond_broadcast(c *Cond) c.Int + +//go:linkname c_pthread_cond_wait C.pthread_cond_wait +func c_pthread_cond_wait(c *Cond, m *Mutex) c.Int + +//go:linkname c_pthread_cond_timedwait C.pthread_cond_timedwait +func c_pthread_cond_timedwait(c *Cond, m *Mutex, abstime *time.Timespec) c.Int + // Cond is a condition variable. -type Cond C.pthread_cond_t +// pthread_cond_t +type Cond struct { + Unused [PthreadCondSize]c.Char +} -// llgo:link (*Cond).Init C.pthread_cond_init -func (c *Cond) Init(attr *CondAttr) c.Int { return 0 } +func (c *Cond) Init(attr *CondAttr) c.Int { + return c_pthread_cond_init(c, attr) +} -// llgo:link (*Cond).Destroy C.pthread_cond_destroy -func (c *Cond) Destroy() {} +func (c *Cond) Destroy() { + c_pthread_cond_destroy(c) +} -// llgo:link (*Cond).Signal C.pthread_cond_signal -func (c *Cond) Signal() c.Int { return 0 } +func (c *Cond) Signal() c.Int { + return c_pthread_cond_signal(c) +} -// llgo:link (*Cond).Broadcast C.pthread_cond_broadcast -func (c *Cond) Broadcast() c.Int { return 0 } +func (c *Cond) Broadcast() c.Int { + return c_pthread_cond_broadcast(c) +} -// llgo:link (*Cond).Wait C.pthread_cond_wait -func (c *Cond) Wait(m *Mutex) c.Int { return 0 } +func (c *Cond) Wait(m *Mutex) c.Int { + return c_pthread_cond_wait(c, m) +} -// llgo:link (*Cond).TimedWait C.pthread_cond_timedwait -func (c *Cond) TimedWait(m *Mutex, abstime *time.Timespec) c.Int { return 0 } +func (c *Cond) TimedWait(m *Mutex, abstime *time.Timespec) c.Int { + return c_pthread_cond_timedwait(c, m, abstime) +} // ----------------------------------------------------------------------------- diff --git a/runtime/internal/clite/pthread/sync/sync_darwin_amd64.go b/runtime/internal/clite/pthread/sync/sync_darwin_amd64.go new file mode 100644 index 00000000..0cbe29cb --- /dev/null +++ b/runtime/internal/clite/pthread/sync/sync_darwin_amd64.go @@ -0,0 +1,11 @@ +package sync + +const ( + PthreadOnceSize = 16 + PthreadMutexSize = 56 + PthreadMutexAttrSize = 8 + PthreadCondSize = 40 + PthreadCondAttrSize = 8 + PthreadRWLockSize = 192 + PthreadRWLockAttrSize = 16 +) diff --git a/runtime/internal/clite/pthread/sync/sync_darwin_arm64.go b/runtime/internal/clite/pthread/sync/sync_darwin_arm64.go new file mode 100644 index 00000000..a43f36a5 --- /dev/null +++ b/runtime/internal/clite/pthread/sync/sync_darwin_arm64.go @@ -0,0 +1,11 @@ +package sync + +const ( + PthreadOnceSize = 16 + PthreadMutexSize = 64 + PthreadMutexAttrSize = 16 + PthreadCondSize = 48 + PthreadCondAttrSize = 16 + PthreadRWLockSize = 200 + PthreadRWLockAttrSize = 24 +) diff --git a/runtime/internal/clite/pthread/sync/sync_linux_amd64.go b/runtime/internal/clite/pthread/sync/sync_linux_amd64.go new file mode 100644 index 00000000..7b33539f --- /dev/null +++ b/runtime/internal/clite/pthread/sync/sync_linux_amd64.go @@ -0,0 +1,11 @@ +package sync + +const ( + PthreadOnceSize = 4 + PthreadMutexSize = 40 + PthreadMutexAttrSize = 4 + PthreadCondSize = 48 + PthreadCondAttrSize = 4 + PthreadRWLockSize = 56 + PthreadRWLockAttrSize = 8 +) diff --git a/runtime/internal/clite/pthread/sync/sync_linux_arm64.go b/runtime/internal/clite/pthread/sync/sync_linux_arm64.go new file mode 100644 index 00000000..c5ae728f --- /dev/null +++ b/runtime/internal/clite/pthread/sync/sync_linux_arm64.go @@ -0,0 +1,11 @@ +package sync + +const ( + PthreadOnceSize = 4 + PthreadMutexSize = 48 + PthreadMutexAttrSize = 8 + PthreadCondSize = 48 + PthreadCondAttrSize = 8 + PthreadRWLockSize = 56 + PthreadRWLockAttrSize = 8 +) diff --git a/runtime/internal/clite/pthread/sync/sync_other.go b/runtime/internal/clite/pthread/sync/sync_other.go new file mode 100644 index 00000000..ab7f01ec --- /dev/null +++ b/runtime/internal/clite/pthread/sync/sync_other.go @@ -0,0 +1,13 @@ +//go:build !((linux || darwin) && (amd64 || arm64)) + +package sync + +const ( + PthreadOnceSize = 4 + PthreadMutexSize = 40 + PthreadMutexAttrSize = 4 + PthreadCondSize = 48 + PthreadCondAttrSize = 4 + PthreadRWLockSize = 56 + PthreadRWLockAttrSize = 8 +) diff --git a/runtime/internal/clite/setjmp/jmpbuf_darwin_amd64.go b/runtime/internal/clite/setjmp/jmpbuf_darwin_amd64.go new file mode 100644 index 00000000..de04021b --- /dev/null +++ b/runtime/internal/clite/setjmp/jmpbuf_darwin_amd64.go @@ -0,0 +1,6 @@ +package setjmp + +const ( + SigjmpBufSize = 196 + JmpBufSize = 192 +) diff --git a/runtime/internal/clite/setjmp/jmpbuf_darwin_arm64.go b/runtime/internal/clite/setjmp/jmpbuf_darwin_arm64.go new file mode 100644 index 00000000..de04021b --- /dev/null +++ b/runtime/internal/clite/setjmp/jmpbuf_darwin_arm64.go @@ -0,0 +1,6 @@ +package setjmp + +const ( + SigjmpBufSize = 196 + JmpBufSize = 192 +) diff --git a/runtime/internal/clite/setjmp/jmpbuf_linux_amd64.go b/runtime/internal/clite/setjmp/jmpbuf_linux_amd64.go new file mode 100644 index 00000000..b64c4993 --- /dev/null +++ b/runtime/internal/clite/setjmp/jmpbuf_linux_amd64.go @@ -0,0 +1,8 @@ +//go:build !darwin + +package setjmp + +const ( + SigjmpBufSize = 200 + JmpBufSize = 200 +) diff --git a/runtime/internal/clite/setjmp/jmpbuf_linux_arm64.go b/runtime/internal/clite/setjmp/jmpbuf_linux_arm64.go new file mode 100644 index 00000000..eb502e1f --- /dev/null +++ b/runtime/internal/clite/setjmp/jmpbuf_linux_arm64.go @@ -0,0 +1,6 @@ +package setjmp + +const ( + SigjmpBufSize = 312 + JmpBufSize = 312 +) diff --git a/runtime/internal/clite/setjmp/jmpbuf_other.go b/runtime/internal/clite/setjmp/jmpbuf_other.go new file mode 100644 index 00000000..c1f89e77 --- /dev/null +++ b/runtime/internal/clite/setjmp/jmpbuf_other.go @@ -0,0 +1,8 @@ +//go:build !((linux || darwin) && (amd64 || arm64)) + +package setjmp + +const ( + SigjmpBufSize = 200 + JmpBufSize = 200 +) diff --git a/runtime/internal/clite/setjmp/setjmp.go b/runtime/internal/clite/setjmp/setjmp.go new file mode 100644 index 00000000..09186a90 --- /dev/null +++ b/runtime/internal/clite/setjmp/setjmp.go @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package setjmp + +import ( + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) + +const ( + LLGoPackage = "decl" +) + +type ( + SigjmpBuf [SigjmpBufSize]byte + JmpBuf [JmpBufSize]byte +) + +// ----------------------------------------------------------------------------- + +//go:linkname Setjmp C.setjmp +func Setjmp(env *JmpBuf) c.Int + +//go:linkname Longjmp C.longjmp +func Longjmp(env *JmpBuf, val c.Int) + +// ----------------------------------------------------------------------------- + +//go:linkname Siglongjmp C.siglongjmp +func Siglongjmp(env *SigjmpBuf, val c.Int) + +// ----------------------------------------------------------------------------- diff --git a/runtime/internal/clite/signal/signal.go b/runtime/internal/clite/signal/signal.go index 9d071978..fba3979d 100644 --- a/runtime/internal/clite/signal/signal.go +++ b/runtime/internal/clite/signal/signal.go @@ -1,3 +1,5 @@ +//go:build !wasm + package signal import ( @@ -5,7 +7,6 @@ import ( c "github.com/goplus/llgo/runtime/internal/clite" ) -import "C" const ( LLGoPackage = "link" diff --git a/runtime/internal/clite/signal/signal_wasm.go b/runtime/internal/clite/signal/signal_wasm.go new file mode 100644 index 00000000..5f45566e --- /dev/null +++ b/runtime/internal/clite/signal/signal_wasm.go @@ -0,0 +1 @@ +package signal diff --git a/runtime/internal/clite/c_default.go b/runtime/internal/clite/stdio_darwin.go similarity index 94% rename from runtime/internal/clite/c_default.go rename to runtime/internal/clite/stdio_darwin.go index 48006fca..324403f5 100644 --- a/runtime/internal/clite/c_default.go +++ b/runtime/internal/clite/stdio_darwin.go @@ -1,5 +1,5 @@ -//go:build !linux -// +build !linux +//go:build darwin +// +build darwin /* * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. @@ -17,7 +17,7 @@ * limitations under the License. */ -package clite +package c import _ "unsafe" diff --git a/runtime/internal/clite/c_linux.go b/runtime/internal/clite/stdio_default.go similarity index 94% rename from runtime/internal/clite/c_linux.go rename to runtime/internal/clite/stdio_default.go index de8203f5..5f95fd27 100644 --- a/runtime/internal/clite/c_linux.go +++ b/runtime/internal/clite/stdio_default.go @@ -1,5 +1,5 @@ -//go:build linux -// +build linux +//go:build !darwin +// +build !darwin /* * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. @@ -17,7 +17,7 @@ * limitations under the License. */ -package clite +package c import _ "unsafe" diff --git a/runtime/internal/clite/syscall/dirent.go b/runtime/internal/clite/syscall/dirent.go new file mode 100644 index 00000000..4917a537 --- /dev/null +++ b/runtime/internal/clite/syscall/dirent.go @@ -0,0 +1,47 @@ +package syscall + +import ( + "github.com/goplus/llgo/runtime/internal/clite/byteorder" + "github.com/goplus/llgo/runtime/internal/clite/goarch" +) + +// readInt returns the size-bytes unsigned integer in native byte order at offset off. +func readInt(b []byte, off, size uintptr) (u uint64, ok bool) { + if len(b) < int(off+size) { + return 0, false + } + if goarch.BigEndian { + return readIntBE(b[off:], size), true + } + return readIntLE(b[off:], size), true +} + +func readIntBE(b []byte, size uintptr) uint64 { + switch size { + case 1: + return uint64(b[0]) + case 2: + return uint64(byteorder.BEUint16(b)) + case 4: + return uint64(byteorder.BEUint32(b)) + case 8: + return uint64(byteorder.BEUint64(b)) + default: + panic("syscall: readInt with unsupported size") + } +} + +func readIntLE(b []byte, size uintptr) uint64 { + switch size { + case 1: + return uint64(b[0]) + case 2: + return uint64(byteorder.LEUint16(b)) + case 4: + return uint64(byteorder.LEUint32(b)) + case 8: + return uint64(byteorder.LEUint64(b)) + default: + panic("syscall: readInt with unsupported size") + } +} diff --git a/runtime/internal/clite/syscall/env_unix.go b/runtime/internal/clite/syscall/env_unix.go new file mode 100644 index 00000000..bb5195e6 --- /dev/null +++ b/runtime/internal/clite/syscall/env_unix.go @@ -0,0 +1,69 @@ +package syscall + +import ( + "sync" + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) + +var ( + envOnce sync.Once + envLock sync.RWMutex + env map[string]int + envs []string +) + +//go:linkname c_environ environ +var c_environ **c.Char + +//go:linkname c_getenv C.getenv +func c_getenv(name *c.Char) *c.Char + +func copyenv() { + env = make(map[string]int) + p := c_environ + i := 0 + for p != nil { + s := c.GoString(*p) + for j := 0; j < len(s); j++ { + if s[j] == '=' { + key := s[:j] + if _, ok := env[key]; !ok { + env[key] = i // first mention of key + } else { + // Clear duplicate keys. This permits Unsetenv to + // safely delete only the first item without + // worrying about unshadowing a later one, + // which might be a security problem. + envs[i] = "" + } + break + } + } + p = c.Advance(p, 1) + i++ + } +} + +func Getenv(key string) (value string, found bool) { + envOnce.Do(copyenv) + if len(key) == 0 { + return "", false + } + + envLock.RLock() + defer envLock.RUnlock() + + i, ok := env[key] + if !ok { + return "", false + } + s := envs[i] + for i := 0; i < len(s); i++ { + if s[i] == '=' { + return s[i+1:], true + } + } + return "", false +} diff --git a/runtime/internal/clite/syscall/fs_wasip1.go b/runtime/internal/clite/syscall/fs_wasip1.go new file mode 100644 index 00000000..d40c9ca7 --- /dev/null +++ b/runtime/internal/clite/syscall/fs_wasip1.go @@ -0,0 +1,316 @@ +// Copyright 2023 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. + +//go:build wasip1 + +package syscall + +import ( + "strings" + "structs" + "unsafe" +) + +func init() { + // Try to set stdio to non-blocking mode before the os package + // calls NewFile for each fd. NewFile queries the non-blocking flag + // but doesn't change it, even if the runtime supports non-blocking + // stdio. Since WebAssembly modules are single-threaded, blocking + // system calls temporarily halt execution of the module. If the + // runtime supports non-blocking stdio, the Go runtime is able to + // use the WASI net poller to poll for read/write readiness and is + // able to schedule goroutines while waiting. + SetNonblock(0, true) + SetNonblock(1, true) + SetNonblock(2, true) +} + +type uintptr32 = uint32 +type size = uint32 +type fdflags = uint32 +type filesize = uint64 +type filetype = uint8 +type lookupflags = uint32 +type oflags = uint32 +type rights = uint64 +type timestamp = uint64 +type dircookie = uint64 +type filedelta = int64 +type fstflags = uint32 + +type iovec struct { + _ structs.HostLayout + buf uintptr32 + bufLen size +} + +const ( + LOOKUP_SYMLINK_FOLLOW = 0x00000001 +) + +const ( + OFLAG_CREATE = 0x0001 + OFLAG_DIRECTORY = 0x0002 + OFLAG_EXCL = 0x0004 + OFLAG_TRUNC = 0x0008 +) + +const ( + FDFLAG_APPEND = 0x0001 + FDFLAG_DSYNC = 0x0002 + FDFLAG_NONBLOCK = 0x0004 + FDFLAG_RSYNC = 0x0008 + FDFLAG_SYNC = 0x0010 +) + +const ( + RIGHT_FD_DATASYNC = 1 << iota + RIGHT_FD_READ + RIGHT_FD_SEEK + RIGHT_FDSTAT_SET_FLAGS + RIGHT_FD_SYNC + RIGHT_FD_TELL + RIGHT_FD_WRITE + RIGHT_FD_ADVISE + RIGHT_FD_ALLOCATE + RIGHT_PATH_CREATE_DIRECTORY + RIGHT_PATH_CREATE_FILE + RIGHT_PATH_LINK_SOURCE + RIGHT_PATH_LINK_TARGET + RIGHT_PATH_OPEN + RIGHT_FD_READDIR + RIGHT_PATH_READLINK + RIGHT_PATH_RENAME_SOURCE + RIGHT_PATH_RENAME_TARGET + RIGHT_PATH_FILESTAT_GET + RIGHT_PATH_FILESTAT_SET_SIZE + RIGHT_PATH_FILESTAT_SET_TIMES + RIGHT_FD_FILESTAT_GET + RIGHT_FD_FILESTAT_SET_SIZE + RIGHT_FD_FILESTAT_SET_TIMES + RIGHT_PATH_SYMLINK + RIGHT_PATH_REMOVE_DIRECTORY + RIGHT_PATH_UNLINK_FILE + RIGHT_POLL_FD_READWRITE + RIGHT_SOCK_SHUTDOWN + RIGHT_SOCK_ACCEPT +) + +const ( + WHENCE_SET = 0 + WHENCE_CUR = 1 + WHENCE_END = 2 +) + +const ( + FILESTAT_SET_ATIM = 0x0001 + FILESTAT_SET_ATIM_NOW = 0x0002 + FILESTAT_SET_MTIM = 0x0004 + FILESTAT_SET_MTIM_NOW = 0x0008 +) + +const ( + // Despite the rights being defined as a 64 bits integer in the spec, + // wasmtime crashes the program if we set any of the upper 32 bits. + fullRights = rights(^uint32(0)) + readRights = rights(RIGHT_FD_READ | RIGHT_FD_READDIR) + writeRights = rights(RIGHT_FD_DATASYNC | RIGHT_FD_WRITE | RIGHT_FD_ALLOCATE | RIGHT_PATH_FILESTAT_SET_SIZE) + + // Some runtimes have very strict expectations when it comes to which + // rights can be enabled on files opened by path_open. The fileRights + // constant is used as a mask to retain only bits for operations that + // are supported on files. + fileRights rights = RIGHT_FD_DATASYNC | + RIGHT_FD_READ | + RIGHT_FD_SEEK | + RIGHT_FDSTAT_SET_FLAGS | + RIGHT_FD_SYNC | + RIGHT_FD_TELL | + RIGHT_FD_WRITE | + RIGHT_FD_ADVISE | + RIGHT_FD_ALLOCATE | + RIGHT_PATH_CREATE_DIRECTORY | + RIGHT_PATH_CREATE_FILE | + RIGHT_PATH_LINK_SOURCE | + RIGHT_PATH_LINK_TARGET | + RIGHT_PATH_OPEN | + RIGHT_FD_READDIR | + RIGHT_PATH_READLINK | + RIGHT_PATH_RENAME_SOURCE | + RIGHT_PATH_RENAME_TARGET | + RIGHT_PATH_FILESTAT_GET | + RIGHT_PATH_FILESTAT_SET_SIZE | + RIGHT_PATH_FILESTAT_SET_TIMES | + RIGHT_FD_FILESTAT_GET | + RIGHT_FD_FILESTAT_SET_SIZE | + RIGHT_FD_FILESTAT_SET_TIMES | + RIGHT_PATH_SYMLINK | + RIGHT_PATH_REMOVE_DIRECTORY | + RIGHT_PATH_UNLINK_FILE | + RIGHT_POLL_FD_READWRITE + + // Runtimes like wasmtime and wasmedge will refuse to open directories + // if the rights requested by the application exceed the operations that + // can be performed on a directory. + dirRights rights = RIGHT_FD_SEEK | + RIGHT_FDSTAT_SET_FLAGS | + RIGHT_FD_SYNC | + RIGHT_PATH_CREATE_DIRECTORY | + RIGHT_PATH_CREATE_FILE | + RIGHT_PATH_LINK_SOURCE | + RIGHT_PATH_LINK_TARGET | + RIGHT_PATH_OPEN | + RIGHT_FD_READDIR | + RIGHT_PATH_READLINK | + RIGHT_PATH_RENAME_SOURCE | + RIGHT_PATH_RENAME_TARGET | + RIGHT_PATH_FILESTAT_GET | + RIGHT_PATH_FILESTAT_SET_SIZE | + RIGHT_PATH_FILESTAT_SET_TIMES | + RIGHT_FD_FILESTAT_GET | + RIGHT_FD_FILESTAT_SET_TIMES | + RIGHT_PATH_SYMLINK | + RIGHT_PATH_REMOVE_DIRECTORY | + RIGHT_PATH_UNLINK_FILE +) + +// https://github.com/WebAssembly/WASI/blob/a2b96e81c0586125cc4dc79a5be0b78d9a059925/legacy/preview1/docs.md#-fdstat-record +// fdflags must be at offset 2, hence the uint16 type rather than the +// fdflags (uint32) type. +type fdstat struct { + _ structs.HostLayout + filetype filetype + fdflags uint16 + rightsBase rights + rightsInheriting rights +} + +type preopentype = uint8 + +const ( + preopentypeDir preopentype = iota +) + +type prestatDir struct { + _ structs.HostLayout + prNameLen size +} + +type prestat struct { + _ structs.HostLayout + typ preopentype + dir prestatDir +} + +// Current working directory. We maintain this as a string and resolve paths in +// the code because wasmtime does not allow relative path lookups outside of the +// scope of a directory; a previous approach we tried consisted in maintaining +// open a file descriptor to the current directory so we could perform relative +// path lookups from that location, but it resulted in breaking path resolution +// from the current directory to its parent. +var cwd string + +//go:nosplit +func appendCleanPath(buf []byte, path string, lookupParent bool) ([]byte, bool) { + i := 0 + for i < len(path) { + for i < len(path) && path[i] == '/' { + i++ + } + + j := i + for j < len(path) && path[j] != '/' { + j++ + } + + s := path[i:j] + i = j + + switch s { + case "": + continue + case ".": + continue + case "..": + if !lookupParent { + k := len(buf) + for k > 0 && buf[k-1] != '/' { + k-- + } + for k > 1 && buf[k-1] == '/' { + k-- + } + buf = buf[:k] + if k == 0 { + lookupParent = true + } else { + s = "" + continue + } + } + default: + lookupParent = false + } + + if len(buf) > 0 && buf[len(buf)-1] != '/' { + buf = append(buf, '/') + } + buf = append(buf, s...) + } + return buf, lookupParent +} + +// joinPath concatenates dir and file paths, producing a cleaned path where +// "." and ".." have been removed, unless dir is relative and the references +// to parent directories in file represented a location relative to a parent +// of dir. +// +// This function is used for path resolution of all wasi functions expecting +// a path argument; the returned string is heap allocated, which we may want +// to optimize in the future. Instead of returning a string, the function +// could append the result to an output buffer that the functions in this +// file can manage to have allocated on the stack (e.g. initializing to a +// fixed capacity). Since it will significantly increase code complexity, +// we prefer to optimize for readability and maintainability at this time. +func joinPath(dir, file string) string { + buf := make([]byte, 0, len(dir)+len(file)+1) + if isAbs(dir) { + buf = append(buf, '/') + } + buf, lookupParent := appendCleanPath(buf, dir, false) + buf, _ = appendCleanPath(buf, file, lookupParent) + // The appendCleanPath function cleans the path so it does not inject + // references to the current directory. If both the dir and file args + // were ".", this results in the output buffer being empty so we handle + // this condition here. + if len(buf) == 0 { + buf = append(buf, '.') + } + // If the file ended with a '/' we make sure that the output also ends + // with a '/'. This is needed to ensure that programs have a mechanism + // to represent dereferencing symbolic links pointing to directories. + if buf[len(buf)-1] != '/' && isDir(file) { + buf = append(buf, '/') + } + return unsafe.String(&buf[0], len(buf)) +} + +func isAbs(path string) bool { + return strings.HasPrefix(path, "/") +} + +func isDir(path string) bool { + return strings.HasSuffix(path, "/") +} + +type Stat_t struct { + Dev uint64 + Ino uint64 + Filetype uint8 + Nlink uint64 + Size uint64 + Atime uint64 + Mtime uint64 + Ctime uint64 +} diff --git a/runtime/internal/clite/syscall/net_fake.go b/runtime/internal/clite/syscall/net_fake.go new file mode 100644 index 00000000..f7fce806 --- /dev/null +++ b/runtime/internal/clite/syscall/net_fake.go @@ -0,0 +1,65 @@ +// Copyright 2023 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. + +// Fake networking for js/wasm and wasip1/wasm. + +//go:build js || wasm + +package syscall + +const ( + AF_UNSPEC = iota + AF_UNIX + AF_INET + AF_INET6 +) + +const ( + SOCK_STREAM = 1 + iota + SOCK_DGRAM + SOCK_RAW + SOCK_SEQPACKET +) + +const ( + IPPROTO_IP = 0 + IPPROTO_IPV4 = 4 + IPPROTO_IPV6 = 0x29 + IPPROTO_TCP = 6 + IPPROTO_UDP = 0x11 +) + +const ( + SOMAXCONN = 0x80 +) + +const ( + _ = iota + IPV6_V6ONLY + SO_ERROR +) + +// Misc constants expected by package net but not supported. +const ( + _ = iota + F_DUPFD_CLOEXEC + SYS_FCNTL = 500 // unsupported +) + +type Sockaddr any + +type SockaddrInet4 struct { + Port int + Addr [4]byte +} + +type SockaddrInet6 struct { + Port int + ZoneId uint32 + Addr [16]byte +} + +type SockaddrUnix struct { + Name string +} diff --git a/runtime/internal/clite/syscall/os_wasm.go b/runtime/internal/clite/syscall/os_wasm.go new file mode 100644 index 00000000..ed663897 --- /dev/null +++ b/runtime/internal/clite/syscall/os_wasm.go @@ -0,0 +1,5 @@ +// Copyright 2023 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. + +package syscall diff --git a/runtime/internal/clite/syscall/syscall.go b/runtime/internal/clite/syscall/syscall.go index 0f1e61ae..e140e387 100644 --- a/runtime/internal/clite/syscall/syscall.go +++ b/runtime/internal/clite/syscall/syscall.go @@ -16,21 +16,61 @@ package syscall +import ( + errorsPkg "errors" + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) + const ( LLGoPackage = "noinit" ) -type Errno uintptr +var ( + ErrInvalid = errorsPkg.New("invalid argument") + ErrPermission = errorsPkg.New("permission denied") + ErrExist = errorsPkg.New("file already exists") + ErrNotExist = errorsPkg.New("file does not exist") + ErrClosed = errorsPkg.New("file already closed") + ErrUnsupported = errorsPkg.New("operation not supported") +) -// A Signal is a number describing a process signal. -// It implements the os.Signal interface. -type Signal = int +// Nano returns the time stored in ts as nanoseconds. +func (ts *Timespec) Nano() int64 { + return int64(ts.Sec)*1e9 + int64(ts.Nsec) +} + +// Nano returns the time stored in tv as nanoseconds. +func (tv *Timeval) Nano() int64 { + return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 +} // Unix returns the time stored in ts as seconds plus nanoseconds. func (ts *Timespec) Unix() (sec int64, nsec int64) { return int64(ts.Sec), int64(ts.Nsec) } -func (iov *Iovec) SetLen(length int) { - iov.Len = uint64(length) +// Unix returns the time stored in tv as seconds plus nanoseconds. +func (tv *Timeval) Unix() (sec int64, nsec int64) { + return int64(tv.Sec), int64(tv.Usec) * 1000 +} + +//go:linkname c_getpid C.getpid +func c_getpid() c.Int + +func Kill(pid int, signum Signal) error { + // WASI does not have the notion of processes nor signal handlers. + // + // Any signal that the application raises to the process itself will + // be interpreted as being cause for termination. + if pid > 0 && pid != int(c_getpid()) { + return ESRCH + } + ProcExit(128 + int32(signum)) + return nil +} + +func ProcExit(code int32) { + panic("not implemented") } diff --git a/runtime/internal/clite/syscall/syscall_unix.go b/runtime/internal/clite/syscall/syscall_unix.go new file mode 100644 index 00000000..007edd9d --- /dev/null +++ b/runtime/internal/clite/syscall/syscall_unix.go @@ -0,0 +1,55 @@ +//go:build !wasm + +package syscall + +import "strconv" + +type Errno uintptr + +func (e Errno) Error() string { + if 0 <= int(e) && int(e) < len(errors) { + s := errors[e] + if s != "" { + return s + } + } + return "errno " + strconv.Itoa(int(e)) +} + +func (e Errno) Is(target error) bool { + switch target { + case ErrPermission: + return e == EACCES || e == EPERM + case ErrExist: + return e == EEXIST || e == ENOTEMPTY + case ErrNotExist: + return e == ENOENT + case ErrUnsupported: + return e == ENOSYS || e == ENOTSUP || e == EOPNOTSUPP + } + return false +} + +func (e Errno) Temporary() bool { + return e == EINTR || e == EMFILE || e == ENFILE || e.Timeout() +} + +func (e Errno) Timeout() bool { + return e == EAGAIN || e == EWOULDBLOCK || e == ETIMEDOUT +} + +// A Signal is a number describing a process signal. +// It implements the [os.Signal] interface. +type Signal int + +func (s Signal) Signal() {} + +func (s Signal) String() string { + if 0 <= s && int(s) < len(signals) { + str := signals[s] + if str != "" { + return str + } + } + return "signal " + strconv.Itoa(int(s)) +} diff --git a/runtime/internal/clite/syscall/syscall_wasm.go b/runtime/internal/clite/syscall/syscall_wasm.go new file mode 100644 index 00000000..d37bfef1 --- /dev/null +++ b/runtime/internal/clite/syscall/syscall_wasm.go @@ -0,0 +1,464 @@ +// Copyright 2023 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. + +package syscall + +import ( + "strconv" + "unsafe" +) + +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +type Dircookie = uint64 + +type Filetype = uint8 + +const ( + FILETYPE_UNKNOWN Filetype = iota + FILETYPE_BLOCK_DEVICE + FILETYPE_CHARACTER_DEVICE + FILETYPE_DIRECTORY + FILETYPE_REGULAR_FILE + FILETYPE_SOCKET_DGRAM + FILETYPE_SOCKET_STREAM + FILETYPE_SYMBOLIC_LINK +) + +type Dirent struct { + // The offset of the next directory entry stored in this directory. + Next Dircookie + // The serial number of the file referred to by this directory entry. + Ino uint64 + // The length of the name of the directory entry. + Namlen uint32 + // The type of the file referred to by this directory entry. + Type Filetype + // Name of the directory entry. + Name *byte +} + +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + namelen, ok := direntNamlen(buf) + return 24 + namelen, ok +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} + +// An Errno is an unsigned number describing an error condition. +// It implements the error interface. The zero Errno is by convention +// a non-error, so code to convert from Errno to error should use: +// +// var err = nil +// if errno != 0 { +// err = errno +// } +type Errno uint32 + +func (e Errno) Error() string { + if 0 <= int(e) && int(e) < len(errorstr) { + s := errorstr[e] + if s != "" { + return s + } + } + return "errno " + strconv.Itoa(int(e)) +} + +func (e Errno) Is(target error) bool { + switch target { + case ErrPermission: + return e == EACCES || e == EPERM + case ErrExist: + return e == EEXIST || e == ENOTEMPTY + case ErrNotExist: + return e == ENOENT + case ErrUnsupported: + return e == ENOSYS + } + return false +} + +func (e Errno) Temporary() bool { + return e == EINTR || e == EMFILE || e.Timeout() +} + +func (e Errno) Timeout() bool { + return e == EAGAIN || e == ETIMEDOUT +} + +// A Signal is a number describing a process signal. +// It implements the [os.Signal] interface. +type Signal uint8 + +const ( + SIGNONE Signal = iota + SIGHUP + SIGINT + SIGQUIT + SIGILL + SIGTRAP + SIGABRT + SIGBUS + SIGFPE + SIGKILL + SIGUSR1 + SIGSEGV + SIGUSR2 + SIGPIPE + SIGALRM + SIGTERM + SIGCHLD + SIGCONT + SIGSTOP + SIGTSTP + SIGTTIN + SIGTTOU + SIGURG + SIGXCPU + SIGXFSZ + SIGVTARLM + SIGPROF + SIGWINCH + SIGPOLL + SIGPWR + SIGSYS +) + +func (s Signal) Signal() {} + +func (s Signal) String() string { + switch s { + case SIGNONE: + return "no signal" + case SIGHUP: + return "hangup" + case SIGINT: + return "interrupt" + case SIGQUIT: + return "quit" + case SIGILL: + return "illegal instruction" + case SIGTRAP: + return "trace/breakpoint trap" + case SIGABRT: + return "abort" + case SIGBUS: + return "bus error" + case SIGFPE: + return "floating point exception" + case SIGKILL: + return "killed" + case SIGUSR1: + return "user defined signal 1" + case SIGSEGV: + return "segmentation fault" + case SIGUSR2: + return "user defined signal 2" + case SIGPIPE: + return "broken pipe" + case SIGALRM: + return "alarm clock" + case SIGTERM: + return "terminated" + case SIGCHLD: + return "child exited" + case SIGCONT: + return "continued" + case SIGSTOP: + return "stopped (signal)" + case SIGTSTP: + return "stopped" + case SIGTTIN: + return "stopped (tty input)" + case SIGTTOU: + return "stopped (tty output)" + case SIGURG: + return "urgent I/O condition" + case SIGXCPU: + return "CPU time limit exceeded" + case SIGXFSZ: + return "file size limit exceeded" + case SIGVTARLM: + return "virtual timer expired" + case SIGPROF: + return "profiling timer expired" + case SIGWINCH: + return "window changed" + case SIGPOLL: + return "I/O possible" + case SIGPWR: + return "power failure" + case SIGSYS: + return "bad system call" + default: + return "signal " + strconv.Itoa(int(s)) + } +} + +const ( + Stdin = 0 + Stdout = 1 + Stderr = 2 +) + +const ( + O_RDONLY = 0 + O_WRONLY = 1 + O_RDWR = 2 + + O_CREAT = 0100 + O_CREATE = O_CREAT + O_TRUNC = 01000 + O_APPEND = 02000 + O_EXCL = 0200 + O_SYNC = 010000 + O_DIRECTORY = 020000 + O_NOFOLLOW = 0400 + + O_CLOEXEC = 0 +) + +const ( + F_DUPFD = 0 + F_GETFD = 1 + F_SETFD = 2 + F_GETFL = 3 + F_SETFL = 4 + F_GETOWN = 5 + F_SETOWN = 6 + F_GETLK = 7 + F_SETLK = 8 + F_SETLKW = 9 + F_RGETLK = 10 + F_RSETLK = 11 + F_CNVT = 12 + F_RSETLKW = 13 + + F_RDLCK = 1 + F_WRLCK = 2 + F_UNLCK = 3 + F_UNLKSYS = 4 +) + +const ( + S_IFMT = 0000370000 + S_IFSHM_SYSV = 0000300000 + S_IFSEMA = 0000270000 + S_IFCOND = 0000260000 + S_IFMUTEX = 0000250000 + S_IFSHM = 0000240000 + S_IFBOUNDSOCK = 0000230000 + S_IFSOCKADDR = 0000220000 + S_IFDSOCK = 0000210000 + + S_IFSOCK = 0000140000 + S_IFLNK = 0000120000 + S_IFREG = 0000100000 + S_IFBLK = 0000060000 + S_IFDIR = 0000040000 + S_IFCHR = 0000020000 + S_IFIFO = 0000010000 + + S_UNSUP = 0000370000 + + S_ISUID = 0004000 + S_ISGID = 0002000 + S_ISVTX = 0001000 + + S_IREAD = 0400 + S_IWRITE = 0200 + S_IEXEC = 0100 + + S_IRWXU = 0700 + S_IRUSR = 0400 + S_IWUSR = 0200 + S_IXUSR = 0100 + + S_IRWXG = 070 + S_IRGRP = 040 + S_IWGRP = 020 + S_IXGRP = 010 + + S_IRWXO = 07 + S_IROTH = 04 + S_IWOTH = 02 + S_IXOTH = 01 +) + +type WaitStatus uint32 + +func (w WaitStatus) Exited() bool { return false } +func (w WaitStatus) ExitStatus() int { return 0 } +func (w WaitStatus) Signaled() bool { return false } +func (w WaitStatus) Signal() Signal { return 0 } +func (w WaitStatus) CoreDump() bool { return false } +func (w WaitStatus) Stopped() bool { return false } +func (w WaitStatus) Continued() bool { return false } +func (w WaitStatus) StopSignal() Signal { return 0 } +func (w WaitStatus) TrapCause() int { return 0 } + +// Rusage is a placeholder to allow compilation of the [os/exec] package +// because we need Go programs to be portable across platforms. WASI does +// not have a mechanism to spawn processes so there is no reason for an +// application to take a dependency on this type. +type Rusage struct { + Utime Timeval + Stime Timeval +} + +// ProcAttr is a placeholder to allow compilation of the [os/exec] package +// because we need Go programs to be portable across platforms. WASI does +// not have a mechanism to spawn processes so there is no reason for an +// application to take a dependency on this type. +type ProcAttr struct { + Dir string + Env []string + Files []uintptr + Sys *SysProcAttr +} + +type SysProcAttr struct { +} + +func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + return 0, 0, ENOSYS +} + +func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + return 0, 0, ENOSYS +} + +func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + return 0, 0, ENOSYS +} + +func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + return 0, 0, ENOSYS +} + +func Sysctl(key string) (string, error) { + if key == "kern.hostname" { + return "wasip1", nil + } + return "", ENOSYS +} + +func Getuid() int { + return 1 +} + +func Getgid() int { + return 1 +} + +func Geteuid() int { + return 1 +} + +func Getegid() int { + return 1 +} + +func Getgroups() ([]int, error) { + return []int{1}, nil +} + +func Getpid() int { + return 3 +} + +func Getppid() int { + return 2 +} + +// func Gettimeofday(tv *Timeval) error { +// var time timestamp +// if errno := clock_time_get(clockRealtime, 1e3, &time); errno != 0 { +// return errno +// } +// tv.setTimestamp(time) +// return nil +// } + +func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + return 0, ENOSYS +} + +func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { + return 0, 0, ENOSYS +} + +func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { + return 0, ENOSYS +} + +func Umask(mask int) int { + return 0 +} + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +type clockid = uint32 + +const ( + clockRealtime clockid = iota + clockMonotonic + clockProcessCPUTimeID + clockThreadCPUTimeID +) + +func SetNonblock(fd int, nonblocking bool) error { + panic("todo: syscall.SetNonblock") +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +const ( + RLIMIT_NOFILE = iota +) + +func Getrlimit(which int, lim *Rlimit) error { + return ENOSYS +} + +type Iovec struct { + Base *byte + Len int +} diff --git a/runtime/internal/clite/syscall/tables_wasm.go b/runtime/internal/clite/syscall/tables_wasm.go new file mode 100644 index 00000000..9c279e3e --- /dev/null +++ b/runtime/internal/clite/syscall/tables_wasm.go @@ -0,0 +1,205 @@ +// Copyright 2023 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. + +package syscall + +import "runtime" + +// TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.) +const ( + E2BIG Errno = 1 + EACCES Errno = 2 + EADDRINUSE Errno = 3 + EADDRNOTAVAIL Errno = 4 + EAFNOSUPPORT Errno = 5 + EAGAIN Errno = 6 + EWOULDBLOCK Errno = EAGAIN + EALREADY Errno = 7 + EBADF Errno = 8 + EBADMSG Errno = 9 + EBUSY Errno = 10 + ECANCELED Errno = 11 + ECHILD Errno = 12 + ECONNABORTED Errno = 13 + ECONNREFUSED Errno = 14 + ECONNRESET Errno = 15 + EDEADLK Errno = 16 + EDESTADDRREQ Errno = 17 + EDOM Errno = 18 + EDQUOT Errno = 19 + EEXIST Errno = 20 + EFAULT Errno = 21 + EFBIG Errno = 22 + EHOSTUNREACH Errno = 23 + EIDRM Errno = 24 + EILSEQ Errno = 25 + EINPROGRESS Errno = 26 + EINTR Errno = 27 + EINVAL Errno = 28 + EIO Errno = 29 + EISCONN Errno = 30 + EISDIR Errno = 31 + ELOOP Errno = 32 + EMFILE Errno = 33 + EMLINK Errno = 34 + EMSGSIZE Errno = 35 + EMULTIHOP Errno = 36 + ENAMETOOLONG Errno = 37 + ENETDOWN Errno = 38 + ENETRESET Errno = 39 + ENETUNREACH Errno = 40 + ENFILE Errno = 41 + ENOBUFS Errno = 42 + ENODEV Errno = 43 + ENOENT Errno = 44 + ENOEXEC Errno = 45 + ENOLCK Errno = 46 + ENOLINK Errno = 47 + ENOMEM Errno = 48 + ENOMSG Errno = 49 + ENOPROTOOPT Errno = 50 + ENOSPC Errno = 51 + ENOSYS Errno = 52 + ENOTCONN Errno = 53 + ENOTDIR Errno = 54 + ENOTEMPTY Errno = 55 + ENOTRECOVERABLE Errno = 56 + ENOTSOCK Errno = 57 + ENOTSUP Errno = 58 + ENOTTY Errno = 59 + ENXIO Errno = 60 + EOVERFLOW Errno = 61 + EOWNERDEAD Errno = 62 + EPERM Errno = 63 + EPIPE Errno = 64 + EPROTO Errno = 65 + EPROTONOSUPPORT Errno = 66 + EPROTOTYPE Errno = 67 + ERANGE Errno = 68 + EROFS Errno = 69 + ESPIPE Errno = 70 + ESRCH Errno = 71 + ESTALE Errno = 72 + ETIMEDOUT Errno = 73 + ETXTBSY Errno = 74 + EXDEV Errno = 75 + ENOTCAPABLE Errno = 76 + EBADFD Errno = 77 + // needed by src/net/error_unix_test.go + EOPNOTSUPP = ENOTSUP +) + +// TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.) +var errorstr = [...]string{ + E2BIG: "Argument list too long", + EACCES: "Permission denied", + EADDRINUSE: "Address already in use", + EADDRNOTAVAIL: "Address not available", + EAFNOSUPPORT: "Address family not supported by protocol family", + EAGAIN: "Try again", + EALREADY: "Socket already connected", + EBADF: "Bad file number", + EBADFD: "file descriptor in bad state", + EBADMSG: "Trying to read unreadable message", + EBUSY: "Device or resource busy", + ECANCELED: "Operation canceled.", + ECHILD: "No child processes", + ECONNABORTED: "Connection aborted", + ECONNREFUSED: "Connection refused", + ECONNRESET: "Connection reset by peer", + EDEADLK: "Deadlock condition", + EDESTADDRREQ: "Destination address required", + EDOM: "Math arg out of domain of func", + EDQUOT: "Quota exceeded", + EEXIST: "File exists", + EFAULT: "Bad address", + EFBIG: "File too large", + EHOSTUNREACH: "Host is unreachable", + EIDRM: "Identifier removed", + EILSEQ: "EILSEQ", + EINPROGRESS: "Connection already in progress", + EINTR: "Interrupted system call", + EINVAL: "Invalid argument", + EIO: "I/O error", + EISCONN: "Socket is already connected", + EISDIR: "Is a directory", + ELOOP: "Too many symbolic links", + EMFILE: "Too many open files", + EMLINK: "Too many links", + EMSGSIZE: "Message too long", + EMULTIHOP: "Multihop attempted", + ENAMETOOLONG: "File name too long", + ENETDOWN: "Network interface is not configured", + ENETRESET: "Network dropped connection on reset", + ENETUNREACH: "Network is unreachable", + ENFILE: "File table overflow", + ENOBUFS: "No buffer space available", + ENODEV: "No such device", + ENOENT: "No such file or directory", + ENOEXEC: "Exec format error", + ENOLCK: "No record locks available", + ENOLINK: "The link has been severed", + ENOMEM: "Out of memory", + ENOMSG: "No message of desired type", + ENOPROTOOPT: "Protocol not available", + ENOSPC: "No space left on device", + ENOSYS: "Not implemented on " + runtime.GOOS, + ENOTCONN: "Socket is not connected", + ENOTDIR: "Not a directory", + ENOTEMPTY: "Directory not empty", + ENOTRECOVERABLE: "State not recoverable", + ENOTSOCK: "Socket operation on non-socket", + ENOTSUP: "Not supported", + ENOTTY: "Not a typewriter", + ENXIO: "No such device or address", + EOVERFLOW: "Value too large for defined data type", + EOWNERDEAD: "Owner died", + EPERM: "Operation not permitted", + EPIPE: "Broken pipe", + EPROTO: "Protocol error", + EPROTONOSUPPORT: "Unknown protocol", + EPROTOTYPE: "Protocol wrong type for socket", + ERANGE: "Math result not representable", + EROFS: "Read-only file system", + ESPIPE: "Illegal seek", + ESRCH: "No such process", + ESTALE: "Stale file handle", + ETIMEDOUT: "Connection timed out", + ETXTBSY: "Text file busy", + EXDEV: "Cross-device link", + ENOTCAPABLE: "Capabilities insufficient", +} + +// Do the interface allocations only once for common +// Errno values. +var ( + errEAGAIN error = EAGAIN + errEINVAL error = EINVAL + errENOENT error = ENOENT +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +// +// We set both noinline and nosplit to reduce code size, this function has many +// call sites in the syscall package, inlining it causes a significant increase +// of the compiled code; the function call ultimately does not make a difference +// in the performance of syscall functions since the time is dominated by calls +// to the imports and path resolution. +// +//go:noinline +//go:nosplit +func errnoErr(e Errno) error { + switch e { + case 0: + return nil + case EAGAIN: + return errEAGAIN + case EINVAL: + return errEINVAL + case ENOENT: + return errENOENT + } + return e +} diff --git a/runtime/internal/clite/syscall/timestruct.go b/runtime/internal/clite/syscall/timestruct.go new file mode 100644 index 00000000..4e9926eb --- /dev/null +++ b/runtime/internal/clite/syscall/timestruct.go @@ -0,0 +1,36 @@ +// Copyright 2016 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. + +//go:build unix || (js && wasm) || wasip1 + +package syscall + +// TimespecToNsec returns the time stored in ts as nanoseconds. +func TimespecToNsec(ts Timespec) int64 { return ts.Nano() } + +// NsecToTimespec converts a number of nanoseconds into a [Timespec]. +// func NsecToTimespec(nsec int64) Timespec { +// sec := nsec / 1e9 +// nsec = nsec % 1e9 +// if nsec < 0 { +// nsec += 1e9 +// sec-- +// } +// return setTimespec(sec, nsec) +// } + +// TimevalToNsec returns the time stored in tv as nanoseconds. +func TimevalToNsec(tv Timeval) int64 { return tv.Nano() } + +// // NsecToTimeval converts a number of nanoseconds into a [Timeval]. +// func NsecToTimeval(nsec int64) Timeval { +// nsec += 999 // round up to microsecond +// usec := nsec % 1e9 / 1e3 +// sec := nsec / 1e9 +// if usec < 0 { +// usec += 1e6 +// sec-- +// } +// return setTimeval(sec, usec) +// } diff --git a/runtime/internal/clite/syscall/zerrors_aix_ppc64.go b/runtime/internal/clite/syscall/zerrors_aix_ppc64.go index 5544610e..9a545ea4 100644 --- a/runtime/internal/clite/syscall/zerrors_aix_ppc64.go +++ b/runtime/internal/clite/syscall/zerrors_aix_ppc64.go @@ -1151,3 +1151,167 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "not owner", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "I/O error", + 6: "no such device or address", + 7: "arg list too long", + 8: "exec format error", + 9: "bad file number", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "not enough space", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "file table overflow", + 24: "too many open files", + 25: "not a typewriter", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "argument out of domain", + 34: "result too large", + 35: "no message of desired type", + 36: "identifier removed", + 37: "channel number out of range", + 38: "level 2 not synchronized", + 39: "level 3 halted", + 40: "level 3 reset", + 41: "link number out of range", + 42: "protocol driver not attached", + 43: "no CSI structure available", + 44: "level 2 halted", + 45: "deadlock condition if locked", + 46: "device not ready", + 47: "write-protected media", + 48: "unformatted or incompatible media", + 49: "no locks available", + 50: "cannot Establish Connection", + 52: "missing file or filesystem", + 53: "requests blocked by Administrator", + 55: "operation now in progress", + 56: "operation already in progress", + 57: "socket operation on non-socket", + 58: "destination address required", + 59: "message too long", + 60: "protocol wrong type for socket", + 61: "protocol not available", + 62: "protocol not supported", + 63: "socket type not supported", + 64: "operation not supported on socket", + 65: "protocol family not supported", + 66: "addr family not supported by protocol", + 67: "address already in use", + 68: "can't assign requested address", + 69: "network is down", + 70: "network is unreachable", + 71: "network dropped connection on reset", + 72: "software caused connection abort", + 73: "connection reset by peer", + 74: "no buffer space available", + 75: "socket is already connected", + 76: "socket is not connected", + 77: "can't send after socket shutdown", + 78: "connection timed out", + 79: "connection refused", + 80: "host is down", + 81: "no route to host", + 82: "restart the system call", + 83: "too many processes", + 84: "too many users", + 85: "too many levels of symbolic links", + 86: "file name too long", + 88: "disk quota exceeded", + 89: "invalid file system control data detected", + 90: "for future use ", + 93: "item is not local to host", + 94: "state not recoverable ", + 95: "previous owner died ", + 109: "function not implemented", + 110: "media surface error", + 111: "I/O completed, but needs relocation", + 112: "no attribute found", + 113: "security Authentication Denied", + 114: "not a Trusted Program", + 115: "too many references: can't splice", + 116: "invalid wide character", + 117: "asynchronous I/O cancelled", + 118: "out of STREAMS resources", + 119: "system call timed out", + 120: "next message has wrong type", + 121: "error in protocol", + 122: "no message on stream head read q", + 123: "fd not associated with a stream", + 124: "unsupported attribute value", + 125: "multihop is not allowed", + 126: "the server link has been severed", + 127: "value too large to be stored in data type", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "IOT/Abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible/complete", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 27: "input device data", + 28: "window size changes", + 29: "power-failure", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "profiling timer expired", + 33: "paging space low", + 34: "virtual timer expired", + 35: "signal 35", + 36: "signal 36", + 37: "signal 37", + 38: "signal 38", + 39: "signal 39", + 48: "signal 48", + 49: "signal 49", + 58: "signal 58", + 59: "CPU Failure Predicted", + 60: "monitor mode granted", + 61: "monitor mode retracted", + 62: "sound completed", + 63: "secure attention", + 255: "signal 255", +} diff --git a/runtime/internal/clite/syscall/zerrors_darwin_amd64.go b/runtime/internal/clite/syscall/zerrors_darwin_amd64.go index abba1845..bad1f889 100644 --- a/runtime/internal/clite/syscall/zerrors_darwin_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_darwin_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && darwin - package syscall const ( @@ -1277,3 +1275,147 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "resource busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "device power is off", + 83: "device error", + 84: "value too large to be stored in data type", + 85: "bad executable (or shared library)", + 86: "bad CPU type in executable", + 87: "shared library version mismatch", + 88: "malformed Mach-o file", + 89: "operation canceled", + 90: "identifier removed", + 91: "no message of desired type", + 92: "illegal byte sequence", + 93: "attribute not found", + 94: "bad message", + 95: "EMULTIHOP (Reserved)", + 96: "no message available on STREAM", + 97: "ENOLINK (Reserved)", + 98: "no STREAM resources", + 99: "not a STREAM", + 100: "protocol error", + 101: "STREAM ioctl timeout", + 102: "operation not supported on socket", + 103: "policy not found", + 104: "state not recoverable", + 105: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", +} diff --git a/runtime/internal/clite/syscall/zerrors_darwin_arm64.go b/runtime/internal/clite/syscall/zerrors_darwin_arm64.go index fc2982a7..53236ca4 100644 --- a/runtime/internal/clite/syscall/zerrors_darwin_arm64.go +++ b/runtime/internal/clite/syscall/zerrors_darwin_arm64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build arm64 && darwin - package syscall const ( @@ -1289,3 +1287,148 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "resource busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "device power is off", + 83: "device error", + 84: "value too large to be stored in data type", + 85: "bad executable (or shared library)", + 86: "bad CPU type in executable", + 87: "shared library version mismatch", + 88: "malformed Mach-o file", + 89: "operation canceled", + 90: "identifier removed", + 91: "no message of desired type", + 92: "illegal byte sequence", + 93: "attribute not found", + 94: "bad message", + 95: "EMULTIHOP (Reserved)", + 96: "no message available on STREAM", + 97: "ENOLINK (Reserved)", + 98: "no STREAM resources", + 99: "not a STREAM", + 100: "protocol error", + 101: "STREAM ioctl timeout", + 102: "operation not supported on socket", + 103: "policy not found", + 104: "state not recoverable", + 105: "previous owner died", + 106: "interface output queue is full", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", +} diff --git a/runtime/internal/clite/syscall/zerrors_dragonfly_amd64.go b/runtime/internal/clite/syscall/zerrors_dragonfly_amd64.go index 3e8ba9fb..d87ab132 100644 --- a/runtime/internal/clite/syscall/zerrors_dragonfly_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_dragonfly_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && dragonfly - package syscall const ( @@ -1390,3 +1388,144 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "no medium found", + 94: "unknown error: 94", + 95: "unknown error: 95", + 96: "unknown error: 96", + 97: "unknown error: 97", + 98: "unknown error: 98", + 99: "unknown error: 99", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread Scheduler", + 33: "checkPoint", + 34: "checkPointExit", +} diff --git a/runtime/internal/clite/syscall/zerrors_freebsd_386.go b/runtime/internal/clite/syscall/zerrors_freebsd_386.go index b4dcbdc7..c59b7dae 100644 --- a/runtime/internal/clite/syscall/zerrors_freebsd_386.go +++ b/runtime/internal/clite/syscall/zerrors_freebsd_386.go @@ -1,11 +1,9 @@ // mkerrors.sh -m32 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go -//go:build 386 && freebsd - package syscall const ( @@ -1578,3 +1576,140 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "capabilities insufficient", + 94: "not permitted in capability mode", + 95: "state not recoverable", + 96: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "unknown signal", + 33: "unknown signal", +} diff --git a/runtime/internal/clite/syscall/zerrors_freebsd_amd64.go b/runtime/internal/clite/syscall/zerrors_freebsd_amd64.go index 19765f64..305b8c66 100644 --- a/runtime/internal/clite/syscall/zerrors_freebsd_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_freebsd_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && freebsd - package syscall const ( @@ -1579,3 +1577,140 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "capabilities insufficient", + 94: "not permitted in capability mode", + 95: "state not recoverable", + 96: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "unknown signal", + 33: "unknown signal", +} diff --git a/runtime/internal/clite/syscall/zerrors_freebsd_arm.go b/runtime/internal/clite/syscall/zerrors_freebsd_arm.go index cc3f67a0..9e082e30 100644 --- a/runtime/internal/clite/syscall/zerrors_freebsd_arm.go +++ b/runtime/internal/clite/syscall/zerrors_freebsd_arm.go @@ -1,11 +1,9 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go -//go:build arm && freebsd - package syscall const ( @@ -1578,3 +1576,140 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "capabilities insufficient", + 94: "not permitted in capability mode", + 95: "state not recoverable", + 96: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "unknown signal", + 33: "unknown signal", +} diff --git a/runtime/internal/clite/syscall/zerrors_freebsd_arm64.go b/runtime/internal/clite/syscall/zerrors_freebsd_arm64.go index 0aac0ef6..305b8c66 100644 --- a/runtime/internal/clite/syscall/zerrors_freebsd_arm64.go +++ b/runtime/internal/clite/syscall/zerrors_freebsd_arm64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -//go:build freebsd && arm64 - // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go @@ -1579,3 +1577,140 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "capabilities insufficient", + 94: "not permitted in capability mode", + 95: "state not recoverable", + 96: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "unknown signal", + 33: "unknown signal", +} diff --git a/runtime/internal/clite/syscall/zerrors_freebsd_riscv64.go b/runtime/internal/clite/syscall/zerrors_freebsd_riscv64.go index 38ce3028..305b8c66 100644 --- a/runtime/internal/clite/syscall/zerrors_freebsd_riscv64.go +++ b/runtime/internal/clite/syscall/zerrors_freebsd_riscv64.go @@ -1,8 +1,6 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -//go:build freebsd && riscv64 - // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go @@ -1579,3 +1577,140 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "capabilities insufficient", + 94: "not permitted in capability mode", + 95: "state not recoverable", + 96: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "unknown signal", + 33: "unknown signal", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_386.go b/runtime/internal/clite/syscall/zerrors_linux_386.go index ae0a2a8a..9d4ecdeb 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_386.go +++ b/runtime/internal/clite/syscall/zerrors_linux_386.go @@ -1,11 +1,9 @@ // mkerrors.sh -m32 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go -//go:build 386 && linux - package syscall const ( @@ -1353,3 +1351,172 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale NFS file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_amd64.go b/runtime/internal/clite/syscall/zerrors_linux_amd64.go index 4c6950f6..a8b67801 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_linux_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && linux - package syscall const ( @@ -1354,3 +1352,172 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale NFS file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_arm.go b/runtime/internal/clite/syscall/zerrors_linux_arm.go index 3e4e47cf..285d26a5 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_arm.go +++ b/runtime/internal/clite/syscall/zerrors_linux_arm.go @@ -1,11 +1,9 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go -//go:build arm && linux - package syscall const ( @@ -1366,3 +1364,173 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale NFS file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "unknown error 133", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_arm64.go b/runtime/internal/clite/syscall/zerrors_linux_arm64.go index dda2f7c8..d32a290a 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_arm64.go +++ b/runtime/internal/clite/syscall/zerrors_linux_arm64.go @@ -1,11 +1,9 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go -//go:build arm64 && linux - package syscall const ( @@ -1630,3 +1628,173 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_loong64.go b/runtime/internal/clite/syscall/zerrors_linux_loong64.go index 37fa6e1a..a28439cf 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_loong64.go +++ b/runtime/internal/clite/syscall/zerrors_linux_loong64.go @@ -1929,3 +1929,173 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_mips.go b/runtime/internal/clite/syscall/zerrors_linux_mips.go index 6f8d70a8..81657d1c 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_mips.go +++ b/runtime/internal/clite/syscall/zerrors_linux_mips.go @@ -1,7 +1,7 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go package syscall @@ -1637,3 +1637,176 @@ const ( SIGXCPU = Signal(0x1e) SIGXFSZ = Signal(0x1f) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "no message of desired type", + 36: "identifier removed", + 37: "channel number out of range", + 38: "level 2 not synchronized", + 39: "level 3 halted", + 40: "level 3 reset", + 41: "link number out of range", + 42: "protocol driver not attached", + 43: "no CSI structure available", + 44: "level 2 halted", + 45: "resource deadlock avoided", + 46: "no locks available", + 50: "invalid exchange", + 51: "invalid request descriptor", + 52: "exchange full", + 53: "no anode", + 54: "invalid request code", + 55: "invalid slot", + 56: "file locking deadlock error", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 73: "RFS specific error", + 74: "multihop attempted", + 77: "bad message", + 78: "file name too long", + 79: "value too large for defined data type", + 80: "name not unique on network", + 81: "file descriptor in bad state", + 82: "remote address changed", + 83: "can not access a needed shared library", + 84: "accessing a corrupted shared library", + 85: ".lib section in a.out corrupted", + 86: "attempting to link in too many shared libraries", + 87: "cannot exec a shared library directly", + 88: "invalid or incomplete multibyte or wide character", + 89: "function not implemented", + 90: "too many levels of symbolic links", + 91: "interrupted system call should be restarted", + 92: "streams pipe error", + 93: "directory not empty", + 94: "too many users", + 95: "socket operation on non-socket", + 96: "destination address required", + 97: "message too long", + 98: "protocol wrong type for socket", + 99: "protocol not available", + 120: "protocol not supported", + 121: "socket type not supported", + 122: "operation not supported", + 123: "protocol family not supported", + 124: "address family not supported by protocol", + 125: "address already in use", + 126: "cannot assign requested address", + 127: "network is down", + 128: "network is unreachable", + 129: "network dropped connection on reset", + 130: "software caused connection abort", + 131: "connection reset by peer", + 132: "no buffer space available", + 133: "transport endpoint is already connected", + 134: "transport endpoint is not connected", + 135: "structure needs cleaning", + 137: "not a XENIX named type file", + 138: "no XENIX semaphores available", + 139: "is a named type file", + 140: "remote I/O error", + 141: "unknown error 141", + 142: "unknown error 142", + 143: "cannot send after transport endpoint shutdown", + 144: "too many references: cannot splice", + 145: "connection timed out", + 146: "connection refused", + 147: "host is down", + 148: "no route to host", + 149: "operation already in progress", + 150: "operation now in progress", + 151: "stale file handle", + 158: "operation canceled", + 159: "no medium found", + 160: "wrong medium type", + 161: "required key not available", + 162: "key has expired", + 163: "key has been revoked", + 164: "key was rejected by service", + 165: "owner died", + 166: "state not recoverable", + 167: "operation not possible due to RF-kill", + 168: "memory page has hardware error", + 1133: "disk quota exceeded", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "user defined signal 1", + 17: "user defined signal 2", + 18: "child exited", + 19: "power failure", + 20: "window changed", + 21: "urgent I/O condition", + 22: "I/O possible", + 23: "stopped (signal)", + 24: "stopped", + 25: "continued", + 26: "stopped (tty input)", + 27: "stopped (tty output)", + 28: "virtual timer expired", + 29: "profiling timer expired", + 30: "CPU time limit exceeded", + 31: "file size limit exceeded", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_mips64.go b/runtime/internal/clite/syscall/zerrors_linux_mips64.go index 002d4dd8..6953c924 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_mips64.go +++ b/runtime/internal/clite/syscall/zerrors_linux_mips64.go @@ -1,7 +1,7 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs _const.go package syscall @@ -1620,3 +1620,176 @@ const ( SIGXCPU = Signal(0x1e) SIGXFSZ = Signal(0x1f) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "no message of desired type", + 36: "identifier removed", + 37: "channel number out of range", + 38: "level 2 not synchronized", + 39: "level 3 halted", + 40: "level 3 reset", + 41: "link number out of range", + 42: "protocol driver not attached", + 43: "no CSI structure available", + 44: "level 2 halted", + 45: "resource deadlock avoided", + 46: "no locks available", + 50: "invalid exchange", + 51: "invalid request descriptor", + 52: "exchange full", + 53: "no anode", + 54: "invalid request code", + 55: "invalid slot", + 56: "file locking deadlock error", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 73: "RFS specific error", + 74: "multihop attempted", + 77: "bad message", + 78: "file name too long", + 79: "value too large for defined data type", + 80: "name not unique on network", + 81: "file descriptor in bad state", + 82: "remote address changed", + 83: "can not access a needed shared library", + 84: "accessing a corrupted shared library", + 85: ".lib section in a.out corrupted", + 86: "attempting to link in too many shared libraries", + 87: "cannot exec a shared library directly", + 88: "invalid or incomplete multibyte or wide character", + 89: "function not implemented", + 90: "too many levels of symbolic links", + 91: "interrupted system call should be restarted", + 92: "streams pipe error", + 93: "directory not empty", + 94: "too many users", + 95: "socket operation on non-socket", + 96: "destination address required", + 97: "message too long", + 98: "protocol wrong type for socket", + 99: "protocol not available", + 120: "protocol not supported", + 121: "socket type not supported", + 122: "operation not supported", + 123: "protocol family not supported", + 124: "address family not supported by protocol", + 125: "address already in use", + 126: "cannot assign requested address", + 127: "network is down", + 128: "network is unreachable", + 129: "network dropped connection on reset", + 130: "software caused connection abort", + 131: "connection reset by peer", + 132: "no buffer space available", + 133: "transport endpoint is already connected", + 134: "transport endpoint is not connected", + 135: "structure needs cleaning", + 137: "not a XENIX named type file", + 138: "no XENIX semaphores available", + 139: "is a named type file", + 140: "remote I/O error", + 141: "unknown error 141", + 142: "unknown error 142", + 143: "cannot send after transport endpoint shutdown", + 144: "too many references: cannot splice", + 145: "connection timed out", + 146: "connection refused", + 147: "host is down", + 148: "no route to host", + 149: "operation already in progress", + 150: "operation now in progress", + 151: "stale NFS file handle", + 158: "operation canceled", + 159: "no medium found", + 160: "wrong medium type", + 161: "required key not available", + 162: "key has expired", + 163: "key has been revoked", + 164: "key was rejected by service", + 165: "owner died", + 166: "state not recoverable", + 167: "operation not possible due to RF-kill", + 168: "memory page has hardware error", + 1133: "disk quota exceeded", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "user defined signal 1", + 17: "user defined signal 2", + 18: "child exited", + 19: "power failure", + 20: "window changed", + 21: "urgent I/O condition", + 22: "I/O possible", + 23: "stopped (signal)", + 24: "stopped", + 25: "continued", + 26: "stopped (tty input)", + 27: "stopped (tty output)", + 28: "virtual timer expired", + 29: "profiling timer expired", + 30: "CPU time limit exceeded", + 31: "file size limit exceeded", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_mips64le.go b/runtime/internal/clite/syscall/zerrors_linux_mips64le.go index 002d4dd8..6953c924 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_mips64le.go +++ b/runtime/internal/clite/syscall/zerrors_linux_mips64le.go @@ -1,7 +1,7 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs _const.go package syscall @@ -1620,3 +1620,176 @@ const ( SIGXCPU = Signal(0x1e) SIGXFSZ = Signal(0x1f) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "no message of desired type", + 36: "identifier removed", + 37: "channel number out of range", + 38: "level 2 not synchronized", + 39: "level 3 halted", + 40: "level 3 reset", + 41: "link number out of range", + 42: "protocol driver not attached", + 43: "no CSI structure available", + 44: "level 2 halted", + 45: "resource deadlock avoided", + 46: "no locks available", + 50: "invalid exchange", + 51: "invalid request descriptor", + 52: "exchange full", + 53: "no anode", + 54: "invalid request code", + 55: "invalid slot", + 56: "file locking deadlock error", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 73: "RFS specific error", + 74: "multihop attempted", + 77: "bad message", + 78: "file name too long", + 79: "value too large for defined data type", + 80: "name not unique on network", + 81: "file descriptor in bad state", + 82: "remote address changed", + 83: "can not access a needed shared library", + 84: "accessing a corrupted shared library", + 85: ".lib section in a.out corrupted", + 86: "attempting to link in too many shared libraries", + 87: "cannot exec a shared library directly", + 88: "invalid or incomplete multibyte or wide character", + 89: "function not implemented", + 90: "too many levels of symbolic links", + 91: "interrupted system call should be restarted", + 92: "streams pipe error", + 93: "directory not empty", + 94: "too many users", + 95: "socket operation on non-socket", + 96: "destination address required", + 97: "message too long", + 98: "protocol wrong type for socket", + 99: "protocol not available", + 120: "protocol not supported", + 121: "socket type not supported", + 122: "operation not supported", + 123: "protocol family not supported", + 124: "address family not supported by protocol", + 125: "address already in use", + 126: "cannot assign requested address", + 127: "network is down", + 128: "network is unreachable", + 129: "network dropped connection on reset", + 130: "software caused connection abort", + 131: "connection reset by peer", + 132: "no buffer space available", + 133: "transport endpoint is already connected", + 134: "transport endpoint is not connected", + 135: "structure needs cleaning", + 137: "not a XENIX named type file", + 138: "no XENIX semaphores available", + 139: "is a named type file", + 140: "remote I/O error", + 141: "unknown error 141", + 142: "unknown error 142", + 143: "cannot send after transport endpoint shutdown", + 144: "too many references: cannot splice", + 145: "connection timed out", + 146: "connection refused", + 147: "host is down", + 148: "no route to host", + 149: "operation already in progress", + 150: "operation now in progress", + 151: "stale NFS file handle", + 158: "operation canceled", + 159: "no medium found", + 160: "wrong medium type", + 161: "required key not available", + 162: "key has expired", + 163: "key has been revoked", + 164: "key was rejected by service", + 165: "owner died", + 166: "state not recoverable", + 167: "operation not possible due to RF-kill", + 168: "memory page has hardware error", + 1133: "disk quota exceeded", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "user defined signal 1", + 17: "user defined signal 2", + 18: "child exited", + 19: "power failure", + 20: "window changed", + 21: "urgent I/O condition", + 22: "I/O possible", + 23: "stopped (signal)", + 24: "stopped", + 25: "continued", + 26: "stopped (tty input)", + 27: "stopped (tty output)", + 28: "virtual timer expired", + 29: "profiling timer expired", + 30: "CPU time limit exceeded", + 31: "file size limit exceeded", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_mipsle.go b/runtime/internal/clite/syscall/zerrors_linux_mipsle.go index 6f8d70a8..81657d1c 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_mipsle.go +++ b/runtime/internal/clite/syscall/zerrors_linux_mipsle.go @@ -1,7 +1,7 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go package syscall @@ -1637,3 +1637,176 @@ const ( SIGXCPU = Signal(0x1e) SIGXFSZ = Signal(0x1f) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "no message of desired type", + 36: "identifier removed", + 37: "channel number out of range", + 38: "level 2 not synchronized", + 39: "level 3 halted", + 40: "level 3 reset", + 41: "link number out of range", + 42: "protocol driver not attached", + 43: "no CSI structure available", + 44: "level 2 halted", + 45: "resource deadlock avoided", + 46: "no locks available", + 50: "invalid exchange", + 51: "invalid request descriptor", + 52: "exchange full", + 53: "no anode", + 54: "invalid request code", + 55: "invalid slot", + 56: "file locking deadlock error", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 73: "RFS specific error", + 74: "multihop attempted", + 77: "bad message", + 78: "file name too long", + 79: "value too large for defined data type", + 80: "name not unique on network", + 81: "file descriptor in bad state", + 82: "remote address changed", + 83: "can not access a needed shared library", + 84: "accessing a corrupted shared library", + 85: ".lib section in a.out corrupted", + 86: "attempting to link in too many shared libraries", + 87: "cannot exec a shared library directly", + 88: "invalid or incomplete multibyte or wide character", + 89: "function not implemented", + 90: "too many levels of symbolic links", + 91: "interrupted system call should be restarted", + 92: "streams pipe error", + 93: "directory not empty", + 94: "too many users", + 95: "socket operation on non-socket", + 96: "destination address required", + 97: "message too long", + 98: "protocol wrong type for socket", + 99: "protocol not available", + 120: "protocol not supported", + 121: "socket type not supported", + 122: "operation not supported", + 123: "protocol family not supported", + 124: "address family not supported by protocol", + 125: "address already in use", + 126: "cannot assign requested address", + 127: "network is down", + 128: "network is unreachable", + 129: "network dropped connection on reset", + 130: "software caused connection abort", + 131: "connection reset by peer", + 132: "no buffer space available", + 133: "transport endpoint is already connected", + 134: "transport endpoint is not connected", + 135: "structure needs cleaning", + 137: "not a XENIX named type file", + 138: "no XENIX semaphores available", + 139: "is a named type file", + 140: "remote I/O error", + 141: "unknown error 141", + 142: "unknown error 142", + 143: "cannot send after transport endpoint shutdown", + 144: "too many references: cannot splice", + 145: "connection timed out", + 146: "connection refused", + 147: "host is down", + 148: "no route to host", + 149: "operation already in progress", + 150: "operation now in progress", + 151: "stale file handle", + 158: "operation canceled", + 159: "no medium found", + 160: "wrong medium type", + 161: "required key not available", + 162: "key has expired", + 163: "key has been revoked", + 164: "key was rejected by service", + 165: "owner died", + 166: "state not recoverable", + 167: "operation not possible due to RF-kill", + 168: "memory page has hardware error", + 1133: "disk quota exceeded", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "user defined signal 1", + 17: "user defined signal 2", + 18: "child exited", + 19: "power failure", + 20: "window changed", + 21: "urgent I/O condition", + 22: "I/O possible", + 23: "stopped (signal)", + 24: "stopped", + 25: "continued", + 26: "stopped (tty input)", + 27: "stopped (tty output)", + 28: "virtual timer expired", + 29: "profiling timer expired", + 30: "CPU time limit exceeded", + 31: "file size limit exceeded", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_ppc64.go b/runtime/internal/clite/syscall/zerrors_linux_ppc64.go index 1fe5088d..f0661a24 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_ppc64.go +++ b/runtime/internal/clite/syscall/zerrors_linux_ppc64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build ppc64 && linux - package syscall const ( @@ -1685,3 +1683,174 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 58: "file locking deadlock error", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale NFS file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_ppc64le.go b/runtime/internal/clite/syscall/zerrors_linux_ppc64le.go index 4e3f7aa7..73849d49 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_ppc64le.go +++ b/runtime/internal/clite/syscall/zerrors_linux_ppc64le.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build ppc64le && linux - package syscall const ( @@ -1709,3 +1707,174 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 58: "file locking deadlock error", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_riscv64.go b/runtime/internal/clite/syscall/zerrors_linux_riscv64.go index b9892a46..760d8742 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_riscv64.go +++ b/runtime/internal/clite/syscall/zerrors_linux_riscv64.go @@ -1,7 +1,7 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go package syscall @@ -1684,3 +1684,173 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_linux_s390x.go b/runtime/internal/clite/syscall/zerrors_linux_s390x.go index eceb9683..9abad9ed 100644 --- a/runtime/internal/clite/syscall/zerrors_linux_s390x.go +++ b/runtime/internal/clite/syscall/zerrors_linux_s390x.go @@ -1,7 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go package syscall @@ -1745,3 +1745,173 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "no such device or address", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device or resource busy", + 17: "file exists", + 18: "invalid cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "numerical result out of range", + 35: "resource deadlock avoided", + 36: "file name too long", + 37: "no locks available", + 38: "function not implemented", + 39: "directory not empty", + 40: "too many levels of symbolic links", + 42: "no message of desired type", + 43: "identifier removed", + 44: "channel number out of range", + 45: "level 2 not synchronized", + 46: "level 3 halted", + 47: "level 3 reset", + 48: "link number out of range", + 49: "protocol driver not attached", + 50: "no CSI structure available", + 51: "level 2 halted", + 52: "invalid exchange", + 53: "invalid request descriptor", + 54: "exchange full", + 55: "no anode", + 56: "invalid request code", + 57: "invalid slot", + 59: "bad font file format", + 60: "device not a stream", + 61: "no data available", + 62: "timer expired", + 63: "out of streams resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "multihop attempted", + 73: "RFS specific error", + 74: "bad message", + 75: "value too large for defined data type", + 76: "name not unique on network", + 77: "file descriptor in bad state", + 78: "remote address changed", + 79: "can not access a needed shared library", + 80: "accessing a corrupted shared library", + 81: ".lib section in a.out corrupted", + 82: "attempting to link in too many shared libraries", + 83: "cannot exec a shared library directly", + 84: "invalid or incomplete multibyte or wide character", + 85: "interrupted system call should be restarted", + 86: "streams pipe error", + 87: "too many users", + 88: "socket operation on non-socket", + 89: "destination address required", + 90: "message too long", + 91: "protocol wrong type for socket", + 92: "protocol not available", + 93: "protocol not supported", + 94: "socket type not supported", + 95: "operation not supported", + 96: "protocol family not supported", + 97: "address family not supported by protocol", + 98: "address already in use", + 99: "cannot assign requested address", + 100: "network is down", + 101: "network is unreachable", + 102: "network dropped connection on reset", + 103: "software caused connection abort", + 104: "connection reset by peer", + 105: "no buffer space available", + 106: "transport endpoint is already connected", + 107: "transport endpoint is not connected", + 108: "cannot send after transport endpoint shutdown", + 109: "too many references: cannot splice", + 110: "connection timed out", + 111: "connection refused", + 112: "host is down", + 113: "no route to host", + 114: "operation already in progress", + 115: "operation now in progress", + 116: "stale file handle", + 117: "structure needs cleaning", + 118: "not a XENIX named type file", + 119: "no XENIX semaphores available", + 120: "is a named type file", + 121: "remote I/O error", + 122: "disk quota exceeded", + 123: "no medium found", + 124: "wrong medium type", + 125: "operation canceled", + 126: "required key not available", + 127: "key has expired", + 128: "key has been revoked", + 129: "key was rejected by service", + 130: "owner died", + 131: "state not recoverable", + 132: "operation not possible due to RF-kill", + 133: "memory page has hardware error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/breakpoint trap", + 6: "aborted", + 7: "bus error", + 8: "floating point exception", + 9: "killed", + 10: "user defined signal 1", + 11: "segmentation fault", + 12: "user defined signal 2", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "stack fault", + 17: "child exited", + 18: "continued", + 19: "stopped (signal)", + 20: "stopped", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "urgent I/O condition", + 24: "CPU time limit exceeded", + 25: "file size limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window changed", + 29: "I/O possible", + 30: "power failure", + 31: "bad system call", +} diff --git a/runtime/internal/clite/syscall/zerrors_netbsd_386.go b/runtime/internal/clite/syscall/zerrors_netbsd_386.go index 56866699..6f21b562 100644 --- a/runtime/internal/clite/syscall/zerrors_netbsd_386.go +++ b/runtime/internal/clite/syscall/zerrors_netbsd_386.go @@ -1,11 +1,9 @@ // mkerrors.sh -m32 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go -//go:build 386 && netbsd - package syscall const ( @@ -1573,3 +1571,139 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large or too small", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol option not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "illegal byte sequence", + 86: "not supported", + 87: "operation Canceled", + 88: "bad or Corrupt message", + 89: "no message available", + 90: "no STREAM resources", + 91: "not a STREAM", + 92: "STREAM ioctl timeout", + 93: "attribute not found", + 94: "multihop attempted", + 95: "link has been severed", + 96: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "power fail/restart", +} diff --git a/runtime/internal/clite/syscall/zerrors_netbsd_amd64.go b/runtime/internal/clite/syscall/zerrors_netbsd_amd64.go index 86c70c17..a404ac21 100644 --- a/runtime/internal/clite/syscall/zerrors_netbsd_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_netbsd_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && netbsd - package syscall const ( @@ -1563,3 +1561,139 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large or too small", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol option not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "illegal byte sequence", + 86: "not supported", + 87: "operation Canceled", + 88: "bad or Corrupt message", + 89: "no message available", + 90: "no STREAM resources", + 91: "not a STREAM", + 92: "STREAM ioctl timeout", + 93: "attribute not found", + 94: "multihop attempted", + 95: "link has been severed", + 96: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "power fail/restart", +} diff --git a/runtime/internal/clite/syscall/zerrors_netbsd_arm.go b/runtime/internal/clite/syscall/zerrors_netbsd_arm.go index b50b54a0..fdf0ca0c 100644 --- a/runtime/internal/clite/syscall/zerrors_netbsd_arm.go +++ b/runtime/internal/clite/syscall/zerrors_netbsd_arm.go @@ -1,11 +1,9 @@ // mkerrors.sh -marm // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -marm _const.go -//go:build arm && netbsd - package syscall const ( @@ -1549,3 +1547,139 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large or too small", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol option not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "illegal byte sequence", + 86: "not supported", + 87: "operation Canceled", + 88: "bad or Corrupt message", + 89: "no message available", + 90: "no STREAM resources", + 91: "not a STREAM", + 92: "STREAM ioctl timeout", + 93: "attribute not found", + 94: "multihop attempted", + 95: "link has been severed", + 96: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "power fail/restart", +} diff --git a/runtime/internal/clite/syscall/zerrors_netbsd_arm64.go b/runtime/internal/clite/syscall/zerrors_netbsd_arm64.go index 82695d63..a404ac21 100644 --- a/runtime/internal/clite/syscall/zerrors_netbsd_arm64.go +++ b/runtime/internal/clite/syscall/zerrors_netbsd_arm64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build arm64 && netbsd - package syscall const ( @@ -1563,3 +1561,139 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large or too small", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol option not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "connection timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "illegal byte sequence", + 86: "not supported", + 87: "operation Canceled", + 88: "bad or Corrupt message", + 89: "no message available", + 90: "no STREAM resources", + 91: "not a STREAM", + 92: "STREAM ioctl timeout", + 93: "attribute not found", + 94: "multihop attempted", + 95: "link has been severed", + 96: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "stopped (signal)", + 18: "stopped", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "power fail/restart", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_386.go b/runtime/internal/clite/syscall/zerrors_openbsd_386.go index bdf23738..4bdae34b 100644 --- a/runtime/internal/clite/syscall/zerrors_openbsd_386.go +++ b/runtime/internal/clite/syscall/zerrors_openbsd_386.go @@ -1,11 +1,9 @@ // mkerrors.sh -m32 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go -//go:build 386 && openbsd - package syscall const ( @@ -1330,6 +1328,7 @@ const ( EALREADY = Errno(0x25) EAUTH = Errno(0x50) EBADF = Errno(0x9) + EBADMSG = Errno(0x5c) EBADRPC = Errno(0x48) EBUSY = Errno(0x10) ECANCELED = Errno(0x58) @@ -1356,7 +1355,7 @@ const ( EIPSEC = Errno(0x52) EISCONN = Errno(0x38) EISDIR = Errno(0x15) - ELAST = Errno(0x5b) + ELAST = Errno(0x5f) ELOOP = Errno(0x3e) EMEDIUMTYPE = Errno(0x56) EMFILE = Errno(0x18) @@ -1384,12 +1383,14 @@ const ( ENOTCONN = Errno(0x39) ENOTDIR = Errno(0x14) ENOTEMPTY = Errno(0x42) + ENOTRECOVERABLE = Errno(0x5d) ENOTSOCK = Errno(0x26) ENOTSUP = Errno(0x5b) ENOTTY = Errno(0x19) ENXIO = Errno(0x6) EOPNOTSUPP = Errno(0x2d) EOVERFLOW = Errno(0x57) + EOWNERDEAD = Errno(0x5e) EPERM = Errno(0x1) EPFNOSUPPORT = Errno(0x2e) EPIPE = Errno(0x20) @@ -1397,6 +1398,7 @@ const ( EPROCUNAVAIL = Errno(0x4c) EPROGMISMATCH = Errno(0x4b) EPROGUNAVAIL = Errno(0x4a) + EPROTO = Errno(0x5f) EPROTONOSUPPORT = Errno(0x2b) EPROTOTYPE = Errno(0x29) ERANGE = Errno(0x22) @@ -1452,3 +1454,138 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_amd64.go b/runtime/internal/clite/syscall/zerrors_openbsd_amd64.go index d2ad3424..69c68502 100644 --- a/runtime/internal/clite/syscall/zerrors_openbsd_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_openbsd_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && openbsd - package syscall const ( @@ -1329,6 +1327,7 @@ const ( EALREADY = Errno(0x25) EAUTH = Errno(0x50) EBADF = Errno(0x9) + EBADMSG = Errno(0x5c) EBADRPC = Errno(0x48) EBUSY = Errno(0x10) ECANCELED = Errno(0x58) @@ -1355,7 +1354,7 @@ const ( EIPSEC = Errno(0x52) EISCONN = Errno(0x38) EISDIR = Errno(0x15) - ELAST = Errno(0x5b) + ELAST = Errno(0x5f) ELOOP = Errno(0x3e) EMEDIUMTYPE = Errno(0x56) EMFILE = Errno(0x18) @@ -1383,12 +1382,14 @@ const ( ENOTCONN = Errno(0x39) ENOTDIR = Errno(0x14) ENOTEMPTY = Errno(0x42) + ENOTRECOVERABLE = Errno(0x5d) ENOTSOCK = Errno(0x26) ENOTSUP = Errno(0x5b) ENOTTY = Errno(0x19) ENXIO = Errno(0x6) EOPNOTSUPP = Errno(0x2d) EOVERFLOW = Errno(0x57) + EOWNERDEAD = Errno(0x5e) EPERM = Errno(0x1) EPFNOSUPPORT = Errno(0x2e) EPIPE = Errno(0x20) @@ -1396,6 +1397,7 @@ const ( EPROCUNAVAIL = Errno(0x4c) EPROGMISMATCH = Errno(0x4b) EPROGUNAVAIL = Errno(0x4a) + EPROTO = Errno(0x5f) EPROTONOSUPPORT = Errno(0x2b) EPROTOTYPE = Errno(0x29) ERANGE = Errno(0x22) @@ -1451,3 +1453,138 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_arm.go b/runtime/internal/clite/syscall/zerrors_openbsd_arm.go index 30a1c9da..dc6379b3 100644 --- a/runtime/internal/clite/syscall/zerrors_openbsd_arm.go +++ b/runtime/internal/clite/syscall/zerrors_openbsd_arm.go @@ -1,11 +1,9 @@ // mkerrors.sh // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go -//go:build arm && openbsd - package syscall const ( @@ -1329,6 +1327,7 @@ const ( EALREADY = Errno(0x25) EAUTH = Errno(0x50) EBADF = Errno(0x9) + EBADMSG = Errno(0x5c) EBADRPC = Errno(0x48) EBUSY = Errno(0x10) ECANCELED = Errno(0x58) @@ -1355,7 +1354,7 @@ const ( EIPSEC = Errno(0x52) EISCONN = Errno(0x38) EISDIR = Errno(0x15) - ELAST = Errno(0x5b) + ELAST = Errno(0x5f) ELOOP = Errno(0x3e) EMEDIUMTYPE = Errno(0x56) EMFILE = Errno(0x18) @@ -1383,12 +1382,14 @@ const ( ENOTCONN = Errno(0x39) ENOTDIR = Errno(0x14) ENOTEMPTY = Errno(0x42) + ENOTRECOVERABLE = Errno(0x5d) ENOTSOCK = Errno(0x26) ENOTSUP = Errno(0x5b) ENOTTY = Errno(0x19) ENXIO = Errno(0x6) EOPNOTSUPP = Errno(0x2d) EOVERFLOW = Errno(0x57) + EOWNERDEAD = Errno(0x5e) EPERM = Errno(0x1) EPFNOSUPPORT = Errno(0x2e) EPIPE = Errno(0x20) @@ -1396,6 +1397,7 @@ const ( EPROCUNAVAIL = Errno(0x4c) EPROGMISMATCH = Errno(0x4b) EPROGUNAVAIL = Errno(0x4a) + EPROTO = Errno(0x5f) EPROTONOSUPPORT = Errno(0x2b) EPROTOTYPE = Errno(0x29) ERANGE = Errno(0x22) @@ -1451,3 +1453,138 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_arm64.go b/runtime/internal/clite/syscall/zerrors_openbsd_arm64.go index 72a93f7e..72e3743d 100644 --- a/runtime/internal/clite/syscall/zerrors_openbsd_arm64.go +++ b/runtime/internal/clite/syscall/zerrors_openbsd_arm64.go @@ -1538,3 +1538,138 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_mips64.go b/runtime/internal/clite/syscall/zerrors_openbsd_mips64.go index 061bce24..4a005bbc 100644 --- a/runtime/internal/clite/syscall/zerrors_openbsd_mips64.go +++ b/runtime/internal/clite/syscall/zerrors_openbsd_mips64.go @@ -1545,3 +1545,138 @@ const ( SIGXCPU = Signal(0x18) SIGXFSZ = Signal(0x19) ) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_ppc64.go b/runtime/internal/clite/syscall/zerrors_openbsd_ppc64.go new file mode 100644 index 00000000..aaca5807 --- /dev/null +++ b/runtime/internal/clite/syscall/zerrors_openbsd_ppc64.go @@ -0,0 +1,1694 @@ +// mkerrors.sh -m64 +// Code generated by the command above; DO NOT EDIT. + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package syscall + +const ( + AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_ENCAP = 0x1c + AF_HYLINK = 0xf + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_KEY = 0x1e + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SIP = 0x1d + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc010427b + BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 + BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x200000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RND = 0xc0 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CREAD = 0x800 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0xff + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DIOCOSFPFLUSH = 0x2000444e + DLT_ARCNET = 0x7 + DLT_ATM_RFC1483 = 0xb + DLT_AX25 = 0x3 + DLT_CHAOS = 0x5 + DLT_C_HDLC = 0x68 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0xd + DLT_FDDI = 0xa + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_LOOP = 0xc + DLT_MPLS = 0xdb + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_SERIAL = 0x32 + DLT_PRONET = 0x4 + DLT_RAW = 0xe + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x9 + EVFILT_TIMER = -0x7 + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf800 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xa + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETOWN = 0x5 + F_ISATTY = 0xb + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xfffffff + IPV6_FLOWLABEL_MASK = 0xfffff + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_AUTH_LEVEL = 0x14 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 + IP_HDRINCL = 0x2 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0xfff + IP_MF = 0x2000 + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PIPEX = 0x22 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + LCNT_OVERLOAD_FLUSH = 0x6 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x0 + MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 + NOFLSH = 0x80000000 + NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRUNCATE = 0x80 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + ONLCR = 0x2 + ONLRET = 0x80 + ONOCR = 0x40 + ONOEOT = 0x8 + OPOST = 0x1 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x10000 + O_CREAT = 0x200 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x80 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PF_FLUSH = 0x1 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_NOFILE = 0x8 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb + RTAX_BRD = 0x7 + RTAX_DNS = 0xc + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf + RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd + RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 + RTA_BRD = 0x80 + RTA_DNS = 0x1000 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_LABEL = 0x400 + RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 + RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x2000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 + RTM_ADD = 0x1 + RTM_BFD = 0x12 + RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DESYNC = 0x10 + RTM_GET = 0x4 + RTM_IFANNOUNCE = 0xf + RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 + RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_SOURCE = 0x16 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x4 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0146953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0146950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0146946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc020697e + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 + SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFDESCR = 0x80206980 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x8020697f + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 + SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SOCK_CLOEXEC = 0x8000 + SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NETPROC = 0x1020 + SO_OOBINLINE = 0x100 + SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RTABLE = 0x1021 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 + TCIFLUSH = 0x1 + TCIOFLUSH = 0x3 + TCOFLUSH = 0x2 + TCP_INFO = 0x9 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x3 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x4 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 + TCP_SACK_ENABLE = 0x8 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALTSIG = 0x4 + WCONTINUED = 0x8 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WUNTRACED = 0x2 +) + +// Errors +const ( + E2BIG = Errno(0x7) + EACCES = Errno(0xd) + EADDRINUSE = Errno(0x30) + EADDRNOTAVAIL = Errno(0x31) + EAFNOSUPPORT = Errno(0x2f) + EAGAIN = Errno(0x23) + EALREADY = Errno(0x25) + EAUTH = Errno(0x50) + EBADF = Errno(0x9) + EBADMSG = Errno(0x5c) + EBADRPC = Errno(0x48) + EBUSY = Errno(0x10) + ECANCELED = Errno(0x58) + ECHILD = Errno(0xa) + ECONNABORTED = Errno(0x35) + ECONNREFUSED = Errno(0x3d) + ECONNRESET = Errno(0x36) + EDEADLK = Errno(0xb) + EDESTADDRREQ = Errno(0x27) + EDOM = Errno(0x21) + EDQUOT = Errno(0x45) + EEXIST = Errno(0x11) + EFAULT = Errno(0xe) + EFBIG = Errno(0x1b) + EFTYPE = Errno(0x4f) + EHOSTDOWN = Errno(0x40) + EHOSTUNREACH = Errno(0x41) + EIDRM = Errno(0x59) + EILSEQ = Errno(0x54) + EINPROGRESS = Errno(0x24) + EINTR = Errno(0x4) + EINVAL = Errno(0x16) + EIO = Errno(0x5) + EIPSEC = Errno(0x52) + EISCONN = Errno(0x38) + EISDIR = Errno(0x15) + ELAST = Errno(0x5f) + ELOOP = Errno(0x3e) + EMEDIUMTYPE = Errno(0x56) + EMFILE = Errno(0x18) + EMLINK = Errno(0x1f) + EMSGSIZE = Errno(0x28) + ENAMETOOLONG = Errno(0x3f) + ENEEDAUTH = Errno(0x51) + ENETDOWN = Errno(0x32) + ENETRESET = Errno(0x34) + ENETUNREACH = Errno(0x33) + ENFILE = Errno(0x17) + ENOATTR = Errno(0x53) + ENOBUFS = Errno(0x37) + ENODEV = Errno(0x13) + ENOENT = Errno(0x2) + ENOEXEC = Errno(0x8) + ENOLCK = Errno(0x4d) + ENOMEDIUM = Errno(0x55) + ENOMEM = Errno(0xc) + ENOMSG = Errno(0x5a) + ENOPROTOOPT = Errno(0x2a) + ENOSPC = Errno(0x1c) + ENOSYS = Errno(0x4e) + ENOTBLK = Errno(0xf) + ENOTCONN = Errno(0x39) + ENOTDIR = Errno(0x14) + ENOTEMPTY = Errno(0x42) + ENOTRECOVERABLE = Errno(0x5d) + ENOTSOCK = Errno(0x26) + ENOTSUP = Errno(0x5b) + ENOTTY = Errno(0x19) + ENXIO = Errno(0x6) + EOPNOTSUPP = Errno(0x2d) + EOVERFLOW = Errno(0x57) + EOWNERDEAD = Errno(0x5e) + EPERM = Errno(0x1) + EPFNOSUPPORT = Errno(0x2e) + EPIPE = Errno(0x20) + EPROCLIM = Errno(0x43) + EPROCUNAVAIL = Errno(0x4c) + EPROGMISMATCH = Errno(0x4b) + EPROGUNAVAIL = Errno(0x4a) + EPROTO = Errno(0x5f) + EPROTONOSUPPORT = Errno(0x2b) + EPROTOTYPE = Errno(0x29) + ERANGE = Errno(0x22) + EREMOTE = Errno(0x47) + EROFS = Errno(0x1e) + ERPCMISMATCH = Errno(0x49) + ESHUTDOWN = Errno(0x3a) + ESOCKTNOSUPPORT = Errno(0x2c) + ESPIPE = Errno(0x1d) + ESRCH = Errno(0x3) + ESTALE = Errno(0x46) + ETIMEDOUT = Errno(0x3c) + ETOOMANYREFS = Errno(0x3b) + ETXTBSY = Errno(0x1a) + EUSERS = Errno(0x44) + EWOULDBLOCK = Errno(0x23) + EXDEV = Errno(0x12) +) + +// Signals +const ( + SIGABRT = Signal(0x6) + SIGALRM = Signal(0xe) + SIGBUS = Signal(0xa) + SIGCHLD = Signal(0x14) + SIGCONT = Signal(0x13) + SIGEMT = Signal(0x7) + SIGFPE = Signal(0x8) + SIGHUP = Signal(0x1) + SIGILL = Signal(0x4) + SIGINFO = Signal(0x1d) + SIGINT = Signal(0x2) + SIGIO = Signal(0x17) + SIGIOT = Signal(0x6) + SIGKILL = Signal(0x9) + SIGPIPE = Signal(0xd) + SIGPROF = Signal(0x1b) + SIGQUIT = Signal(0x3) + SIGSEGV = Signal(0xb) + SIGSTOP = Signal(0x11) + SIGSYS = Signal(0xc) + SIGTERM = Signal(0xf) + SIGTHR = Signal(0x20) + SIGTRAP = Signal(0x5) + SIGTSTP = Signal(0x12) + SIGTTIN = Signal(0x15) + SIGTTOU = Signal(0x16) + SIGURG = Signal(0x10) + SIGUSR1 = Signal(0x1e) + SIGUSR2 = Signal(0x1f) + SIGVTALRM = Signal(0x1a) + SIGWINCH = Signal(0x1c) + SIGXCPU = Signal(0x18) + SIGXFSZ = Signal(0x19) +) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_openbsd_riscv64.go b/runtime/internal/clite/syscall/zerrors_openbsd_riscv64.go new file mode 100644 index 00000000..3740f22e --- /dev/null +++ b/runtime/internal/clite/syscall/zerrors_openbsd_riscv64.go @@ -0,0 +1,1693 @@ +// mkerrors.sh -m64 +// Code generated by the command above; DO NOT EDIT. + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package syscall + +const ( + AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_ENCAP = 0x1c + AF_HYLINK = 0xf + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_KEY = 0x1e + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SIP = 0x1d + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc010427b + BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 + BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x200000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RND = 0xc0 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CREAD = 0x800 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0xff + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DIOCOSFPFLUSH = 0x2000444e + DLT_ARCNET = 0x7 + DLT_ATM_RFC1483 = 0xb + DLT_AX25 = 0x3 + DLT_CHAOS = 0x5 + DLT_C_HDLC = 0x68 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0xd + DLT_FDDI = 0xa + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_LOOP = 0xc + DLT_MPLS = 0xdb + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_SERIAL = 0x32 + DLT_PRONET = 0x4 + DLT_RAW = 0xe + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x9 + EVFILT_TIMER = -0x7 + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf800 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xa + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETOWN = 0x5 + F_ISATTY = 0xb + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_AUTH_LEVEL = 0x14 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 + IP_HDRINCL = 0x2 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0xfff + IP_MF = 0x2000 + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PIPEX = 0x22 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + LCNT_OVERLOAD_FLUSH = 0x6 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x0 + MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 + NOFLSH = 0x80000000 + NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRUNCATE = 0x80 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + ONLCR = 0x2 + ONLRET = 0x80 + ONOCR = 0x40 + ONOEOT = 0x8 + OPOST = 0x1 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x10000 + O_CREAT = 0x200 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x80 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PF_FLUSH = 0x1 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_NOFILE = 0x8 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb + RTAX_BRD = 0x7 + RTAX_DNS = 0xc + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf + RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd + RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 + RTA_BRD = 0x80 + RTA_DNS = 0x1000 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_LABEL = 0x400 + RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 + RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x2000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 + RTM_ADD = 0x1 + RTM_BFD = 0x12 + RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DESYNC = 0x10 + RTM_GET = 0x4 + RTM_IFANNOUNCE = 0xf + RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 + RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_SOURCE = 0x16 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x4 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0146953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0146950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0146946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc020697e + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 + SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFDESCR = 0x80206980 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x8020697f + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 + SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SOCK_CLOEXEC = 0x8000 + SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NETPROC = 0x1020 + SO_OOBINLINE = 0x100 + SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RTABLE = 0x1021 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 + TCIFLUSH = 0x1 + TCIOFLUSH = 0x3 + TCOFLUSH = 0x2 + TCP_INFO = 0x9 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x3 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x4 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 + TCP_SACK_ENABLE = 0x8 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALTSIG = 0x4 + WCONTINUED = 0x8 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WUNTRACED = 0x2 +) + +// Errors +const ( + E2BIG = Errno(0x7) + EACCES = Errno(0xd) + EADDRINUSE = Errno(0x30) + EADDRNOTAVAIL = Errno(0x31) + EAFNOSUPPORT = Errno(0x2f) + EAGAIN = Errno(0x23) + EALREADY = Errno(0x25) + EAUTH = Errno(0x50) + EBADF = Errno(0x9) + EBADMSG = Errno(0x5c) + EBADRPC = Errno(0x48) + EBUSY = Errno(0x10) + ECANCELED = Errno(0x58) + ECHILD = Errno(0xa) + ECONNABORTED = Errno(0x35) + ECONNREFUSED = Errno(0x3d) + ECONNRESET = Errno(0x36) + EDEADLK = Errno(0xb) + EDESTADDRREQ = Errno(0x27) + EDOM = Errno(0x21) + EDQUOT = Errno(0x45) + EEXIST = Errno(0x11) + EFAULT = Errno(0xe) + EFBIG = Errno(0x1b) + EFTYPE = Errno(0x4f) + EHOSTDOWN = Errno(0x40) + EHOSTUNREACH = Errno(0x41) + EIDRM = Errno(0x59) + EILSEQ = Errno(0x54) + EINPROGRESS = Errno(0x24) + EINTR = Errno(0x4) + EINVAL = Errno(0x16) + EIO = Errno(0x5) + EIPSEC = Errno(0x52) + EISCONN = Errno(0x38) + EISDIR = Errno(0x15) + ELAST = Errno(0x5f) + ELOOP = Errno(0x3e) + EMEDIUMTYPE = Errno(0x56) + EMFILE = Errno(0x18) + EMLINK = Errno(0x1f) + EMSGSIZE = Errno(0x28) + ENAMETOOLONG = Errno(0x3f) + ENEEDAUTH = Errno(0x51) + ENETDOWN = Errno(0x32) + ENETRESET = Errno(0x34) + ENETUNREACH = Errno(0x33) + ENFILE = Errno(0x17) + ENOATTR = Errno(0x53) + ENOBUFS = Errno(0x37) + ENODEV = Errno(0x13) + ENOENT = Errno(0x2) + ENOEXEC = Errno(0x8) + ENOLCK = Errno(0x4d) + ENOMEDIUM = Errno(0x55) + ENOMEM = Errno(0xc) + ENOMSG = Errno(0x5a) + ENOPROTOOPT = Errno(0x2a) + ENOSPC = Errno(0x1c) + ENOSYS = Errno(0x4e) + ENOTBLK = Errno(0xf) + ENOTCONN = Errno(0x39) + ENOTDIR = Errno(0x14) + ENOTEMPTY = Errno(0x42) + ENOTRECOVERABLE = Errno(0x5d) + ENOTSOCK = Errno(0x26) + ENOTSUP = Errno(0x5b) + ENOTTY = Errno(0x19) + ENXIO = Errno(0x6) + EOPNOTSUPP = Errno(0x2d) + EOVERFLOW = Errno(0x57) + EOWNERDEAD = Errno(0x5e) + EPERM = Errno(0x1) + EPFNOSUPPORT = Errno(0x2e) + EPIPE = Errno(0x20) + EPROCLIM = Errno(0x43) + EPROCUNAVAIL = Errno(0x4c) + EPROGMISMATCH = Errno(0x4b) + EPROGUNAVAIL = Errno(0x4a) + EPROTO = Errno(0x5f) + EPROTONOSUPPORT = Errno(0x2b) + EPROTOTYPE = Errno(0x29) + ERANGE = Errno(0x22) + EREMOTE = Errno(0x47) + EROFS = Errno(0x1e) + ERPCMISMATCH = Errno(0x49) + ESHUTDOWN = Errno(0x3a) + ESOCKTNOSUPPORT = Errno(0x2c) + ESPIPE = Errno(0x1d) + ESRCH = Errno(0x3) + ESTALE = Errno(0x46) + ETIMEDOUT = Errno(0x3c) + ETOOMANYREFS = Errno(0x3b) + ETXTBSY = Errno(0x1a) + EUSERS = Errno(0x44) + EWOULDBLOCK = Errno(0x23) + EXDEV = Errno(0x12) +) + +// Signals +const ( + SIGABRT = Signal(0x6) + SIGALRM = Signal(0xe) + SIGBUS = Signal(0xa) + SIGCHLD = Signal(0x14) + SIGCONT = Signal(0x13) + SIGEMT = Signal(0x7) + SIGFPE = Signal(0x8) + SIGHUP = Signal(0x1) + SIGILL = Signal(0x4) + SIGINFO = Signal(0x1d) + SIGINT = Signal(0x2) + SIGIO = Signal(0x17) + SIGIOT = Signal(0x6) + SIGKILL = Signal(0x9) + SIGPIPE = Signal(0xd) + SIGPROF = Signal(0x1b) + SIGQUIT = Signal(0x3) + SIGSEGV = Signal(0xb) + SIGSTOP = Signal(0x11) + SIGSYS = Signal(0xc) + SIGTERM = Signal(0xf) + SIGTHR = Signal(0x20) + SIGTRAP = Signal(0x5) + SIGTSTP = Signal(0x12) + SIGTTIN = Signal(0x15) + SIGTTOU = Signal(0x16) + SIGURG = Signal(0x10) + SIGUSR1 = Signal(0x1e) + SIGUSR2 = Signal(0x1f) + SIGVTALRM = Signal(0x1a) + SIGWINCH = Signal(0x1c) + SIGXCPU = Signal(0x18) + SIGXFSZ = Signal(0x19) +) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disk quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC program not available", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "IPsec processing failure", + 83: "attribute not found", + 84: "illegal byte sequence", + 85: "no medium found", + 86: "wrong medium type", + 87: "value too large to be stored in data type", + 88: "operation canceled", + 89: "identifier removed", + 90: "no message of desired type", + 91: "not supported", + 92: "bad message", + 93: "state not recoverable", + 94: "previous owner died", + 95: "protocol error", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "thread AST", +} diff --git a/runtime/internal/clite/syscall/zerrors_solaris_amd64.go b/runtime/internal/clite/syscall/zerrors_solaris_amd64.go index d3da33f6..094a78dc 100644 --- a/runtime/internal/clite/syscall/zerrors_solaris_amd64.go +++ b/runtime/internal/clite/syscall/zerrors_solaris_amd64.go @@ -1,11 +1,9 @@ // mkerrors.sh -m64 // Code generated by the command above; DO NOT EDIT. -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go -//go:build amd64 && solaris - package syscall const ( @@ -634,6 +632,7 @@ const ( O_APPEND = 0x8 O_CLOEXEC = 0x800000 O_CREAT = 0x100 + O_DIRECTORY = 0x1000000 O_DSYNC = 0x40 O_EXCL = 0x400 O_EXEC = 0x400000 @@ -1245,3 +1244,172 @@ const ( SIGXFSZ = Signal(0x1f) SIGXRES = Signal(0x26) ) + +// Error table +var errors = [...]string{ + 1: "not owner", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "I/O error", + 6: "no such device or address", + 7: "arg list too long", + 8: "exec format error", + 9: "bad file number", + 10: "no child processes", + 11: "resource temporarily unavailable", + 12: "not enough space", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "no such device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "file table overflow", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "argument out of domain", + 34: "result too large", + 35: "no message of desired type", + 36: "identifier removed", + 37: "channel number out of range", + 38: "level 2 not synchronized", + 39: "level 3 halted", + 40: "level 3 reset", + 41: "link number out of range", + 42: "protocol driver not attached", + 43: "no CSI structure available", + 44: "level 2 halted", + 45: "deadlock situation detected/avoided", + 46: "no record locks available", + 47: "operation canceled", + 48: "operation not supported", + 49: "disc quota exceeded", + 50: "bad exchange descriptor", + 51: "bad request descriptor", + 52: "message tables full", + 53: "anode table overflow", + 54: "bad request code", + 55: "invalid slot", + 56: "file locking deadlock", + 57: "bad font file format", + 58: "owner of the lock died", + 59: "lock is not recoverable", + 60: "not a stream device", + 61: "no data available", + 62: "timer expired", + 63: "out of stream resources", + 64: "machine is not on the network", + 65: "package not installed", + 66: "object is remote", + 67: "link has been severed", + 68: "advertise error", + 69: "srmount error", + 70: "communication error on send", + 71: "protocol error", + 72: "locked lock was unmapped ", + 73: "facility is not active", + 74: "multihop attempted", + 77: "not a data message", + 78: "file name too long", + 79: "value too large for defined data type", + 80: "name not unique on network", + 81: "file descriptor in bad state", + 82: "remote address changed", + 83: "can not access a needed shared library", + 84: "accessing a corrupted shared library", + 85: ".lib section in a.out corrupted", + 86: "attempting to link in more shared libraries than system limit", + 87: "can not exec a shared library directly", + 88: "illegal byte sequence", + 89: "operation not applicable", + 90: "number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS", + 91: "error 91", + 92: "error 92", + 93: "directory not empty", + 94: "too many users", + 95: "socket operation on non-socket", + 96: "destination address required", + 97: "message too long", + 98: "protocol wrong type for socket", + 99: "option not supported by protocol", + 120: "protocol not supported", + 121: "socket type not supported", + 122: "operation not supported on transport endpoint", + 123: "protocol family not supported", + 124: "address family not supported by protocol family", + 125: "address already in use", + 126: "cannot assign requested address", + 127: "network is down", + 128: "network is unreachable", + 129: "network dropped connection because of reset", + 130: "software caused connection abort", + 131: "connection reset by peer", + 132: "no buffer space available", + 133: "transport endpoint is already connected", + 134: "transport endpoint is not connected", + 143: "cannot send after socket shutdown", + 144: "too many references: cannot splice", + 145: "connection timed out", + 146: "connection refused", + 147: "host is down", + 148: "no route to host", + 149: "operation already in progress", + 150: "operation now in progress", + 151: "stale NFS file handle", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal Instruction", + 5: "trace/Breakpoint Trap", + 6: "abort", + 7: "emulation Trap", + 8: "arithmetic Exception", + 9: "killed", + 10: "bus Error", + 11: "segmentation Fault", + 12: "bad System Call", + 13: "broken Pipe", + 14: "alarm Clock", + 15: "terminated", + 16: "user Signal 1", + 17: "user Signal 2", + 18: "child Status Changed", + 19: "power-Fail/Restart", + 20: "window Size Change", + 21: "urgent Socket Condition", + 22: "pollable Event", + 23: "stopped (signal)", + 24: "stopped (user)", + 25: "continued", + 26: "stopped (tty input)", + 27: "stopped (tty output)", + 28: "virtual Timer Expired", + 29: "profiling Timer Expired", + 30: "cpu Limit Exceeded", + 31: "file Size Limit Exceeded", + 32: "no runnable lwp", + 33: "inter-lwp signal", + 34: "checkpoint Freeze", + 35: "checkpoint Thaw", + 36: "thread Cancellation", + 37: "resource Lost", + 38: "resource Control Exceeded", + 39: "reserved for JVM 1", + 40: "reserved for JVM 2", +} diff --git a/runtime/internal/clite/syscall/zerrors_windows.go b/runtime/internal/clite/syscall/zerrors_windows.go index b56609d8..0a971c7d 100644 --- a/runtime/internal/clite/syscall/zerrors_windows.go +++ b/runtime/internal/clite/syscall/zerrors_windows.go @@ -146,3 +146,138 @@ const ( EXFULL EWINDOWS ) + +// Error strings for invented errors +var errors = [...]string{ + E2BIG - APPLICATION_ERROR: "argument list too long", + EACCES - APPLICATION_ERROR: "permission denied", + EADDRINUSE - APPLICATION_ERROR: "address already in use", + EADDRNOTAVAIL - APPLICATION_ERROR: "cannot assign requested address", + EADV - APPLICATION_ERROR: "advertise error", + EAFNOSUPPORT - APPLICATION_ERROR: "address family not supported by protocol", + EAGAIN - APPLICATION_ERROR: "resource temporarily unavailable", + EALREADY - APPLICATION_ERROR: "operation already in progress", + EBADE - APPLICATION_ERROR: "invalid exchange", + EBADF - APPLICATION_ERROR: "bad file descriptor", + EBADFD - APPLICATION_ERROR: "file descriptor in bad state", + EBADMSG - APPLICATION_ERROR: "bad message", + EBADR - APPLICATION_ERROR: "invalid request descriptor", + EBADRQC - APPLICATION_ERROR: "invalid request code", + EBADSLT - APPLICATION_ERROR: "invalid slot", + EBFONT - APPLICATION_ERROR: "bad font file format", + EBUSY - APPLICATION_ERROR: "device or resource busy", + ECANCELED - APPLICATION_ERROR: "operation canceled", + ECHILD - APPLICATION_ERROR: "no child processes", + ECHRNG - APPLICATION_ERROR: "channel number out of range", + ECOMM - APPLICATION_ERROR: "communication error on send", + ECONNABORTED - APPLICATION_ERROR: "software caused connection abort", + ECONNREFUSED - APPLICATION_ERROR: "connection refused", + ECONNRESET - APPLICATION_ERROR: "connection reset by peer", + EDEADLK - APPLICATION_ERROR: "resource deadlock avoided", + EDEADLOCK - APPLICATION_ERROR: "resource deadlock avoided", + EDESTADDRREQ - APPLICATION_ERROR: "destination address required", + EDOM - APPLICATION_ERROR: "numerical argument out of domain", + EDOTDOT - APPLICATION_ERROR: "RFS specific error", + EDQUOT - APPLICATION_ERROR: "disk quota exceeded", + EEXIST - APPLICATION_ERROR: "file exists", + EFAULT - APPLICATION_ERROR: "bad address", + EFBIG - APPLICATION_ERROR: "file too large", + EHOSTDOWN - APPLICATION_ERROR: "host is down", + EHOSTUNREACH - APPLICATION_ERROR: "no route to host", + EIDRM - APPLICATION_ERROR: "identifier removed", + EILSEQ - APPLICATION_ERROR: "invalid or incomplete multibyte or wide character", + EINPROGRESS - APPLICATION_ERROR: "operation now in progress", + EINTR - APPLICATION_ERROR: "interrupted system call", + EINVAL - APPLICATION_ERROR: "invalid argument", + EIO - APPLICATION_ERROR: "input/output error", + EISCONN - APPLICATION_ERROR: "transport endpoint is already connected", + EISDIR - APPLICATION_ERROR: "is a directory", + EISNAM - APPLICATION_ERROR: "is a named type file", + EKEYEXPIRED - APPLICATION_ERROR: "key has expired", + EKEYREJECTED - APPLICATION_ERROR: "key was rejected by service", + EKEYREVOKED - APPLICATION_ERROR: "key has been revoked", + EL2HLT - APPLICATION_ERROR: "level 2 halted", + EL2NSYNC - APPLICATION_ERROR: "level 2 not synchronized", + EL3HLT - APPLICATION_ERROR: "level 3 halted", + EL3RST - APPLICATION_ERROR: "level 3 reset", + ELIBACC - APPLICATION_ERROR: "can not access a needed shared library", + ELIBBAD - APPLICATION_ERROR: "accessing a corrupted shared library", + ELIBEXEC - APPLICATION_ERROR: "cannot exec a shared library directly", + ELIBMAX - APPLICATION_ERROR: "attempting to link in too many shared libraries", + ELIBSCN - APPLICATION_ERROR: ".lib section in a.out corrupted", + ELNRNG - APPLICATION_ERROR: "link number out of range", + ELOOP - APPLICATION_ERROR: "too many levels of symbolic links", + EMEDIUMTYPE - APPLICATION_ERROR: "wrong medium type", + EMFILE - APPLICATION_ERROR: "too many open files", + EMLINK - APPLICATION_ERROR: "too many links", + EMSGSIZE - APPLICATION_ERROR: "message too long", + EMULTIHOP - APPLICATION_ERROR: "multihop attempted", + ENAMETOOLONG - APPLICATION_ERROR: "file name too long", + ENAVAIL - APPLICATION_ERROR: "no XENIX semaphores available", + ENETDOWN - APPLICATION_ERROR: "network is down", + ENETRESET - APPLICATION_ERROR: "network dropped connection on reset", + ENETUNREACH - APPLICATION_ERROR: "network is unreachable", + ENFILE - APPLICATION_ERROR: "too many open files in system", + ENOANO - APPLICATION_ERROR: "no anode", + ENOBUFS - APPLICATION_ERROR: "no buffer space available", + ENOCSI - APPLICATION_ERROR: "no CSI structure available", + ENODATA - APPLICATION_ERROR: "no data available", + ENODEV - APPLICATION_ERROR: "no such device", + ENOEXEC - APPLICATION_ERROR: "exec format error", + ENOKEY - APPLICATION_ERROR: "required key not available", + ENOLCK - APPLICATION_ERROR: "no locks available", + ENOLINK - APPLICATION_ERROR: "link has been severed", + ENOMEDIUM - APPLICATION_ERROR: "no medium found", + ENOMEM - APPLICATION_ERROR: "cannot allocate memory", + ENOMSG - APPLICATION_ERROR: "no message of desired type", + ENONET - APPLICATION_ERROR: "machine is not on the network", + ENOPKG - APPLICATION_ERROR: "package not installed", + ENOPROTOOPT - APPLICATION_ERROR: "protocol not available", + ENOSPC - APPLICATION_ERROR: "no space left on device", + ENOSR - APPLICATION_ERROR: "out of streams resources", + ENOSTR - APPLICATION_ERROR: "device not a stream", + ENOSYS - APPLICATION_ERROR: "function not implemented", + ENOTBLK - APPLICATION_ERROR: "block device required", + ENOTCONN - APPLICATION_ERROR: "transport endpoint is not connected", + ENOTEMPTY - APPLICATION_ERROR: "directory not empty", + ENOTNAM - APPLICATION_ERROR: "not a XENIX named type file", + ENOTRECOVERABLE - APPLICATION_ERROR: "state not recoverable", + ENOTSOCK - APPLICATION_ERROR: "socket operation on non-socket", + ENOTSUP - APPLICATION_ERROR: "operation not supported", + ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device", + ENOTUNIQ - APPLICATION_ERROR: "name not unique on network", + ENXIO - APPLICATION_ERROR: "no such device or address", + EOPNOTSUPP - APPLICATION_ERROR: "operation not supported", + EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type", + EOWNERDEAD - APPLICATION_ERROR: "owner died", + EPERM - APPLICATION_ERROR: "operation not permitted", + EPFNOSUPPORT - APPLICATION_ERROR: "protocol family not supported", + EPIPE - APPLICATION_ERROR: "broken pipe", + EPROTO - APPLICATION_ERROR: "protocol error", + EPROTONOSUPPORT - APPLICATION_ERROR: "protocol not supported", + EPROTOTYPE - APPLICATION_ERROR: "protocol wrong type for socket", + ERANGE - APPLICATION_ERROR: "numerical result out of range", + EREMCHG - APPLICATION_ERROR: "remote address changed", + EREMOTE - APPLICATION_ERROR: "object is remote", + EREMOTEIO - APPLICATION_ERROR: "remote I/O error", + ERESTART - APPLICATION_ERROR: "interrupted system call should be restarted", + EROFS - APPLICATION_ERROR: "read-only file system", + ESHUTDOWN - APPLICATION_ERROR: "cannot send after transport endpoint shutdown", + ESOCKTNOSUPPORT - APPLICATION_ERROR: "socket type not supported", + ESPIPE - APPLICATION_ERROR: "illegal seek", + ESRCH - APPLICATION_ERROR: "no such process", + ESRMNT - APPLICATION_ERROR: "srmount error", + ESTALE - APPLICATION_ERROR: "stale NFS file handle", + ESTRPIPE - APPLICATION_ERROR: "streams pipe error", + ETIME - APPLICATION_ERROR: "timer expired", + ETIMEDOUT - APPLICATION_ERROR: "connection timed out", + ETOOMANYREFS - APPLICATION_ERROR: "too many references: cannot splice", + ETXTBSY - APPLICATION_ERROR: "text file busy", + EUCLEAN - APPLICATION_ERROR: "structure needs cleaning", + EUNATCH - APPLICATION_ERROR: "protocol driver not attached", + EUSERS - APPLICATION_ERROR: "too many users", + EWOULDBLOCK - APPLICATION_ERROR: "resource temporarily unavailable", + EXDEV - APPLICATION_ERROR: "invalid cross-device link", + EXFULL - APPLICATION_ERROR: "exchange full", + EWINDOWS - APPLICATION_ERROR: "not supported by windows", +} diff --git a/runtime/internal/clite/time/time.go b/runtime/internal/clite/time/time.go index 4622aba3..d013822b 100644 --- a/runtime/internal/clite/time/time.go +++ b/runtime/internal/clite/time/time.go @@ -16,9 +16,6 @@ package time -// #include -import "C" - import ( _ "unsafe" @@ -31,7 +28,9 @@ const ( // ----------------------------------------------------------------------------- -type TimeT C.time_t +const ( + ClockTSize = 8 +) //go:linkname Time C.time func Time(timer *TimeT) TimeT @@ -72,28 +71,31 @@ func Strftime(buf *c.Char, bufSize uintptr, format *c.Char, timeptr *Tm) uintptr // ----------------------------------------------------------------------------- -type ClockT C.clock_t +// clock_t +type ClockT struct { + Unused [ClockTSize]c.Char +} //go:linkname Clock C.clock func Clock() ClockT // ----------------------------------------------------------------------------- -type ClockidT C.clockid_t +type ClockidT c.Int const ( // the system's real time (i.e. wall time) clock, expressed as the amount of time since the Epoch. // This is the same as the value returned by gettimeofday - CLOCK_REALTIME = ClockidT(C.CLOCK_REALTIME) + CLOCK_REALTIME = ClockidT(0x0) // clock that increments monotonically, tracking the time since an arbitrary point, and will continue // to increment while the system is asleep. - CLOCK_MONOTONIC = ClockidT(C.CLOCK_MONOTONIC) + CLOCK_MONOTONIC = ClockidT(0x6) // clock that increments monotonically, tracking the time since an arbitrary point like CLOCK_MONOTONIC. // However, this clock is unaffected by frequency or time adjustments. It should not be compared to // other system time sources. - CLOCK_MONOTONIC_RAW = ClockidT(C.CLOCK_MONOTONIC_RAW) + CLOCK_MONOTONIC_RAW = ClockidT(0x6) // like CLOCK_MONOTONIC_RAW, but reads a value cached by the system at context switch. This can be // read faster, but at a loss of accuracy as it may return values that are milliseconds old. @@ -109,10 +111,10 @@ const ( // CLOCK_UPTIME_RAW_APPROX = ClockidT(C.CLOCK_UPTIME_RAW_APPROX) // clock that tracks the amount of CPU (in user- or kernel-mode) used by the calling process. - CLOCK_PROCESS_CPUTIME_ID = ClockidT(C.CLOCK_PROCESS_CPUTIME_ID) + CLOCK_PROCESS_CPUTIME_ID = ClockidT(0xc) // clock that tracks the amount of CPU (in user- or kernel-mode) used by the calling thread. - CLOCK_THREAD_CPUTIME_ID = ClockidT(C.CLOCK_THREAD_CPUTIME_ID) + CLOCK_THREAD_CPUTIME_ID = ClockidT(0x10) ) type Timespec struct { diff --git a/runtime/internal/clite/time/types.go b/runtime/internal/clite/time/types.go new file mode 100644 index 00000000..80971ca9 --- /dev/null +++ b/runtime/internal/clite/time/types.go @@ -0,0 +1,6 @@ +//go:build !(linux && 386) + +package time + +// time_t +type TimeT int64 diff --git a/runtime/internal/clite/time/types_linux_386.go b/runtime/internal/clite/time/types_linux_386.go new file mode 100644 index 00000000..8bb0aa6b --- /dev/null +++ b/runtime/internal/clite/time/types_linux_386.go @@ -0,0 +1,6 @@ +package time + +import c "github.com/goplus/llgo/runtime/internal/clite" + +// time_t +type TimeT c.Int diff --git a/runtime/internal/lib/internal/abi/abi.go b/runtime/internal/lib/internal/abi/abi.go index e6f333f5..993ea56e 100644 --- a/runtime/internal/lib/internal/abi/abi.go +++ b/runtime/internal/lib/internal/abi/abi.go @@ -22,9 +22,6 @@ import ( "github.com/goplus/llgo/runtime/abi" ) -// llgo:skipall -type _abi struct{} - type InterfaceType = abi.InterfaceType func NoEscape(p unsafe.Pointer) unsafe.Pointer { diff --git a/runtime/internal/lib/internal/chacha8rand/chcha8.go b/runtime/internal/lib/internal/chacha8rand/chcha8.go new file mode 100644 index 00000000..5c491544 --- /dev/null +++ b/runtime/internal/lib/internal/chacha8rand/chcha8.go @@ -0,0 +1,185 @@ +package chacha8rand + +import ( + "unsafe" + + "github.com/goplus/llgo/runtime/internal/runtime/goarch" +) + +func block(seed *[4]uint64, blocks *[32]uint64, counter uint32) { + block_generic(seed, blocks, counter) +} + +// setup sets up 4 ChaCha8 blocks in b32 with the counter and seed. +// Note that b32 is [16][4]uint32 not [4][16]uint32: the blocks are interlaced +// the same way they would be in a 4-way SIMD implementations. +func setup(seed *[4]uint64, b32 *[16][4]uint32, counter uint32) { + // Convert to uint64 to do half as many stores to memory. + b := (*[16][2]uint64)(unsafe.Pointer(b32)) + + // Constants; same as in ChaCha20: "expand 32-byte k" + b[0][0] = 0x61707865_61707865 + b[0][1] = 0x61707865_61707865 + + b[1][0] = 0x3320646e_3320646e + b[1][1] = 0x3320646e_3320646e + + b[2][0] = 0x79622d32_79622d32 + b[2][1] = 0x79622d32_79622d32 + + b[3][0] = 0x6b206574_6b206574 + b[3][1] = 0x6b206574_6b206574 + + // Seed values. + var x64 uint64 + var x uint32 + + x = uint32(seed[0]) + x64 = uint64(x)<<32 | uint64(x) + b[4][0] = x64 + b[4][1] = x64 + + x = uint32(seed[0] >> 32) + x64 = uint64(x)<<32 | uint64(x) + b[5][0] = x64 + b[5][1] = x64 + + x = uint32(seed[1]) + x64 = uint64(x)<<32 | uint64(x) + b[6][0] = x64 + b[6][1] = x64 + + x = uint32(seed[1] >> 32) + x64 = uint64(x)<<32 | uint64(x) + b[7][0] = x64 + b[7][1] = x64 + + x = uint32(seed[2]) + x64 = uint64(x)<<32 | uint64(x) + b[8][0] = x64 + b[8][1] = x64 + + x = uint32(seed[2] >> 32) + x64 = uint64(x)<<32 | uint64(x) + b[9][0] = x64 + b[9][1] = x64 + + x = uint32(seed[3]) + x64 = uint64(x)<<32 | uint64(x) + b[10][0] = x64 + b[10][1] = x64 + + x = uint32(seed[3] >> 32) + x64 = uint64(x)<<32 | uint64(x) + b[11][0] = x64 + b[11][1] = x64 + + // Counters. + if goarch.BigEndian { + b[12][0] = uint64(counter+0)<<32 | uint64(counter+1) + b[12][1] = uint64(counter+2)<<32 | uint64(counter+3) + } else { + b[12][0] = uint64(counter+0) | uint64(counter+1)<<32 + b[12][1] = uint64(counter+2) | uint64(counter+3)<<32 + } + + // Zeros. + b[13][0] = 0 + b[13][1] = 0 + b[14][0] = 0 + b[14][1] = 0 + + b[15][0] = 0 + b[15][1] = 0 +} + +// block_generic is the non-assembly block implementation, +// for use on systems without special assembly. +// Even on such systems, it is quite fast: on GOOS=386, +// ChaCha8 using this code generates random values faster than PCG-DXSM. +func block_generic(seed *[4]uint64, buf *[32]uint64, counter uint32) { + b := (*[16][4]uint32)(unsafe.Pointer(buf)) + + setup(seed, b, counter) + + for i := range b[0] { + // Load block i from b[*][i] into local variables. + b0 := b[0][i] + b1 := b[1][i] + b2 := b[2][i] + b3 := b[3][i] + b4 := b[4][i] + b5 := b[5][i] + b6 := b[6][i] + b7 := b[7][i] + b8 := b[8][i] + b9 := b[9][i] + b10 := b[10][i] + b11 := b[11][i] + b12 := b[12][i] + b13 := b[13][i] + b14 := b[14][i] + b15 := b[15][i] + + // 4 iterations of eight quarter-rounds each is 8 rounds + for round := 0; round < 4; round++ { + b0, b4, b8, b12 = qr(b0, b4, b8, b12) + b1, b5, b9, b13 = qr(b1, b5, b9, b13) + b2, b6, b10, b14 = qr(b2, b6, b10, b14) + b3, b7, b11, b15 = qr(b3, b7, b11, b15) + + b0, b5, b10, b15 = qr(b0, b5, b10, b15) + b1, b6, b11, b12 = qr(b1, b6, b11, b12) + b2, b7, b8, b13 = qr(b2, b7, b8, b13) + b3, b4, b9, b14 = qr(b3, b4, b9, b14) + } + + // Store block i back into b[*][i]. + // Add b4..b11 back to the original key material, + // like in ChaCha20, to avoid trivial invertibility. + // There is no entropy in b0..b3 and b12..b15 + // so we can skip the additions and save some time. + b[0][i] = b0 + b[1][i] = b1 + b[2][i] = b2 + b[3][i] = b3 + b[4][i] += b4 + b[5][i] += b5 + b[6][i] += b6 + b[7][i] += b7 + b[8][i] += b8 + b[9][i] += b9 + b[10][i] += b10 + b[11][i] += b11 + b[12][i] = b12 + b[13][i] = b13 + b[14][i] = b14 + b[15][i] = b15 + } + + if goarch.BigEndian { + // On a big-endian system, reading the uint32 pairs as uint64s + // will word-swap them compared to little-endian, so we word-swap + // them here first to make the next swap get the right answer. + for i, x := range buf { + buf[i] = x>>32 | x<<32 + } + } +} + +// qr is the (inlinable) ChaCha8 quarter round. +func qr(a, b, c, d uint32) (_a, _b, _c, _d uint32) { + a += b + d ^= a + d = d<<16 | d>>16 + c += d + b ^= c + b = b<<12 | b>>20 + a += b + d ^= a + d = d<<8 | d>>24 + c += d + b ^= c + b = b<<7 | b>>25 + return a, b, c, d +} diff --git a/runtime/internal/lib/internal/cpu/_wrap/cpu_x86.c b/runtime/internal/lib/internal/cpu/_wrap/cpu_x86.c new file mode 100644 index 00000000..3756ee17 --- /dev/null +++ b/runtime/internal/lib/internal/cpu/_wrap/cpu_x86.c @@ -0,0 +1,21 @@ +#if defined(__GNUC__) || defined(__clang__) +void llgo_getcpuid(unsigned int eax, unsigned int ecx, + unsigned int *a, unsigned int *b, + unsigned int *c, unsigned int *d) +{ +#if defined(__i386__) || defined(__x86_64__) + __asm__ __volatile__( + "pushq %%rbp\n\t" + "movq %%rsp, %%rbp\n\t" + "andq $-16, %%rsp\n\t" // 16-byte align stack + "cpuid\n\t" + "movq %%rbp, %%rsp\n\t" + "popq %%rbp\n\t" + : "=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d) + : "a"(eax), "c"(ecx) + : "memory"); +#endif +} +#else +#error This code requires GCC or Clang +#endif diff --git a/runtime/internal/lib/internal/cpu/cpu_x86.go b/runtime/internal/lib/internal/cpu/cpu_x86.go index 129ff880..46022c42 100644 --- a/runtime/internal/lib/internal/cpu/cpu_x86.go +++ b/runtime/internal/lib/internal/cpu/cpu_x86.go @@ -2,39 +2,28 @@ package cpu -/* -#if defined(__GNUC__) || defined(__clang__) - static void getcpuid(unsigned int eax, unsigned int ecx, - unsigned int *a, unsigned int *b, - unsigned int *c, unsigned int *d) { - #if defined(__i386__) || defined(__x86_64__) - __asm__ __volatile__( - "pushq %%rbp\n\t" - "movq %%rsp, %%rbp\n\t" - "andq $-16, %%rsp\n\t" // 16-byte align stack - "cpuid\n\t" - "movq %%rbp, %%rsp\n\t" - "popq %%rbp\n\t" - : "=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d) - : "a"(eax), "c"(ecx) - : "memory" - ); - #endif - } -#else - #error This code requires GCC or Clang -#endif -*/ -import "C" +import ( + _ "unsafe" + + c "github.com/goplus/llgo/runtime/internal/clite" +) + +const ( + LLGoPackage = "link" + LLGoFiles = "_wrap/cpu_x86.c" +) + +//go:linkname c_getcpuid C.llgo_getcpuid +func c_getcpuid(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *c.Uint) func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { - C.getcpuid( - C.uint(eaxArg), - C.uint(ecxArg), - (*C.uint)(&eax), - (*C.uint)(&ebx), - (*C.uint)(&ecx), - (*C.uint)(&edx), + c_getcpuid( + c.Uint(eaxArg), + c.Uint(ecxArg), + (*c.Uint)(&eax), + (*c.Uint)(&ebx), + (*c.Uint)(&ecx), + (*c.Uint)(&edx), ) return } diff --git a/runtime/internal/lib/internal/goarch/gengoarch.go b/runtime/internal/lib/internal/goarch/gengoarch.go new file mode 100644 index 00000000..a52936ef --- /dev/null +++ b/runtime/internal/lib/internal/goarch/gengoarch.go @@ -0,0 +1,60 @@ +// Copyright 2014 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. + +//go:build ignore + +package main + +import ( + "bytes" + "fmt" + "log" + "os" + "strings" +) + +var goarches []string + +func main() { + data, err := os.ReadFile("../../internal/syslist/syslist.go") + if err != nil { + log.Fatal(err) + } + const goarchPrefix = `var KnownArch = map[string]bool{` + inGOARCH := false + for _, line := range strings.Split(string(data), "\n") { + if strings.HasPrefix(line, goarchPrefix) { + inGOARCH = true + } else if inGOARCH && strings.HasPrefix(line, "}") { + break + } else if inGOARCH { + goarch := strings.Fields(line)[0] + goarch = strings.TrimPrefix(goarch, `"`) + goarch = strings.TrimSuffix(goarch, `":`) + goarches = append(goarches, goarch) + } + } + + for _, target := range goarches { + if target == "amd64p32" { + continue + } + var buf bytes.Buffer + fmt.Fprintf(&buf, "// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT.\n\n") + fmt.Fprintf(&buf, "//go:build %s\n\n", target) // must explicitly include target for bootstrapping purposes + fmt.Fprintf(&buf, "package goarch\n\n") + fmt.Fprintf(&buf, "const GOARCH = `%s`\n\n", target) + for _, goarch := range goarches { + value := 0 + if goarch == target { + value = 1 + } + fmt.Fprintf(&buf, "const Is%s = %d\n", strings.Title(goarch), value) + } + err := os.WriteFile("zgoarch_"+target+".go", buf.Bytes(), 0666) + if err != nil { + log.Fatal(err) + } + } +} diff --git a/runtime/internal/lib/internal/goarch/goarch.go b/runtime/internal/lib/internal/goarch/goarch.go new file mode 100644 index 00000000..3dda62fa --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch.go @@ -0,0 +1,60 @@ +// Copyright 2021 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. + +// package goarch contains GOARCH-specific constants. +package goarch + +// The next line makes 'go generate' write the zgoarch*.go files with +// per-arch information, including constants named $GOARCH for every +// GOARCH. The constant is 1 on the current system, 0 otherwise; multiplying +// by them is useful for defining GOARCH-specific constants. +// +//go:generate go run gengoarch.go + +type ArchFamilyType int + +const ( + AMD64 ArchFamilyType = iota + ARM + ARM64 + I386 + LOONG64 + MIPS + MIPS64 + PPC64 + RISCV64 + S390X + WASM +) + +// PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant. +// It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit). +const PtrSize = 4 << (^uintptr(0) >> 63) + +// ArchFamily is the architecture family (AMD64, ARM, ...) +const ArchFamily ArchFamilyType = _ArchFamily + +// BigEndian reports whether the architecture is big-endian. +const BigEndian = IsArmbe|IsArm64be|IsMips|IsMips64|IsPpc|IsPpc64|IsS390|IsS390x|IsSparc|IsSparc64 == 1 + +// DefaultPhysPageSize is the default physical page size. +const DefaultPhysPageSize = _DefaultPhysPageSize + +// PCQuantum is the minimal unit for a program counter (1 on x86, 4 on most other systems). +// The various PC tables record PC deltas pre-divided by PCQuantum. +const PCQuantum = _PCQuantum + +// Int64Align is the required alignment for a 64-bit integer (4 on 32-bit systems, 8 on 64-bit). +const Int64Align = PtrSize + +// MinFrameSize is the size of the system-reserved words at the bottom +// of a frame (just above the architectural stack pointer). +// It is zero on x86 and PtrSize on most non-x86 (LR-based) systems. +// On PowerPC it is larger, to cover three more reserved words: +// the compiler word, the link editor word, and the TOC save word. +const MinFrameSize = _MinFrameSize + +// StackAlign is the required alignment of the SP register. +// The stack must be at least word aligned, but some architectures require more. +const StackAlign = _StackAlign diff --git a/runtime/internal/lib/internal/goarch/goarch_386.go b/runtime/internal/lib/internal/goarch/goarch_386.go new file mode 100644 index 00000000..c6214217 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_386.go @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +package goarch + +const ( + _ArchFamily = I386 + _DefaultPhysPageSize = 4096 + _PCQuantum = 1 + _MinFrameSize = 0 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_amd64.go b/runtime/internal/lib/internal/goarch/goarch_amd64.go new file mode 100644 index 00000000..911e3e72 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_amd64.go @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +package goarch + +const ( + _ArchFamily = AMD64 + _DefaultPhysPageSize = 4096 + _PCQuantum = 1 + _MinFrameSize = 0 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_arm.go b/runtime/internal/lib/internal/goarch/goarch_arm.go new file mode 100644 index 00000000..a6591713 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_arm.go @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +package goarch + +const ( + _ArchFamily = ARM + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 4 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_arm64.go b/runtime/internal/lib/internal/goarch/goarch_arm64.go new file mode 100644 index 00000000..85d0b476 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_arm64.go @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +package goarch + +const ( + _ArchFamily = ARM64 + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = 16 +) diff --git a/runtime/internal/lib/internal/goarch/goarch_loong64.go b/runtime/internal/lib/internal/goarch/goarch_loong64.go new file mode 100644 index 00000000..dae1f4da --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_loong64.go @@ -0,0 +1,15 @@ +// Copyright 2022 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. + +//go:build loong64 + +package goarch + +const ( + _ArchFamily = LOONG64 + _DefaultPhysPageSize = 16384 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_mips.go b/runtime/internal/lib/internal/goarch/goarch_mips.go new file mode 100644 index 00000000..59f3995e --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_mips.go @@ -0,0 +1,13 @@ +// Copyright 2015 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. + +package goarch + +const ( + _ArchFamily = MIPS + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 4 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_mips64.go b/runtime/internal/lib/internal/goarch/goarch_mips64.go new file mode 100644 index 00000000..9e4f8279 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_mips64.go @@ -0,0 +1,13 @@ +// Copyright 2015 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. + +package goarch + +const ( + _ArchFamily = MIPS64 + _DefaultPhysPageSize = 16384 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_mips64le.go b/runtime/internal/lib/internal/goarch/goarch_mips64le.go new file mode 100644 index 00000000..9e4f8279 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_mips64le.go @@ -0,0 +1,13 @@ +// Copyright 2015 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. + +package goarch + +const ( + _ArchFamily = MIPS64 + _DefaultPhysPageSize = 16384 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_mipsle.go b/runtime/internal/lib/internal/goarch/goarch_mipsle.go new file mode 100644 index 00000000..3e6642bb --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_mipsle.go @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +package goarch + +const ( + _ArchFamily = MIPS + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 4 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_ppc64.go b/runtime/internal/lib/internal/goarch/goarch_ppc64.go new file mode 100644 index 00000000..60cc846e --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_ppc64.go @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +package goarch + +const ( + _ArchFamily = PPC64 + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 32 + _StackAlign = 16 +) diff --git a/runtime/internal/lib/internal/goarch/goarch_ppc64le.go b/runtime/internal/lib/internal/goarch/goarch_ppc64le.go new file mode 100644 index 00000000..60cc846e --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_ppc64le.go @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +package goarch + +const ( + _ArchFamily = PPC64 + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 32 + _StackAlign = 16 +) diff --git a/runtime/internal/lib/internal/goarch/goarch_riscv64.go b/runtime/internal/lib/internal/goarch/goarch_riscv64.go new file mode 100644 index 00000000..3b6da1e0 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_riscv64.go @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +package goarch + +const ( + _ArchFamily = RISCV64 + _DefaultPhysPageSize = 4096 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_s390x.go b/runtime/internal/lib/internal/goarch/goarch_s390x.go new file mode 100644 index 00000000..20c57055 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_s390x.go @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +package goarch + +const ( + _ArchFamily = S390X + _DefaultPhysPageSize = 4096 + _PCQuantum = 2 + _MinFrameSize = 8 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/goarch_wasm.go b/runtime/internal/lib/internal/goarch/goarch_wasm.go new file mode 100644 index 00000000..98618d69 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/goarch_wasm.go @@ -0,0 +1,13 @@ +// Copyright 2018 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. + +package goarch + +const ( + _ArchFamily = WASM + _DefaultPhysPageSize = 65536 + _PCQuantum = 1 + _MinFrameSize = 0 + _StackAlign = PtrSize +) diff --git a/runtime/internal/lib/internal/goarch/zgoarch_386.go b/runtime/internal/lib/internal/goarch/zgoarch_386.go new file mode 100644 index 00000000..4a9b0e67 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_386.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build 386 + +package goarch + +const GOARCH = `386` + +const Is386 = 1 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_amd64.go b/runtime/internal/lib/internal/goarch/zgoarch_amd64.go new file mode 100644 index 00000000..7926392b --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_amd64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build amd64 + +package goarch + +const GOARCH = `amd64` + +const Is386 = 0 +const IsAmd64 = 1 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_arm.go b/runtime/internal/lib/internal/goarch/zgoarch_arm.go new file mode 100644 index 00000000..6c03b8b0 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_arm.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build arm + +package goarch + +const GOARCH = `arm` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 1 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_arm64.go b/runtime/internal/lib/internal/goarch/zgoarch_arm64.go new file mode 100644 index 00000000..ad342d79 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_arm64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build arm64 + +package goarch + +const GOARCH = `arm64` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 1 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_arm64be.go b/runtime/internal/lib/internal/goarch/zgoarch_arm64be.go new file mode 100644 index 00000000..0f260030 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_arm64be.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build arm64be + +package goarch + +const GOARCH = `arm64be` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 1 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_armbe.go b/runtime/internal/lib/internal/goarch/zgoarch_armbe.go new file mode 100644 index 00000000..6092fee7 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_armbe.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build armbe + +package goarch + +const GOARCH = `armbe` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 1 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_loong64.go b/runtime/internal/lib/internal/goarch/zgoarch_loong64.go new file mode 100644 index 00000000..21c67e11 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_loong64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build loong64 + +package goarch + +const GOARCH = `loong64` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 1 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_mips.go b/runtime/internal/lib/internal/goarch/zgoarch_mips.go new file mode 100644 index 00000000..0db19746 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_mips.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build mips + +package goarch + +const GOARCH = `mips` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 1 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_mips64.go b/runtime/internal/lib/internal/goarch/zgoarch_mips64.go new file mode 100644 index 00000000..738806f0 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_mips64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build mips64 + +package goarch + +const GOARCH = `mips64` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 1 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_mips64le.go b/runtime/internal/lib/internal/goarch/zgoarch_mips64le.go new file mode 100644 index 00000000..8de5beb8 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_mips64le.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build mips64le + +package goarch + +const GOARCH = `mips64le` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 1 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_mips64p32.go b/runtime/internal/lib/internal/goarch/zgoarch_mips64p32.go new file mode 100644 index 00000000..ea461bed --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_mips64p32.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build mips64p32 + +package goarch + +const GOARCH = `mips64p32` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 1 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_mips64p32le.go b/runtime/internal/lib/internal/goarch/zgoarch_mips64p32le.go new file mode 100644 index 00000000..15473ce6 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_mips64p32le.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build mips64p32le + +package goarch + +const GOARCH = `mips64p32le` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 1 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_mipsle.go b/runtime/internal/lib/internal/goarch/zgoarch_mipsle.go new file mode 100644 index 00000000..4955142e --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_mipsle.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build mipsle + +package goarch + +const GOARCH = `mipsle` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 1 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_ppc.go b/runtime/internal/lib/internal/goarch/zgoarch_ppc.go new file mode 100644 index 00000000..ec01763b --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_ppc.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build ppc + +package goarch + +const GOARCH = `ppc` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 1 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_ppc64.go b/runtime/internal/lib/internal/goarch/zgoarch_ppc64.go new file mode 100644 index 00000000..39be3925 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_ppc64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build ppc64 + +package goarch + +const GOARCH = `ppc64` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 1 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_ppc64le.go b/runtime/internal/lib/internal/goarch/zgoarch_ppc64le.go new file mode 100644 index 00000000..5f959e0e --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_ppc64le.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build ppc64le + +package goarch + +const GOARCH = `ppc64le` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 1 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_riscv.go b/runtime/internal/lib/internal/goarch/zgoarch_riscv.go new file mode 100644 index 00000000..8d81a14d --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_riscv.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build riscv + +package goarch + +const GOARCH = `riscv` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 1 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_riscv64.go b/runtime/internal/lib/internal/goarch/zgoarch_riscv64.go new file mode 100644 index 00000000..1df989c2 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_riscv64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build riscv64 + +package goarch + +const GOARCH = `riscv64` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 1 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_s390.go b/runtime/internal/lib/internal/goarch/zgoarch_s390.go new file mode 100644 index 00000000..56815b9f --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_s390.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build s390 + +package goarch + +const GOARCH = `s390` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 1 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_s390x.go b/runtime/internal/lib/internal/goarch/zgoarch_s390x.go new file mode 100644 index 00000000..e61e9bd5 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_s390x.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build s390x + +package goarch + +const GOARCH = `s390x` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 1 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_sparc.go b/runtime/internal/lib/internal/goarch/zgoarch_sparc.go new file mode 100644 index 00000000..ee5b7465 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_sparc.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build sparc + +package goarch + +const GOARCH = `sparc` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 1 +const IsSparc64 = 0 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_sparc64.go b/runtime/internal/lib/internal/goarch/zgoarch_sparc64.go new file mode 100644 index 00000000..519aaa10 --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_sparc64.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build sparc64 + +package goarch + +const GOARCH = `sparc64` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 1 +const IsWasm = 0 diff --git a/runtime/internal/lib/internal/goarch/zgoarch_wasm.go b/runtime/internal/lib/internal/goarch/zgoarch_wasm.go new file mode 100644 index 00000000..25567a1b --- /dev/null +++ b/runtime/internal/lib/internal/goarch/zgoarch_wasm.go @@ -0,0 +1,32 @@ +// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT. + +//go:build wasm + +package goarch + +const GOARCH = `wasm` + +const Is386 = 0 +const IsAmd64 = 0 +const IsAmd64p32 = 0 +const IsArm = 0 +const IsArmbe = 0 +const IsArm64 = 0 +const IsArm64be = 0 +const IsLoong64 = 0 +const IsMips = 0 +const IsMipsle = 0 +const IsMips64 = 0 +const IsMips64le = 0 +const IsMips64p32 = 0 +const IsMips64p32le = 0 +const IsPpc = 0 +const IsPpc64 = 0 +const IsPpc64le = 0 +const IsRiscv = 0 +const IsRiscv64 = 0 +const IsS390 = 0 +const IsS390x = 0 +const IsSparc = 0 +const IsSparc64 = 0 +const IsWasm = 1 diff --git a/runtime/internal/lib/internal/oserror/errors.go b/runtime/internal/lib/internal/oserror/errors.go index 6e46ff9c..a42d6649 100644 --- a/runtime/internal/lib/internal/oserror/errors.go +++ b/runtime/internal/lib/internal/oserror/errors.go @@ -7,15 +7,17 @@ // These types are defined here to permit the syscall package to reference them. package oserror -import "errors" +import ( + "github.com/goplus/llgo/runtime/internal/clite/syscall" +) // llgo:skipall type _oserror struct{} var ( - ErrInvalid = errors.New("invalid argument") - ErrPermission = errors.New("permission denied") - ErrExist = errors.New("file already exists") - ErrNotExist = errors.New("file does not exist") - ErrClosed = errors.New("file already closed") + ErrInvalid = syscall.ErrInvalid + ErrPermission = syscall.ErrPermission + ErrExist = syscall.ErrExist + ErrNotExist = syscall.ErrNotExist + ErrClosed = syscall.ErrClosed ) diff --git a/runtime/internal/lib/internal/runtime/atomic/atomic.go b/runtime/internal/lib/internal/runtime/atomic/atomic.go new file mode 100644 index 00000000..5713a372 --- /dev/null +++ b/runtime/internal/lib/internal/runtime/atomic/atomic.go @@ -0,0 +1,19 @@ +package atomic + +import ( + "unsafe" + + "github.com/goplus/llgo/runtime/internal/lib/sync/atomic" +) + +func casPointer(ptr *unsafe.Pointer, old, new unsafe.Pointer) bool { + return atomic.CompareAndSwapPointer(ptr, old, new) +} + +func storePointer(ptr *unsafe.Pointer, new unsafe.Pointer) { + atomic.StorePointer(ptr, new) +} + +func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer) { + atomic.StorePointer((*unsafe.Pointer)(ptr), val) +} diff --git a/runtime/internal/lib/internal/runtime/maps/maps.go b/runtime/internal/lib/internal/runtime/maps/maps.go new file mode 100644 index 00000000..f5c6d93b --- /dev/null +++ b/runtime/internal/lib/internal/runtime/maps/maps.go @@ -0,0 +1,50 @@ +package maps + +import ( + "unsafe" + + "github.com/goplus/llgo/runtime/abi" +) + +func rand() uint64 { + panic("not implemented") +} + +func fatal(s string) { + panic("fatal: " + s) +} + +type Type = abi.Type + +type SwissMapType struct { + Type + Key *Type + Elem *Type + Group *Type // internal type representing a slot group + // function for hashing keys (ptr to key, seed) -> hash + Hasher func(unsafe.Pointer, uintptr) uintptr + GroupSize uintptr // == Group.Size_ + SlotSize uintptr // size of key/elem slot + ElemOff uintptr // offset of elem in key/elem slot + Flags uint32 +} + +func mapKeyError(typ *SwissMapType, p unsafe.Pointer) error { + return nil +} + +func typedmemmove(typ *abi.Type, dst, src unsafe.Pointer) { + panic("not implemented") +} + +func typedmemclr(typ *abi.Type, ptr unsafe.Pointer) { + panic("not implemented") +} + +func newobject(typ *abi.Type) unsafe.Pointer { + panic("not implemented") +} + +func newarray(typ *abi.Type, n int) unsafe.Pointer { + panic("not implemented") +} diff --git a/runtime/internal/lib/internal/runtime/sys/sys.go b/runtime/internal/lib/internal/runtime/sys/sys.go new file mode 100644 index 00000000..552f19d0 --- /dev/null +++ b/runtime/internal/lib/internal/runtime/sys/sys.go @@ -0,0 +1,5 @@ +package sys + +func GetCallerPC() uintptr { + panic("not implemented") +} diff --git a/runtime/internal/lib/internal/sync/sync.go b/runtime/internal/lib/internal/sync/sync.go new file mode 100644 index 00000000..146d02e8 --- /dev/null +++ b/runtime/internal/lib/internal/sync/sync.go @@ -0,0 +1,29 @@ +package sync + +func runtime_canSpin(i int) bool { + panic("not implemented") +} + +func runtime_doSpin() { + panic("not implemented") +} + +func throw(string) { + panic("not implemented") +} + +func fatal(string) { + panic("not implemented") +} + +func runtime_nanotime() int64 { + panic("not implemented") +} + +func runtime_SemacquireMutex(s *uint32, lifo bool, skipframes int) { + panic("not implemented") +} + +func runtime_Semrelease(s *uint32, handoff bool, skipframes int) { + panic("not implemented") +} diff --git a/runtime/internal/lib/internal/syscall/unix/nonblocking_unix.go b/runtime/internal/lib/internal/syscall/unix/nonblocking_unix.go new file mode 100644 index 00000000..fc0bc279 --- /dev/null +++ b/runtime/internal/lib/internal/syscall/unix/nonblocking_unix.go @@ -0,0 +1,21 @@ +// Copyright 2018 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. + +//go:build unix + +package unix + +import "syscall" + +func IsNonblock(fd int) (nonblocking bool, err error) { + flag, e1 := Fcntl(fd, syscall.F_GETFL, 0) + if e1 != nil { + return false, e1 + } + return flag&syscall.O_NONBLOCK != 0, nil +} + +func HasNonblockFlag(flag int) bool { + return flag&syscall.O_NONBLOCK != 0 +} diff --git a/runtime/internal/lib/internal/syscall/unix/nonblocking_wasm.go b/runtime/internal/lib/internal/syscall/unix/nonblocking_wasm.go new file mode 100644 index 00000000..b24d69a9 --- /dev/null +++ b/runtime/internal/lib/internal/syscall/unix/nonblocking_wasm.go @@ -0,0 +1,17 @@ +// Copyright 2023 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. + +package unix + +import ( + _ "unsafe" // for go:linkname +) + +func IsNonblock(fd int) (nonblocking bool, err error) { + panic("not implemented") +} + +func HasNonblockFlag(flag int) bool { + panic("not implemented") +} diff --git a/runtime/internal/lib/internal/syscall/unix/unix.go b/runtime/internal/lib/internal/syscall/unix/unix.go index ca29490a..9b98a10e 100644 --- a/runtime/internal/lib/internal/syscall/unix/unix.go +++ b/runtime/internal/lib/internal/syscall/unix/unix.go @@ -17,10 +17,8 @@ package unix import ( - "syscall" _ "unsafe" ) -func HasNonblockFlag(flag int) bool { - return flag&syscall.O_NONBLOCK != 0 -} +// llgo:skip path_filestat_get path_create_directory path_readlink path_unlink_file path_remove_directory Fstatat Mkdirat Readlinkat Unlinkat +type _unix struct{} diff --git a/runtime/internal/lib/io/fs/fs.go b/runtime/internal/lib/io/fs/fs.go new file mode 100644 index 00000000..6749f4f3 --- /dev/null +++ b/runtime/internal/lib/io/fs/fs.go @@ -0,0 +1,42 @@ +package fs + +import ( + "io" + "io/fs" +) + +func ReadFile(fsys fs.FS, name string) ([]byte, error) { + if fsys, ok := fsys.(fs.ReadFileFS); ok { + return fsys.ReadFile(name) + } + + file, err := fsys.Open(name) + if err != nil { + return nil, err + } + + var size int + if info, err := file.Stat(); err == nil { + size64 := info.Size() + if int64(int(size64)) == size64 { + size = int(size64) + } + } + + data := make([]byte, 0, size+1) + for { + if len(data) >= cap(data) { + d := append(data[:cap(data)], 0) + data = d[:len(data)] + } + n, err := file.Read(data[len(data):cap(data)]) + data = data[:len(data)+n] + if err != nil { + if err == io.EOF { + err = nil + } + file.Close() + return data, err + } + } +} diff --git a/runtime/internal/lib/math/rand/rand.go b/runtime/internal/lib/math/rand/rand.go index 761e4abc..a28b99a8 100644 --- a/runtime/internal/lib/math/rand/rand.go +++ b/runtime/internal/lib/math/rand/rand.go @@ -22,7 +22,7 @@ import ( "sync/atomic" _ "unsafe" // for go:linkname - "github.com/goplus/llgo/runtime/internal/clite" + c "github.com/goplus/llgo/runtime/internal/clite" "github.com/goplus/llgo/runtime/internal/clite/math/rand" "github.com/goplus/llgo/runtime/internal/clite/time" ) @@ -348,7 +348,7 @@ func fastrand64() uint64 { } func init() { - rand.Srandom(clite.Uint(time.Time(nil))) + rand.Srandom(c.Uint(time.Time(nil))) } // fastSource is an implementation of Source64 that uses the runtime diff --git a/runtime/internal/lib/os/dir.go b/runtime/internal/lib/os/dir.go index 7dba50ae..4eb102ed 100644 --- a/runtime/internal/lib/os/dir.go +++ b/runtime/internal/lib/os/dir.go @@ -8,8 +8,8 @@ import ( c "github.com/goplus/llgo/runtime/internal/clite" "github.com/goplus/llgo/runtime/internal/clite/os" + "github.com/goplus/llgo/runtime/internal/clite/syscall" "github.com/goplus/llgo/runtime/internal/lib/internal/bytealg" - "github.com/goplus/llgo/runtime/internal/lib/syscall" ) type readdirMode int @@ -39,7 +39,7 @@ func (f *File) Readdirnames(n int) (names []string, err error) { } func open(path string, flag int, perm uint32) (int, error) { - fd, err := syscall.Open(path, flag, perm) + fd, err := origSyscall.Open(path, flag, perm) return fd, err } @@ -100,10 +100,29 @@ func closedir(dir uintptr) error { } //go:linkname c_readdir C.readdir -func c_readdir(dir uintptr) ([]syscall.Dirent, error) +func c_readdir(dir uintptr) *syscall.Dirent func readdir(dir uintptr) ([]syscall.Dirent, error) { - return c_readdir(dir) + var entries []syscall.Dirent + for { + dirent := c_readdir(dir) + if dirent == nil { + break + } + entries = append(entries, *dirent) + } + return entries, nil +} + +func direntNamePtr(name any) *byte { + switch name := name.(type) { + case *byte: + return name + case []byte: + return &name[0] + default: + panic("invalid type") + } } func (f *File) ReadDir(n int) (dirents []DirEntry, err error) { @@ -133,26 +152,26 @@ func (f *File) ReadDir(n int) (dirents []DirEntry, err error) { for _, entry := range entries { // Convert syscall.Dirent to fs.DirEntry - name := bytesToString((*[1024]byte)(unsafe.Pointer(&entry.Name[0]))[:]) + name := bytesToString((*[1024]byte)(unsafe.Pointer(direntNamePtr(entry.Name)))[:]) if name == "." || name == ".." { continue } typ := fs.FileMode(0) switch entry.Type { - case origSyscall.DT_REG: + case syscall.DT_REG: typ = 0 - case origSyscall.DT_DIR: + case syscall.DT_DIR: typ = fs.ModeDir - case origSyscall.DT_LNK: + case syscall.DT_LNK: typ = fs.ModeSymlink - case origSyscall.DT_SOCK: + case syscall.DT_SOCK: typ = fs.ModeSocket - case origSyscall.DT_FIFO: + case syscall.DT_FIFO: typ = fs.ModeNamedPipe - case origSyscall.DT_CHR: + case syscall.DT_CHR: typ = fs.ModeCharDevice - case origSyscall.DT_BLK: + case syscall.DT_BLK: typ = fs.ModeDevice } diff --git a/runtime/internal/lib/os/file.go b/runtime/internal/lib/os/file.go index f72ba520..c95710ad 100644 --- a/runtime/internal/lib/os/file.go +++ b/runtime/internal/lib/os/file.go @@ -208,15 +208,6 @@ func (f *File) WriteString(s string) (n int, err error) { panic("todo: os.(*File).WriteString") } -// setStickyBit adds ModeSticky to the permission bits of path, non atomic. -func setStickyBit(name string) error { - fi, err := Stat(name) - if err != nil { - return err - } - return Chmod(name, fi.Mode()|ModeSticky) -} - // Open opens the named file for reading. If successful, methods on // the returned file can be used for reading; the associated file // descriptor has mode O_RDONLY. @@ -476,7 +467,6 @@ func ReadFile(name string) ([]byte, error) { if err != nil { return nil, err } - defer f.Close() var size int if info, err := f.Stat(); err == nil { @@ -507,6 +497,7 @@ func ReadFile(name string) ([]byte, error) { if err == io.EOF { err = nil } + f.Close() return data, err } } diff --git a/runtime/internal/lib/os/os.go b/runtime/internal/lib/os/os.go index b4c6bf1a..d926eb4b 100644 --- a/runtime/internal/lib/os/os.go +++ b/runtime/internal/lib/os/os.go @@ -80,44 +80,6 @@ func Chdir(dir string) error { } */ -func Chmod(name string, mode FileMode) error { - ret := os.Chmod(c.AllocaCStr(name), os.ModeT(syscallMode(mode))) - if ret == 0 { - return nil - } - return toPathErr("chmod", name, ret) -} - -/* TODO(xsw): -// Chmod changes the mode of the named file to mode. -// If the file is a symbolic link, it changes the mode of the link's target. -// If there is an error, it will be of type *PathError. -// -// A different subset of the mode bits are used, depending on the -// operating system. -// -// On Unix, the mode's permission bits, ModeSetuid, ModeSetgid, and -// ModeSticky are used. -// -// On Windows, only the 0200 bit (owner writable) of mode is used; it -// controls whether the file's read-only attribute is set or cleared. -// The other bits are currently unused. For compatibility with Go 1.12 -// and earlier, use a non-zero mode. Use mode 0400 for a read-only -// file and 0600 for a readable+writable file. -// -// On Plan 9, the mode's permission bits, ModeAppend, ModeExclusive, -// and ModeTemporary are used. -func Chmod(name string, mode FileMode) error { return chmod(name, mode) } -*/ - -func Chown(name string, uid, gid int) error { - ret := os.Chown(c.AllocaCStr(name), os.UidT(uid), os.GidT(gid)) - if ret == 0 { - return nil - } - return toPathErr("chown", name, ret) -} - /* TODO(xsw): // Chown changes the numeric uid and gid of the named file. // If the file is a symbolic link, it changes the uid and gid of the link's target. @@ -152,34 +114,6 @@ func Clearenv() // func Expand(s string, mapping func(string) string) string // func ExpandEnv(s string) string -func Getegid() int { - return int(os.Getegid()) -} - -func Geteuid() int { - return int(os.Geteuid()) -} - -func Getgid() int { - return int(os.Getgid()) -} - -// TODO(xsw): -// func Getgroups() ([]int, error) -// func Getpagesize() int - -func Getpid() int { - return int(os.Getpid()) -} - -func Getppid() int { - return int(os.Getppid()) -} - -func Getuid() int { - return int(os.Getuid()) -} - func Getwd() (dir string, err error) { wd := os.Getcwd(c.Alloca(os.PATH_MAX), os.PATH_MAX) if wd != nil { @@ -195,32 +129,6 @@ func Getwd() (dir string, err error) { // func IsPermission(err error) bool // func IsTimeout(err error) bool -func Lchown(name string, uid, gid int) error { - ret := os.Lchown(c.AllocaCStr(name), os.UidT(uid), os.GidT(gid)) - if ret == 0 { - return nil - } - return toPathErr("lchown", name, ret) -} - -/* TODO(xsw): -// Lchown changes the numeric uid and gid of the named file. -// If the file is a symbolic link, it changes the uid and gid of the link itself. -// If there is an error, it will be of type *PathError. -// -// On Windows, it always returns the syscall.EWINDOWS error, wrapped -// in *PathError. -func Lchown(name string, uid, gid int) error { - e := ignoringEINTR(func() error { - return syscall.Lchown(name, uid, gid) - }) - if e != nil { - return &PathError{Op: "lchown", Path: name, Err: e} - } - return nil -} -*/ - func Link(oldname, newname string) error { ret := os.Link(c.AllocaCStr(oldname), c.AllocaCStr(newname)) if ret == 0 { diff --git a/runtime/internal/lib/os/os_nonwasm.go b/runtime/internal/lib/os/os_nonwasm.go new file mode 100644 index 00000000..be082c82 --- /dev/null +++ b/runtime/internal/lib/os/os_nonwasm.go @@ -0,0 +1,109 @@ +//go:build !wasm + +package os + +import ( + c "github.com/goplus/llgo/runtime/internal/clite" + "github.com/goplus/llgo/runtime/internal/clite/os" +) + +// setStickyBit adds ModeSticky to the permission bits of path, non atomic. +func setStickyBit(name string) error { + fi, err := Stat(name) + if err != nil { + return err + } + return Chmod(name, fi.Mode()|ModeSticky) +} + +func Chmod(name string, mode FileMode) error { + ret := os.Chmod(c.AllocaCStr(name), os.ModeT(syscallMode(mode))) + if ret == 0 { + return nil + } + return toPathErr("chmod", name, ret) +} + +/* TODO(xsw): +// Chmod changes the mode of the named file to mode. +// If the file is a symbolic link, it changes the mode of the link's target. +// If there is an error, it will be of type *PathError. +// +// A different subset of the mode bits are used, depending on the +// operating system. +// +// On Unix, the mode's permission bits, ModeSetuid, ModeSetgid, and +// ModeSticky are used. +// +// On Windows, only the 0200 bit (owner writable) of mode is used; it +// controls whether the file's read-only attribute is set or cleared. +// The other bits are currently unused. For compatibility with Go 1.12 +// and earlier, use a non-zero mode. Use mode 0400 for a read-only +// file and 0600 for a readable+writable file. +// +// On Plan 9, the mode's permission bits, ModeAppend, ModeExclusive, +// and ModeTemporary are used. +func Chmod(name string, mode FileMode) error { return chmod(name, mode) } +*/ + +func Chown(name string, uid, gid int) error { + ret := os.Chown(c.AllocaCStr(name), os.UidT(uid), os.GidT(gid)) + if ret == 0 { + return nil + } + return toPathErr("chown", name, ret) +} + +func Getegid() int { + return int(os.Getegid()) +} + +func Geteuid() int { + return int(os.Geteuid()) +} + +func Getgid() int { + return int(os.Getgid()) +} + +// TODO(xsw): +// func Getgroups() ([]int, error) +// func Getpagesize() int + +func Getpid() int { + return int(os.Getpid()) +} + +func Getppid() int { + return int(os.Getppid()) +} + +func Getuid() int { + return int(os.Getuid()) +} + +func Lchown(name string, uid, gid int) error { + ret := os.Lchown(c.AllocaCStr(name), os.UidT(uid), os.GidT(gid)) + if ret == 0 { + return nil + } + return toPathErr("lchown", name, ret) +} + +/* TODO(xsw): +// Lchown changes the numeric uid and gid of the named file. +// If the file is a symbolic link, it changes the uid and gid of the link itself. +// If there is an error, it will be of type *PathError. +// +// On Windows, it always returns the syscall.EWINDOWS error, wrapped +// in *PathError. +func Lchown(name string, uid, gid int) error { + e := ignoringEINTR(func() error { + return syscall.Lchown(name, uid, gid) + }) + if e != nil { + return &PathError{Op: "lchown", Path: name, Err: e} + } + return nil +} +*/ diff --git a/runtime/internal/lib/os/os_wasm.go b/runtime/internal/lib/os/os_wasm.go new file mode 100644 index 00000000..56d6d2cf --- /dev/null +++ b/runtime/internal/lib/os/os_wasm.go @@ -0,0 +1,10 @@ +package os + +// setStickyBit adds ModeSticky to the permission bits of path, non atomic. +func setStickyBit(name string) error { + return nil +} + +func Chmod(name string, mode FileMode) error { + return nil +} diff --git a/runtime/internal/lib/os/path.go b/runtime/internal/lib/os/path.go index 2aa6416a..0591b89a 100644 --- a/runtime/internal/lib/os/path.go +++ b/runtime/internal/lib/os/path.go @@ -57,3 +57,14 @@ func MkdirAll(path string, perm FileMode) error { func RemoveAll(path string) error { return removeAll(path) } + +// endsWithDot reports whether the final component of path is ".". +func endsWithDot(path string) bool { + if path == "." { + return true + } + if len(path) >= 2 && path[len(path)-1] == '.' && IsPathSeparator(path[len(path)-2]) { + return true + } + return false +} diff --git a/runtime/internal/lib/os/removeall_at.go b/runtime/internal/lib/os/removeall_at.go index 40802d58..a141c0f0 100644 --- a/runtime/internal/lib/os/removeall_at.go +++ b/runtime/internal/lib/os/removeall_at.go @@ -209,14 +209,3 @@ func openDirAt(dirfd int, name string) (*File, error) { // We use kindNoPoll because we know that this is a directory. return newFile(r, name, kindNoPoll), nil } - -// endsWithDot reports whether the final component of path is ".". -func endsWithDot(path string) bool { - if path == "." { - return true - } - if len(path) >= 2 && path[len(path)-1] == '.' && IsPathSeparator(path[len(path)-2]) { - return true - } - return false -} diff --git a/runtime/internal/lib/os/stat_unix.go b/runtime/internal/lib/os/stat_unix.go index 64cecb37..b55f2341 100644 --- a/runtime/internal/lib/os/stat_unix.go +++ b/runtime/internal/lib/os/stat_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build unix || (js && wasm) || wasip1 +//go:build unix || wasm package os @@ -23,7 +23,6 @@ func (f *File) Stat() (FileInfo, error) { if err != 0 { return nil, &PathError{Op: "stat", Path: f.name, Err: syscall.Errno(err)} } - fillFileStatFromSys(&fs, f.name) return &fs, nil } @@ -36,7 +35,6 @@ func statNolog(name string) (FileInfo, error) { if err != nil { return nil, &PathError{Op: "stat", Path: name, Err: err} } - fillFileStatFromSys(&fs, name) return &fs, nil } @@ -49,6 +47,5 @@ func lstatNolog(name string) (FileInfo, error) { if err != nil { return nil, &PathError{Op: "lstat", Path: name, Err: err} } - fillFileStatFromSys(&fs, name) return &fs, nil } diff --git a/runtime/internal/lib/os/sys_js.go b/runtime/internal/lib/os/sys_js.go index 4fd0e2d7..7d1622d7 100644 --- a/runtime/internal/lib/os/sys_js.go +++ b/runtime/internal/lib/os/sys_js.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build js && wasm +//go:build js && !wasm package os diff --git a/runtime/internal/lib/os/sys_wasip1.go b/runtime/internal/lib/os/sys_wasm.go similarity index 93% rename from runtime/internal/lib/os/sys_wasip1.go rename to runtime/internal/lib/os/sys_wasm.go index 5a29aa53..bcfadf47 100644 --- a/runtime/internal/lib/os/sys_wasip1.go +++ b/runtime/internal/lib/os/sys_wasm.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build wasip1 - package os // supportsCloseOnExec reports whether the platform supports the diff --git a/runtime/internal/lib/reflect/value.go b/runtime/internal/lib/reflect/value.go index 489e6ca2..abd53991 100644 --- a/runtime/internal/lib/reflect/value.go +++ b/runtime/internal/lib/reflect/value.go @@ -707,10 +707,10 @@ func (v Value) Float() float64 { } else { switch k { case Float32: - return float64(bitcast.ToFloat32(uintptr(v.ptr))) + return float64(bitcast.ToFloat32(int32(uintptr(v.ptr)))) case Float64: if is64bit { - return bitcast.ToFloat64(uintptr(v.ptr)) + return bitcast.ToFloat64(int64(uintptr(v.ptr))) } else { return *(*float64)(v.ptr) } @@ -2845,10 +2845,10 @@ func makeFloat(f flag, v float64, t Type) Value { var ptr unsafe.Pointer switch typ.Size() { case 4: - ptr = unsafe.Pointer(bitcast.FromFloat32(float32(v))) + ptr = unsafe.Pointer(uintptr(bitcast.FromFloat32(float32(v)))) case 8: if is64bit { - ptr = unsafe.Pointer(bitcast.FromFloat64(v)) + ptr = unsafe.Pointer(uintptr(bitcast.FromFloat64(v))) } else { ptr = unsafe_New(typ) *(*float64)(ptr) = v diff --git a/runtime/internal/lib/runtime/_wrap/runtime.c b/runtime/internal/lib/runtime/_wrap/runtime.c new file mode 100644 index 00000000..4dc23cfd --- /dev/null +++ b/runtime/internal/lib/runtime/_wrap/runtime.c @@ -0,0 +1,10 @@ +#include + +int llgo_maxprocs() +{ +#ifdef _SC_NPROCESSORS_ONLN + return (int)sysconf(_SC_NPROCESSORS_ONLN); +#else + return 1; +#endif +} diff --git a/runtime/internal/lib/runtime/malloc.go b/runtime/internal/lib/runtime/malloc.go new file mode 100644 index 00000000..6b44a9c1 --- /dev/null +++ b/runtime/internal/lib/runtime/malloc.go @@ -0,0 +1,5 @@ +package runtime + +// const ( +// heapAddrBits = (_64bit*(1-goarch.IsWasm)*(1-goos.IsIos*goarch.IsArm64))*48 + (1-_64bit+goarch.IsWasm)*(32-(goarch.IsMips+goarch.IsMipsle)) + 40*goos.IsIos*goarch.IsArm64 +// ) diff --git a/runtime/internal/lib/runtime/runtime.go b/runtime/internal/lib/runtime/runtime.go index bde2d8e4..398d248a 100644 --- a/runtime/internal/lib/runtime/runtime.go +++ b/runtime/internal/lib/runtime/runtime.go @@ -16,27 +16,21 @@ package runtime -/* -#include - -int llgo_maxprocs() { - #ifdef _SC_NPROCESSORS_ONLN - return (int)sysconf(_SC_NPROCESSORS_ONLN); - #else - return 1; - #endif -} -*/ -import "C" import ( "unsafe" + c "github.com/goplus/llgo/runtime/internal/clite" "github.com/goplus/llgo/runtime/internal/runtime" ) // llgo:skipall type _runtime struct{} +const ( + LLGoPackage = "link" + LLGoFiles = "_wrap/runtime.c" +) + // GOROOT returns the root of the Go tree. It uses the // GOROOT environment variable, if set at process start, // or else the root used during the Go build. @@ -58,6 +52,11 @@ func Goexit() { func KeepAlive(x any) { } +//go:linkname c_write C.write +func c_write(fd c.Int, p unsafe.Pointer, n c.SizeT) int32 + func write(fd uintptr, p unsafe.Pointer, n int32) int32 { - return int32(C.write(C.int(fd), p, C.size_t(n))) + return int32(c_write(c.Int(fd), p, c.SizeT(n))) } + +const heapArenaBytes = 1024 * 1024 diff --git a/runtime/internal/lib/runtime/runtime2.go b/runtime/internal/lib/runtime/runtime2.go index 8b30b526..db2db492 100644 --- a/runtime/internal/lib/runtime/runtime2.go +++ b/runtime/internal/lib/runtime/runtime2.go @@ -4,9 +4,7 @@ package runtime -import ( - "runtime" -) +import "runtime" // Layout of in-memory per-function information prepared by linker // See https://golang.org/s/go12symtab. diff --git a/runtime/internal/lib/sync/atomic/type.go b/runtime/internal/lib/sync/atomic/type.go index d9e3c9ca..117de37e 100644 --- a/runtime/internal/lib/sync/atomic/type.go +++ b/runtime/internal/lib/sync/atomic/type.go @@ -101,3 +101,37 @@ func OrInt64(addr *int64, mask int64) (old int64) { func OrUint64(addr *uint64, mask uint64) (old uint64) { panic("implement by llgo instruction") } + +// ---------------------------------------------------------------------------- + +// llgo:link AndInt32 llgo.atomicAnd +func AndInt32(addr *int32, mask int32) (old int32) { + panic("implement by llgo instruction") +} + +// llgo:link AndUint32 llgo.atomicAnd +func AndUint32(addr *uint32, mask uint32) (old uint32) { + panic("implement by llgo instruction") +} + +// llgo:link OrInt32 llgo.atomicOr +func OrInt32(addr *int32, mask int32) (old int32) { + panic("implement by llgo instruction") +} + +// llgo:link OrUint32 llgo.atomicOr +func OrUint32(addr *uint32, mask uint32) (old uint32) { + panic("implement by llgo instruction") +} + +// ---------------------------------------------------------------------------- + +// llgo:link AndUintptr llgo.atomicAnd +func AndUintptr(addr *uintptr, mask uintptr) (old uintptr) { + panic("implement by llgo instruction") +} + +// llgo:link OrUintptr llgo.atomicOr +func OrUintptr(addr *uintptr, mask uintptr) (old uintptr) { + panic("implement by llgo instruction") +} diff --git a/runtime/internal/lib/sync/sync.go b/runtime/internal/lib/sync/sync.go index 07cdec69..19b72758 100644 --- a/runtime/internal/lib/sync/sync.go +++ b/runtime/internal/lib/sync/sync.go @@ -19,7 +19,9 @@ package sync import ( "runtime" gosync "sync" + _ "unsafe" + c "github.com/goplus/llgo/runtime/internal/clite" "github.com/goplus/llgo/runtime/internal/clite/pthread/sync" "github.com/goplus/llgo/runtime/internal/lib/sync/atomic" ) @@ -62,8 +64,12 @@ func (m *Mutex) TryLock() bool { return (*sync.Mutex)(&m.Mutex).TryLock() == 0 } -// llgo:link (*Mutex).Unlock C.pthread_mutex_unlock -func (m *Mutex) Unlock() {} +//go:linkname c_pthread_mutex_unlock C.pthread_mutex_unlock +func c_pthread_mutex_unlock(m *Mutex) c.Int + +func (m *Mutex) Unlock() { + c_pthread_mutex_unlock(m) +} // ----------------------------------------------------------------------------- @@ -94,8 +100,12 @@ func (rw *RWMutex) TryRLock() bool { return (*sync.RWLock)(&rw.RWLock).TryRLock() == 0 } -// llgo:link (*RWMutex).RUnlock C.pthread_rwlock_unlock -func (rw *RWMutex) RUnlock() {} +//go:linkname c_pthread_rwlock_unlock C.pthread_rwlock_unlock +func c_pthread_rwlock_unlock(rw *RWMutex) c.Int + +func (rw *RWMutex) RUnlock() { + c_pthread_rwlock_unlock(rw) +} func (rw *RWMutex) Lock() { rw.ensureInit() @@ -107,8 +117,9 @@ func (rw *RWMutex) TryLock() bool { return (*sync.RWLock)(&rw.RWLock).TryLock() == 0 } -// llgo:link (*RWMutex).Unlock C.pthread_rwlock_unlock -func (rw *RWMutex) Unlock() {} +func (rw *RWMutex) Unlock() { + c_pthread_rwlock_unlock(rw) +} // ----------------------------------------------------------------------------- @@ -144,11 +155,19 @@ func NewCond(l gosync.Locker) *Cond { return ret } -// llgo:link (*Cond).Signal C.pthread_cond_signal -func (c *Cond) Signal() {} +//go:linkname c_pthread_cond_signal C.pthread_cond_signal +func c_pthread_cond_signal(c *Cond) c.Int -// llgo:link (*Cond).Broadcast C.pthread_cond_broadcast -func (c *Cond) Broadcast() {} +//go:linkname c_pthread_cond_broadcast C.pthread_cond_broadcast +func c_pthread_cond_broadcast(c *Cond) c.Int + +func (c *Cond) Signal() { + c_pthread_cond_signal(c) +} + +func (c *Cond) Broadcast() { + c_pthread_cond_broadcast(c) +} func (c *Cond) Wait() { c.cond.Wait(c.m) diff --git a/runtime/internal/lib/syscall/exec_linux.go b/runtime/internal/lib/syscall/exec_linux.go index cf89eee1..94132f10 100644 --- a/runtime/internal/lib/syscall/exec_linux.go +++ b/runtime/internal/lib/syscall/exec_linux.go @@ -724,7 +724,7 @@ func forkAndExecInChild1(argv0 *c.Char, argv, envv **c.Char, chroot, dir *c.Char childerror: // send error code on pipe - os.Write(c.Int(pipe), unsafe.Pointer(&err1), unsafe.Sizeof(err1)) + os.Write(c.Int(pipe), unsafe.Pointer(&err1), c.SizeT(unsafe.Sizeof(err1))) for { os.Exit(253) } diff --git a/runtime/internal/lib/syscall/fs_wasip1.go b/runtime/internal/lib/syscall/fs_wasip1.go new file mode 100644 index 00000000..e7ad5e53 --- /dev/null +++ b/runtime/internal/lib/syscall/fs_wasip1.go @@ -0,0 +1,325 @@ +// Copyright 2023 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. + +//go:build wasip1 + +package syscall + +import ( + "structs" +) + +func init() { + // Try to set stdio to non-blocking mode before the os package + // calls NewFile for each fd. NewFile queries the non-blocking flag + // but doesn't change it, even if the runtime supports non-blocking + // stdio. Since WebAssembly modules are single-threaded, blocking + // system calls temporarily halt execution of the module. If the + // runtime supports non-blocking stdio, the Go runtime is able to + // use the WASI net poller to poll for read/write readiness and is + // able to schedule goroutines while waiting. + SetNonblock(0, true) + SetNonblock(1, true) + SetNonblock(2, true) +} + +type uintptr32 = uint32 +type size = uint32 +type fdflags = uint32 +type filesize = uint64 +type filetype = uint8 +type lookupflags = uint32 +type oflags = uint32 +type rights = uint64 +type timestamp = uint64 +type dircookie = uint64 +type filedelta = int64 +type fstflags = uint32 + +type iovec struct { + _ structs.HostLayout + buf uintptr32 + bufLen size +} + +const ( + LOOKUP_SYMLINK_FOLLOW = 0x00000001 +) + +const ( + OFLAG_CREATE = 0x0001 + OFLAG_DIRECTORY = 0x0002 + OFLAG_EXCL = 0x0004 + OFLAG_TRUNC = 0x0008 +) + +const ( + FDFLAG_APPEND = 0x0001 + FDFLAG_DSYNC = 0x0002 + FDFLAG_NONBLOCK = 0x0004 + FDFLAG_RSYNC = 0x0008 + FDFLAG_SYNC = 0x0010 +) + +const ( + RIGHT_FD_DATASYNC = 1 << iota + RIGHT_FD_READ + RIGHT_FD_SEEK + RIGHT_FDSTAT_SET_FLAGS + RIGHT_FD_SYNC + RIGHT_FD_TELL + RIGHT_FD_WRITE + RIGHT_FD_ADVISE + RIGHT_FD_ALLOCATE + RIGHT_PATH_CREATE_DIRECTORY + RIGHT_PATH_CREATE_FILE + RIGHT_PATH_LINK_SOURCE + RIGHT_PATH_LINK_TARGET + RIGHT_PATH_OPEN + RIGHT_FD_READDIR + RIGHT_PATH_READLINK + RIGHT_PATH_RENAME_SOURCE + RIGHT_PATH_RENAME_TARGET + RIGHT_PATH_FILESTAT_GET + RIGHT_PATH_FILESTAT_SET_SIZE + RIGHT_PATH_FILESTAT_SET_TIMES + RIGHT_FD_FILESTAT_GET + RIGHT_FD_FILESTAT_SET_SIZE + RIGHT_FD_FILESTAT_SET_TIMES + RIGHT_PATH_SYMLINK + RIGHT_PATH_REMOVE_DIRECTORY + RIGHT_PATH_UNLINK_FILE + RIGHT_POLL_FD_READWRITE + RIGHT_SOCK_SHUTDOWN + RIGHT_SOCK_ACCEPT +) + +const ( + WHENCE_SET = 0 + WHENCE_CUR = 1 + WHENCE_END = 2 +) + +const ( + FILESTAT_SET_ATIM = 0x0001 + FILESTAT_SET_ATIM_NOW = 0x0002 + FILESTAT_SET_MTIM = 0x0004 + FILESTAT_SET_MTIM_NOW = 0x0008 +) + +const ( + // Despite the rights being defined as a 64 bits integer in the spec, + // wasmtime crashes the program if we set any of the upper 32 bits. + fullRights = rights(^uint32(0)) + readRights = rights(RIGHT_FD_READ | RIGHT_FD_READDIR) + writeRights = rights(RIGHT_FD_DATASYNC | RIGHT_FD_WRITE | RIGHT_FD_ALLOCATE | RIGHT_PATH_FILESTAT_SET_SIZE) + + // Some runtimes have very strict expectations when it comes to which + // rights can be enabled on files opened by path_open. The fileRights + // constant is used as a mask to retain only bits for operations that + // are supported on files. + fileRights rights = RIGHT_FD_DATASYNC | + RIGHT_FD_READ | + RIGHT_FD_SEEK | + RIGHT_FDSTAT_SET_FLAGS | + RIGHT_FD_SYNC | + RIGHT_FD_TELL | + RIGHT_FD_WRITE | + RIGHT_FD_ADVISE | + RIGHT_FD_ALLOCATE | + RIGHT_PATH_CREATE_DIRECTORY | + RIGHT_PATH_CREATE_FILE | + RIGHT_PATH_LINK_SOURCE | + RIGHT_PATH_LINK_TARGET | + RIGHT_PATH_OPEN | + RIGHT_FD_READDIR | + RIGHT_PATH_READLINK | + RIGHT_PATH_RENAME_SOURCE | + RIGHT_PATH_RENAME_TARGET | + RIGHT_PATH_FILESTAT_GET | + RIGHT_PATH_FILESTAT_SET_SIZE | + RIGHT_PATH_FILESTAT_SET_TIMES | + RIGHT_FD_FILESTAT_GET | + RIGHT_FD_FILESTAT_SET_SIZE | + RIGHT_FD_FILESTAT_SET_TIMES | + RIGHT_PATH_SYMLINK | + RIGHT_PATH_REMOVE_DIRECTORY | + RIGHT_PATH_UNLINK_FILE | + RIGHT_POLL_FD_READWRITE + + // Runtimes like wasmtime and wasmedge will refuse to open directories + // if the rights requested by the application exceed the operations that + // can be performed on a directory. + dirRights rights = RIGHT_FD_SEEK | + RIGHT_FDSTAT_SET_FLAGS | + RIGHT_FD_SYNC | + RIGHT_PATH_CREATE_DIRECTORY | + RIGHT_PATH_CREATE_FILE | + RIGHT_PATH_LINK_SOURCE | + RIGHT_PATH_LINK_TARGET | + RIGHT_PATH_OPEN | + RIGHT_FD_READDIR | + RIGHT_PATH_READLINK | + RIGHT_PATH_RENAME_SOURCE | + RIGHT_PATH_RENAME_TARGET | + RIGHT_PATH_FILESTAT_GET | + RIGHT_PATH_FILESTAT_SET_SIZE | + RIGHT_PATH_FILESTAT_SET_TIMES | + RIGHT_FD_FILESTAT_GET | + RIGHT_FD_FILESTAT_SET_TIMES | + RIGHT_PATH_SYMLINK | + RIGHT_PATH_REMOVE_DIRECTORY | + RIGHT_PATH_UNLINK_FILE +) + +type preopentype = uint8 + +const ( + preopentypeDir preopentype = iota +) + +type prestatDir struct { + _ structs.HostLayout + prNameLen size +} + +type prestat struct { + _ structs.HostLayout + typ preopentype + dir prestatDir +} + +//go:wasmimport wasi_snapshot_preview1 fd_prestat_get +//go:noescape +func fd_prestat_get(fd int32, prestat *prestat) Errno + +//go:wasmimport wasi_snapshot_preview1 fd_prestat_dir_name +//go:noescape +func fd_prestat_dir_name(fd int32, path *byte, pathLen size) Errno + +type opendir struct { + fd int32 + name string +} + +// List of preopen directories that were exposed by the runtime. The first one +// is assumed to the be root directory of the file system, and others are seen +// as mount points at sub paths of the root. +var preopens []opendir + +// Current working directory. We maintain this as a string and resolve paths in +// the code because wasmtime does not allow relative path lookups outside of the +// scope of a directory; a previous approach we tried consisted in maintaining +// open a file descriptor to the current directory so we could perform relative +// path lookups from that location, but it resulted in breaking path resolution +// from the current directory to its parent. +var cwd string + +func Openat(dirFd int, path string, openmode int, perm uint32) (int, error) { + panic("not implemented") +} + +func CloseOnExec(fd int) { + // nothing to do - no exec +} + +func Mkdir(path string, perm uint32) error { + panic("not implemented") +} + +func ReadDir(fd int, buf []byte, cookie dircookie) (int, error) { + panic("not implemented") +} + +func Fstat(fd int, st *Stat_t) error { + panic("not implemented") +} + +func Unlink(path string) error { + panic("not implemented") +} + +func Rmdir(path string) error { + panic("not implemented") +} + +func Chmod(path string, mode uint32) error { + var stat Stat_t + return Stat(path, &stat) +} + +func Fchmod(fd int, mode uint32) error { + var stat Stat_t + return Fstat(fd, &stat) +} + +func Chown(path string, uid, gid int) error { + panic("not implemented") +} + +func Fchown(fd int, uid, gid int) error { + panic("not implemented") +} + +func Lchown(path string, uid, gid int) error { + panic("not implemented") +} + +func UtimesNano(path string, ts []Timespec) error { + panic("not implemented") +} + +func Rename(from, to string) error { + panic("not implemented") +} + +func Truncate(path string, length int64) error { + panic("not implemented") +} + +func Ftruncate(fd int, length int64) error { + panic("not implemented") +} + +const ImplementsGetwd = true + +func Chdir(path string) error { + panic("not implemented") +} + +func Readlink(path string, buf []byte) (n int, err error) { + panic("not implemented") +} + +func Link(path, link string) error { + panic("not implemented") +} + +func Symlink(path, link string) error { + panic("not implemented") +} + +func Fsync(fd int) error { + panic("not implemented") +} + +func Write(fd int, b []byte) (int, error) { + panic("not implemented") +} + +func Pread(fd int, b []byte, offset int64) (int, error) { + panic("not implemented") +} + +func Pwrite(fd int, b []byte, offset int64) (int, error) { + panic("not implemented") +} + +func Dup(fd int) (int, error) { + panic("not implemented") +} + +func Dup2(fd, newfd int) error { + panic("not implemented") +} diff --git a/runtime/internal/lib/syscall/net_wasip1.go b/runtime/internal/lib/syscall/net_wasip1.go new file mode 100644 index 00000000..05092a38 --- /dev/null +++ b/runtime/internal/lib/syscall/net_wasip1.go @@ -0,0 +1,81 @@ +// Copyright 2023 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. + +//go:build wasip1 + +package syscall + +import "syscall" + +const ( + SHUT_RD = 0x1 + SHUT_WR = 0x2 + SHUT_RDWR = SHUT_RD | SHUT_WR +) + +type sdflags = uint32 + +//go:wasmimport wasi_snapshot_preview1 sock_accept +//go:noescape +func sock_accept(fd int32, flags fdflags, newfd *int32) Errno + +//go:wasmimport wasi_snapshot_preview1 sock_shutdown +//go:noescape +func sock_shutdown(fd int32, flags sdflags) Errno + +func Socket(proto, sotype, unused int) (fd int, err error) { + panic("not implemented") +} + +func Bind(fd int, sa syscall.Sockaddr) error { + panic("not implemented") +} + +func StopIO(fd int) error { + panic("not implemented") +} + +func Listen(fd int, backlog int) error { + panic("not implemented") +} + +func Connect(fd int, sa syscall.Sockaddr) error { + panic("not implemented") +} + +func Recvfrom(fd int, p []byte, flags int) (n int, from syscall.Sockaddr, err error) { + panic("not implemented") +} + +func Sendto(fd int, p []byte, flags int, to syscall.Sockaddr) error { + panic("not implemented") +} + +func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn, recvflags int, from syscall.Sockaddr, err error) { + panic("not implemented") +} + +func SendmsgN(fd int, p, oob []byte, to syscall.Sockaddr, flags int) (n int, err error) { + panic("not implemented") +} + +func GetsockoptInt(fd, level, opt int) (value int, err error) { + panic("not implemented") +} + +func SetsockoptInt(fd, level, opt int, value int) error { + panic("not implemented") +} + +func SetReadDeadline(fd int, t int64) error { + panic("not implemented") +} + +func SetWriteDeadline(fd int, t int64) error { + panic("not implemented") +} + +func Shutdown(fd int, how int) error { + panic("not implemented") +} diff --git a/runtime/internal/lib/syscall/rlimit.go b/runtime/internal/lib/syscall/rlimit.go index d899b8f2..4c145375 100644 --- a/runtime/internal/lib/syscall/rlimit.go +++ b/runtime/internal/lib/syscall/rlimit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build unix +//go:build unix && !wasm package syscall diff --git a/runtime/internal/lib/syscall/syscall.go b/runtime/internal/lib/syscall/syscall.go index c5fac4b7..d01ccc84 100644 --- a/runtime/internal/lib/syscall/syscall.go +++ b/runtime/internal/lib/syscall/syscall.go @@ -83,30 +83,6 @@ func Getpid() (pid int) { return int(os.Getpid()) } -func Kill(pid int, signum Signal) (err error) { - ret := os.Kill(os.PidT(pid), c.Int(signum)) - if ret == 0 { - return nil - } - return Errno(ret) -} - -func fork() (uintptr, Errno) { - ret := os.Fork() - if ret >= 0 { - return uintptr(ret), Errno(0) - } - return 0, Errno(os.Errno()) -} - -func wait4(pid int, wstatus *c.Int, options int, rusage *syscall.Rusage) (wpid int, err error) { - ret := os.Wait4(os.PidT(pid), wstatus, c.Int(options), rusage) - if ret >= 0 { - return int(ret), nil - } - return 0, Errno(os.Errno()) -} - func Open(path string, mode int, perm uint32) (fd int, err error) { ret := os.Open(c.AllocaCStr(path), c.Int(mode), os.ModeT(perm)) if ret >= 0 { @@ -165,38 +141,6 @@ func Stat(path string, stat *Stat_t) (err error) { return Errno(os.Errno()) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return Errno(syscall.EINVAL) - } - var q [2]c.Int - ret := os.Pipe(&q) - if ret == 0 { - p[0] = int(q[0]) - p[1] = int(q[1]) - return nil - } - return Errno(ret) -} - -type Rlimit syscall.Rlimit - -func Getrlimit(which int, lim *Rlimit) (err error) { - ret := os.Getrlimit(c.Int(which), (*syscall.Rlimit)(lim)) - if ret == 0 { - return nil - } - return Errno(ret) -} - -func setrlimit(which int, lim *Rlimit) (err error) { - ret := os.Setrlimit(c.Int(which), (*syscall.Rlimit)(lim)) - if ret == 0 { - return nil - } - return Errno(ret) -} - func BytePtrFromString(s string) (*byte, error) { a, err := ByteSliceFromString(s) if err != nil { @@ -217,3 +161,7 @@ func ByteSliceFromString(s string) ([]byte, error) { func Accept(fd int) (nfd int, sa origSyscall.Sockaddr, err error) { panic("todo: syscall.Accept") } + +func Kill(pid int, signum Signal) error { + return syscall.Kill(pid, syscall.Signal(signum)) +} diff --git a/runtime/internal/lib/syscall/syscall_nonwasm.go b/runtime/internal/lib/syscall/syscall_nonwasm.go new file mode 100644 index 00000000..221408bc --- /dev/null +++ b/runtime/internal/lib/syscall/syscall_nonwasm.go @@ -0,0 +1,57 @@ +//go:build !wasm + +package syscall + +import ( + c "github.com/goplus/llgo/runtime/internal/clite" + "github.com/goplus/llgo/runtime/internal/clite/os" + "github.com/goplus/llgo/runtime/internal/clite/syscall" +) + +type Rlimit syscall.Rlimit + +func Getrlimit(which int, lim *Rlimit) (err error) { + ret := os.Getrlimit(c.Int(which), (*syscall.Rlimit)(lim)) + if ret == 0 { + return nil + } + return Errno(ret) +} + +func setrlimit(which int, lim *Rlimit) (err error) { + ret := os.Setrlimit(c.Int(which), (*syscall.Rlimit)(lim)) + if ret == 0 { + return nil + } + return Errno(ret) +} + +func wait4(pid int, wstatus *c.Int, options int, rusage *syscall.Rusage) (wpid int, err error) { + ret := os.Wait4(os.PidT(pid), wstatus, c.Int(options), rusage) + if ret >= 0 { + return int(ret), nil + } + return 0, Errno(os.Errno()) +} + +func fork() (uintptr, Errno) { + ret := os.Fork() + if ret >= 0 { + return uintptr(ret), Errno(0) + } + return 0, Errno(os.Errno()) +} + +func Pipe(p []int) (err error) { + if len(p) != 2 { + return Errno(syscall.EINVAL) + } + var q [2]c.Int + ret := os.Pipe(&q) + if ret == 0 { + p[0] = int(q[0]) + p[1] = int(q[1]) + return nil + } + return Errno(ret) +} diff --git a/runtime/internal/lib/syscall/syscall_unix.go b/runtime/internal/lib/syscall/syscall_unix.go index c81c214c..a0bd70bf 100644 --- a/runtime/internal/lib/syscall/syscall_unix.go +++ b/runtime/internal/lib/syscall/syscall_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build unix +//go:build unix && !wasm package syscall diff --git a/runtime/internal/lib/syscall/syscall_wasm.go b/runtime/internal/lib/syscall/syscall_wasm.go new file mode 100644 index 00000000..6da22423 --- /dev/null +++ b/runtime/internal/lib/syscall/syscall_wasm.go @@ -0,0 +1,366 @@ +// Copyright 2023 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. + +//go:build wasip1 + +package syscall + +import ( + "strconv" + + "github.com/goplus/llgo/runtime/internal/clite/syscall" +) + +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +type Dircookie = uint64 + +type Filetype = uint8 + +const ( + FILETYPE_UNKNOWN Filetype = iota + FILETYPE_BLOCK_DEVICE + FILETYPE_CHARACTER_DEVICE + FILETYPE_DIRECTORY + FILETYPE_REGULAR_FILE + FILETYPE_SOCKET_DGRAM + FILETYPE_SOCKET_STREAM + FILETYPE_SYMBOLIC_LINK +) + +type Dirent struct { + // The offset of the next directory entry stored in this directory. + Next Dircookie + // The serial number of the file referred to by this directory entry. + Ino uint64 + // The length of the name of the directory entry. + Namlen uint32 + // The type of the file referred to by this directory entry. + Type Filetype + // Name of the directory entry. + Name *byte +} + +// An Errno is an unsigned number describing an error condition. +// It implements the error interface. The zero Errno is by convention +// a non-error, so code to convert from Errno to error should use: +// +// var err = nil +// if errno != 0 { +// err = errno +// } +type Errno syscall.Errno + +func (e Errno) Error() string { + return syscall.Errno(e).Error() +} + +func (e Errno) Is(target error) bool { + return syscall.Errno(e).Is(target) +} + +// A Signal is a number describing a process signal. +// It implements the [os.Signal] interface. +type Signal uint8 + +const ( + SIGNONE Signal = iota + SIGHUP + SIGINT + SIGQUIT + SIGILL + SIGTRAP + SIGABRT + SIGBUS + SIGFPE + SIGKILL + SIGUSR1 + SIGSEGV + SIGUSR2 + SIGPIPE + SIGALRM + SIGTERM + SIGCHLD + SIGCONT + SIGSTOP + SIGTSTP + SIGTTIN + SIGTTOU + SIGURG + SIGXCPU + SIGXFSZ + SIGVTARLM + SIGPROF + SIGWINCH + SIGPOLL + SIGPWR + SIGSYS +) + +func (s Signal) Signal() {} + +func (s Signal) String() string { + switch s { + case SIGNONE: + return "no signal" + case SIGHUP: + return "hangup" + case SIGINT: + return "interrupt" + case SIGQUIT: + return "quit" + case SIGILL: + return "illegal instruction" + case SIGTRAP: + return "trace/breakpoint trap" + case SIGABRT: + return "abort" + case SIGBUS: + return "bus error" + case SIGFPE: + return "floating point exception" + case SIGKILL: + return "killed" + case SIGUSR1: + return "user defined signal 1" + case SIGSEGV: + return "segmentation fault" + case SIGUSR2: + return "user defined signal 2" + case SIGPIPE: + return "broken pipe" + case SIGALRM: + return "alarm clock" + case SIGTERM: + return "terminated" + case SIGCHLD: + return "child exited" + case SIGCONT: + return "continued" + case SIGSTOP: + return "stopped (signal)" + case SIGTSTP: + return "stopped" + case SIGTTIN: + return "stopped (tty input)" + case SIGTTOU: + return "stopped (tty output)" + case SIGURG: + return "urgent I/O condition" + case SIGXCPU: + return "CPU time limit exceeded" + case SIGXFSZ: + return "file size limit exceeded" + case SIGVTARLM: + return "virtual timer expired" + case SIGPROF: + return "profiling timer expired" + case SIGWINCH: + return "window changed" + case SIGPOLL: + return "I/O possible" + case SIGPWR: + return "power failure" + case SIGSYS: + return "bad system call" + default: + return "signal " + strconv.Itoa(int(s)) + } +} + +const ( + Stdin = 0 + Stdout = 1 + Stderr = 2 +) + +const ( + O_RDONLY = 0 + O_WRONLY = 1 + O_RDWR = 2 + + O_CREAT = 0100 + O_CREATE = O_CREAT + O_TRUNC = 01000 + O_APPEND = 02000 + O_EXCL = 0200 + O_SYNC = 010000 + O_DIRECTORY = 020000 + O_NOFOLLOW = 0400 + + O_CLOEXEC = 0 +) + +const ( + F_DUPFD = 0 + F_GETFD = 1 + F_SETFD = 2 + F_GETFL = 3 + F_SETFL = 4 + F_GETOWN = 5 + F_SETOWN = 6 + F_GETLK = 7 + F_SETLK = 8 + F_SETLKW = 9 + F_RGETLK = 10 + F_RSETLK = 11 + F_CNVT = 12 + F_RSETLKW = 13 + + F_RDLCK = 1 + F_WRLCK = 2 + F_UNLCK = 3 + F_UNLKSYS = 4 +) + +const ( + S_IFMT = 0000370000 + S_IFSHM_SYSV = 0000300000 + S_IFSEMA = 0000270000 + S_IFCOND = 0000260000 + S_IFMUTEX = 0000250000 + S_IFSHM = 0000240000 + S_IFBOUNDSOCK = 0000230000 + S_IFSOCKADDR = 0000220000 + S_IFDSOCK = 0000210000 + + S_IFSOCK = 0000140000 + S_IFLNK = 0000120000 + S_IFREG = 0000100000 + S_IFBLK = 0000060000 + S_IFDIR = 0000040000 + S_IFCHR = 0000020000 + S_IFIFO = 0000010000 + + S_UNSUP = 0000370000 + + S_ISUID = 0004000 + S_ISGID = 0002000 + S_ISVTX = 0001000 + + S_IREAD = 0400 + S_IWRITE = 0200 + S_IEXEC = 0100 + + S_IRWXU = 0700 + S_IRUSR = 0400 + S_IWUSR = 0200 + S_IXUSR = 0100 + + S_IRWXG = 070 + S_IRGRP = 040 + S_IWGRP = 020 + S_IXGRP = 010 + + S_IRWXO = 07 + S_IROTH = 04 + S_IWOTH = 02 + S_IXOTH = 01 +) + +type WaitStatus uint32 + +func (w WaitStatus) Exited() bool { return false } +func (w WaitStatus) ExitStatus() int { return 0 } +func (w WaitStatus) Signaled() bool { return false } +func (w WaitStatus) Signal() Signal { return 0 } +func (w WaitStatus) CoreDump() bool { return false } +func (w WaitStatus) Stopped() bool { return false } +func (w WaitStatus) Continued() bool { return false } +func (w WaitStatus) StopSignal() Signal { return 0 } +func (w WaitStatus) TrapCause() int { return 0 } + +// Rusage is a placeholder to allow compilation of the [os/exec] package +// because we need Go programs to be portable across platforms. WASI does +// not have a mechanism to spawn processes so there is no reason for an +// application to take a dependency on this type. +type Rusage struct { + Utime Timeval + Stime Timeval +} + +// ProcAttr is a placeholder to allow compilation of the [os/exec] package +// because we need Go programs to be portable across platforms. WASI does +// not have a mechanism to spawn processes so there is no reason for an +// application to take a dependency on this type. +type ProcAttr struct { + Dir string + Env []string + Files []uintptr + Sys *SysProcAttr +} + +type SysProcAttr struct { +} + +func Getuid() int { + return 1 +} + +func Getgid() int { + return 1 +} + +func Geteuid() int { + return 1 +} + +func Getegid() int { + return 1 +} + +func Getgroups() ([]int, error) { + return []int{1}, nil +} + +func Getppid() int { + return 2 +} + +func Umask(mask int) int { + return 0 +} + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +type clockid = uint32 + +const ( + clockRealtime clockid = iota + clockMonotonic + clockProcessCPUTimeID + clockThreadCPUTimeID +) + +func SetNonblock(fd int, nonblocking bool) error { + panic("todo: syscall.SetNonblock") +} + +const ( + RLIMIT_NOFILE = iota +) + +func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { + panic("not implemented") +} + +func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { + panic("not implemented") +} diff --git a/runtime/internal/lib/time/sleep.go b/runtime/internal/lib/time/sleep.go index 08c180fa..7d61db90 100644 --- a/runtime/internal/lib/time/sleep.go +++ b/runtime/internal/lib/time/sleep.go @@ -6,10 +6,8 @@ package time import ( "sync" - "unsafe" c "github.com/goplus/llgo/runtime/internal/clite" - "github.com/goplus/llgo/runtime/internal/clite/libuv" ) // Sleep pauses the current goroutine for at least the duration d. @@ -21,7 +19,7 @@ func Sleep(d Duration) { // Interface to timers implemented in package runtime. // Must be in sync with ../runtime/time.go:/^type timer type runtimeTimer struct { - libuv.Timer + // libuv.Timer when int64 f func(any, uintptr) arg any @@ -178,62 +176,65 @@ func goFunc(arg any, seq uintptr) { } var ( - timerLoop *libuv.Loop + // timerLoop *libuv.Loop timerOnce sync.Once ) -func init() { - timerOnce.Do(func() { - timerLoop = libuv.LoopNew() - }) - go func() { - timerLoop.Run(libuv.RUN_DEFAULT) - }() -} +// func init() { +// timerOnce.Do(func() { +// timerLoop = libuv.LoopNew() +// }) +// go func() { +// timerLoop.Run(libuv.RUN_DEFAULT) +// }() +// } // cross thread -func timerEvent(async *libuv.Async) { - a := (*asyncTimerEvent)(unsafe.Pointer(async)) - a.cb() - a.Close(nil) -} +// func timerEvent(async *libuv.Async) { +// a := (*asyncTimerEvent)(unsafe.Pointer(async)) +// a.cb() +// a.Close(nil) +// } type asyncTimerEvent struct { - libuv.Async + // libuv.Async cb func() } -func timerCallback(t *libuv.Timer) { -} +// func timerCallback(t *libuv.Timer) { +// } func startTimer(r *runtimeTimer) { - asyncTimer := &asyncTimerEvent{ - cb: func() { - libuv.InitTimer(timerLoop, &r.Timer) - r.Start(timerCallback, uint64(r.when), 0) - }, - } - timerLoop.Async(&asyncTimer.Async, timerEvent) - asyncTimer.Send() + panic("not implemented") + // asyncTimer := &asyncTimerEvent{ + // cb: func() { + // libuv.InitTimer(timerLoop, &r.Timer) + // r.Start(timerCallback, uint64(r.when), 0) + // }, + // } + // timerLoop.Async(&asyncTimer.Async, timerEvent) + // asyncTimer.Send() } func stopTimer(r *runtimeTimer) bool { - asyncTimer := &asyncTimerEvent{ - cb: func() { - r.Stop() - }, - } - timerLoop.Async(&asyncTimer.Async, timerEvent) - return asyncTimer.Send() == 0 + panic("not implemented") + // asyncTimer := &asyncTimerEvent{ + // cb: func() { + // r.Stop() + // }, + // } + // timerLoop.Async(&asyncTimer.Async, timerEvent) + // return asyncTimer.Send() == 0 } func resetTimer(r *runtimeTimer, when int64) bool { - asyncTimer := &asyncTimerEvent{ - cb: func() { - r.Stop() - r.Start(timerCallback, uint64(when), 0) - }, - } - timerLoop.Async(&asyncTimer.Async, timerEvent) - return asyncTimer.Send() == 0 + panic("not implemented") + // asyncTimer := &asyncTimerEvent{ + // cb: func() { + // r.Stop() + // r.Start(timerCallback, uint64(when), 0) + // }, + // } + // timerLoop.Async(&asyncTimer.Async, timerEvent) + // return asyncTimer.Send() == 0 } diff --git a/runtime/internal/lib/time/zoneinfo_wasm.go b/runtime/internal/lib/time/zoneinfo_wasm.go new file mode 100644 index 00000000..b6c8bbc3 --- /dev/null +++ b/runtime/internal/lib/time/zoneinfo_wasm.go @@ -0,0 +1,12 @@ +// Copyright 2023 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. + +package time + +// in wasip1 zoneinfo is managed by the runtime. +var platformZoneSources = []string{} + +func initLocal() { + localLoc.name = "Local" +} diff --git a/runtime/internal/runtime/hash32.go b/runtime/internal/runtime/hash32.go index 818118f7..fb5aa7fa 100644 --- a/runtime/internal/runtime/hash32.go +++ b/runtime/internal/runtime/hash32.go @@ -5,7 +5,7 @@ // Hashing algorithm inspired by // wyhash: https://github.com/wangyi-fudan/wyhash/blob/ceb019b530e2c1c14d70b79bfa2bc49de7d95bc1/Modern%20Non-Cryptographic%20Hash%20Function%20and%20Pseudorandom%20Number%20Generator.pdf -//go:build 386 || arm || mips || mipsle +//go:build 386 || arm || mips || mipsle || wasm package runtime diff --git a/runtime/internal/runtime/hash64.go b/runtime/internal/runtime/hash64.go index d6a56f00..af1ee052 100644 --- a/runtime/internal/runtime/hash64.go +++ b/runtime/internal/runtime/hash64.go @@ -5,7 +5,7 @@ // Hashing algorithm inspired by // wyhash: https://github.com/wangyi-fudan/wyhash -//go:build amd64 || arm64 || loong64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm +//go:build amd64 || arm64 || loong64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x package runtime diff --git a/runtime/internal/runtime/z_error.go b/runtime/internal/runtime/z_error.go index ed5f4195..fdf00695 100644 --- a/runtime/internal/runtime/z_error.go +++ b/runtime/internal/runtime/z_error.go @@ -136,13 +136,13 @@ func printanycustomtype(i any) { } case abi.Float32: if isDirectIface(e._type) { - print(typestring, "(", bitcast.ToFloat32((uintptr(e.data))), ")") + print(typestring, "(", bitcast.ToFloat32(int32(uintptr(e.data))), ")") } else { print(typestring, "(", *(*float32)(e.data), ")") } case abi.Float64: if isDirectIface(e._type) { - print(typestring, "(", bitcast.ToFloat64(uintptr(e.data)), ")") + print(typestring, "(", bitcast.ToFloat64(int64(uintptr(e.data))), ")") } else { print(typestring, "(", *(*float64)(e.data), ")") } diff --git a/runtime/internal/runtime/z_rt.go b/runtime/internal/runtime/z_rt.go index ba31b2c6..e2809856 100644 --- a/runtime/internal/runtime/z_rt.go +++ b/runtime/internal/runtime/z_rt.go @@ -22,8 +22,7 @@ import ( c "github.com/goplus/llgo/runtime/internal/clite" "github.com/goplus/llgo/runtime/internal/clite/debug" "github.com/goplus/llgo/runtime/internal/clite/pthread" - "github.com/goplus/llgo/runtime/internal/clite/signal" - "github.com/goplus/llgo/runtime/internal/clite/syscall" + "github.com/goplus/llgo/runtime/internal/clite/setjmp" ) // ----------------------------------------------------------------------------- @@ -137,16 +136,22 @@ const MaxZero = 1024 var ZeroVal [MaxZero]byte -func init() { - signal.Signal(c.Int(syscall.SIGSEGV), func(v c.Int) { - switch syscall.Signal(v) { - case syscall.SIGSEGV: - panic(errorString("invalid memory address or nil pointer dereference")) - default: - var buf [20]byte - panic(errorString("unexpected signal value: " + string(itoa(buf[:], uint64(v))))) - } - }) +// func init() { +// signal.Signal(c.Int(syscall.SIGSEGV), func(v c.Int) { +// switch syscall.Signal(v) { +// case syscall.SIGSEGV: +// panic(errorString("invalid memory address or nil pointer dereference")) +// default: +// var buf [20]byte +// panic(errorString("unexpected signal value: " + string(itoa(buf[:], uint64(v))))) +// } +// }) +// } + +// ----------------------------------------------------------------------------- + +type SigjmpBuf struct { + Unused [setjmp.SigjmpBufSize]byte } // ----------------------------------------------------------------------------- diff --git a/runtime/internal/test/test.go b/runtime/internal/test/test.go new file mode 100644 index 00000000..b6e19667 --- /dev/null +++ b/runtime/internal/test/test.go @@ -0,0 +1,181 @@ +package test + +/* +#include +#include +#include +#include +*/ +import "C" +import ( + "runtime" + "unsafe" + + _ "github.com/goplus/llgo/c" +) + +var mode C.mode_t +var uid C.uid_t +var gid C.gid_t +var off C.off_t +var dev C.dev_t + +var once C.pthread_once_t +var mutex C.pthread_mutex_t +var cond C.pthread_cond_t +var rwlock C.pthread_rwlock_t +var mutexattr C.pthread_mutexattr_t +var condattr C.pthread_condattr_t +var rwlockattr C.pthread_rwlockattr_t +var clock C.clock_t +var sigjmpbuf C.sigjmp_buf +var jmpbuf C.jmp_buf + +const ( + // Real sizes from the current platform + pthreadOnceSizeReal = unsafe.Sizeof(once) + pthreadMutexSizeReal = unsafe.Sizeof(mutex) + pthreadMutexAttrSizeReal = unsafe.Sizeof(mutexattr) + pthreadCondSizeReal = unsafe.Sizeof(cond) + pthreadCondAttrSizeReal = unsafe.Sizeof(condattr) + pthreadRWLockSizeReal = unsafe.Sizeof(rwlock) + pthreadRWLockAttrSizeReal = unsafe.Sizeof(rwlockattr) + clockSizeReal = unsafe.Sizeof(clock) + sigjmpBufSizeReal = unsafe.Sizeof(sigjmpbuf) + jmpBufSizeReal = unsafe.Sizeof(jmpbuf) +) + +// Linux amd64 specific sizes +var linuxAmd64 = runtime.GOOS == "linux" && runtime.GOARCH == "amd64" + +// Linux arm64 specific sizes +var linuxArm64 = runtime.GOOS == "linux" && runtime.GOARCH == "arm64" + +// macOS amd64 specific sizes +var darwinAmd64 = runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" + +// macOS arm64 specific sizes +var darwinArm64 = runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" + +const ( + // Linux amd64 pthread sizes + pthreadOnceSizeLinuxAmd64 = 4 + pthreadMutexSizeLinuxAmd64 = 40 + pthreadMutexAttrSizeLinuxAmd64 = 4 + pthreadCondSizeLinuxAmd64 = 48 + pthreadCondAttrSizeLinuxAmd64 = 4 + pthreadRWLockSizeLinuxAmd64 = 56 + pthreadRWLockAttrSizeLinuxAmd64 = 8 + clockSizeLinuxAmd64 = 8 + sigjmpBufSizeLinuxAmd64 = 200 + jmpBufSizeLinuxAmd64 = 200 + + // Linux arm64 pthread sizes + pthreadOnceSizeLinuxArm64 = 4 + pthreadMutexSizeLinuxArm64 = 48 + pthreadMutexAttrSizeLinuxArm64 = 8 + pthreadCondSizeLinuxArm64 = 48 + pthreadCondAttrSizeLinuxArm64 = 8 + pthreadRWLockSizeLinuxArm64 = 56 + pthreadRWLockAttrSizeLinuxArm64 = 8 + clockSizeLinuxArm64 = 8 + sigjmpBufSizeLinuxArm64 = 312 + jmpBufSizeLinuxArm64 = 312 + + // macOS amd64 pthread sizes + pthreadOnceSizeDarwinAmd64 = 16 + pthreadMutexSizeDarwinAmd64 = 56 + pthreadMutexAttrSizeDarwinAmd64 = 8 + pthreadCondSizeDarwinAmd64 = 40 + pthreadCondAttrSizeDarwinAmd64 = 8 + pthreadRWLockSizeDarwinAmd64 = 192 + pthreadRWLockAttrSizeDarwinAmd64 = 16 + clockSizeDarwinAmd64 = 8 + sigjmpBufSizeDarwinAmd64 = 196 + jmpBufSizeDarwinAmd64 = 196 + + // macOS arm64 pthread sizes + pthreadOnceSizeDarwinArm64 = 16 + pthreadMutexSizeDarwinArm64 = 64 + pthreadMutexAttrSizeDarwinArm64 = 16 + pthreadCondSizeDarwinArm64 = 48 + pthreadCondAttrSizeDarwinArm64 = 16 + pthreadRWLockSizeDarwinArm64 = 200 + pthreadRWLockAttrSizeDarwinArm64 = 24 + clockSizeDarwinArm64 = 8 + sigjmpBufSizeDarwinArm64 = 196 + jmpBufSizeDarwinArm64 = 192 +) + +// Get architecture-specific pthread sizes based on the current platform +func getPlatformPthreadSizes() (onceSize, mutexSize, mutexAttrSize, condSize, condAttrSize, rwlockSize, rwlockAttrSize int) { + switch { + case linuxAmd64: + return pthreadOnceSizeLinuxAmd64, pthreadMutexSizeLinuxAmd64, pthreadMutexAttrSizeLinuxAmd64, + pthreadCondSizeLinuxAmd64, pthreadCondAttrSizeLinuxAmd64, pthreadRWLockSizeLinuxAmd64, pthreadRWLockAttrSizeLinuxAmd64 + case linuxArm64: + return pthreadOnceSizeLinuxArm64, pthreadMutexSizeLinuxArm64, pthreadMutexAttrSizeLinuxArm64, + pthreadCondSizeLinuxArm64, pthreadCondAttrSizeLinuxArm64, pthreadRWLockSizeLinuxArm64, pthreadRWLockAttrSizeLinuxArm64 + case darwinAmd64: + return pthreadOnceSizeDarwinAmd64, pthreadMutexSizeDarwinAmd64, pthreadMutexAttrSizeDarwinAmd64, + pthreadCondSizeDarwinAmd64, pthreadCondAttrSizeDarwinAmd64, pthreadRWLockSizeDarwinAmd64, pthreadRWLockAttrSizeDarwinAmd64 + case darwinArm64: + return pthreadOnceSizeDarwinArm64, pthreadMutexSizeDarwinArm64, pthreadMutexAttrSizeDarwinArm64, + pthreadCondSizeDarwinArm64, pthreadCondAttrSizeDarwinArm64, pthreadRWLockSizeDarwinArm64, pthreadRWLockAttrSizeDarwinArm64 + default: + panic("Unsupported platform: " + runtime.GOOS + ", " + runtime.GOARCH) + } +} + +func getPlatformClockSizes() (clockSize int) { + switch { + case linuxAmd64: + return clockSizeLinuxAmd64 + case linuxArm64: + return clockSizeLinuxArm64 + case darwinAmd64: + return clockSizeDarwinAmd64 + case darwinArm64: + return clockSizeDarwinArm64 + default: + panic("Unsupported platform: " + runtime.GOOS + ", " + runtime.GOARCH) + } +} + +func getPlatformJmpBufSizes() (sigjmpBufSize, jmpBufSize int) { + switch { + case linuxAmd64: + return sigjmpBufSizeLinuxAmd64, jmpBufSizeLinuxAmd64 + case linuxArm64: + return sigjmpBufSizeLinuxArm64, jmpBufSizeLinuxArm64 + case darwinAmd64: + return sigjmpBufSizeDarwinAmd64, jmpBufSizeDarwinAmd64 + case darwinArm64: + return sigjmpBufSizeDarwinArm64, jmpBufSizeDarwinArm64 + default: + panic("Unsupported platform: " + runtime.GOOS + ", " + runtime.GOARCH) + } +} + +func max(a int, others ...int) int { + max := a + for _, v := range others { + if v > max { + max = v + } + } + return max +} + +var ( + pthreadOnceSize = max(pthreadOnceSizeLinuxAmd64, pthreadOnceSizeDarwinAmd64, pthreadOnceSizeLinuxArm64, pthreadOnceSizeDarwinArm64) + pthreadMutexSize = max(pthreadMutexSizeLinuxAmd64, pthreadMutexSizeLinuxArm64, pthreadMutexSizeDarwinAmd64, pthreadMutexSizeDarwinArm64) + pthreadMutexAttrSize = max(pthreadMutexAttrSizeLinuxAmd64, pthreadMutexAttrSizeLinuxArm64, pthreadMutexAttrSizeDarwinAmd64, pthreadMutexAttrSizeDarwinArm64) + pthreadCondSize = max(pthreadCondSizeLinuxAmd64, pthreadCondSizeLinuxArm64, pthreadCondSizeDarwinAmd64, pthreadCondSizeDarwinArm64) + pthreadCondAttrSize = max(pthreadCondAttrSizeLinuxAmd64, pthreadCondAttrSizeLinuxArm64, pthreadCondAttrSizeDarwinAmd64, pthreadCondAttrSizeDarwinArm64) + pthreadRWLockSize = max(pthreadRWLockSizeLinuxAmd64, pthreadRWLockSizeLinuxArm64, pthreadRWLockSizeDarwinAmd64, pthreadRWLockSizeDarwinArm64) + pthreadRWLockAttrSize = max(pthreadRWLockAttrSizeLinuxAmd64, pthreadRWLockAttrSizeLinuxArm64, pthreadRWLockAttrSizeDarwinAmd64, pthreadRWLockAttrSizeDarwinArm64) + clockSize = max(clockSizeLinuxAmd64, clockSizeLinuxArm64, clockSizeDarwinAmd64, clockSizeDarwinArm64) + sigjmpBufSize = max(sigjmpBufSizeLinuxAmd64, sigjmpBufSizeLinuxArm64, sigjmpBufSizeDarwinAmd64, sigjmpBufSizeDarwinArm64) + jmpBufSize = max(jmpBufSizeLinuxAmd64, jmpBufSizeLinuxArm64, jmpBufSizeDarwinAmd64, jmpBufSizeDarwinArm64) +) diff --git a/runtime/internal/test/typesize_test.go b/runtime/internal/test/typesize_test.go new file mode 100644 index 00000000..c3c5430d --- /dev/null +++ b/runtime/internal/test/typesize_test.go @@ -0,0 +1,202 @@ +package test + +import ( + "runtime" + "testing" + "unsafe" + + "github.com/goplus/llgo/runtime/internal/clite/os" + "github.com/goplus/llgo/runtime/internal/clite/pthread/sync" + "github.com/goplus/llgo/runtime/internal/clite/setjmp" + "github.com/goplus/llgo/runtime/internal/clite/time" +) + +func TestOSTypes(t *testing.T) { + if unsafe.Sizeof(mode) != unsafe.Sizeof(os.ModeT(0)) { + t.Fatalf("mode size mismatch: %d != %d", unsafe.Sizeof(mode), unsafe.Sizeof(os.ModeT(0))) + } + if unsafe.Sizeof(uid) != unsafe.Sizeof(os.UidT(0)) { + t.Fatalf("uid size mismatch: %d != %d", unsafe.Sizeof(uid), unsafe.Sizeof(os.UidT(0))) + } + if unsafe.Sizeof(gid) != unsafe.Sizeof(os.GidT(0)) { + t.Fatalf("gid size mismatch: %d != %d", unsafe.Sizeof(gid), unsafe.Sizeof(os.GidT(0))) + } + if unsafe.Sizeof(off) != unsafe.Sizeof(os.OffT(0)) { + t.Fatalf("off size mismatch: %d != %d", unsafe.Sizeof(off), unsafe.Sizeof(os.OffT(0))) + } + if unsafe.Sizeof(dev) != unsafe.Sizeof(os.DevT(0)) { + t.Fatalf("dev size mismatch: %d != %d", unsafe.Sizeof(dev), unsafe.Sizeof(os.DevT(0))) + } +} + +func TestTypeSizes(t *testing.T) { + // Test platform-specific sizes based on OS and architecture + switch { + case runtime.GOOS == "linux" && runtime.GOARCH == "amd64": + // Linux amd64 specific tests + if pthreadOnceSizeLinuxAmd64 != pthreadOnceSizeReal { + t.Fatalf("pthreadOnceSizeLinuxAmd64 mismatch: %d != %d", pthreadOnceSizeLinuxAmd64, pthreadOnceSizeReal) + } + if pthreadMutexSizeLinuxAmd64 != pthreadMutexSizeReal { + t.Fatalf("pthreadMutexSizeLinuxAmd64 mismatch: %d != %d", pthreadMutexSizeLinuxAmd64, pthreadMutexSizeReal) + } + if pthreadMutexAttrSizeLinuxAmd64 != pthreadMutexAttrSizeReal { + t.Fatalf("pthreadMutexAttrSizeLinuxAmd64 mismatch: %d != %d", pthreadMutexAttrSizeLinuxAmd64, pthreadMutexAttrSizeReal) + } + if pthreadCondSizeLinuxAmd64 != pthreadCondSizeReal { + t.Fatalf("pthreadCondSizeLinuxAmd64 mismatch: %d != %d", pthreadCondSizeLinuxAmd64, pthreadCondSizeReal) + } + if pthreadCondAttrSizeLinuxAmd64 != pthreadCondAttrSizeReal { + t.Fatalf("pthreadCondAttrSizeLinuxAmd64 mismatch: %d != %d", pthreadCondAttrSizeLinuxAmd64, pthreadCondAttrSizeReal) + } + if pthreadRWLockSizeLinuxAmd64 != pthreadRWLockSizeReal { + t.Fatalf("pthreadRWLockSizeLinuxAmd64 mismatch: %d != %d", pthreadRWLockSizeLinuxAmd64, pthreadRWLockSizeReal) + } + if pthreadRWLockAttrSizeLinuxAmd64 != pthreadRWLockAttrSizeReal { + t.Fatalf("pthreadRWLockAttrSizeLinuxAmd64 mismatch: %d != %d", pthreadRWLockAttrSizeLinuxAmd64, pthreadRWLockAttrSizeReal) + } + if clockSizeLinuxAmd64 != clockSizeReal { + t.Fatalf("clockSizeLinuxAmd64 mismatch: %d != %d", clockSizeLinuxAmd64, clockSizeReal) + } + if sigjmpBufSizeLinuxAmd64 != sigjmpBufSizeReal { + t.Fatalf("sigjmpBufSizeLinuxAmd64 mismatch: %d != %d", sigjmpBufSizeLinuxAmd64, sigjmpBufSizeReal) + } + if jmpBufSizeLinuxAmd64 != jmpBufSizeReal { + t.Fatalf("jmpBufSizeLinuxAmd64 mismatch: %d != %d", jmpBufSizeLinuxAmd64, jmpBufSizeReal) + } + case runtime.GOOS == "linux" && runtime.GOARCH == "arm64": + // Linux arm64 specific tests + if pthreadOnceSizeLinuxArm64 != pthreadOnceSizeReal { + t.Fatalf("pthreadOnceSizeLinuxArm64 mismatch: %d != %d", pthreadOnceSizeLinuxArm64, pthreadOnceSizeReal) + } + if pthreadMutexSizeLinuxArm64 != pthreadMutexSizeReal { + t.Fatalf("pthreadMutexSizeLinuxArm64 mismatch: %d != %d", pthreadMutexSizeLinuxArm64, pthreadMutexSizeReal) + } + if pthreadMutexAttrSizeLinuxArm64 != pthreadMutexAttrSizeReal { + t.Fatalf("pthreadMutexAttrSizeLinuxArm64 mismatch: %d != %d", pthreadMutexAttrSizeLinuxArm64, pthreadMutexAttrSizeReal) + } + if pthreadCondSizeLinuxArm64 != pthreadCondSizeReal { + t.Fatalf("pthreadCondSizeLinuxArm64 mismatch: %d != %d", pthreadCondSizeLinuxArm64, pthreadCondSizeReal) + } + if pthreadCondAttrSizeLinuxArm64 != pthreadCondAttrSizeReal { + t.Fatalf("pthreadCondAttrSizeLinuxArm64 mismatch: %d != %d", pthreadCondAttrSizeLinuxArm64, pthreadCondAttrSizeReal) + } + if pthreadRWLockSizeLinuxArm64 != pthreadRWLockSizeReal { + t.Fatalf("pthreadRWLockSizeLinuxArm64 mismatch: %d != %d", pthreadRWLockSizeLinuxArm64, pthreadRWLockSizeReal) + } + if pthreadRWLockAttrSizeLinuxArm64 != pthreadRWLockAttrSizeReal { + t.Fatalf("pthreadRWLockAttrSizeLinuxArm64 mismatch: %d != %d", pthreadRWLockAttrSizeLinuxArm64, pthreadRWLockAttrSizeReal) + } + if clockSizeLinuxArm64 != clockSizeReal { + t.Fatalf("clockSizeLinuxArm64 mismatch: %d != %d", clockSizeLinuxArm64, clockSizeReal) + } + if sigjmpBufSizeLinuxArm64 != sigjmpBufSizeReal { + t.Fatalf("sigjmpBufSizeLinuxArm64 mismatch: %d != %d", sigjmpBufSizeLinuxArm64, sigjmpBufSizeReal) + } + if jmpBufSizeLinuxArm64 != jmpBufSizeReal { + t.Fatalf("jmpBufSizeLinuxArm64 mismatch: %d != %d", jmpBufSizeLinuxArm64, jmpBufSizeReal) + } + case runtime.GOOS == "darwin" && runtime.GOARCH == "amd64": + // macOS amd64 specific tests + if pthreadOnceSizeDarwinAmd64 != pthreadOnceSizeReal { + t.Fatalf("pthreadOnceSizeDarwinAmd64 mismatch: %d != %d", pthreadOnceSizeDarwinAmd64, pthreadOnceSizeReal) + } + if pthreadMutexSizeDarwinAmd64 != pthreadMutexSizeReal { + t.Fatalf("pthreadMutexSizeDarwinAmd64 mismatch: %d != %d", pthreadMutexSizeDarwinAmd64, pthreadMutexSizeReal) + } + if pthreadMutexAttrSizeDarwinAmd64 != pthreadMutexAttrSizeReal { + t.Fatalf("pthreadMutexAttrSizeDarwinAmd64 mismatch: %d != %d", pthreadMutexAttrSizeDarwinAmd64, pthreadMutexAttrSizeReal) + } + if pthreadCondSizeDarwinAmd64 != pthreadCondSizeReal { + t.Fatalf("pthreadCondSizeDarwinAmd64 mismatch: %d != %d", pthreadCondSizeDarwinAmd64, pthreadCondSizeReal) + } + if pthreadCondAttrSizeDarwinAmd64 != pthreadCondAttrSizeReal { + t.Fatalf("pthreadCondAttrSizeDarwinAmd64 mismatch: %d != %d", pthreadCondAttrSizeDarwinAmd64, pthreadCondAttrSizeReal) + } + if pthreadRWLockSizeDarwinAmd64 != pthreadRWLockSizeReal { + t.Fatalf("pthreadRWLockSizeDarwinAmd64 mismatch: %d != %d", pthreadRWLockSizeDarwinAmd64, pthreadRWLockSizeReal) + } + if pthreadRWLockAttrSizeDarwinAmd64 != pthreadRWLockAttrSizeReal { + t.Fatalf("pthreadRWLockAttrSizeDarwinAmd64 mismatch: %d != %d", pthreadRWLockAttrSizeDarwinAmd64, pthreadRWLockAttrSizeReal) + } + if clockSizeDarwinAmd64 != clockSizeReal { + t.Fatalf("clockSizeDarwinAmd64 mismatch: %d != %d", clockSizeDarwinAmd64, clockSizeReal) + } + if sigjmpBufSizeDarwinAmd64 != sigjmpBufSizeReal { + t.Fatalf("sigjmpBufSizeDarwinAmd64 mismatch: %d != %d", sigjmpBufSizeDarwinAmd64, sigjmpBufSizeReal) + } + if jmpBufSizeDarwinAmd64 != jmpBufSizeReal { + t.Fatalf("jmpBufSizeDarwinAmd64 mismatch: %d != %d", jmpBufSizeDarwinAmd64, jmpBufSizeReal) + } + case runtime.GOOS == "darwin" && runtime.GOARCH == "arm64": + // macOS arm64 specific tests + if pthreadOnceSizeDarwinArm64 != pthreadOnceSizeReal { + t.Fatalf("pthreadOnceSizeDarwinArm64 mismatch: %d != %d", pthreadOnceSizeDarwinArm64, pthreadOnceSizeReal) + } + if pthreadMutexSizeDarwinArm64 != pthreadMutexSizeReal { + t.Fatalf("pthreadMutexSizeDarwinArm64 mismatch: %d != %d", pthreadMutexSizeDarwinArm64, pthreadMutexSizeReal) + } + if pthreadMutexAttrSizeDarwinArm64 != pthreadMutexAttrSizeReal { + t.Fatalf("pthreadMutexAttrSizeDarwinArm64 mismatch: %d != %d", pthreadMutexAttrSizeDarwinArm64, pthreadMutexAttrSizeReal) + } + if pthreadCondSizeDarwinArm64 != pthreadCondSizeReal { + t.Fatalf("pthreadCondSizeDarwinArm64 mismatch: %d != %d", pthreadCondSizeDarwinArm64, pthreadCondSizeReal) + } + if pthreadCondAttrSizeDarwinArm64 != pthreadCondAttrSizeReal { + t.Fatalf("pthreadCondAttrSizeDarwinArm64 mismatch: %d != %d", pthreadCondAttrSizeDarwinArm64, pthreadCondAttrSizeReal) + } + if pthreadRWLockSizeDarwinArm64 != pthreadRWLockSizeReal { + t.Fatalf("pthreadRWLockSizeDarwinArm64 mismatch: %d != %d", pthreadRWLockSizeDarwinArm64, pthreadRWLockSizeReal) + } + if pthreadRWLockAttrSizeDarwinArm64 != pthreadRWLockAttrSizeReal { + t.Fatalf("pthreadRWLockAttrSizeDarwinArm64 mismatch: %d != %d", pthreadRWLockAttrSizeDarwinArm64, pthreadRWLockAttrSizeReal) + } + if clockSizeDarwinArm64 != clockSizeReal { + t.Fatalf("clockSizeDarwinArm64 mismatch: %d != %d", clockSizeDarwinArm64, clockSizeReal) + } + if sigjmpBufSizeDarwinArm64 != sigjmpBufSizeReal { + t.Fatalf("sigjmpBufSizeDarwinArm64 mismatch: %d != %d", sigjmpBufSizeDarwinArm64, sigjmpBufSizeReal) + } + if jmpBufSizeDarwinArm64 != jmpBufSizeReal { + t.Fatalf("jmpBufSizeDarwinArm64 mismatch: %d != %d", jmpBufSizeDarwinArm64, jmpBufSizeReal) + } + default: + t.Fatalf("Unsupported platform: %s, %s", runtime.GOOS, runtime.GOARCH) + } + + // Sync package size checks + onceSize, mutexSize, mutexAttrSize, condSize, condAttrSize, rwlockSize, rwlockAttrSize := getPlatformPthreadSizes() + clockSize := getPlatformClockSizes() + sigjmpBufSize, jmpBufSize := getPlatformJmpBufSizes() + + if sync.PthreadOnceSize != onceSize { + t.Fatalf("PthreadOnceSize mismatch: %d != %d", sync.PthreadOnceSize, onceSize) + } + if sync.PthreadMutexSize != mutexSize { + t.Fatalf("PthreadMutexSize mismatch: %d != %d", sync.PthreadMutexSize, mutexSize) + } + if sync.PthreadMutexAttrSize != mutexAttrSize { + t.Fatalf("PthreadMutexAttrSize mismatch: %d != %d", sync.PthreadMutexAttrSize, mutexAttrSize) + } + if sync.PthreadCondSize != condSize { + t.Fatalf("PthreadCondSize mismatch: %d != %d", sync.PthreadCondSize, condSize) + } + if sync.PthreadCondAttrSize != condAttrSize { + t.Fatalf("PthreadCondAttrSize mismatch: %d != %d", sync.PthreadCondAttrSize, condAttrSize) + } + if sync.PthreadRWLockSize != rwlockSize { + t.Fatalf("PthreadRWLockSize mismatch: %d != %d", sync.PthreadRWLockSize, rwlockSize) + } + if sync.PthreadRWLockAttrSize != rwlockAttrSize { + t.Fatalf("PthreadRWLockAttrSize mismatch: %d != %d", sync.PthreadRWLockAttrSize, rwlockAttrSize) + } + if time.ClockTSize != clockSize { + t.Fatalf("ClockSize mismatch: %d != %d", time.ClockTSize, clockSize) + } + if setjmp.SigjmpBufSize != sigjmpBufSize { + t.Fatalf("SigjmpBufSize mismatch: %d != %d", setjmp.SigjmpBufSize, sigjmpBufSize) + } + if setjmp.JmpBufSize != jmpBufSize { + t.Fatalf("JmpBufSize mismatch: %d != %d", setjmp.JmpBufSize, jmpBufSize) + } +} diff --git a/runtime/overlay.go b/runtime/overlay.go index f7afd5bd..5649223b 100644 --- a/runtime/overlay.go +++ b/runtime/overlay.go @@ -4,6 +4,9 @@ import ( _ "embed" ) +//go:embed _overlay/runtime/runtime.go +var fakeRuntime string + //go:embed _overlay/go/parser/resolver.go var go_parser_resolver string @@ -26,4 +29,5 @@ var OverlayFiles = map[string]string{ "testing/testing_go123.go": testing_testing_go123, "testing/testing_go124.go": testing_testing_go124, "net/textproto/textproto.go": net_textproto, + "runtime/runtime.go": fakeRuntime, }