github.com/aloncn/graphics-go@v0.0.1/src/runtime/os_nacl.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package runtime 6 7 import "unsafe" 8 9 type mOS struct { 10 waitsema int32 // semaphore for parking on locks 11 waitsemacount int32 12 waitsemalock int32 13 } 14 15 func nacl_exception_stack(p uintptr, size int32) int32 16 func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32 17 func nacl_sem_create(flag int32) int32 18 func nacl_sem_wait(sem int32) int32 19 func nacl_sem_post(sem int32) int32 20 func nacl_mutex_create(flag int32) int32 21 func nacl_mutex_lock(mutex int32) int32 22 func nacl_mutex_trylock(mutex int32) int32 23 func nacl_mutex_unlock(mutex int32) int32 24 func nacl_cond_create(flag int32) int32 25 func nacl_cond_wait(cond, n int32) int32 26 func nacl_cond_signal(cond int32) int32 27 func nacl_cond_broadcast(cond int32) int32 28 29 //go:noescape 30 func nacl_cond_timed_wait_abs(cond, lock int32, ts *timespec) int32 31 func nacl_thread_create(fn uintptr, stk, tls, xx unsafe.Pointer) int32 32 33 //go:noescape 34 func nacl_nanosleep(ts, extra *timespec) int32 35 func nanotime() int64 36 func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) unsafe.Pointer 37 func exit(code int32) 38 func osyield() 39 40 //go:noescape 41 func write(fd uintptr, p unsafe.Pointer, n int32) int32 42 43 //go:linkname os_sigpipe os.sigpipe 44 func os_sigpipe() { 45 throw("too many writes on closed pipe") 46 } 47 48 func dieFromSignal(sig int32) { 49 exit(2) 50 } 51 52 func sigpanic() { 53 g := getg() 54 if !canpanic(g) { 55 throw("unexpected signal during runtime execution") 56 } 57 58 // Native Client only invokes the exception handler for memory faults. 59 g.sig = _SIGSEGV 60 panicmem() 61 } 62 63 func raiseproc(sig int32) { 64 } 65 66 // Stubs so tests can link correctly. These should never be called. 67 func open(name *byte, mode, perm int32) int32 68 func closefd(fd int32) int32 69 func read(fd int32, p unsafe.Pointer, n int32) int32