From 59be46ca3587725bde3708605f818cbbce7cf64c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 8 May 2009 16:36:46 -0700 Subject: [PATCH] use exitgroup on linux to exit whole process. R=r DELTA=60 (38 added, 19 deleted, 3 changed) OCL=28589 CL=28589 --- src/lib/os/Makefile | 6 +++--- src/lib/os/{proc.go => proc_darwin.go} | 0 src/lib/os/proc_linux.go | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) rename src/lib/os/{proc.go => proc_darwin.go} (100%) create mode 100644 src/lib/os/proc_linux.go diff --git a/src/lib/os/Makefile b/src/lib/os/Makefile index e7b49e5b99..0334734d1e 100644 --- a/src/lib/os/Makefile +++ b/src/lib/os/Makefile @@ -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) diff --git a/src/lib/os/proc.go b/src/lib/os/proc_darwin.go 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 index 0000000000..a802284f37 --- /dev/null +++ b/src/lib/os/proc_linux.go @@ -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) +} + -- 2.48.1