Home | History | Annotate | Download | only in runtime
      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 func nacl_exception_stack(p uintptr, size int32) int32
     10 func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32
     11 func nacl_sem_create(flag int32) int32
     12 func nacl_sem_wait(sem int32) int32
     13 func nacl_sem_post(sem int32) int32
     14 func nacl_mutex_create(flag int32) int32
     15 func nacl_mutex_lock(mutex int32) int32
     16 func nacl_mutex_trylock(mutex int32) int32
     17 func nacl_mutex_unlock(mutex int32) int32
     18 func nacl_cond_create(flag int32) int32
     19 func nacl_cond_wait(cond, n int32) int32
     20 func nacl_cond_signal(cond int32) int32
     21 func nacl_cond_broadcast(cond int32) int32
     22 
     23 //go:noescape
     24 func nacl_cond_timed_wait_abs(cond, lock int32, ts *timespec) int32
     25 func nacl_thread_create(fn uintptr, stk, tls, xx unsafe.Pointer) int32
     26 
     27 //go:noescape
     28 func nacl_nanosleep(ts, extra *timespec) int32
     29 func nanotime() int64
     30 func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) unsafe.Pointer
     31 func exit(code int32)
     32 func osyield()
     33 
     34 //go:noescape
     35 func write(fd uintptr, p unsafe.Pointer, n int32) int32
     36 
     37 //go:linkname os_sigpipe os.sigpipe
     38 func os_sigpipe() {
     39 	throw("too many writes on closed pipe")
     40 }
     41 
     42 func sigpanic() {
     43 	g := getg()
     44 	if !canpanic(g) {
     45 		throw("unexpected signal during runtime execution")
     46 	}
     47 
     48 	// Native Client only invokes the exception handler for memory faults.
     49 	g.sig = _SIGSEGV
     50 	panicmem()
     51 }
     52 
     53 func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer) {
     54 	throw("sigfwd not implemented")
     55 }
     56 
     57 func raiseproc(sig int32) {
     58 }
     59 
     60 // Stubs so tests can link correctly.  These should never be called.
     61 func open(name *byte, mode, perm int32) int32
     62 func closefd(fd int32) int32
     63 func read(fd int32, p unsafe.Pointer, n int32) int32
     64