]> Cypherpunks repositories - gostls13.git/commitdiff
move things out of sys into os and runtime
authorRuss Cox <rsc@golang.org>
Fri, 8 May 2009 22:21:41 +0000 (15:21 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 8 May 2009 22:21:41 +0000 (15:21 -0700)
R=r
OCL=28569
CL=28573

70 files changed:
doc/progs/cat.go
doc/progs/cat_rot13.go
doc/progs/helloworld3.go
doc/progs/strings.go
src/cmd/gc/Makefile
src/cmd/gc/builtin.c.boot
src/cmd/gc/go.h
src/cmd/gc/lex.c
src/cmd/gc/mkbuiltin
src/cmd/gc/runtime.go [new file with mode: 0644]
src/cmd/gc/sys.go
src/cmd/gobuild/gobuild.go
src/cmd/gobuild/util.go
src/lib/flag/flag.go
src/lib/http/triv.go
src/lib/log/log.go
src/lib/os/Makefile
src/lib/os/env.go
src/lib/os/file.go
src/lib/regexp/regexp.go
src/lib/template/template.go
src/lib/testing/testing.go
src/runtime/386/asm.s
src/runtime/386/traceback.c
src/runtime/amd64/asm.s
src/runtime/amd64/traceback.c
src/runtime/chan.c
src/runtime/darwin/386/signal.c
src/runtime/darwin/386/sys.s
src/runtime/darwin/amd64/signal.c
src/runtime/darwin/amd64/sys.s
src/runtime/linux/386/signal.c
src/runtime/linux/386/sys.s
src/runtime/linux/amd64/signal.c
src/runtime/linux/amd64/sys.s
src/runtime/proc.c
src/runtime/runtime.c
src/runtime/runtime.h
src/runtime/sema.c
src/runtime/string.c
test/235.go
test/args.go
test/chan/fifo.go
test/chan/goroutines.go
test/chan/nonblock.go
test/chan/powser1.go
test/chan/powser2.go
test/chan/sieve.go
test/char_lit.go
test/env.go
test/fixedbugs/bug006.go
test/fixedbugs/bug059.go
test/fixedbugs/bug060.go
test/fixedbugs/bug120.go
test/fixedbugs/bug130.go
test/fixedbugs/bug141.go
test/if1.go
test/int_lit.go
test/interface10.go
test/interface4.go
test/interface6.go
test/ken/chan.go
test/ken/chan1.go
test/string_lit.go
test/stringrange.go
test/switch1.go
test/typeswitch.go
usr/gri/pretty/godoc.go
usr/gri/pretty/pretty.go
usr/gri/pretty/untab.go

index 1f6c0f9df65c2115be9dcf0460d1f790c4e3ac91..f0f534926ec0d8504d706ef9e52140be143962b4 100644 (file)
@@ -18,7 +18,7 @@ func cat(f *file.File) {
                switch nr, er := f.Read(&buf); true {
                case nr < 0:
                        fmt.Fprintf(os.Stderr, "error reading from %s: %s\n", f.String(), er.String());
-                       sys.Exit(1);
+                       os.Exit(1);
                case nr == 0:  // EOF
                        return;
                case nr > 0:
@@ -38,7 +38,7 @@ func main() {
                f, err := file.Open(flag.Arg(i), 0, 0);
                if f == nil {
                        fmt.Fprintf(os.Stderr, "can't open %s: error %s\n", flag.Arg(i), err);
-                       sys.Exit(1);
+                       os.Exit(1);
                }
                cat(f);
                f.Close();
index 7411a7bedc9638f87f02d3ed23a1cd39afebae43..931fdf03c34ac9f15fe9ad24793bb0d5bda2ec8f 100644 (file)
@@ -60,7 +60,7 @@ func cat(r reader) {
                switch nr, er := r.Read(&buf); {
                case nr < 0:
                        fmt.Fprintf(os.Stderr, "error reading from %s: %s\n", r.String(), er.String());
-                       sys.Exit(1);
+                       os.Exit(1);
                case nr == 0:  // EOF
                        return;
                case nr > 0:
@@ -81,7 +81,7 @@ func main() {
                f, err := file.Open(flag.Arg(i), 0, 0);
                if f == nil {
                        fmt.Fprintf(os.Stderr, "can't open %s: error %s\n", flag.Arg(i), err);
-                       sys.Exit(1);
+                       os.Exit(1);
                }
                cat(f);
                f.Close();
index 630c49232c024898f004126318e07bc3f64a2eae..01fc3e30a1f3e277d8fa1dce6ced053c1556f236 100644 (file)
@@ -7,6 +7,7 @@ package main
 import (
        "file";
        "fmt";
+       "os";
 )
 
 func main() {
@@ -15,6 +16,6 @@ func main() {
        file, err := file.Open("/does/not/exist",  0,  0);
        if file == nil {
                fmt.Printf("can't open file; err=%s\n",  err.String());
-               sys.Exit(1);
+               os.Exit(1);
        }
 }
index ee2596d8f2e4f91b5920e6b30762194b33a7a9ad..2c4937e38f24aa5a08abe47e1c002c328926a051 100644 (file)
@@ -5,10 +5,11 @@
 package main
 
 import "fmt"
+import "os"
 
 func main() {
        s := "hello";
-       if s[1] != 'e' { sys.Exit(1) }
+       if s[1] != 'e' { os.Exit(1) }
        s = "good bye";
        var p *string = &s;
        *p = "ciao";
index 0fc15deaa89e8e59c3fc516fc5974108895a3d2a..0083240e468ddd51ff7e44307678fabbbb072f95 100644 (file)
@@ -44,7 +44,7 @@ y.tab.h: $(YFILES)
 y.tab.c: y.tab.h
        test -f y.tab.c && touch y.tab.c
 
-builtin.c:     sys.go unsafe.go mkbuiltin1.c mkbuiltin
+builtin.c:     sys.go unsafe.go runtime.go mkbuiltin1.c mkbuiltin
        ./mkbuiltin >builtin.c || \
        (echo 'mkbuiltin failed; using bootstrap copy of builtin.c'; cp builtin.c.boot builtin.c)
 
index 0f189d36340501b56d00511ad92c8ecc77ec65f7..8657944b5627f0491efb565eb78587c4a82ba8e6 100644 (file)
@@ -55,13 +55,6 @@ char *sysimport =
        "func sys.arrayslices (old *any, nel int, lb int, hb int, width int) (ary []any)\n"
        "func sys.arrays2d (old *any, nel int) (ary []any)\n"
        "func sys.closure ()\n"
-       "func sys.Breakpoint ()\n"
-       "var sys.Args []string\n"
-       "var sys.Envs []string\n"
-       "func sys.Gosched ()\n"
-       "func sys.Goexit ()\n"
-       "func sys.Exit (? int)\n"
-       "func sys.Caller (n int) (pc uint64, file string, line int, ok bool)\n"
        "\n"
        "$$\n";
 char *unsafeimport =
@@ -74,3 +67,11 @@ char *unsafeimport =
        "func unsafe.Unreflect (? uint64, ? string, ? bool) (ret interface { })\n"
        "\n"
        "$$\n";
+char *runtimeimport =
+       "package runtime\n"
+       "func runtime.Breakpoint ()\n"
+       "func runtime.Gosched ()\n"
+       "func runtime.Goexit ()\n"
+       "func runtime.Caller (n int) (pc uint64, file string, line int, ok bool)\n"
+       "\n"
+       "$$\n";
index a74dd645c2c5f5dd757df0ac6374814745e0d577..29e2fd64bab921f94ae20848ea2d20f04ae0cc75 100644 (file)
@@ -541,6 +541,7 @@ EXTERN      Sym*    pkgimportname;  // package name from imported package
 EXTERN int     tptr;           // either TPTR32 or TPTR64
 extern char*   sysimport;
 extern char*   unsafeimport;
+extern char*   runtimeimport;
 EXTERN char*   filename;       // name to uniqify names
 EXTERN Idir*   idirs;
 
index b84d91ba74db9ab0304b3030768d83c354d7c3e4..e5edf5051399ef24f2a3962e23ff479768b4e990 100644 (file)
@@ -265,6 +265,10 @@ importfile(Val *f)
                cannedimports("unsafe.6", unsafeimport);
                return;
        }
+       if(strcmp(f->u.sval->s, "runtime") == 0) {
+               cannedimports("runtime.6", runtimeimport);
+               return;
+       }
 
        if(!findpkg(f->u.sval))
                fatal("can't find import: %Z", f->u.sval);
index e0c29c1bb410305f3955c07b6eb0afe44c8fb157..b0cb634f50e2a3d0bf37483499daec2e4b33cb07 100755 (executable)
@@ -5,11 +5,12 @@
 
 set -e
 gcc -o mkbuiltin1 mkbuiltin1.c
-6g sys.go
-6g unsafe.go
 rm -f _builtin.c
-./mkbuiltin1 sys >_builtin.c
-./mkbuiltin1 unsafe >>_builtin.c
+for i in sys unsafe runtime
+do
+       6g $i.go
+       ./mkbuiltin1 $i >>_builtin.c
+done
 
 # If _builtin.c has changed vs builtin.c.boot,
 # check in the new change if being run by
diff --git a/src/cmd/gc/runtime.go b/src/cmd/gc/runtime.go
new file mode 100644 (file)
index 0000000..6b9722a
--- /dev/null
@@ -0,0 +1,9 @@
+// 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 PACKAGE
+func   Breakpoint();
+func   Gosched();
+func   Goexit();
+func   Caller(n int) (pc uint64, file string, line int, ok bool);
index f77771a09dea10b35a42aaf125fe427007bf0bfc..67fbb0391d7ab83c87d41284e4f6a94d676e9cbe 100644 (file)
@@ -72,17 +72,3 @@ func arrayslices(old *any, nel int, lb int, hb int, width int) (ary []any);
 func   arrays2d(old *any, nel int) (ary []any);
 
 func   closure();      // has args, but compiler fills in
-
-// used by go programs
-
-func   Breakpoint();
-
-var    Args []string;
-var    Envs []string;
-
-func   Gosched();
-func   Goexit();
-
-func   Exit(int);
-
-func   Caller(n int) (pc uint64, file string, line int, ok bool);
index 9324e98ff4a9fc336d175c456774dfb088456658..0db9bca0423d70ef9c4f8152ac0ded53319733d2 100644 (file)
@@ -131,7 +131,7 @@ func ScanFiles(filenames []string) *Info {
        // TODO(rsc): Build a binary from package main?
 
        z := new(Info);
-       z.Args = sys.Args;
+       z.Args = os.Args;
        z.Dir = PkgDir();
        z.Char = theChar;       // for template
        z.ObjDir = ObjDir;      // for template
index 34351cea82769be2529aa40d762d8bbe69df34fe..be50ba1cab09d6ec53854ede61c0b52c82afdb11 100644 (file)
@@ -34,7 +34,7 @@ const ObjDir = "_obj"
 
 func fatal(args ...) {
        fmt.Fprintf(os.Stderr, "gobuild: %s\n", fmt.Sprint(args));
-       sys.Exit(1);
+       os.Exit(1);
 }
 
 func init() {
index e66238f6dd24573071b03e81bc16789ac30bef3f..63d649a9bd7fe7819db3ec716213e8a339f80582 100644 (file)
@@ -261,15 +261,15 @@ func PrintDefaults() {
 }
 
 // Usage prints to standard error a default usage message documenting all defined flags and
-// then calls sys.Exit(1).
+// then calls os.Exit(1).
 func Usage() {
-       if len(sys.Args) > 0 {
-               fmt.Fprintln(os.Stderr, "Usage of", sys.Args[0] + ":");
+       if len(os.Args) > 0 {
+               fmt.Fprintln(os.Stderr, "Usage of", os.Args[0] + ":");
        } else {
                fmt.Fprintln(os.Stderr, "Usage:");
        }
        PrintDefaults();
-       sys.Exit(1);
+       os.Exit(1);
 }
 
 func NFlag() int {
@@ -280,20 +280,20 @@ func NFlag() int {
 // after flags have been processed.
 func Arg(i int) string {
        i += flags.first_arg;
-       if i < 0 || i >= len(sys.Args) {
+       if i < 0 || i >= len(os.Args) {
                return "";
        }
-       return sys.Args[i]
+       return os.Args[i]
 }
 
 // NArg is the number of arguments remaining after flags have been processed.
 func NArg() int {
-       return len(sys.Args) - flags.first_arg
+       return len(os.Args) - flags.first_arg
 }
 
 // Args returns the non-flag command-line arguments.
 func Args() []string {
-       return sys.Args[flags.first_arg:len(sys.Args)];
+       return os.Args[flags.first_arg:len(os.Args)];
 }
 
 func add(name string, value FlagValue, usage string) {
@@ -393,7 +393,7 @@ func String(name, value string, usage string) *string {
 
 func (f *allFlags) parseOne(index int) (ok bool, next int)
 {
-       s := sys.Args[index];
+       s := os.Args[index];
        f.first_arg = index;  // until proven otherwise
        if len(s) == 0 {
                return false, -1
@@ -450,11 +450,11 @@ func (f *allFlags) parseOne(index int) (ok bool, next int)
                }
        } else {
                // It must have a value, which might be the next argument.
-               if !has_value && index < len(sys.Args)-1 {
+               if !has_value && index < len(os.Args)-1 {
                        // value is the next arg
                        has_value = true;
                        index++;
-                       value = sys.Args[index];
+                       value = os.Args[index];
                }
                if !has_value {
                        print("flag needs an argument: -", name, "\n");
@@ -473,7 +473,7 @@ func (f *allFlags) parseOne(index int) (ok bool, next int)
 // Parse parses the command-line flags.  Must be called after all flags are defined
 // and before any are accessed by the program.
 func Parse() {
-       for i := 1; i < len(sys.Args); {
+       for i := 1; i < len(os.Args); {
                ok, next := flags.parseOne(i);
                if next > 0 {
                        flags.first_arg = next;
index d2e074d73da35765fb60b43bb838afda8d686199..f8b59ebeabb9839c4dee97b91664942ebbac1c47 100644 (file)
@@ -74,7 +74,7 @@ func FlagServer(c *http.Conn, req *http.Request) {
 
 // simple argument server
 func ArgServer(c *http.Conn, req *http.Request) {
-       for i, s := range sys.Args {
+       for i, s := range os.Args {
                fmt.Fprint(c, s, " ");
        }
 }
index 4a679a839eff32c7adec684707fe2002f9d04e3f..f5e4dd4a9a715b077e0f6ca348bc459f266b09fc 100644 (file)
@@ -14,6 +14,7 @@ package log
 import (
        "fmt";
        "io";
+       "runtime";
        "os";
        "time";
 )
@@ -96,7 +97,7 @@ func (l *Logger) formatHeader(ns int64, calldepth int) string {
                }
        }
        if l.flag & (Lshortfile | Llongfile) != 0 {
-               pc, file, line, ok := sys.Caller(calldepth);
+               pc, file, line, ok := runtime.Caller(calldepth);
                if ok {
                        if l.flag & Lshortfile != 0 {
                                short, ok := shortnames[file];
@@ -139,7 +140,7 @@ func (l *Logger) Output(calldepth int, s string) {
        case Lcrash:
                panic("log: fatal error");
        case Lexit:
-               sys.Exit(1);
+               os.Exit(1);
        }
 }
 
@@ -173,12 +174,12 @@ func Stderrf(format string, v ...) {
        stderr.Output(2, fmt.Sprintf(format, v))
 }
 
-// Exit is equivalent to Stderr() followed by a call to sys.Exit(1).
+// Exit is equivalent to Stderr() followed by a call to os.Exit(1).
 func Exit(v ...) {
        exit.Output(2, fmt.Sprintln(v))
 }
 
-// Exitf is equivalent to Stderrf() followed by a call to sys.Exit(1).
+// Exitf is equivalent to Stderrf() followed by a call to os.Exit(1).
 func Exitf(format string, v ...) {
        exit.Output(2, fmt.Sprintf(format, v))
 }
index b563da3f3e66cdba74e63657fa3afbb53c0f554f..e7b49e5b997f4dc9ce0713397d6f3b4a63afd62b 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 stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile
+# 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
 
 D=
 
@@ -41,6 +41,7 @@ coverage: packages
 
 O1=\
        error.$O\
+       proc.$O\
        types.$O\
 
 O2=\
@@ -60,7 +61,7 @@ phases: a1 a2 a3 a4
 _obj$D/os.a: phases
 
 a1: $(O1)
-       $(AR) grc _obj$D/os.a error.$O types.$O
+       $(AR) grc _obj$D/os.a error.$O proc.$O types.$O
        rm -f $(O1)
 
 a2: $(O2)
index e7df309e03dbfe4390ccfb5c62ec2574efbf0155..74875041307922ac23c0b6d6ee325ffc7ce94900 100644 (file)
@@ -19,7 +19,7 @@ var env map[string] string;
 
 func copyenv() {
        env = make(map[string] string);
-       for i, s := range sys.Envs {
+       for i, s := range os.Envs {
                for j := 0; j < len(s); j++ {
                        if s[j] == '=' {
                                env[s[0:j]] = s[j+1:len(s)];
index fa1784a426f34b232bed4d4b56f60e56310fbe72..9b22a896dbef0640e21a52229db586f22a477cb3 100644 (file)
@@ -132,7 +132,7 @@ func (file *File) Write(b []byte) (ret int, err Error) {
        if e == syscall.EPIPE {
                file.nepipe++;
                if file.nepipe >= 10 {
-                       sys.Exit(syscall.EPIPE);
+                       os.Exit(syscall.EPIPE);
                }
        } else {
                file.nepipe = 0;
index 135dcc368a98163af5ce157db26a75f14afbc4d6..8cbd380352d4a5480cb567154f3d346e3595a0d3 100644 (file)
@@ -25,6 +25,7 @@ package regexp
 import (
        "container/vector";
        "os";
+       "runtime";
        "utf8";
 )
 
@@ -236,7 +237,7 @@ func (nop *_Nop) print() { print("nop") }
 func (re *Regexp) setError(err os.Error) {
        re.error = err;
        re.ch <- re;
-       sys.Goexit();
+       runtime.Goexit();
 }
 
 func (re *Regexp) add(i instr) instr {
index b886b31813af038563184ce0036eef2f41e98032..182a85b4261d79b457654a6a8a9f458c8e62e4b1 100644 (file)
@@ -44,7 +44,7 @@
        first looked for in the cursor, as in .section and .repeated.
        If it is not found, the search continues in outer sections
        until the top level is reached.
-       
+
        If a formatter is specified, it must be named in the formatter
        map passed to the template set up routines or in the default
        set ("html","str","") and is used to process the data for
@@ -61,6 +61,7 @@ import (
        "io";
        "os";
        "reflect";
+       "runtime";
        "strings";
        "template";
        "container/vector";
@@ -181,7 +182,7 @@ func New(fmap FormatterMap) *Template {
 // Generic error handler, called only from execError or parseError.
 func error(errors chan os.Error, line int, err string, args ...) {
        errors <- ParseError{fmt.Sprintf("line %d: %s", line, fmt.Sprintf(err, args))};
-       sys.Goexit();
+       runtime.Goexit();
 }
 
 // Report error and stop executing.  The line number must  be provided explicitly.
index 2f717d0e97ea0aad45df0b4acc5d3f78108e4caf..63e4af5e9ab9051fe800f665d58069a33f0bbdaf 100644 (file)
@@ -14,6 +14,8 @@ package testing
 import (
        "flag";
        "fmt";
+       "os";
+       "runtime";
 )
 
 // Report as tests are run; default is silent for success.
@@ -47,7 +49,7 @@ func (t *T) Fail() {
 func (t *T) FailNow() {
        t.Fail();
        t.ch <- t;
-       sys.Goexit();
+       runtime.Goexit();
 }
 
 // Log formats its arguments using default formatting, analogous to Print(),
@@ -129,7 +131,7 @@ func Main(tests []Test) {
        }
        if !ok {
                println("FAIL");
-               sys.Exit(1);
+               os.Exit(1);
        }
        println("PASS");
 }
index 3ef8d8e47cd2de998356a26b06bcdb7abcaaf3fb..9dd9c11a98cd20028320e0e2cf9f950d0aebbbd7 100644 (file)
@@ -84,12 +84,12 @@ TEXT mainstart(SB),7,$0
        CALL    initdone(SB)
        CALL    main·main(SB)
        PUSHL   $0
-       CALL    sys·Exit(SB)
+       CALL    exit(SB)
        POPL    AX
        INT $3
        RET
 
-TEXT   sys·Breakpoint(SB),7,$0
+TEXT   breakpoint(SB),7,$0
        BYTE $0xcc
        RET
 
index b60512ab1926d21a6d4e7d615b90d4c480bdef7d..23e92d8926b8f5d041e20cac585b035974dbfb56 100644 (file)
@@ -82,7 +82,7 @@ traceback(byte *pc0, byte *sp, G *g)
 
 // func caller(n int) (pc uint64, file string, line int, ok bool)
 void
-sys·Caller(int32 n, uint64 retpc, string retfile, int32 retline, bool retbool)
+runtime·Caller(int32 n, uint64 retpc, string retfile, int32 retline, bool retbool)
 {
        uint64 pc;
        byte *sp;
index cad656e70f1dbbdcf3bf951263dd139dfabc2d73..b69259e314d28a9f406de3ce3fdddfce226d14d0 100644 (file)
@@ -55,12 +55,12 @@ TEXT mainstart(SB),7,$0
        CALL    initdone(SB)
        CALL    main·main(SB)
        PUSHQ   $0
-       CALL    sys·Exit(SB)
+       CALL    exit(SB)
        POPQ    AX
        CALL    notok(SB)
        RET
 
-TEXT   sys·Breakpoint(SB),7,$0
+TEXT   breakpoint(SB),7,$0
        BYTE    $0xcc
        RET
 
index 2e237a21fa1ade258350547cb27171cfef3b6364..16d7bed72efadc839e002d1da1accb3152d0ef69 100644 (file)
@@ -79,7 +79,7 @@ traceback(byte *pc0, byte *sp, G *g)
 
 // func caller(n int) (pc uint64, file string, line int, ok bool)
 void
-sys·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbool)
+runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbool)
 {
        uint64 pc;
        byte *sp;
index 59ac78d79c7c84dd67d5dc87d58eb22063f911d5..be65bcbc164417e1ccb5d83ae3199135a04b117c 100644 (file)
@@ -211,7 +211,7 @@ loop:
        g->status = Gwaiting;
        enqueue(&c->sendq, sg);
        unlock(&chanlock);
-       sys·Gosched();
+       gosched();
 
        lock(&chanlock);
        sg = g->param;
@@ -237,7 +237,7 @@ asynch:
                g->status = Gwaiting;
                enqueue(&c->sendq, sg);
                unlock(&chanlock);
-               sys·Gosched();
+               gosched();
 
                lock(&chanlock);
                goto asynch;
@@ -311,7 +311,7 @@ loop:
        g->status = Gwaiting;
        enqueue(&c->recvq, sg);
        unlock(&chanlock);
-       sys·Gosched();
+       gosched();
 
        lock(&chanlock);
        sg = g->param;
@@ -339,7 +339,7 @@ asynch:
                g->status = Gwaiting;
                enqueue(&c->recvq, sg);
                unlock(&chanlock);
-               sys·Gosched();
+               gosched();
 
                lock(&chanlock);
                goto asynch;
@@ -748,7 +748,7 @@ loop:
        g->param = nil;
        g->status = Gwaiting;
        unlock(&chanlock);
-       sys·Gosched();
+       gosched();
 
        lock(&chanlock);
        sg = g->param;
index a6c782294f7d0685c3e163af27b4224e5ec7da6f..3a63c4b382a525800bcdb33a46dc3af37ef71927 100644 (file)
@@ -33,7 +33,7 @@ sighandler(int32 sig, Siginfo *info, void *context)
        Regs *r;
 
        if(panicking)   // traceback already printed
-               sys_Exit(2);
+               exit(2);
        panicking = 1;
 
        if(sig < 0 || sig >= NSIG){
@@ -56,8 +56,8 @@ sighandler(int32 sig, Siginfo *info, void *context)
                dumpregs(r);
        }
 
-       sys·Breakpoint();
-       sys_Exit(2);
+       breakpoint();
+       exit(2);
 }
 
 void
index 93dd4e300b783920601d69cf4a169b5f61ca7d0a..1ad6d2acebc1154297969238edf19915acdfadee 100644 (file)
@@ -11,7 +11,7 @@ TEXT notok(SB),7,$0
        RET
 
 // Exit the entire program (like C exit)
-TEXT sys·Exit(SB),7,$0
+TEXT exit(SB),7,$0
        MOVL    $1, AX
        INT     $0x80
        CALL    notok(SB)
index 88cddeb00d070939d5b4b9150808ec65433581dd..45e5e8d478132e7705037745094185f2be639750 100644 (file)
@@ -41,7 +41,7 @@ sighandler(int32 sig, Siginfo *info, void *context)
        Regs *r;
 
        if(panicking)   // traceback already printed
-               sys_Exit(2);
+               exit(2);
        panicking = 1;
 
        if(sig < 0 || sig >= NSIG){
@@ -64,8 +64,8 @@ sighandler(int32 sig, Siginfo *info, void *context)
                dumpregs(r);
        }
 
-       sys·Breakpoint();
-       sys_Exit(2);
+       breakpoint();
+       exit(2);
 }
 
 void
index e16983346d552599b8ee223a11b75b134ce31217..4238cd185882a77041889162c16ed63c7edea8ff 100644 (file)
@@ -9,7 +9,7 @@
 //
 
 // Exit the entire program (like C exit)
-TEXT   sys·Exit(SB),7,$-8
+TEXT   exit(SB),7,$-8
        MOVL    8(SP), DI               // arg 1 exit status
        MOVL    $(0x2000000+1), AX      // syscall entry
        SYSCALL
index 9cbd9fa855b1aa2dd2c9e0731f37b074c39ddd75..7dfca6bb40d957864545a791709e96865fdae1fa 100644 (file)
@@ -40,7 +40,7 @@ sighandler(int32 sig, Siginfo* info, void* context)
        Sigcontext *sc;
 
        if(panicking)   // traceback already printed
-               sys_Exit(2);
+               exit(2);
        panicking = 1;
 
        uc = context;
@@ -61,8 +61,8 @@ sighandler(int32 sig, Siginfo* info, void* context)
                dumpregs(sc);
        }
 
-       sys·Breakpoint();
-       sys_Exit(2);
+       breakpoint();
+       exit(2);
 }
 
 void
index 379d153e4ca4e5660d55ea6b79e21e1e9f2382f4..419973a5ca9868a33bc9e0a0ad05ef26ec62af29 100755 (executable)
@@ -20,7 +20,7 @@ TEXT syscall(SB),7,$0
        INT $3  // not reached
        RET
 
-TEXT sys·Exit(SB),7,$0
+TEXT exit(SB),7,$0
        MOVL    $252, AX        // syscall number
        MOVL    4(SP), BX
        INT     $0x80
index 5f3574f8e27fb105818881e85f465df8df4cec6a..55215176dec4fdd6d65b22e681073148dc4b11c8 100644 (file)
@@ -49,7 +49,7 @@ sighandler(int32 sig, Siginfo* info, void* context)
        Sigcontext *sc;
 
        if(panicking)   // traceback already printed
-               sys_Exit(2);
+               exit(2);
        panicking = 1;
 
        uc = context;
@@ -71,8 +71,8 @@ sighandler(int32 sig, Siginfo* info, void* context)
                dumpregs(sc);
        }
 
-       sys·Breakpoint();
-       sys_Exit(2);
+       breakpoint();
+       exit(2);
 }
 
 void
index 5c4d98f973f214f7184c462cf6407120ad1d4cb7..f90c704faf02457fad29dcc2f2dafb0e7ff34889 100644 (file)
@@ -6,7 +6,7 @@
 // System calls and other sys.stuff for AMD64, Linux
 //
 
-TEXT   sys·Exit(SB),7,$0-8
+TEXT   exit(SB),7,$0-8
        MOVL    8(SP), DI
        MOVL    $231, AX        // exitgroup - force all os threads to exi
        SYSCALL
index 3875916e77bafecd79deffb25dd1e0b52ce21212..d52adf94c06049a6b07ee6f53741ebd74e1bc492 100644 (file)
@@ -129,7 +129,7 @@ initdone(void)
 }
 
 void
-sys·Goexit(void)
+goexit(void)
 {
        if(debug > 1){
                lock(&debuglock);
@@ -137,7 +137,7 @@ sys·Goexit(void)
                unlock(&debuglock);
        }
        g->status = Gmoribund;
-       sys·Gosched();
+       gosched();
 }
 
 void
@@ -431,7 +431,7 @@ scheduler(void)
                case Gmoribund:
                        gp->status = Gdead;
                        if(--sched.gcount == 0)
-                               sys_Exit(0);
+                               exit(0);
                        break;
                }
                if(gp->readyonstop){
@@ -461,7 +461,7 @@ scheduler(void)
 // before running g again.  If g->status is Gmoribund,
 // kills off g.
 void
-sys·Gosched(void)
+gosched(void)
 {
        if(g == m->g0)
                throw("gosched of g0");
@@ -529,7 +529,7 @@ sys·exitsyscall(void)
        // The scheduler will ready g and put this m to sleep.
        // When the scheduler takes g awa from m,
        // it will undo the sched.mcpu++ above.
-       sys·Gosched();
+       gosched();
 }
 
 /*
@@ -784,7 +784,7 @@ sys·newproc(int32 siz, byte* fn, byte* arg0)
        mcpy(sp, (byte*)&arg0, siz);
 
        sp -= sizeof(uintptr);
-       *(byte**)sp = (byte*)sys·Goexit;
+       *(byte**)sp = (byte*)goexit;
 
        sp -= sizeof(uintptr);  // retpc used by gogo
        newg->sched.SP = sp;
@@ -839,3 +839,21 @@ sys·deferreturn(int32 arg0)
        jmpdefer(sp);
 }
 
+void
+runtime·Breakpoint(void)
+{
+       breakpoint();
+}
+
+void
+runtime·Goexit(void)
+{
+       goexit();
+}
+
+void
+runtime·Gosched(void)
+{
+       gosched();
+}
+
index e05563bd6e015ffdcfc9974d72d36fe87caea267..afb9cce172219feced554c3ab4fd94f768bc9073 100644 (file)
@@ -25,7 +25,7 @@ sys·panicl(int32 lno)
 
        if(panicking) {
                printf("double panic\n");
-               sys_Exit(3);
+               exit(3);
        }
        panicking++;
 
@@ -35,8 +35,8 @@ sys·panicl(int32 lno)
                traceback(sys·getcallerpc(&lno), sp, g);
                tracebackothers(g);
        }
-       sys·Breakpoint();  // so we can grab it in a debugger
-       sys_Exit(2);
+       breakpoint();  // so we can grab it in a debugger
+       exit(2);
 }
 
 void
@@ -57,7 +57,7 @@ throw(int8 *s)
        printf("throw: %s\n", s);
        sys·panicl(-1);
        *(int32*)0 = 0; // not reached
-       sys_Exit(1);    // even more not reached
+       exit(1);        // even more not reached
 }
 
 void
@@ -136,8 +136,8 @@ rnd(uint32 n, uint32 m)
 static int32   argc;
 static uint8** argv;
 
-Array sys·Args;
-Array sys·Envs;
+Array os·Args;
+Array os·Envs;
 
 void
 args(int32 c, uint8 **v)
@@ -161,15 +161,15 @@ goargs(void)
 
        for(i=0; i<argc; i++)
                gargv[i] = gostring(argv[i]);
-       sys·Args.array = (byte*)gargv;
-       sys·Args.nel = argc;
-       sys·Args.cap = argc;
+       os·Args.array = (byte*)gargv;
+       os·Args.nel = argc;
+       os·Args.cap = argc;
 
        for(i=0; i<envc; i++)
                genvv[i] = gostring(argv[argc+1+i]);
-       sys·Envs.array = (byte*)genvv;
-       sys·Envs.nel = envc;
-       sys·Envs.cap = envc;
+       os·Envs.array = (byte*)genvv;
+       os·Envs.nel = envc;
+       os·Envs.cap = envc;
 }
 
 byte*
@@ -182,8 +182,8 @@ getenv(int8 *s)
 
        bs = (byte*)s;
        len = findnull(bs);
-       envv = (String*)sys·Envs.array;
-       envc = sys·Envs.nel;
+       envv = (String*)os·Envs.array;
+       envc = os·Envs.nel;
        for(i=0; i<envc; i++){
                if(envv[i].len <= len)
                        continue;
index 6b398c2bfa0bc9785bf73f58f7264f5aaa04bec7..68d3748f37dfc81afa7475830525aa05db22c291 100644 (file)
@@ -329,6 +329,10 @@ uint32     noequal(uint32, void*, void*);
 void*  malloc(uintptr size);
 void*  mallocgc(uintptr size);
 void   free(void *v);
+void   exit(int32);
+void   breakpoint(void);
+void   gosched(void);
+void   goexit(void);
 
 #pragma        varargck        argpos  printf  1
 
@@ -378,15 +382,11 @@ void      notewakeup(Note*);
  * UTF-8 characters in identifiers.
  */
 #ifndef __GNUC__
-#define sys_Exit sys·Exit
-#define sys_Gosched sys·Gosched
 #define sys_memclr sys·memclr
 #define sys_write sys·write
-#define sys_Breakpoint sys·Breakpoint
 #define sys_catstring sys·catstring
 #define sys_cmpstring sys·cmpstring
 #define sys_getcallerpc sys·getcallerpc
-#define sys_Goexit sys·Goexit
 #define sys_indexstring sys·indexstring
 #define sys_intstring sys·intstring
 #define sys_mal sys·mal
@@ -408,11 +408,7 @@ void       notewakeup(Note*);
 /*
  * low level go-called
  */
-void   sys_Goexit(void);
-void   sys_Gosched(void);
-void   sys_Exit(int32);
 void   sys_write(int32, void*, int32);
-void   sys_Breakpoint(void);
 uint8* sys_mmap(byte*, uint32, int32, int32, int32, uint32);
 void   sys_memclr(byte*, uint32);
 void   sys_setcallerpc(void*, void*);
index cad08d1672318c6acd23340ba1dfbb4191a16569..5e5b07aa6ff5952c1cf500864cf4242e2e42704c 100644 (file)
@@ -119,7 +119,7 @@ semsleep2(Sema *s)
 {
        USED(s);
        g->status = Gwaiting;
-       sys·Gosched();
+       gosched();
 }
 
 static int32
index 667828d66e3153f2b000724dff40a1a72befe7ea..5e4922a99f69464d235ee2539889bf9d4ad1c819 100644 (file)
@@ -215,8 +215,6 @@ out:
 void
 sys·stringiter2(String s, int32 k, int32 retk, int32 retv)
 {
-       int32 l;
-
        if(k >= s.len) {
                // retk=0 is end of iteration
                retk = 0;
index e24106dd00cca538d72fc677bd0055565d6d6b56..b8621cc7e53fa5ff839a83daefe84b60328e6928 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 type T chan uint64;
 
 func M(f uint64) (in, out T) {
@@ -65,5 +67,5 @@ func main() {
                x = min(xs);
                if x != OUT[i] { panic("bad: ", x, " should be ", OUT[i]); }
        }
-       sys.Exit(0);
+       os.Exit(0);
 }
index 4b9671a53fac04724601872232735019c2d97bd6..ba9a377a6f8e228bffb47fa7a7b25cbe81bf16f0 100644 (file)
@@ -6,14 +6,16 @@
 
 package main
 
+import "os"
+
 func main() {
-       if len(sys.Args) != 3 {
+       if len(os.Args) != 3 {
                panic("argc")
        }
-       if sys.Args[1] != "arg1" {
+       if os.Args[1] != "arg1" {
                panic("arg1")
        }
-       if sys.Args[2] != "arg2" {
+       if os.Args[2] != "arg2" {
                panic("arg2")
        }
 }
index ad53ab6558c77626c526e169732d438edd8543b8..00a297a604f410aba5f7e656c26693cee8cafc75 100644 (file)
@@ -8,6 +8,8 @@
 
 package main
 
+import "os"
+
 const N = 10
 
 func AsynchFifo() {
@@ -18,7 +20,7 @@ func AsynchFifo() {
        for i := 0; i < N; i++ {
                if <-ch != i {
                        print("bad receive\n");
-                       sys.Exit(1);
+                       os.Exit(1);
                }
        }
 }
index c1b7143566f2f50bbc7b6f3ad175081ab0b8f699..cee8a18ac9125233128f76ea54b57620642c0bc4 100644 (file)
@@ -20,12 +20,12 @@ func f(left, right chan int) {
 
 func main() {
        var n = 10000;
-       if len(sys.Args) > 1 {
+       if len(os.Args) > 1 {
                var err os.Error;
-               n, err = strconv.Atoi(sys.Args[1]);
+               n, err = strconv.Atoi(os.Args[1]);
                if err != nil {
                        print("bad arg\n");
-                       sys.Exit(1);
+                       os.Exit(1);
                }
        }
        leftmost := make(chan int);
index 2b61ec9dbb4f90a4aaccab1d0309061608274985..5fd7f0d45d2d020d2001c05ec568c40920760e34 100644 (file)
@@ -9,6 +9,7 @@
 
 package main
 
+import "runtime"
 import "time"
 
 func i32receiver(c chan int32, strobe chan bool) {
@@ -55,9 +56,9 @@ var ticker = time.Tick(10*1000);      // 10 us
 func sleep() {
        <-ticker;
        <-ticker;
-       sys.Gosched();
-       sys.Gosched();
-       sys.Gosched();
+       runtime.Gosched();
+       runtime.Gosched();
+       runtime.Gosched();
 }
 
 func main() {
index c167da192708b43ea9b76dd6e26611eba1ff743c..f37f639aba24e71c34a63caab598c91db68c2041 100644 (file)
@@ -13,6 +13,8 @@
 
 package main
 
+import "os"
+
 type rat struct  {
        num, den  int64;        // numerator, denominator
 }
@@ -623,7 +625,7 @@ func checka(U PS, a []rat, str string) {
 
 func main() {
        Init();
-       if len(sys.Args) > 1 {  // print
+       if len(os.Args) > 1 {  // print
                print("Ones: "); printn(Ones, 10);
                print("Twos: "); printn(Twos, 10);
                print("Add: "); printn(Add(Ones, Twos), 10);
index b48110819ba69214842fdf77196eabe20fa3da54..d910019691fb4cf83c0fa493ef18c96e7c8abd11 100644 (file)
@@ -16,6 +16,8 @@
 
 package main
 
+import "os"
+
 type rat struct  {
        num, den  int64;        // numerator, denominator
 }
@@ -636,7 +638,7 @@ func checka(U PS, a []*rat, str string) {
 
 func main() {
        Init();
-       if len(sys.Args) > 1 {  // print
+       if len(os.Args) > 1 {  // print
                print("Ones: "); Printn(Ones, 10);
                print("Twos: "); Printn(Twos, 10);
                print("Add: "); Printn(Add(Ones, Twos), 10);
index 7d06e98fa729a8c3b1507797f85d69df0d43a9ea..49f1c105e2fc931191af3b4e467dfd2312c4fdd6 100644 (file)
@@ -9,6 +9,8 @@
 
 package main
 
+import "os"
+
 // Send the sequence 2, 3, 4, ... to channel 'ch'.
 func Generate(ch chan<- int) {
        for i := 2; ; i++ {
@@ -47,5 +49,5 @@ func main() {
        for i := 0; i < len(a); i++ {
                if x := <-primes; x != a[i] { panic(x, " != ", a[i]) }
        }
-       sys.Exit(0);
+       os.Exit(0);
 }
index d45ecf39801952bf812b7f5f63beadeb6a757c87..6699442dc8ad6bedef05fd5576b9477ba3be01e6 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 func main() {
   var i uint64 =
     ' ' +
@@ -33,10 +35,10 @@ func main() {
   ;
   if '\Ucafebabe' != 0xcafebabe {
        print("cafebabe wrong\n");
-       sys.Exit(1)
+       os.Exit(1)
   }
   if i != 0xcc238de1 {
        print("number is ", i, " should be ", 0xcc238de1, "\n");
-       sys.Exit(1)
+       os.Exit(1)
   }
 }
index 41f230d1aa1cec0138e6c8063e085c0206d168b0..88cec4546b83b2b99d29a3521aa7bddd0fda1a1c 100644 (file)
@@ -12,15 +12,15 @@ func main() {
        ga, e0 := os.Getenv("GOARCH");
        if e0 != nil {
                print("$GOARCH: ", e0.String(), "\n");
-               sys.Exit(1);
+               os.Exit(1);
        }
        if ga != "amd64" {
                print("$GOARCH=", ga, "\n");
-               sys.Exit(1);
+               os.Exit(1);
        }
        xxx, e1 := os.Getenv("DOES_NOT_EXIST");
        if e1 != os.ENOENV {
                print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n");
-               sys.Exit(1);
+               os.Exit(1);
        }
 }
index 2fbde9c9a7079f2fe1ca4855a594c3ea14f8d081..e7694f95b564d07add36fce1243ec866351012e8 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 const (
        x float = iota;
        g float = 4.5 * iota;
@@ -13,5 +15,5 @@ const (
 
 func main() {
        if g == 0.0 { print("zero\n");}
-       if g != 4.5 { print(" fail\n"); sys.Exit(1); }
+       if g != 4.5 { print(" fail\n"); os.Exit(1); }
 }
index 44f60fedbcb2a0fbc927aaebb01983416dd4cba6..b190d4f26d5788ebeb5b61c728c8683b62c8615f 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 func P(a []string) string {
        s := "{";
        for i := 0; i < 2; i++ {
@@ -29,6 +31,6 @@ func main() {
        a[0] = "x";
        m["0"][0] = "deleted";
        if m["0"][0] != "deleted" {
-               sys.Exit(1);
+               os.Exit(1);
        }
 }
index 5d5fc4a7bae0e08679b489b5832b72117a796a19..82778b8386f3418d22f6f023c7afea35da20c1de 100644 (file)
@@ -6,12 +6,14 @@
 
 package main
 
+import "os"
+
 func main() {
        m := make(map[int]int);
        m[0] = 0;
        m[0]++;
        if m[0] != 1 {
                print("map does not increment\n");
-               sys.Exit(1)
+               os.Exit(1)
        }
 }
index 10e28034dca052bbc5832c92db029dcbf9bd917d..06a07e80543758b1a4df5a66485ace0124cb92dc 100644 (file)
@@ -6,6 +6,7 @@
 
 package main
 
+import "os"
 import "strconv";
 
 type Test struct {
@@ -53,6 +54,6 @@ func main() {
                }
        }
        if !ok {
-               sys.Exit(1);
+               os.Exit(1);
        }
 }
index aa3f0dd70e2c9d4f479e0351095200f14223c024..3d13cb8ab1c2c6402f60b4e36f71cfd4e4b57407 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 type I interface { send(chan <- int) }
 
 type S struct { v int }
@@ -16,5 +18,5 @@ func main() {
   var i I = &s;
   c := make(chan int);
   go i.send(c);
-  sys.Exit(<-c);
+  os.Exit(<-c);
 }
index a2fd992c0329c047299c284cd587cee4a995d842..756ba308d9c3e20411ed7a208a6f938d17503bb1 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 type S struct { i int }
 func (p *S) Get() int { return p.i }
 
@@ -18,7 +20,7 @@ type Getter interface {
 
 func f1(p Empty) {
        switch x := p.(type) {
-       default: println("failed to match interface"); sys.Exit(1);
+       default: println("failed to match interface"); os.Exit(1);
        case Getter: break;
        }
 
index 1784d82395f91085c8607495ec8e3a54bec36d6b..3f3ef1597ecc3eb590de3e9c6fe4bff26966eee0 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 func main() {
        count := 7;
        if one := 1; {
@@ -13,6 +15,6 @@ func main() {
        }
        if count != 8 {
                print(count, " should be 8\n");
-               sys.Exit(1)
+               os.Exit(1)
        }
 }
index 4121070f340e33600c11ff507b6e3925d1bf591e..1f4d318afed0b1fbae63ae32afad211f2a6dbb9c 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 func main() {
   s :=
     0 +
@@ -18,6 +20,6 @@ func main() {
     0X123;
   if s != 788 {
     print("s is ", s, "; should be 788\n");
-    sys.Exit(1);
+    os.Exit(1);
   }
 }
index 6afd42a2f48bff3b3acaf651375f9306ae39d156..f84da58ed1bb120660d692f53e4019d46db7ab48 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 const Value = 1e12
 
 type Inter interface { M() int64 }
@@ -73,6 +75,6 @@ func main() {
 
        if !ok {
                println("BUG: interface10");
-               sys.Exit(1)
+               os.Exit(1)
        }
 }
index 68c5efafb3670b30c06773454a0d3a8686932cc5..b871309379eab7c17a6cbd2d1ede4e5b17174e82 100644 (file)
@@ -9,6 +9,8 @@
 
 package main
 
+import "os"
+
 type I interface { M() int64 }
 
 type BigPtr struct { a, b, c, d int64 }
@@ -70,6 +72,6 @@ func main() {
        nonptrs();
 
        if bad {
-               sys.Exit(1)
+               os.Exit(1)
        }
 }
index 8bfcdf0fc0873b0d44b014ba0f3623cdbce3beb2..c675595fd8cf68919114801e11b352666126c0af 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 var fail int
 
 func check(b bool, msg string) {
@@ -145,6 +147,6 @@ func main() {
   f11();
   f12();
   if fail > 0 {
-    sys.Exit(1)
+    os.Exit(1)
   }
 }
index e06d9ab40a6a3fda33af39d03bc1929b669eb144..d56d77ade2fa0997888935444b3bcc7397c032f0 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+import "runtime"
 
 var    randx   int;
 
@@ -88,7 +90,7 @@ send(c *Chan)
        nproc++;        // total goroutines running
        for {
                for r:=nrand(10); r>=0; r-- {
-                       sys.Gosched();
+                       runtime.Gosched();
                }
                c.sc <- c.sv;
                if c.send() {
@@ -119,7 +121,7 @@ recv(c *Chan)
        nproc++;        // total goroutines running
        for {
                for r:=nrand(10); r>=0; r-- {
-                       sys.Gosched();
+                       runtime.Gosched();
                }
                v = <-c.rc;
                if c.recv(v) {
@@ -148,7 +150,7 @@ sel(r0,r1,r2,r3, s0,s1,s2,s3 *Chan)
 
        for {
                for r:=nrand(5); r>=0; r-- {
-                       sys.Gosched();
+                       runtime.Gosched();
                }
 
                select {
@@ -270,9 +272,9 @@ test6(c int)
 func
 wait()
 {
-       sys.Gosched();
+       runtime.Gosched();
        for nproc != 0 {
-               sys.Gosched();
+               runtime.Gosched();
        }
 }
 
@@ -321,7 +323,7 @@ main()
 
        if tots != t || totr != t {
                print("tots=", tots, " totr=", totr, " sb=", t, "\n");
-               sys.Exit(1);
+               os.Exit(1);
        }
-       sys.Exit(0);
+       os.Exit(0);
 }
index c6d7825b77f3c9c2068ce829906f4ecb11259798..5a59de1c0e4240dc4ab2936e4b76af756b368798 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "runtime"
+
 const  N       = 1000;         // sent messages
 const  M       = 10;           // receiving goroutines
 const  W       = 2;            // channel buffering
@@ -48,9 +50,9 @@ main()
        c := make(chan int, W);
        for m:=0; m<M; m++ {
                go r(c, m);
-               sys.Gosched();
+               runtime.Gosched();
        }
-       sys.Gosched();
-       sys.Gosched();
+       runtime.Gosched();
+       runtime.Gosched();
        s(c);
 }
index 5842eaa29062a4a6976a4d2ec7435afa11ff71f4..18f539dce605852a2b231e9918c876736a5d2491 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 var ecode int;
 
 func assert(a, b, c string) {
@@ -84,5 +86,5 @@ func main() {
        r = 0x10ffff + 1;
        s = string(r);
        assert(s, "\xef\xbf\xbd", "too-large rune");
-       sys.Exit(ecode);
+       os.Exit(ecode);
 }
index 4d581d70f2eaebeba78d9408370f800426f78024..32ed1e5f02308cc9a80879cbbad53ae8ed4d0173 100644 (file)
@@ -8,6 +8,7 @@ package main
 
 import(
         "fmt";
+        "os";
         "utf8";
 )
 
@@ -56,6 +57,6 @@ func main() {
 
        if !ok {
                fmt.Println("BUG: stringrange");
-               sys.Exit(1)
+               os.Exit(1)
        }
 }
index fac9ac8ec635433fa18c541ff2f55917f5ab5713..9e61cc65858e4ea4cf7789bdb804699782bdf35f 100644 (file)
@@ -6,13 +6,15 @@
 
 package main
 
+import "os"
+
 func main() {
        i := 0;
        switch x := 5; {
                case i < x:
-                       sys.Exit(0);
+                       os.Exit(0);
                case i == x:
                case i > x:
-                       sys.Exit(1);
+                       os.Exit(1);
        }
 }
index 5ad694d868d56bf3be958396b5eb89b47670cb8f..0a421ae96fbdb69226ffe43772ccd30ece49fc7d 100644 (file)
@@ -6,6 +6,8 @@
 
 package main
 
+import "os"
+
 const (
        Bool = iota;
        Int;
@@ -31,7 +33,7 @@ var m = make(map[string]int)
 func assert(b bool, s string) {
        if !b {
                println(s);
-               sys.Exit(1);
+               os.Exit(1);
        }
 }
 
index f79749f2b30d372ede3fe744b277503a52717fd4..90984170c62a3bd898169a45a3aae3264e07a16b 100644 (file)
@@ -641,7 +641,7 @@ func findPackages(name string) *pakInfo {
                                return info;
                        }
                }
-               
+
                info.Packages = paks;
                if cname == "." {
                        info.Path = "";
@@ -704,7 +704,7 @@ func usage() {
                "       godoc -http=:6060\n"
        );
        flag.PrintDefaults();
-       sys.Exit(1);
+       os.Exit(1);
 }
 
 
@@ -761,7 +761,7 @@ func main() {
                if err != nil {
                        log.Stderrf("packagelistText.Execute: %s", err);
                }
-               sys.Exit(1);
+               os.Exit(1);
        }
 
        doc, errors := info.Package.Doc();
@@ -770,7 +770,7 @@ func main() {
                if err != nil {
                        log.Stderrf("parseerrorText.Execute: %s", err);
                }
-               sys.Exit(1);
+               os.Exit(1);
        }
 
        if flag.NArg() > 1 {
index 5a27d40207a34e2ad6d66f8777751a8218e55847..dce3a286bf6cde19027fde2fbf47938a1a32bdcc 100644 (file)
@@ -41,7 +41,7 @@ func init() {
 func usage() {
        fmt.Fprintf(os.Stderr, "usage: pretty { flags } { files }\n");
        flag.PrintDefaults();
-       sys.Exit(1);
+       os.Exit(1);
 }
 
 
@@ -127,12 +127,12 @@ func main() {
        src, err := readFile(ast_txt);
        if err != nil {
                fmt.Fprintf(os.Stderr, "%s: %v\n", ast_txt, err);
-               sys.Exit(1);
+               os.Exit(1);
        }
        ast_format, err := format.Parse(src, format.FormatterMap{"isValidPos": isValidPos, "isSend": isSend, "isRecv": isRecv});
        if err != nil {
                fmt.Fprintf(os.Stderr, "%s: format errors:\n%s", ast_txt, err);
-               sys.Exit(1);
+               os.Exit(1);
        }
 
        // process files
@@ -150,7 +150,7 @@ func main() {
                prog, ok := parser.Parse(src, &ErrorHandler{filename, 0}, mode);
                if !ok {
                        exitcode = 1;
-                       continue;  // proceed with next file                    
+                       continue;  // proceed with next file
                }
 
                if !*silent {
@@ -165,6 +165,6 @@ func main() {
                        tw.Flush();
                }
        }
-       
-       sys.Exit(exitcode);
+
+       os.Exit(exitcode);
 }
index 026e5b2dd7829c7eaaed051f488e4b56c0bde46b..b18e08f8b7d6c6a1ab195f2f18ad8c77f3546605 100644 (file)
@@ -21,7 +21,7 @@ var (
 
 func error(format string, params ...) {
        fmt.Printf(format, params);
-       sys.Exit(1);
+       os.Exit(1);
 }