mirror of
https://github.com/golang/go
synced 2024-11-20 00:44:45 -07:00
2c67c8c303
Previously, when a program died because of a SIGHUP, SIGINT, or SIGTERM signal it would exit with status 2. This CL fixes the runtime to exit with a status indicating that the program was killed by a signal. Change-Id: Ic2982a2562857edfdccaf68856e0e4df532af136 Reviewed-on: https://go-review.googlesource.com/18156 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
70 lines
1.9 KiB
Go
70 lines
1.9 KiB
Go
// 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 runtime
|
|
|
|
import "unsafe"
|
|
|
|
type mOS struct {
|
|
waitsema int32 // semaphore for parking on locks
|
|
waitsemacount int32
|
|
waitsemalock int32
|
|
}
|
|
|
|
func nacl_exception_stack(p uintptr, size int32) int32
|
|
func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32
|
|
func nacl_sem_create(flag int32) int32
|
|
func nacl_sem_wait(sem int32) int32
|
|
func nacl_sem_post(sem int32) int32
|
|
func nacl_mutex_create(flag int32) int32
|
|
func nacl_mutex_lock(mutex int32) int32
|
|
func nacl_mutex_trylock(mutex int32) int32
|
|
func nacl_mutex_unlock(mutex int32) int32
|
|
func nacl_cond_create(flag int32) int32
|
|
func nacl_cond_wait(cond, n int32) int32
|
|
func nacl_cond_signal(cond int32) int32
|
|
func nacl_cond_broadcast(cond int32) int32
|
|
|
|
//go:noescape
|
|
func nacl_cond_timed_wait_abs(cond, lock int32, ts *timespec) int32
|
|
func nacl_thread_create(fn uintptr, stk, tls, xx unsafe.Pointer) int32
|
|
|
|
//go:noescape
|
|
func nacl_nanosleep(ts, extra *timespec) int32
|
|
func nanotime() int64
|
|
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) unsafe.Pointer
|
|
func exit(code int32)
|
|
func osyield()
|
|
|
|
//go:noescape
|
|
func write(fd uintptr, p unsafe.Pointer, n int32) int32
|
|
|
|
//go:linkname os_sigpipe os.sigpipe
|
|
func os_sigpipe() {
|
|
throw("too many writes on closed pipe")
|
|
}
|
|
|
|
func dieFromSignal(sig int32) {
|
|
exit(2)
|
|
}
|
|
|
|
func sigpanic() {
|
|
g := getg()
|
|
if !canpanic(g) {
|
|
throw("unexpected signal during runtime execution")
|
|
}
|
|
|
|
// Native Client only invokes the exception handler for memory faults.
|
|
g.sig = _SIGSEGV
|
|
panicmem()
|
|
}
|
|
|
|
func raiseproc(sig int32) {
|
|
}
|
|
|
|
// Stubs so tests can link correctly. These should never be called.
|
|
func open(name *byte, mode, perm int32) int32
|
|
func closefd(fd int32) int32
|
|
func read(fd int32, p unsafe.Pointer, n int32) int32
|