Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
0c3a93ce
Commit
0c3a93ce
authored
Mar 17, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: add GOROOT and Version
R=r CC=golang-dev
https://golang.org/cl/608041
parent
5e6203d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
2 deletions
+57
-2
.hgignore
.hgignore
+5
-1
Makefile
src/pkg/runtime/Makefile
+8
-1
extern.go
src/pkg/runtime/extern.go
+20
-0
mkversion.c
src/pkg/runtime/mkversion.c
+15
-0
runtime.c
src/pkg/runtime/runtime.c
+9
-0
No files found.
.hgignore
View file @
0c3a93ce
...
@@ -26,9 +26,13 @@ src/cmd/gc/yerr.h
...
@@ -26,9 +26,13 @@ src/cmd/gc/yerr.h
src/pkg/Make.deps
src/pkg/Make.deps
src/pkg/exp/ogle/ogle
src/pkg/exp/ogle/ogle
src/pkg/os/signal/unix.go
src/pkg/os/signal/unix.go
src/pkg/runtime/cgo2c
src/pkg/runtime/*/asm.h
src/pkg/runtime/*/asm.h
src/pkg/runtime/cgo2c
src/pkg/runtime/mkversion
src/pkg/runtime/runtime.acid.*
src/pkg/runtime/runtime.acid.*
src/pkg/runtime/version.go
src/pkg/github.com/
src/pkg/*.googlecode.com/
test/pass.out
test/pass.out
test/run.out
test/run.out
test/times.out
test/times.out
...
...
src/pkg/runtime/Makefile
View file @
0c3a93ce
...
@@ -23,6 +23,7 @@ CFLAGS=-I$(GOOS) -I$(GOOS)/$(GOARCH) -wF $(CFLAGS_$(SIZE)) $(CFLAGS_$(GOARCH)) $
...
@@ -23,6 +23,7 @@ CFLAGS=-I$(GOOS) -I$(GOOS)/$(GOARCH) -wF $(CFLAGS_$(SIZE)) $(CFLAGS_$(GOARCH)) $
GOFILES
=
\
GOFILES
=
\
extern.go
\
extern.go
\
type.go
\
type.go
\
version.go
\
GOFILES_pchw
=
\
GOFILES_pchw
=
\
pchw/io.go
\
pchw/io.go
\
...
@@ -111,7 +112,7 @@ $(pkgdir)/%.h: %.h
...
@@ -111,7 +112,7 @@ $(pkgdir)/%.h: %.h
clean
:
clean-local
clean
:
clean-local
clean-local
:
clean-local
:
rm
-f
cgo2c
*
/asm.h runtime.acid.
*
rm
-f
cgo2c
mkversion version.go
*
/asm.h runtime.acid.
*
$(GOARCH)/asm.h
:
mkasmh.sh runtime.acid.$(GOARCH)
$(GOARCH)/asm.h
:
mkasmh.sh runtime.acid.$(GOARCH)
./mkasmh.sh
>
$@
.x
./mkasmh.sh
>
$@
.x
...
@@ -120,6 +121,12 @@ $(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
...
@@ -120,6 +121,12 @@ $(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
cgo2c
:
cgo2c.c
cgo2c
:
cgo2c.c
$(QUOTED_GOBIN)
/quietgcc
-o
$@
$<
$(QUOTED_GOBIN)
/quietgcc
-o
$@
$<
mkversion
:
mkversion.c
$(QUOTED_GOBIN)
/quietgcc
-o
$@
-I
"
$(GOROOT)
/include"
$<
"
$(GOROOT)
/lib/lib9.a"
version.go
:
mkversion
mkversion
>
version.go
%.c
:
%.cgo cgo2c
%.c
:
%.cgo cgo2c
./cgo2c
$<
>
$@
.tmp
./cgo2c
$<
>
$@
.tmp
mv
-f
$@
.tmp
$@
mv
-f
$@
.tmp
$@
...
...
src/pkg/runtime/extern.go
View file @
0c3a93ce
...
@@ -150,3 +150,23 @@ func GC()
...
@@ -150,3 +150,23 @@ func GC()
// TODO(rsc): allow f to have (ignored) return values
// TODO(rsc): allow f to have (ignored) return values
//
//
func
SetFinalizer
(
x
,
f
interface
{})
func
SetFinalizer
(
x
,
f
interface
{})
func
getgoroot
()
string
// GOROOT returns the root of the Go tree.
// It uses the GOROOT environment variable, if set,
// or else the root used during the Go build.
func
GOROOT
()
string
{
s
:=
getgoroot
()
if
s
!=
""
{
return
s
}
return
defaultGoroot
}
// Version returns the Go tree's version string.
// It is either a sequence number or, when possible,
// a release tag like "release.2010-03-04".
// A trailing + indicates that the tree had local modifications
// at the time of the build.
func
Version
()
string
{
return
defaultVersion
}
src/pkg/runtime/mkversion.c
0 → 100644
View file @
0c3a93ce
#include <u.h>
#include <libc.h>
char
*
template
=
"// generated by mkversion.c; do not edit.
\n
"
"package runtime
\n
"
"const defaultGoroot =
\"
%s
\"\n
"
"const defaultVersion =
\"
%s
\"\n
"
;
void
main
(
void
)
{
print
(
template
,
getgoroot
(),
getgoversion
());
exits
(
0
);
}
src/pkg/runtime/runtime.c
View file @
0c3a93ce
...
@@ -206,6 +206,15 @@ getenv(int8 *s)
...
@@ -206,6 +206,15 @@ getenv(int8 *s)
return
nil
;
return
nil
;
}
}
void
·
getgoroot
(
String
out
)
{
byte
*
p
;
p
=
getenv
(
"GOROOT"
);
out
=
gostring
(
p
);
FLUSH
(
&
out
);
}
int32
int32
atoi
(
byte
*
p
)
atoi
(
byte
*
p
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment