Anthony Martin avatar Anthony Martin committed 2cde7ed

misc/plan9: fix last patch update

Comments (0)

Files changed (3)

misc/plan9/patches/cl-5608059.diff

-diff -r fae148fab2a7 src/all.rc
+diff -r 14c38c23c819 src/all.rc
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/src/all.rc	Tue Feb 07 04:11:24 2012 -0800
++++ b/src/all.rc	Thu Apr 12 06:23:49 2012 -0700
 @@ -0,0 +1,13 @@
 +#!/bin/rc -e
 +# Copyright 2012 The Go Authors. All rights reserved.
 +
 +. ./make.rc --no-banner
 +./run.rc --no-rebuild
-+../bin/tool/dist banner # print build info
-diff -r fae148fab2a7 src/cmd/dist/a.h
---- a/src/cmd/dist/a.h	Tue Feb 07 17:50:04 2012 +1100
-+++ b/src/cmd/dist/a.h	Tue Feb 07 04:11:24 2012 -0800
++$GOTOOLDIR/dist banner  # print build info
+diff -r 14c38c23c819 src/clean.rc
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/src/clean.rc	Thu Apr 12 06:23:49 2012 -0700
+@@ -0,0 +1,14 @@
++#!/bin/rc -e
++# Copyright 2012 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.
++
++eval `{go tool dist env -9}
++
++if(! test -x $GOTOOLDIR/dist){
++	echo 'cannot find $GOTOOLDIR/dist; nothing to clean' >[1=2]
++	exit noclean
++}
++
++$GOBIN/go clean -i std
++$GOTOOLDIR/dist clean
+diff -r 14c38c23c819 src/cmd/dist/a.h
+--- a/src/cmd/dist/a.h	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/cmd/dist/a.h	Thu Apr 12 06:23:49 2012 -0700
 @@ -10,7 +10,9 @@
  
  #define nil ((void*)0)
  
  // A Buf is a byte buffer, like Go's []byte.
  typedef struct Buf Buf;
-@@ -73,6 +75,7 @@
- extern char *goversion;
- extern char *workdir;
- extern char *slash;
-+extern char *hostchar;
- 
- int	find(char*, char**, int);
- void	init(void);
-diff -r fae148fab2a7 src/cmd/dist/arg.h
---- a/src/cmd/dist/arg.h	Tue Feb 07 17:50:04 2012 +1100
-+++ b/src/cmd/dist/arg.h	Tue Feb 07 04:11:24 2012 -0800
+diff -r 14c38c23c819 src/cmd/dist/arg.h
+--- a/src/cmd/dist/arg.h	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/cmd/dist/arg.h	Thu Apr 12 06:23:49 2012 -0700
 @@ -28,7 +28,7 @@
  
  /* command line */
  				while((_argc = *_args++) != 0)\
  				switch(_argc)
  #define	ARGEND		_argt=0;USED(_argt);USED(_argc);USED(_args);}USED(argv);USED(argc);
-diff -r fae148fab2a7 src/cmd/dist/buildgc.c
---- a/src/cmd/dist/buildgc.c	Tue Feb 07 17:50:04 2012 +1100
-+++ b/src/cmd/dist/buildgc.c	Tue Feb 07 04:11:24 2012 -0800
+diff -r 14c38c23c819 src/cmd/dist/build.c
+--- a/src/cmd/dist/build.c	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/cmd/dist/build.c	Thu Apr 12 06:23:49 2012 -0700
+@@ -539,7 +539,7 @@
+ 	Buf b, b1, path;
+ 	Vec compile, files, link, go, missing, clean, lib, extra;
+ 	Time ttarg, t;
+-	int i, j, k, n, doclean, targ;
++	int i, j, k, n, doclean, targ, usecpp;
+ 
+ 	if(vflag) {
+ 		if(!streq(goos, gohostos) || !streq(goarch, gohostarch))
+@@ -560,6 +560,7 @@
+ 	vinit(&lib);
+ 	vinit(&extra);
+ 
++
+ 	// path = full path to dir.
+ 	bpathf(&path, "%s/src/%s", goroot, dir);
+ 	name = lastelem(dir);
+@@ -605,7 +606,10 @@
+ 	if(islib) {
+ 		// C library.
+ 		vadd(&link, "ar");
+-		vadd(&link, "rsc");
++		if(streq(gohostos, "plan9"))
++			vadd(&link, "rc");
++		else
++			vadd(&link, "rsc");
+ 		prefix = "";
+ 		if(!hasprefix(name, "lib"))
+ 			prefix = "lib";
+@@ -631,14 +635,21 @@
+ 		vadd(&link, bpathf(&b, "%s/%s%s", tooldir, elem, exe));
+ 	} else {
+ 		// C command. Use gccargs.
+-		vcopy(&link, gccargs.p, gccargs.len);
+-		vadd(&link, "-o");
+-		targ = link.len;
+-		vadd(&link, bpathf(&b, "%s/%s%s", tooldir, name, exe));
+-		if(streq(gohostarch, "amd64"))
+-			vadd(&link, "-m64");
+-		else if(streq(gohostarch, "386"))
+-			vadd(&link, "-m32");
++		if(streq(gohostos, "plan9")) {
++			vadd(&link, bprintf(&b, "%sl", gohostchar));
++			vadd(&link, "-o");
++			targ = link.len;
++			vadd(&link, bpathf(&b, "%s/%s", tooldir, name));
++		} else {
++			vcopy(&link, gccargs.p, gccargs.len);
++			vadd(&link, "-o");
++			targ = link.len;
++			vadd(&link, bpathf(&b, "%s/%s%s", tooldir, name, exe));
++			if(streq(gohostarch, "amd64"))
++				vadd(&link, "-m64");
++			else if(streq(gohostarch, "386"))
++				vadd(&link, "-m32");
++		}
+ 	}
+ 	ttarg = mtime(link.p[targ]);
+ 
+@@ -672,6 +683,8 @@
+ 				bsubst(&b1, "$GOARCH", goarch);
+ 				p = bstr(&b1);
+ 				if(hassuffix(p, ".a")) {
++					if(streq(gohostos, "plan9") && hassuffix(p, "libbio.a"))
++						continue;
+ 					vadd(&lib, bpathf(&b, "%s", p));
+ 					continue;
+ 				}
+@@ -741,6 +754,10 @@
+ 	}
+ 	files.len = n;
+ 
++	// If there are no files to compile, we're done.
++	if(files.len == 0)
++		goto out;
++	
+ 	for(i=0; i<lib.len && !stale; i++)
+ 		if(mtime(lib.p[i]) > ttarg)
+ 			stale = 1;
+@@ -799,10 +816,10 @@
+ 			p = files.p[i];
+ 			if(!hassuffix(p, ".goc"))
+ 				continue;
+-			// b = path/zp but with _goarch.c instead of .goc
++			// b = path/zp but with _goos_goarch.c instead of .goc
+ 			bprintf(&b, "%s%sz%s", bstr(&path), slash, lastelem(p));
+ 			b.len -= 4;
+-			bwritef(&b, "_%s.c", goarch);
++			bwritef(&b, "_%s_%s.c", goos, goarch);
+ 			goc2c(p, bstr(&b));
+ 			vadd(&files, bstr(&b));
+ 		}
+@@ -816,6 +833,20 @@
+ 		goto nobuild;
+ 	}
+ 
++	// The files generated by GNU Bison use macros that aren't
++	// supported by the Plan 9 compilers so we have to use the
++	// external preprocessor when compiling.
++	usecpp = 0;
++	if(streq(gohostos, "plan9")) {
++		for(i=0; i<files.len; i++) {
++			p = files.p[i];
++			if(hassuffix(p, "y.tab.c") || hassuffix(p, "y.tab.h")){
++				usecpp = 1;
++				break;
++			}
++		}
++	}
++
+ 	// Compile the files.
+ 	for(i=0; i<files.len; i++) {
+ 		if(!hassuffix(files.p[i], ".c") && !hassuffix(files.p[i], ".s"))
+@@ -825,17 +856,26 @@
+ 		vreset(&compile);
+ 		if(!isgo) {
+ 			// C library or tool.
+-			vcopy(&compile, gccargs.p, gccargs.len);
+-			vadd(&compile, "-c");
+-			if(streq(gohostarch, "amd64"))
+-				vadd(&compile, "-m64");
+-			else if(streq(gohostarch, "386"))
+-				vadd(&compile, "-m32");
+-			if(streq(dir, "lib9"))
+-				vadd(&compile, "-DPLAN9PORT");
+-
+-			vadd(&compile, "-I");
+-			vadd(&compile, bpathf(&b, "%s/include", goroot));
++			if(streq(gohostos, "plan9")) {
++				vadd(&compile, bprintf(&b, "%sc", gohostchar));
++				vadd(&compile, "-FTVw");
++				if(usecpp)
++					vadd(&compile, "-Bp+");
++				vadd(&compile, bpathf(&b, "-I%s/include/plan9", goroot));
++				vadd(&compile, bpathf(&b, "-I%s/include/plan9/%s", goroot, gohostarch));
++			} else {
++				vcopy(&compile, gccargs.p, gccargs.len);
++				vadd(&compile, "-c");
++				if(streq(gohostarch, "amd64"))
++					vadd(&compile, "-m64");
++				else if(streq(gohostarch, "386"))
++					vadd(&compile, "-m32");
++				if(streq(dir, "lib9"))
++					vadd(&compile, "-DPLAN9PORT");
++	
++				vadd(&compile, "-I");
++				vadd(&compile, bpathf(&b, "%s/include", goroot));
++			}
+ 
+ 			vadd(&compile, "-I");
+ 			vadd(&compile, bstr(&path));
+@@ -882,7 +922,11 @@
+ 			doclean = 0;
+ 		}
+ 
+-		b.p[b.len-1] = 'o';  // was c or s
++		// Change the last character of the output file (which was c or s).
++		if(streq(gohostos, "plan9"))
++			b.p[b.len-1] = gohostchar[0];
++		else
++			b.p[b.len-1] = 'o';
+ 		vadd(&compile, "-o");
+ 		vadd(&compile, bstr(&b));
+ 		vadd(&compile, files.p[i]);
+@@ -923,7 +967,8 @@
+ 	if(!islib && !isgo) {
+ 		// C binaries need the libraries explicitly, and -lm.
+ 		vcopy(&link, lib.p, lib.len);
+-		vadd(&link, "-lm");
++		if(!streq(gohostos, "plan9"))
++			vadd(&link, "-lm");
+ 	}
+ 
+ 	// Remove target before writing it.
+@@ -981,6 +1026,16 @@
+ 	Buf b;
+ 	Vec lines, fields;
+ 
++	// On Plan 9, most of the libraries are already present.
++	// The main exception is libmach which has been modified
++	// in various places to support Go object files.
++	if(streq(gohostos, "plan9")) {
++		if(streq(dir, "lib9") && !hassuffix(file, "lib9/goos.c"))
++			return 0;
++		if(streq(dir, "libbio"))
++			return 0;
++	}
++	
+ 	// Check file name for GOOS or GOARCH.
+ 	name = lastelem(file);
+ 	for(i=0; i<nelem(okgoos); i++)
+@@ -1285,6 +1340,9 @@
+ 	format = "%s=\"%s\"\n";
+ 	pflag = 0;
+ 	ARGBEGIN{
++	case '9':
++		format = "%s='%s'\n";
++		break;
+ 	case 'p':
+ 		pflag = 1;
+ 		break;
+diff -r 14c38c23c819 src/cmd/dist/buildgc.c
+--- a/src/cmd/dist/buildgc.c	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/cmd/dist/buildgc.c	Thu Apr 12 06:23:49 2012 -0700
 @@ -3,7 +3,6 @@
  // license that can be found in the LICENSE file.
  
  
  /*
   * Helpers for building cmd/gc.
-diff -r fae148fab2a7 src/cmd/dist/buildruntime.c
---- a/src/cmd/dist/buildruntime.c	Tue Feb 07 17:50:04 2012 +1100
-+++ b/src/cmd/dist/buildruntime.c	Tue Feb 07 04:11:24 2012 -0800
+diff -r 14c38c23c819 src/cmd/dist/buildruntime.c
+--- a/src/cmd/dist/buildruntime.c	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/cmd/dist/buildruntime.c	Thu Apr 12 06:23:49 2012 -0700
 @@ -3,7 +3,6 @@
  // license that can be found in the LICENSE file.
  
  	
  	binit(&b);
  	binit(&out);
-diff -r fae148fab2a7 src/cmd/dist/goc2c.c
---- a/src/cmd/dist/goc2c.c	Tue Feb 07 17:50:04 2012 +1100
-+++ b/src/cmd/dist/goc2c.c	Tue Feb 07 04:11:24 2012 -0800
+diff -r 14c38c23c819 src/cmd/dist/goc2c.c
+--- a/src/cmd/dist/goc2c.c	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/cmd/dist/goc2c.c	Thu Apr 12 06:23:49 2012 -0700
 @@ -111,7 +111,7 @@
  	{"int64",	8},
  	{"uint64",	8},
  	else if (rets->next == nil)
  		bwritef(output, "return %s;\n", rets->name);
  	else {
-diff -r fae148fab2a7 src/cmd/dist/plan9.c
+diff -r 14c38c23c819 src/cmd/dist/plan9.c
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/src/cmd/dist/plan9.c	Tue Feb 07 04:11:24 2012 -0800
-@@ -0,0 +1,732 @@
++++ b/src/cmd/dist/plan9.c	Thu Apr 12 06:23:49 2012 -0700
+@@ -0,0 +1,734 @@
 +// Copyright 2012 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.
 +	int pid;
 +	int mode;
 +	char *cmd;
++	Buf *b;
 +} bg[MAXBG];
 +static int nbg;
++static int maxnbg = nelem(bg);
 +
 +static void bgwait1(void);
 +
 +	Buf b1, cmd;
 +	char *q;
 +
-+	while(nbg >= nelem(bg))
++	while(nbg >= maxnbg)
 +		bgwait1();
 +
 +	binit(&b1);
 +	bg[nbg].pid = pid;
 +	bg[nbg].mode = mode;
 +	bg[nbg].cmd = btake(&cmd);
++	bg[nbg].b = b;
 +	nbg++;
 +	
 +	if(wait)
 +	Waitmsg *w;
 +	int i, mode;
 +	char *cmd;
++	Buf *b;
 +
 +	w = wait();
 +	if(w == nil)
 +	cmd = bg[i].cmd;
 +	mode = bg[i].mode;
 +	bg[i].pid = 0;
++	b = bg[i].b;
++	bg[i].b = nil;
 +	bg[i] = bg[--nbg];
 +	
-+	if(mode == CheckExit && w->msg[0])
++	if(mode == CheckExit && w->msg[0]) {
++		if(b != nil)
++			xprintf("%s\n", bstr(b));
 +		fatal("FAILED: %s", cmd);
++	}
 +	xfree(cmd);
 +}
 +
 +readfile(Buf *b, char *file)
 +{
 +	int fd;
-+	
++
 +	breset(b);
 +	fd = open(file, OREAD);
 +	if(fd < 0)
 +
 +// writefile writes b to the named file, creating it if needed.
 +void
-+writefile(Buf *b, char *file)
++writefile(Buf *b, char *file, int exec)
 +{
 +	int fd;
++	Dir d;
 +	
 +	fd = create(file, ORDWR, 0666);
 +	if(fd < 0)
 +		fatal("create %s", file);
 +	if(write(fd, b->p, b->len) != b->len)
 +		fatal("short write");
++	if(exec) {
++		nulldir(&d);
++		d.mode = 0755;
++		dirfwstat(fd, &d);
++	}
 +	close(fd);
 +}
-+	
++
 +// xmkdir creates the directory p.
 +void
 +xmkdir(char *p)
 +void
 +xremove(char *p)
 +{
-+	if(vflag > 1)
++	if(vflag > 2)
 +		xprintf("rm %s\n", p);
 +	remove(p);
 +}
 +			xremoveall(bstr(&b));
 +		}
 +	}
-+	if(vflag > 1)
++	if(vflag > 2)
 +		xprintf("rm %s\n", p);
 +	remove(p);
 +	
 +	
 +	rerrstr(buf, sizeof buf);
 +
++	fflush(stdout);
 +	fprintf(stderr, "go tool dist: ");
 +	va_start(arg, msg);
 +	vfprintf(stderr, msg, arg);
 +	if(buf[0])
 +		fprintf(stderr, ": %s", buf);
 +	fprintf(stderr, "\n");
++
++	bgwait();
 +	exits(msg);
 +}
 +
 +	va_list arg;
 +	
 +	va_start(arg, fmt);
-+	vfprintf(stdout, fmt, arg);
++	vprintf(fmt, arg);
 +	va_end(arg);
 +}
 +
 +	putenv(name, value);
 +}
 +
-+// The known host architecture letters.
-+static char *hostchars = "01256789kqv";
-+
-+// The known host architectures.
-+static char *okhostarch[] = {
-+	// same order as hostchars
-+	"spim",
-+	"68000",
-+	"68020",
-+	"arm",
-+	"amd64",
-+	"alpha",
-+	"386",
-+	"power64",
-+	"sparc",
-+	"power",
-+	"mips",
-+};
-+
 +// main takes care of OS-specific startup and dispatches to xmain.
 +void
 +main(int argc, char **argv)
 +{
 +	Buf b;
-+	int i;
++
++	setvbuf(stdout, nil, _IOLBF, BUFSIZ);
++	setvbuf(stderr, nil, _IOLBF, BUFSIZ);
 +
 +	binit(&b);
 +
 +		fatal("$objtype is unset");
 +	gohostarch = btake(&b);
 +
-+	if((i=find(gohostarch, okhostarch, nelem(okhostarch))) < 0)
-+		fatal("unknown $objtype %s", gohostarch);
-+	bprintf(&b, "%c", hostchars[i]);
-+	hostchar = btake(&b);
++	xgetenv(&b, "GOBIN");
++	if(b.len == 0){
++		bpathf(&b, "/%s/bin", gohostarch);
++		xsetenv("GOBIN", bstr(&b));
++	}
 +
 +	srand(time(0)+getpid());
 +	init();
 +}
 +
 +#endif // PLAN9
-diff -r fae148fab2a7 src/make.rc
+diff -r 14c38c23c819 src/make.rc
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/src/make.rc	Tue Feb 07 04:11:24 2012 -0800
-@@ -0,0 +1,56 @@
++++ b/src/make.rc	Thu Apr 12 06:23:49 2012 -0700
+@@ -0,0 +1,91 @@
 +#!/bin/rc -e
 +# Copyright 2012 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.
 +
-+rfork en
++# Environment variables that control make.rc:
++#
++# GOROOT_FINAL: The expected final Go root, baked into binaries.
++# The default is the location of the Go tree during the build.
++#
++# GOHOSTARCH: The architecture for host tools (compilers and
++# binaries).  Binaries of this type must be executable on the current
++# system, so the only common reason to set this is to set
++# GOHOSTARCH=386 on an amd64 machine.
++#
++# GOARCH: The target architecture for installed packages and tools.
++#
++# GOOS: The target operating system for installed packages and tools.
++#
++# GO_GCFLAGS: Additional 5g/6g/8g arguments to use when
++# building the packages and commands.
++#
++# GO_LDFLAGS: Additional 5l/6l/8l arguments to use when
++# building the commands.
++#
++# CGO_ENABLED: Setting this to 0 disables the use of cgo
++# in the built and installed packages and tools.
 +
++rfork e
 +if(! test -f run.bash){
 +	echo 'make.rc must be run from $GOROOT/src' >[1=2]
 +	exit wrongdir
 +}
 +
-+switch($objtype){
-+case arm
-+	O = 5
-+case amd64
-+	O = 6
-+case 386
-+	O = 8
-+case *
-+	echo 'unknown $objtype:' $objtype >[1=2]
-+	exit objtype
++# Clean old generated file that will cause problems in the build.
++rm -rf ./pkg/runtime/runtime_defs.go
++
++# Determine the host compiler toolchain.
++eval `{grep '^(CC|LD|O)=' /$objtype/mkfile}
++
++echo '# Building C bootstrap tool.'
++echo cmd/dist
++GOROOT = `{cd .. && pwd}
++if(! ~ $#GOROOT_FINAL 1)
++	GOROOT_FINAL = $GOROOT
++DEFGOROOT='-DGOROOT_FINAL="'$GOROOT_FINAL'"'
++
++for(i in cmd/dist/*.c)
++	$CC -FTVwp+ -DPLAN9 $DEFGOROOT $i
++$LD -o cmd/dist/dist *.$O
++rm *.$O
++
++eval `{./cmd/dist/dist env -9}
++echo
++
++if(~ $1 --dist-tool){
++	# Stop after building dist tool.
++	mkdir -p $GOTOOLDIR
++	if(! ~ $2 '')
++		cp cmd/dist/dist $2
++	mv cmd/dist/dist $GOTOOLDIR/dist
++	exit
 +}
 +
-+# The go tool will be installed here.
-+if(! ~ $#GOBIN 1)
-+	GOBIN = /$objtype/bin
-+
-+echo '# Building C bootstrap tool.'
-+mkdir -p ../bin/tool
-+@{
-+	cd ../bin/tool
-+	for(i in ../../src/cmd/dist/*.c)
-+		$O^c -FTVwp+ -DPLAN9 -DDEFAULT_GOROOT'="'$GOROOT'"' $i
-+	$O^l -o dist *.$O
-+	rm -f *.$O
-+}
++echo '# Building compilers and Go bootstrap tool for host,' $GOHOSTOS/$GOHOSTARCH^.
++buildall = -a
++if(~ $1 --no-clean)
++	buildall = ()
++./cmd/dist/dist bootstrap $buildall -v # builds go_bootstrap
++# Delay move of dist tool to now, because bootstrap may clear tool directory.
++mv cmd/dist/dist $GOTOOLDIR/dist
++$GOTOOLDIR/go_bootstrap clean -i std
 +echo
 +
-+echo '# Building compilers and Go bootstrap tool.'
-+../bin/tool/dist bootstrap -v # builds go_bootstrap
-+echo
-+
-+if(~ $1 --dist-tool)
-+	exit # Stop after building dist tool.
-+
 +# TODO(ality): remove the -p flag once the exec/await/RFNOTEG race is fixed.
 +
-+echo '# Building packages and commands.'
-+../bin/tool/go_bootstrap clean std
-+../bin/tool/go_bootstrap install -a -v -p 1 std
-+rm -f ../bin/tool/go_bootstrap
++if(! ~ $GOHOSTARCH $GOARCH || ! ~ $GOHOSTOS $GOOS){
++	echo '# Building packages and commands for host,' $GOHOSTOS/$GOHOSTARCH^.
++	GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
++		$GOTOOLDIR/go_bootstrap install -gcflags $"GO_GCFLAGS -ldflags $"GO_LDFLAGS -v -p 1 std
++	echo
++}
++
++echo '# Building packages and commands for' $GOOS/$GOARCH^.
++$GOTOOLDIR/go_bootstrap install -gcflags $"GO_GCFLAGS -ldflags $"GO_LDFLAGS -v -p 1 std
 +echo
 +
++rm -f $GOTOOLDIR/go_bootstrap
++
 +if(! ~ $1 --no-banner)
-+	../bin/tool/dist banner
-diff -r fae148fab2a7 src/run.rc
++	$GOTOOLDIR/dist banner
+diff -r 14c38c23c819 src/run.rc
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/src/run.rc	Tue Feb 07 04:11:24 2012 -0800
-@@ -0,0 +1,33 @@
++++ b/src/run.rc	Thu Apr 12 06:23:49 2012 -0700
+@@ -0,0 +1,50 @@
 +#!/bin/rc -e
 +# Copyright 2012 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.
 +
-+if(! test -f make.rc){
-+	echo 'all.rc must be run from $GOROOT/src' >[1=2]
-+	exit wrongdir
-+}
++eval `{go env -9}
 +
++# allow all.rc to avoid double-build of everything
 +rebuild = true
 +if(~ $1 --no-rebuild)
 +	shift
 +}
 +
 +echo '# Testing packages.'
-+time go test std -short -timeout'='120s
++time go test std -short -timeout 120s
 +echo
 +
-+echo '# runtime -cpu=1,2,4'
-+go test runtime -short -timeout'='120s -cpu'='1,2,4
++echo '# GOMAXPROCS=2 runtime -cpu=1,2,4'
++GOMAXPROCS=2 go test runtime -short -timeout 120s -cpu 1,2,4
 +echo
 +
 +echo '# sync -cpu=10'
-+go test sync -short -timeout'='120s -cpu'='10
++go test sync -short -timeout 120s -cpu 10
 +echo
 +
++fn xcd {
++	echo
++	echo '#' $1
++	cd $"GOROOT/src/$1
++}
++
++echo
++echo '#' ../misc/dashboard/builder ../misc/goplay
++go build ../misc/dashboard/builder ../misc/gplay
++
++echo
++echo '#' ../test/bench/go1
++go test ../test/bench/go1
++
++@{
++	xcd ../test
++	time go run run.go
++}
++
 +echo
 +echo ALL TESTS PASSED

misc/plan9/patches/cl-6015046.desc

+Mailed: False
+Description:
+	syscall: remove the Signal type on Plan 9
+	
+	Instead use a new type, "Note", whose underlying
+	type is just a string.  This change allows us to
+	remove the exported os.Plan9Note type.
+Files:
+	src/pkg/os/exec.go
+	src/pkg/os/exec_plan9.go
+	src/pkg/os/exec_posix.go
+	src/pkg/syscall/syscall_plan9.go
+	src/pkg/syscall/zerrors_plan9_386.go

misc/plan9/patches/cl-6015046.diff

-Mailed: False
-Description:
-	syscall: remove the Signal type on Plan 9
-	
-	Instead use a new type, "Note", whose underlying
-	type is just a string.  This change allows us to
-	remove the exported os.Plan9Note type.
-Files:
-	src/pkg/os/exec.go
-	src/pkg/os/exec_plan9.go
-	src/pkg/os/exec_posix.go
-	src/pkg/syscall/syscall_plan9.go
-	src/pkg/syscall/zerrors_plan9_386.go
+diff -r 14c38c23c819 src/pkg/os/exec.go
+--- a/src/pkg/os/exec.go	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/pkg/os/exec.go	Thu Apr 12 06:23:50 2012 -0700
+@@ -49,19 +49,15 @@
+ // A Signal represents an operating system signal.
+ // The usual underlying implementation is operating system-dependent:
+ // on Unix it is syscall.Signal.
++//
++// The only signal values guaranteed to be present on all systems
++// are Interrupt (send the process an interrupt) and Kill (force
++// the process to exit).
+ type Signal interface {
+ 	String() string
+ 	Signal() // to distinguish from other Stringers
+ }
+ 
+-// The only signal values guaranteed to be present on all systems
+-// are Interrupt (send the process an interrupt) and
+-// Kill (force the process to exit).
+-var (
+-	Interrupt Signal = syscall.SIGINT
+-	Kill      Signal = syscall.SIGKILL
+-)
+-
+ // Getpid returns the process id of the caller.
+ func Getpid() int { return syscall.Getpid() }
+ 
+diff -r 14c38c23c819 src/pkg/os/exec_plan9.go
+--- a/src/pkg/os/exec_plan9.go	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/pkg/os/exec_plan9.go	Thu Apr 12 06:23:50 2012 -0700
+@@ -11,6 +11,11 @@
+ 	"time"
+ )
+ 
++var (
++	Interrupt = syscall.Note("interrupt")
++	Kill      = syscall.Note("kill")
++)
++
+ func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err error) {
+ 	sysattr := &syscall.ProcAttr{
+ 		Dir: attr.Dir,
+@@ -30,35 +35,35 @@
+ 	return newProcess(pid, h), nil
+ }
+ 
+-// Plan9Note implements the Signal interface on Plan 9.
+-type Plan9Note string
+-
+-func (note Plan9Note) String() string {
+-	return string(note)
++func (p *Process) writeProcFile(file string, data string) error {
++	f, e := OpenFile("/proc/"+itoa(p.Pid)+"/ctl", O_WRONLY, 0)
++	if e != nil {
++		return e
++	}
++	defer f.Close()
++	_, e = f.Write([]byte(data))
++	return e
+ }
+ 
+ func (p *Process) signal(sig Signal) error {
+ 	if p.done {
+ 		return errors.New("os: process already finished")
+ 	}
+-
+-	f, e := OpenFile("/proc/"+itoa(p.Pid)+"/note", O_WRONLY, 0)
+-	if e != nil {
++	if sig == Kill {
++		// Special-case the kill signal since it doesn't use /proc/$pid/note.
++		return p.Kill()
++	}
++	if e := p.writeProcFile("note", sig.String()); e != nil {
+ 		return NewSyscallError("signal", e)
+ 	}
+-	defer f.Close()
+-	_, e = f.Write([]byte(sig.String()))
+-	return e
++	return nil
+ }
+ 
+ func (p *Process) kill() error {
+-	f, e := OpenFile("/proc/"+itoa(p.Pid)+"/ctl", O_WRONLY, 0)
+-	if e != nil {
++	if e := p.writeProcFile("ctl", "kill"); e != nil {
+ 		return NewSyscallError("kill", e)
+ 	}
+-	defer f.Close()
+-	_, e = f.Write([]byte("kill"))
+-	return e
++	return nil
+ }
+ 
+ func (p *Process) wait() (ps *ProcessState, err error) {
+diff -r 14c38c23c819 src/pkg/os/exec_posix.go
+--- a/src/pkg/os/exec_posix.go	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/pkg/os/exec_posix.go	Thu Apr 12 06:23:50 2012 -0700
+@@ -10,6 +10,11 @@
+ 	"syscall"
+ )
+ 
++var (
++	Interrupt Signal = syscall.SIGINT
++	Kill      Signal = syscall.SIGKILL
++)
++
+ func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err error) {
+ 	// Double-check existence of the directory we want
+ 	// to chdir into.  We can make the error clearer this way.
+diff -r 14c38c23c819 src/pkg/syscall/syscall_plan9.go
+--- a/src/pkg/syscall/syscall_plan9.go	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/pkg/syscall/syscall_plan9.go	Thu Apr 12 06:23:50 2012 -0700
+@@ -23,6 +23,16 @@
+ // NewError converts s to an ErrorString, which satisfies the Error interface.
+ func NewError(s string) error { return ErrorString(s) }
+ 
++// A Note is a string describing a process signal.
++// It implements the os.Signal interface.
++type Note string
++
++func (n Note) Signal() {}
++
++func (n Note) String() string {
++	return string(n)
++}
++
+ var (
+ 	Stdin  = 0
+ 	Stdout = 1
+@@ -335,14 +345,6 @@
+ 	return make([]int, 0), nil
+ }
+ 
+-type Signal int
+-
+-func (s Signal) Signal() {}
+-
+-func (s Signal) String() string {
+-	return ""
+-}
+-
+ //sys	Dup(oldfd int, newfd int) (fd int, err error)
+ //sys	Open(path string, mode int) (fd int, err error)
+ //sys	Create(path string, mode int, perm uint32) (fd int, err error)
+diff -r 14c38c23c819 src/pkg/syscall/zerrors_plan9_386.go
+--- a/src/pkg/syscall/zerrors_plan9_386.go	Thu Apr 12 12:01:24 2012 +0400
++++ b/src/pkg/syscall/zerrors_plan9_386.go	Thu Apr 12 06:23:50 2012 -0700
+@@ -24,9 +24,6 @@
+ 	S_IFREG  = 0x8000
+ 	S_IFLNK  = 0xa000
+ 	S_IFSOCK = 0xc000
+-
+-	SIGINT  = Signal(0x2)
+-	SIGKILL = Signal(0x9)
+ )
+ 
+ // Errors
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.