]> Cypherpunks repositories - gostls13.git/commitdiff
use exitgroup on linux to exit whole process.
authorRuss Cox <rsc@golang.org>
Fri, 8 May 2009 23:36:46 +0000 (16:36 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 8 May 2009 23:36:46 +0000 (16:36 -0700)
R=r
DELTA=60  (38 added, 19 deleted, 3 changed)
OCL=28589
CL=28589

src/lib/os/Makefile
src/lib/os/proc_darwin.go [moved from src/lib/os/proc.go with 100% similarity]
src/lib/os/proc_linux.go [new file with mode: 0644]

index e7b49e5b997f4dc9ce0713397d6f3b4a63afd62b..0334734d1e052367fdc80c9bcd5f7f7b91a1b948 100644 (file)
@@ -3,7 +3,7 @@
 # license that can be found in the LICENSE file.
 
 # DO NOT EDIT.  Automatically generated by gobuild.
-# gobuild -m dir_${GOARCH}_${GOOS}.go env.go error.go file.go proc.go stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile
+# gobuild -m dir_${GOARCH}_${GOOS}.go env.go error.go file.go proc_${GOOS}.go stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile
 
 D=
 
@@ -41,7 +41,7 @@ coverage: packages
 
 O1=\
        error.$O\
-       proc.$O\
+       proc_$(GOOS).$O\
        types.$O\
 
 O2=\
@@ -61,7 +61,7 @@ phases: a1 a2 a3 a4
 _obj$D/os.a: phases
 
 a1: $(O1)
-       $(AR) grc _obj$D/os.a error.$O proc.$O types.$O
+       $(AR) grc _obj$D/os.a error.$O proc_$(GOOS).$O types.$O
        rm -f $(O1)
 
 a2: $(O2)
similarity index 100%
rename from src/lib/os/proc.go
rename to src/lib/os/proc_darwin.go
diff --git a/src/lib/os/proc_linux.go b/src/lib/os/proc_linux.go
new file mode 100644 (file)
index 0000000..a802284
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2009 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 os
+
+import (
+       "os";
+       "syscall";
+)
+
+var Args []string;     // provided by runtime
+var Envs []string;     // provided by runtime
+
+// Exit causes the current program to exit with the given status code.
+// Conventionally, code zero indicates success, non-zero an error.
+func Exit(code int) {
+       syscall.Syscall(syscall.SYS_EXIT_GROUP, int64(code), 0, 0)
+}
+