]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: cleanly exit all Go procs on Plan 9
authorAkshat Kumar <seed@mail.nanosouffle.net>
Thu, 19 Apr 2012 23:31:26 +0000 (16:31 -0700)
committerAnthony Martin <ality@pbrane.org>
Thu, 19 Apr 2012 23:31:26 +0000 (16:31 -0700)
syscall.Exit would originally kill only the calling
Go proc, leaving behind other procs in the
same group. This change makes syscall.Exit call
runtime·exit, which due to CL
https://golang.org/cl/5617048
will cleanly exit all the Go procs in the group.

R=golang-dev, rsc, rminnich, remyoudompheng, ality, john
CC=golang-dev, mirtchovski
https://golang.org/cl/6036051

src/pkg/syscall/asm_plan9_386.s
src/pkg/syscall/syscall_plan9.go

index 86ebedccce55d42ec2f1681b82368e3d4dccb51a..2ba13760812454e6b5e27e0b3590ff6f90b65519 100644 (file)
@@ -149,3 +149,11 @@ copyresult6:
        MOVSL
        MOVSL
        RET
+
+//func exit(code int)
+// Import runtime·exit for cleanly exiting.
+TEXT ·exit(SB),7,$4
+       MOVL    code+0(FP), AX
+       MOVL    AX, 0(SP)
+       CALL    runtime·exit(SB)
+       RET
index 122a96f26d62a3e451f4dd26dad75ae484c73cf2..c1f45f3a2c0477c1d0dd6f22e578add3387ed6bc 100644 (file)
@@ -69,23 +69,10 @@ func errstr() string {
 
 func Getpagesize() int { return 4096 }
 
-//sys  exits(msg *byte)
-func Exits(msg *string) {
-       if msg == nil {
-               exits(nil)
-       }
-
-       exits(StringBytePtr(*msg))
-}
+// Implemented in assembly to import from runtime.
+func exit(int)
 
-func Exit(code int) {
-       if code == 0 {
-               Exits(nil)
-       }
-
-       msg := itoa(code)
-       Exits(&msg)
-}
+func Exit(code int) { exit(code) }
 
 func readnum(path string) (uint, error) {
        var b [12]byte