diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/5a/lex.c | 53 | ||||
-rw-r--r-- | src/cmd/6a/lex.c | 53 | ||||
-rw-r--r-- | src/cmd/8a/lex.c | 53 | ||||
-rw-r--r-- | src/cmd/cc/lex.c | 58 | ||||
-rwxr-xr-x | src/cmd/prof/gopprof | 9 |
5 files changed, 205 insertions, 21 deletions
diff --git a/src/cmd/5a/lex.c b/src/cmd/5a/lex.c index a04cda220..dbee3657f 100644 --- a/src/cmd/5a/lex.c +++ b/src/cmd/5a/lex.c @@ -50,7 +50,7 @@ void main(int argc, char *argv[]) { char *p; - int c; + int nout, nproc, i, c; thechar = '5'; thestring = "arm"; @@ -94,10 +94,46 @@ main(int argc, char *argv[]) print("usage: %ca [-options] file.s\n", thechar); errorexit(); } - if(argc > 1){ - print("can't assemble multiple files\n"); + if(argc > 1 && systemtype(Windows)){ + print("can't assemble multiple files on windows\n"); errorexit(); } + if(argc > 1 && !systemtype(Windows)) { + nproc = 1; + if(p = getenv("NPROC")) + nproc = atol(p); /* */ + c = 0; + nout = 0; + for(;;) { + Waitmsg *w; + + while(nout < nproc && argc > 0) { + i = fork(); + if(i < 0) { + fprint(2, "fork: %r\n"); + errorexit(); + } + if(i == 0) { + print("%s:\n", *argv); + if(assemble(*argv)) + errorexit(); + exits(0); + } + nout++; + argc--; + argv++; + } + w = wait(); + if(w == nil) { + if(c) + errorexit(); + exits(0); + } + if(w->msg[0]) + c++; + nout--; + } + } if(assemble(argv[0])) errorexit(); exits(0); @@ -106,7 +142,7 @@ main(int argc, char *argv[]) int assemble(char *file) { - char *ofile, *p; + char *ofile, incfile[20], *p; int i, of; ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) @@ -131,6 +167,15 @@ assemble(char *file) } else outfile = "/dev/null"; } + p = getenv("INCLUDE"); + if(p) { + setinclude(p); + } else { + if(systemtype(Plan9)) { + sprint(incfile,"/%s/include", thestring); + setinclude(strdup(incfile)); + } + } of = create(outfile, OWRITE, 0664); if(of < 0) { diff --git a/src/cmd/6a/lex.c b/src/cmd/6a/lex.c index b4c7d0c2c..37144c888 100644 --- a/src/cmd/6a/lex.c +++ b/src/cmd/6a/lex.c @@ -56,7 +56,7 @@ void main(int argc, char *argv[]) { char *p; - int c; + int nout, nproc, i, c; thechar = '6'; thestring = "amd64"; @@ -96,10 +96,46 @@ main(int argc, char *argv[]) print("usage: %ca [-options] file.s\n", thechar); errorexit(); } - if(argc > 1){ - print("can't assemble multiple files\n"); + if(argc > 1 && systemtype(Windows)){ + print("can't assemble multiple files on windows\n"); errorexit(); } + if(argc > 1 && !systemtype(Windows)) { + nproc = 1; + if(p = getenv("NPROC")) + nproc = atol(p); /* */ + c = 0; + nout = 0; + for(;;) { + Waitmsg *w; + + while(nout < nproc && argc > 0) { + i = fork(); + if(i < 0) { + fprint(2, "fork: %r\n"); + errorexit(); + } + if(i == 0) { + print("%s:\n", *argv); + if(assemble(*argv)) + errorexit(); + exits(0); + } + nout++; + argc--; + argv++; + } + w = wait(); + if(w == nil) { + if(c) + errorexit(); + exits(0); + } + if(w->msg[0]) + c++; + nout--; + } + } if(assemble(argv[0])) errorexit(); exits(0); @@ -108,7 +144,7 @@ main(int argc, char *argv[]) int assemble(char *file) { - char *ofile, *p; + char *ofile, incfile[20], *p; int i, of; ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) @@ -133,6 +169,15 @@ assemble(char *file) } else outfile = "/dev/null"; } + p = getenv("INCLUDE"); + if(p) { + setinclude(p); + } else { + if(systemtype(Plan9)) { + sprint(incfile,"/%s/include", thestring); + setinclude(strdup(incfile)); + } + } of = create(outfile, OWRITE, 0664); if(of < 0) { diff --git a/src/cmd/8a/lex.c b/src/cmd/8a/lex.c index 078861877..ca18b69ce 100644 --- a/src/cmd/8a/lex.c +++ b/src/cmd/8a/lex.c @@ -56,7 +56,7 @@ void main(int argc, char *argv[]) { char *p; - int c; + int nout, nproc, i, c; thechar = '8'; thestring = "386"; @@ -96,10 +96,46 @@ main(int argc, char *argv[]) print("usage: %ca [-options] file.s\n", thechar); errorexit(); } - if(argc > 1){ - print("can't assemble multiple files\n"); + if(argc > 1 && systemtype(Windows)){ + print("can't assemble multiple files on windows\n"); errorexit(); } + if(argc > 1 && !systemtype(Windows)) { + nproc = 1; + if(p = getenv("NPROC")) + nproc = atol(p); /* */ + c = 0; + nout = 0; + for(;;) { + Waitmsg *w; + + while(nout < nproc && argc > 0) { + i = fork(); + if(i < 0) { + fprint(2, "fork: %r\n"); + errorexit(); + } + if(i == 0) { + print("%s:\n", *argv); + if(assemble(*argv)) + errorexit(); + exits(0); + } + nout++; + argc--; + argv++; + } + w = wait(); + if(w == nil) { + if(c) + errorexit(); + exits(0); + } + if(w->msg[0]) + c++; + nout--; + } + } if(assemble(argv[0])) errorexit(); exits(0); @@ -108,7 +144,7 @@ main(int argc, char *argv[]) int assemble(char *file) { - char *ofile, *p; + char *ofile, incfile[20], *p; int i, of; ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar) @@ -133,6 +169,15 @@ assemble(char *file) } else outfile = "/dev/null"; } + p = getenv("INCLUDE"); + if(p) { + setinclude(p); + } else { + if(systemtype(Plan9)) { + sprint(incfile,"/%s/include", thestring); + setinclude(strdup(incfile)); + } + } of = create(outfile, OWRITE, 0664); if(of < 0) { diff --git a/src/cmd/cc/lex.c b/src/cmd/cc/lex.c index 71cc89bf0..dba8ff634 100644 --- a/src/cmd/cc/lex.c +++ b/src/cmd/cc/lex.c @@ -88,7 +88,7 @@ void main(int argc, char *argv[]) { char **defs, *p; - int c, ndef; + int nproc, nout, i, c, ndef; ensuresymb(NSYMB); memset(debug, 0, sizeof(debug)); @@ -142,10 +142,51 @@ main(int argc, char *argv[]) print("usage: %cc [-options] files\n", thechar); errorexit(); } - if(argc > 1){ - print("can't compile multiple files\n"); + if(argc > 1 && systemtype(Windows)){ + print("can't compile multiple files on windows\n"); errorexit(); } + if(argc > 1 && !systemtype(Windows)) { + nproc = 1; + /* + * if we're writing acid to standard output, don't compile + * concurrently, to avoid interleaving output. + */ + if(((!debug['a'] && !debug['q'] && !debug['Q']) || debug['n']) && + (p = getenv("NPROC")) != nil) + nproc = atol(p); /* */ + c = 0; + nout = 0; + for(;;) { + Waitmsg *w; + + while(nout < nproc && argc > 0) { + i = fork(); + if(i < 0) { + print("cannot create a process\n"); + errorexit(); + } + if(i == 0) { + fprint(2, "%s:\n", *argv); + if (compile(*argv, defs, ndef)) + errorexit(); + exits(0); + } + nout++; + argc--; + argv++; + } + w = wait(); + if(w == nil) { + if(c) + errorexit(); + exits(0); + } + if(w->msg[0]) + c++; + nout--; + } + } if(argc == 0) c = compile("stdin", defs, ndef); @@ -160,7 +201,7 @@ main(int argc, char *argv[]) int compile(char *file, char **defs, int ndef) { - char *ofile; + char *ofile, incfile[20]; char *p, **av, opt[256]; int i, c, fd[2]; static int first = 1; @@ -195,6 +236,15 @@ compile(char *file, char **defs, int ndef) outfile = "/dev/null"; } + if(p = getenv("INCLUDE")) { + setinclude(p); + } else { + if(systemtype(Plan9)) { + sprint(incfile, "/%s/include", thestring); + setinclude(strdup(incfile)); + setinclude("/sys/include"); + } + } if (first) Binit(&diagbuf, 1, OWRITE); /* diff --git a/src/cmd/prof/gopprof b/src/cmd/prof/gopprof index 8863fc623..8fa00cbe8 100755 --- a/src/cmd/prof/gopprof +++ b/src/cmd/prof/gopprof @@ -2880,18 +2880,17 @@ sub FetchSymbols { my @toask = @pcs; while (@toask > 0) { my $n = @toask; - # NOTE(rsc): Limiting the number of PCs requested per round - # used to be necessary, but I think it was a bug in - # debug/pprof/symbol's implementation. Leaving here - # in case I am wrong. - # if ($n > 49) { $n = 49; } + if ($n > 49) { $n = 49; } my @thisround = @toask[0..$n]; +my $t = @toask; +print STDERR "$n $t\n"; @toask = @toask[($n+1)..(@toask-1)]; my $post_data = join("+", sort((map {"0x" . "$_"} @thisround))); open(POSTFILE, ">$main::tmpfile_sym"); print POSTFILE $post_data; close(POSTFILE); +print STDERR "SYMBL!\n"; my $url = SymbolPageURL(); $url = ResolveRedirectionForCurl($url); my $command_line = "$CURL -sd '\@$main::tmpfile_sym' '$url'"; |