]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: accept GOTRACEBACK=crash to mean 'crash after panic'
authorRuss Cox <rsc@golang.org>
Fri, 15 Mar 2013 05:11:03 +0000 (01:11 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 15 Mar 2013 05:11:03 +0000 (01:11 -0400)
This provides a way to generate core dumps when people need them.
The settings are:

        GOTRACEBACK=0  no traceback on panic, just exit
        GOTRACEBACK=1  default - traceback on panic, then exit
        GOTRACEBACK=2  traceback including runtime frames on panic, then exit
        GOTRACEBACK=crash traceback including runtime frames on panic, then crash

Fixes #3257.

R=golang-dev, devon.odell, r, daniel.morsing, ality
CC=golang-dev
https://golang.org/cl/7666044

30 files changed:
src/pkg/runtime/extern.go
src/pkg/runtime/os_plan9.c
src/pkg/runtime/os_plan9_386.c
src/pkg/runtime/os_plan9_amd64.c
src/pkg/runtime/os_windows.c
src/pkg/runtime/os_windows_386.c
src/pkg/runtime/os_windows_amd64.c
src/pkg/runtime/panic.c
src/pkg/runtime/proc.c
src/pkg/runtime/runtime.c
src/pkg/runtime/runtime.h
src/pkg/runtime/signal_386.c
src/pkg/runtime/signal_amd64.c
src/pkg/runtime/signal_arm.c
src/pkg/runtime/signal_unix.c
src/pkg/runtime/signal_unix.h
src/pkg/runtime/symtab.c
src/pkg/runtime/sys_darwin_386.s
src/pkg/runtime/sys_darwin_amd64.s
src/pkg/runtime/sys_freebsd_386.s
src/pkg/runtime/sys_freebsd_amd64.s
src/pkg/runtime/sys_freebsd_arm.s
src/pkg/runtime/sys_linux_386.s
src/pkg/runtime/sys_linux_amd64.s
src/pkg/runtime/sys_linux_arm.s
src/pkg/runtime/sys_netbsd_386.s
src/pkg/runtime/sys_netbsd_amd64.s
src/pkg/runtime/sys_netbsd_arm.s
src/pkg/runtime/sys_openbsd_386.s
src/pkg/runtime/sys_openbsd_amd64.s

index fbaffd1d56b86fa2a630e6b0959f504f7d2a9c57..20f23425304371c3ac76f035efdcf2eb95d9565d 100644 (file)
@@ -3,10 +3,54 @@
 // license that can be found in the LICENSE file.
 
 /*
-       Package runtime contains operations that interact with Go's runtime system,
-       such as functions to control goroutines. It also includes the low-level type information
-       used by the reflect package; see reflect's documentation for the programmable
-       interface to the run-time type system.
+Package runtime contains operations that interact with Go's runtime system,
+such as functions to control goroutines. It also includes the low-level type information
+used by the reflect package; see reflect's documentation for the programmable
+interface to the run-time type system.
+
+Environment Variables
+
+The following environment variables ($name or %name%, depending on the host
+operating system) control the run-time behavior of Go programs. The meanings
+and use may change from release to release.
+
+The GOGC variable sets the initial garbage collection target percentage.
+A collection is triggered when the ratio of freshly allocated data to live data
+remaining after the previous collection reaches this percentage. The default
+is GOGC=100. Setting GOGC=off disables the garbage collector entirely.
+The runtime/debug package's SetGCPercent function allows changing this
+percentage at run time. See http://golang.org/pkg/runtime/debug/#SetGCPercent.
+
+The GOGCTRACE variable controls debug output from the garbage collector.
+Setting GOGCTRACE=1 causes the garbage collector to emit a single line to standard
+error at each collection, summarizing the amount of memory collected and the
+length of the pause. Setting GOGCTRACE=2 emits the same summary but also
+repeats each collection.
+
+The GOMAXPROCS variable limits the number of operating system threads that
+can execute user-level Go code simultaneously. There is no limit to the number of threads
+that can be blocked in system calls on behalf of Go code; those do not count against
+the GOMAXPROCS limit. This package's GOMAXPROCS function queries and changes
+the limit.
+
+The GOTRACEBACK variable controls the amount of output generated when a Go
+program fails due to an unrecovered panic or an unexpected runtime condition.
+By default, a failure prints a stack trace for every extant goroutine, eliding functions
+internal to the run-time system, and then exits with exit code 2.
+If GOTRACEBACK=0, the per-goroutine stack traces are omitted entirely.
+If GOTRACEBACK=1, the default behavior is used.
+If GOTRACEBACK=2, the per-goroutine stack traces include run-time functions.
+If GOTRACEBACK=crash, the per-goroutine stack traces include run-time functions,
+and if possible the program crashes in an operating-specific manner instead of
+exiting. For example, on Unix systems, the program raises SIGABRT to trigger a
+core dump.
+
+The GOARCH, GOOS, GOPATH, and GOROOT environment variables complete
+the set of Go environment variables. They influence the building of Go programs
+(see http://golang.org/cmd/go and http://golang.org/pkg/go/build).
+GOARCH, GOOS, and GOROOT are recorded at compile time and made available by
+constants or functions in this package, but they do not influence the execution
+of the run-time system.
 */
 package runtime
 
index 338da8f216da3c168e4cd54ac5426359ea3805f0..c7ed59fc9326d963cf8e6550c19894f7a0a7f283 100644 (file)
@@ -91,6 +91,13 @@ runtime·osinit(void)
        runtime·notify(runtime·sigtramp);
 }
 
+void
+runtime·crash(void)
+{
+       runtime·notify(nil);
+       *(int32*)0 = 0;
+}
+
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
index 3d8b43a5da7aa360151a481ad394d04c4d7744b0..3396e44e72b5863ed682181df91be3b16479ebf4 100644 (file)
@@ -28,6 +28,7 @@ runtime·dumpregs(Ureg *u)
 int32
 runtime·sighandler(void *v, int8 *s, G *gp)
 {
+       bool crash;
        Ureg *ureg;
        uintptr *sp;
        SigTab *sig, *nsig;
@@ -93,11 +94,15 @@ Throw:
        runtime·printf("PC=%X\n", ureg->pc);
        runtime·printf("\n");
 
-       if(runtime·gotraceback()) {
+       if(runtime·gotraceback(&crash)) {
                runtime·traceback((void*)ureg->pc, (void*)ureg->sp, 0, gp);
                runtime·tracebackothers(gp);
                runtime·dumpregs(ureg);
        }
+       
+       if(crash)
+               runtime·crash();
+
        runtime·goexitsall("");
        runtime·exits(s);
 
index acdf65d00cb46d243992ee8ec278d4f71e37c34b..cf0a82b6bc994dabae38674c5a7d8dd72367dae8 100644 (file)
@@ -36,6 +36,7 @@ runtime·dumpregs(Ureg *u)
 int32
 runtime·sighandler(void *v, int8 *s, G *gp)
 {
+       bool crash;
        Ureg *ureg;
        uintptr *sp;
        SigTab *sig, *nsig;
@@ -101,11 +102,15 @@ Throw:
        runtime·printf("PC=%X\n", ureg->ip);
        runtime·printf("\n");
 
-       if(runtime·gotraceback()) {
+       if(runtime·gotraceback(&crash)) {
                runtime·traceback((void*)ureg->ip, (void*)ureg->sp, 0, gp);
                runtime·tracebackothers(gp);
                runtime·dumpregs(ureg);
        }
+       
+       if(crash)
+               runtime·crash();
+
        runtime·goexitsall("");
        runtime·exits(s);
 
index c80a38a374d0a6b766974839e06dbbbb1f7e5ade..b28affe31b66593792368e843d24eb4c519cb712 100644 (file)
@@ -455,3 +455,16 @@ int32 runtime·badcallbacklen = sizeof runtime·badcallbackmsg - 1;
 
 int8 runtime·badsignalmsg[] = "runtime: signal received on thread not created by Go.\n";
 int32 runtime·badsignallen = sizeof runtime·badsignalmsg - 1;
+
+void
+runtime·crash(void)
+{
+       // TODO: This routine should do whatever is needed
+       // to make the Windows program abort/crash as it
+       // would if Go was not intercepting signals.
+       // On Unix the routine would remove the custom signal
+       // handler and then raise a signal (like SIGABRT).
+       // Something like that should happen here.
+       // It's okay to leave this empty for now: if crash returns
+       // the ordinary exit-after-panic happens.
+}
index fc75eb3af007e2cc2bf47f35a6b09412bc2baab8..20fbea13de200ce2e46a16f6f0e48bcd2347170f 100644 (file)
@@ -27,6 +27,7 @@ runtime·dumpregs(Context *r)
 uint32
 runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
 {
+       bool crash;
        uintptr *sp;
 
        switch(info->ExceptionCode) {
@@ -74,11 +75,15 @@ runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
        }
        runtime·printf("\n");
 
-       if(runtime·gotraceback()){
+       if(runtime·gotraceback(&crash)){
                runtime·traceback((void*)r->Eip, (void*)r->Esp, 0, gp);
                runtime·tracebackothers(gp);
                runtime·dumpregs(r);
        }
+       
+       if(crash)
+               runtime·crash();
+
 
        runtime·exit(2);
        return 0;
index 7ed33465e30a17be6d55e7ad42d398d12affc13e..881c73c93c46622fdb6b855d0955c7608326eced 100644 (file)
@@ -35,6 +35,7 @@ runtime·dumpregs(Context *r)
 uint32
 runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
 {
+       bool crash;
        uintptr *sp;
 
        switch(info->ExceptionCode) {
@@ -81,11 +82,14 @@ runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
        }
        runtime·printf("\n");
 
-       if(runtime·gotraceback()){
+       if(runtime·gotraceback(&crash)){
                runtime·traceback((void*)r->Rip, (void*)r->Rsp, 0, gp);
                runtime·tracebackothers(gp);
                runtime·dumpregs(r);
        }
+       
+       if(crash)
+               runtime·crash();
 
        runtime·exit(2);
        return 0;
index fbcf6a572dbf4f3485cf67dffda4b3c6d3af266f..d0cf3ad6f9ec34bf70ff23a1c4008da1db97fce2 100644 (file)
@@ -402,12 +402,13 @@ void
 runtime·dopanic(int32 unused)
 {
        static bool didothers;
+       bool crash;
 
        if(g->sig != 0)
                runtime·printf("[signal %x code=%p addr=%p pc=%p]\n",
                        g->sig, g->sigcode0, g->sigcode1, g->sigpc);
 
-       if(runtime·gotraceback()){
+       if(runtime·gotraceback(&crash)){
                if(g != m->g0) {
                        runtime·printf("\n");
                        runtime·goroutineheader(g);
@@ -428,6 +429,9 @@ runtime·dopanic(int32 unused)
                runtime·lock(&deadlock);
                runtime·lock(&deadlock);
        }
+       
+       if(crash)
+               runtime·crash();
 
        runtime·exit(2);
 }
index 313ac653b485e71e40c1aca24f6fd42d2f5911f6..a6ef83ba73d3773038af009d02b7ca1387dd92ef 100644 (file)
@@ -232,7 +232,7 @@ runtime·tracebackothers(G *me)
        G *gp;
        int32 traceback;
 
-       traceback = runtime·gotraceback();
+       traceback = runtime·gotraceback(nil);
        for(gp = runtime·allg; gp != nil; gp = gp->alllink) {
                if(gp == me || gp->status == Gdead)
                        continue;
index 3ff4d7fa7ec2823c3dba323cf75afe7d58fef714..ef39a2d55f4e679d481dcb73a2fca440f86026f7 100644 (file)
@@ -17,14 +17,27 @@ enum {
  */
 void   runtime·sigpanic(void);
 
+// The GOTRACEBACK environment variable controls the
+// behavior of a Go program that is crashing and exiting.
+//     GOTRACEBACK=0   suppress all tracebacks
+//     GOTRACEBACK=1   default behavior - show tracebacks but exclude runtime frames
+//     GOTRACEBACK=2   show tracebacks including runtime frames
+//     GOTRACEBACK=crash   show tracebacks including runtime frames, then crash (core dump etc)
 int32
-runtime·gotraceback(void)
+runtime·gotraceback(bool *crash)
 {
        byte *p;
 
+       if(crash != nil)
+               *crash = false;
        p = runtime·getenv("GOTRACEBACK");
        if(p == nil || p[0] == '\0')
                return 1;       // default is on
+       if(runtime·strcmp(p, (byte*)"crash") == 0) {
+               if(crash != nil)
+                       *crash = true;
+               return 2;       // extra information
+       }
        return runtime·atoi(p);
 }
 
index e0da57bb0ab9e5f89dd508b957f9ac52d7794802..9828a9c5584019cff613dc4028445760a0eba2ea 100644 (file)
@@ -699,7 +699,7 @@ String      runtime·gostringw(uint16*);
 void   runtime·initsig(void);
 void   runtime·sigenable(uint32 sig);
 void   runtime·sigdisable(uint32 sig);
-int32  runtime·gotraceback(void);
+int32  runtime·gotraceback(bool *crash);
 void   runtime·goroutineheader(G*);
 void   runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp);
 void   runtime·tracebackothers(G*);
@@ -793,6 +793,7 @@ G*  runtime·netpoll(bool);
 void   runtime·netpollinit(void);
 int32  runtime·netpollopen(int32, PollDesc*);
 void   runtime·netpollready(G**, PollDesc*, int32);
+void   runtime·crash(void);
 
 #pragma        varargck        argpos  runtime·printf 1
 #pragma        varargck        type    "d"     int32
index 1377de140006f73c13c8a2db463c30d69605ed8f..c409aee5070b7f21d5d1bdeb5ec04d45760bea43 100644 (file)
@@ -36,6 +36,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
 {
        uintptr *sp;
        SigTab *t;
+       bool crash;
 
        if(sig == SIGPROF) {
                if(gp != m->g0 && gp != m->gsignal)
@@ -109,11 +110,14 @@ Throw:
        }       
        runtime·printf("\n");
 
-       if(runtime·gotraceback()){
+       if(runtime·gotraceback(&crash)){
                runtime·traceback((void*)SIG_EIP(info, ctxt), (void*)SIG_ESP(info, ctxt), 0, gp);
                runtime·tracebackothers(gp);
                runtime·dumpregs(info, ctxt);
        }
+       
+       if(crash)
+               runtime·crash();
 
        runtime·exit(2);
 }
index 04ba038663bfbaed1ab5dfba66825336f4e38916..157e0ee46da74c665f7d17395d3fa750fd95b061 100644 (file)
@@ -44,6 +44,7 @@ runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
 {
        uintptr *sp;
        SigTab *t;
+       bool crash;
 
        if(sig == SIGPROF) {
                if(gp != m->g0 && gp != m->gsignal)
@@ -119,11 +120,14 @@ Throw:
        }
        runtime·printf("\n");
 
-       if(runtime·gotraceback()){
+       if(runtime·gotraceback(&crash)){
                runtime·traceback((void*)SIG_RIP(info, ctxt), (void*)SIG_RSP(info, ctxt), 0, gp);
                runtime·tracebackothers(gp);
                runtime·dumpregs(info, ctxt);
        }
+       
+       if(crash)
+               runtime·crash();
 
        runtime·exit(2);
 }
index 0763cd6dd0c6860343d61c84f2f51f6bc0c2830f..a7f373bd5e397388a41e534c2bcb43369559a21a 100644 (file)
@@ -43,6 +43,7 @@ void
 runtime·sighandler(int32 sig, Siginfo *info, void *ctxt, G *gp)
 {
        SigTab *t;
+       bool crash;
 
        if(sig == SIGPROF) {
                if(gp != m->g0 && gp != m->gsignal)
@@ -109,12 +110,15 @@ Throw:
        }
        runtime·printf("\n");
 
-       if(runtime·gotraceback()){
+       if(runtime·gotraceback(&crash)){
                runtime·traceback((void*)SIG_PC(info, ctxt), (void*)SIG_SP(info, ctxt), (void*)SIG_LR(info, ctxt), gp);
                runtime·tracebackothers(gp);
                runtime·printf("\n");
                runtime·dumpregs(info, ctxt);
        }
+       
+       if(crash)
+               runtime·crash();
 
        runtime·exit(2);
 }
index 5d0bcbd2d51ab956eeb5c11003f9c1bd1b3457f5..54e461f995f73acc9504441a2ce6734bae4af76a 100644 (file)
@@ -98,5 +98,23 @@ void
 os·sigpipe(void)
 {
        runtime·setsig(SIGPIPE, SIG_DFL, false);
-       runtime·raisesigpipe();
+       runtime·raise(SIGPIPE);
+}
+
+void
+runtime·crash(void)
+{
+#ifdef GOOS_darwin
+       // OS X core dumps are linear dumps of the mapped memory,
+       // from the first virtual byte to the last, with zeros in the gaps.
+       // Because of the way we arrange the address space on 64-bit systems,
+       // this means the OS X core file will be >128 GB and even on a zippy
+       // workstation can take OS X well over an hour to write (uninterruptible).
+       // Save users from making that mistake.
+       if(sizeof(void*) == 8)
+               return;
+#endif
+
+       runtime·setsig(SIGABRT, SIG_DFL, false);
+       runtime·raise(SIGABRT);
 }
index a4acff4b20d07bd96bb89525e1341cc269a44ae6..2d84a018640199f32e91a4c66c025101beabe75f 100644 (file)
@@ -10,4 +10,5 @@ void  runtime·setsig(int32, GoSighandler*, bool);
 GoSighandler* runtime·getsig(int32);
 
 void   runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp);
-void   runtime·raisesigpipe(void);
+void   runtime·raise(int32);
+
index d7221c4767eda0fb92a9469a925d158f30e832b5..578406247e3cdbec0c6301731faa03d0705b99de 100644 (file)
@@ -670,6 +670,6 @@ runtime·showframe(Func *f, bool current)
        if(current && m->throwing > 0)
                return 1;
        if(traceback < 0)
-               traceback = runtime·gotraceback();
+               traceback = runtime·gotraceback(nil);
        return traceback > 1 || f != nil && contains(f->name, ".") && !hasprefix(f->name, "runtime.");
 }
index 99cd8e76110f29d2b170e75f9d720892966f77f4..59bb9d80d8b86fce55a6454f64c9ca33ad7ac4b2 100644 (file)
@@ -44,13 +44,14 @@ TEXT runtime·write(SB),7,$0
        INT     $0x80
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$8
-       get_tls(CX)
-       MOVL    m(CX), DX
-       MOVL    m_procid(DX), DX
-       MOVL    DX, 0(SP)       // thread_port
-       MOVL    $13, 4(SP)      // signal: SIGPIPE
-       MOVL    $328, AX        // __pthread_kill
+TEXT runtime·raise(SB),7,$16
+       MOVL    $20, AX // getpid
+       INT     $0x80
+       MOVL    AX, 4(SP)       // pid
+       MOVL    sig+0(FP), AX
+       MOVL    AX, 8(SP)       // signal
+       MOVL    $1, 12(SP)      // posix
+       MOVL    $37, AX // kill
        INT     $0x80
        RET
 
index c8a45439d101094b50a7646f80ac8564053a2fd2..b324a04240f4ad8b3fc1661b9f0d5bb59fc575df 100644 (file)
@@ -60,12 +60,13 @@ TEXT runtime·write(SB),7,$0
        SYSCALL
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$24
-       get_tls(CX)
-       MOVQ    m(CX), DX
-       MOVL    $13, DI // arg 1 SIGPIPE
-       MOVQ    m_procid(DX), SI        // arg 2 thread_port
-       MOVL    $(0x2000000+328), AX    // syscall entry __pthread_kill
+TEXT runtime·raise(SB),7,$24
+       MOVL    $(0x2000000+20), AX // getpid
+       SYSCALL
+       MOVQ    AX, DI  // arg 1 - pid
+       MOVL    sig+0(FP), SI   // arg 2 - signal
+       MOVL    $1, DX  // arg 3 - posix
+       MOVL    $(0x2000000+37), AX // kill
        SYSCALL
        RET
 
index 34af30781642540beacffdf695c74446036d4888..d960663cb4511fe682576dbc3956a05c33544354 100644 (file)
@@ -81,16 +81,17 @@ TEXT runtime·getrlimit(SB),7,$-4
        INT     $0x80
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$12
+TEXT runtime·raise(SB),7,$16
        // thr_self(&8(SP))
        LEAL    8(SP), AX
-       MOVL    AX, 0(SP)
+       MOVL    AX, 4(SP)
        MOVL    $432, AX
        INT     $0x80
        // thr_kill(self, SIGPIPE)
        MOVL    8(SP), AX
-       MOVL    AX, 0(SP)
-       MOVL    $13, 4(SP)
+       MOVL    AX, 4(SP)
+       MOVL    sig+0(FP), AX
+       MOVL    AX, 8(SP)
        MOVL    $433, AX
        INT     $0x80
        RET
index 3738f16073f0888cd710eb9ee511b75eed765924..cfa33d4fbda972d33e0b28d2c1a9e8909c5a5a34 100644 (file)
@@ -95,14 +95,14 @@ TEXT runtime·getrlimit(SB),7,$-8
        SYSCALL
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$16
+TEXT runtime·raise(SB),7,$16
        // thr_self(&8(SP))
        LEAQ    8(SP), DI       // arg 1 &8(SP)
        MOVL    $432, AX
        SYSCALL
        // thr_kill(self, SIGPIPE)
        MOVQ    8(SP), DI       // arg 1 id
-       MOVQ    $13, SI // arg 2 SIGPIPE
+       MOVL    sig+0(FP), SI   // arg 2
        MOVL    $433, AX
        SYSCALL
        RET
index 2c744f232150bd7da0f540d78210ced3256382d1..5531936ffdf3cc88a4a1dcb8c7546a2f062a8c49 100644 (file)
@@ -87,13 +87,13 @@ TEXT runtime·getrlimit(SB),7,$-8
        SWI $194
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$8
+TEXT runtime·raise(SB),7,$8
        // thr_self(&4(R13))
        MOVW $4(R13), R0 // arg 1 &4(R13)
        SWI $432
        // thr_kill(self, SIGPIPE)
        MOVW 4(R13), R0 // arg 1 id
-       MOVW $13, R1    // arg 2 SIGPIPE
+       MOVW sig+0(FP), R1      // arg 2 - signal
        SWI $433
        RET
 
index 19dfbf3847d6f3ab7329c577cba96478849731e2..76ebe3dcf700d551cce35659bcf43d4bbf601a2c 100644 (file)
@@ -77,11 +77,11 @@ TEXT runtime·usleep(SB),7,$8
        CALL    *runtime·_vdso(SB)
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$12
+TEXT runtime·raise(SB),7,$12
        MOVL    $224, AX        // syscall - gettid
        CALL    *runtime·_vdso(SB)
-       MOVL    AX, 0(SP)       // arg 1 tid
-       MOVL    $13, 4(SP)      // arg 2 SIGPIPE
+       MOVL    AX, BX  // arg 1 tid
+       MOVL    sig+0(FP), CX   // arg 2 signal
        MOVL    $238, AX        // syscall - tkill
        CALL    *runtime·_vdso(SB)
        RET
index f1591b8e7afcf776489ab91c57de1df7c45858cd..2d802abb6122533ecd4c43599df0fc278b388750 100644 (file)
@@ -75,11 +75,11 @@ TEXT runtime·usleep(SB),7,$16
        SYSCALL
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$12
+TEXT runtime·raise(SB),7,$12
        MOVL    $186, AX        // syscall - gettid
        SYSCALL
        MOVL    AX, DI  // arg 1 tid
-       MOVL    $13, SI // arg 2 SIGPIPE
+       MOVL    sig+0(FP), SI   // arg 2
        MOVL    $200, AX        // syscall - tkill
        SYSCALL
        RET
index 8bae2933f75b9ad0b070e94cee11a58dcca34f83..e3994bccaa07c3c6c1b2bcf7581ff39f2f199109 100644 (file)
@@ -92,11 +92,11 @@ TEXT runtime·exit1(SB),7,$-4
        MOVW    $1003, R1
        MOVW    R0, (R1)        // fail hard
 
-TEXT   runtime·raisesigpipe(SB),7,$-4
+TEXT   runtime·raise(SB),7,$-4
        MOVW    $SYS_gettid, R7
        SWI     $0
        // arg 1 tid already in R0 from gettid
-       MOVW    $13, R1 // arg 2 SIGPIPE
+       MOVW    sig+0(FP), R1   // arg 2 - signal
        MOVW    $SYS_tkill, R7
        SWI     $0
        RET
index 475f875421dc252507db00fbb22fb96fe323850d..61686e7de4ec08944fe1cc539bc364fa2803064e 100644 (file)
@@ -61,12 +61,13 @@ TEXT runtime·usleep(SB),7,$24
        INT     $0x80
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$12
+TEXT runtime·raise(SB),7,$12
        MOVL    $311, AX                // sys__lwp_self
        INT     $0x80
        MOVL    $0, 0(SP)
        MOVL    AX, 4(SP)               // arg 1 - target
-       MOVL    $13, 8(SP)              // arg 2 - signo == SIGPIPE
+       MOVL    sig+0(FP), AX
+       MOVL    AX, 8(SP)               // arg 2 - signo
        MOVL    $318, AX                // sys__lwp_kill
        INT     $0x80
        RET
index 958b97e601c2ff8ae4aa2c71c199dffc03f9f5e1..43399a5eee352b6185889a41deb656f977621edc 100644 (file)
@@ -125,11 +125,11 @@ TEXT runtime·usleep(SB),7,$16
        SYSCALL
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$16
+TEXT runtime·raise(SB),7,$16
        MOVL    $311, AX                // sys__lwp_self
        SYSCALL
        MOVQ    AX, DI                  // arg 1 - target
-       MOVQ    $13, SI                 // arg 2 - signo == SIGPIPE
+       MOVL    sig+0(FP), SI           // arg 2 - signo
        MOVL    $318, AX                // sys__lwp_kill
        SYSCALL
        RET
index 4a119c5dee409b5ae45c39b1f6182b90c570e333..fc64b1096d12c7ae755d2bb7ecd81b34d7beb5a0 100644 (file)
@@ -88,9 +88,9 @@ TEXT runtime·usleep(SB),7,$16
        SWI $0xa001ae   // sys_nanosleep
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$16
+TEXT runtime·raise(SB),7,$16
        SWI $0xa00137   // sys__lwp_self, the returned R0 is arg 1
-       MOVW $13, R1    // arg 2 - signo == SIGPIPE
+       MOVW    sig+0(FP), R1   // arg 2 - signal
        SWI $0xa0013e   // sys__lwp_kill
        RET
 
index ab2f68037a20e6ff21aa63afb06c748808d69d1b..a96e354ab74ea98649a3b067dd5c850fc6ddef24 100644 (file)
@@ -62,12 +62,13 @@ TEXT runtime·usleep(SB),7,$20
        INT     $0x80
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$12
+TEXT runtime·raise(SB),7,$12
        MOVL    $299, AX                // sys_getthrid
        INT     $0x80
        MOVL    $0, 0(SP)
        MOVL    AX, 4(SP)               // arg 1 - pid
-       MOVL    $13, 8(SP)              // arg 2 - signum == SIGPIPE
+       MOVL    sig+0(FP), AX
+       MOVL    AX, 8(SP)               // arg 2 - signum
        MOVL    $37, AX                 // sys_kill
        INT     $0x80
        RET
index 585fe47c2b2f903deb695f9a1e94e747d6684d85..4d038a89e15b5b3e5bf6587010b5cad2f0532808 100644 (file)
@@ -133,11 +133,11 @@ TEXT runtime·usleep(SB),7,$16
        SYSCALL
        RET
 
-TEXT runtime·raisesigpipe(SB),7,$16
+TEXT runtime·raise(SB),7,$16
        MOVL    $299, AX                // sys_getthrid
        SYSCALL
        MOVQ    AX, DI                  // arg 1 - pid
-       MOVQ    $13, SI                 // arg 2 - signum == SIGPIPE
+       MOVL    sig+0(FP), SI                   // arg 2 - signum
        MOVL    $37, AX                 // sys_kill
        SYSCALL
        RET