os_nacl.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. package runtime
  5. import "unsafe"
  6. func nacl_exception_stack(p unsafe.Pointer, size int32) int32
  7. func nacl_exception_handler(fn, arg unsafe.Pointer) int32
  8. func nacl_sem_create(flag int32) int32
  9. func nacl_sem_wait(sem int32) int32
  10. func nacl_sem_post(sem int32) int32
  11. func nacl_mutex_create(flag int32) int32
  12. func nacl_mutex_lock(mutex int32) int32
  13. func nacl_mutex_trylock(mutex int32) int32
  14. func nacl_mutex_unlock(mutex int32) int32
  15. func nacl_cond_create(flag int32) int32
  16. func nacl_cond_wait(cond, n int32) int32
  17. func nacl_cond_signal(cond int32) int32
  18. func nacl_cond_broadcast(cond int32) int32
  19. func nacl_cond_timed_wait_abs(cond, lock int32, ts unsafe.Pointer) int32
  20. func nacl_thread_create(fn, stk, tls, xx unsafe.Pointer) int32
  21. func nacl_nanosleep(ts, extra unsafe.Pointer) int32
  22. func os_sigpipe() {
  23. gothrow("too many writes on closed pipe")
  24. }
  25. func sigpanic() {
  26. g := getg()
  27. if !canpanic(g) {
  28. gothrow("unexpected signal during runtime execution")
  29. }
  30. // Native Client only invokes the exception handler for memory faults.
  31. g.sig = _SIGSEGV
  32. panicmem()
  33. }