]> Cypherpunks repositories - gostls13.git/commitdiff
lib9, libmach, cmd/dist, go/build: add support for GOOS=solaris
authorAram Hăvărneanu <aram@mgk.ro>
Tue, 7 Jan 2014 12:12:12 +0000 (23:12 +1100)
committerJoel Sing <jsing@google.com>
Tue, 7 Jan 2014 12:12:12 +0000 (23:12 +1100)
This change adds solaris to the list of supported operating
systems and allows cmd/dist to be built on Solaris.

This CL has to come first because we want the tools to ignore
solaris-specific files until the whole port is integrated.

R=golang-codereviews, jsing, rsc, minux.ma
CC=golang-codereviews
https://golang.org/cl/35900045

src/cmd/dist/build.c
src/cmd/dist/unix.c
src/lib9/run_unix.c
src/lib9/tempdir_unix.c
src/libmach/solaris.c [new file with mode: 0644]
src/pkg/go/build/deps_test.go
src/pkg/go/build/syslist.go

index 26d546af520e9e875de108d5fc4a18c2bb182d57..000f32403597745bc3404b7e3249807be876efc0 100644 (file)
@@ -52,6 +52,7 @@ static char *okgoos[] = {
        "darwin",
        "dragonfly",
        "linux",
+       "solaris",
        "freebsd",
        "netbsd",
        "openbsd",
index fa388e0587bec1a4e4026b5c93d6873edfaeb51c..8b943a2d9577a0eabf45c07dfe18b6b70e2cefa0 100644 (file)
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <setjmp.h>
+#include <signal.h>
 
 // bprintf replaces the buffer with the result of the printf formatting
 // and returns a pointer to the NUL-terminated buffer contents.
@@ -686,6 +687,14 @@ main(int argc, char **argv)
        gohostos = "openbsd";
 #elif defined(__NetBSD__)
        gohostos = "netbsd";
+#elif defined(__sun) && defined(__SVR4)
+       gohostos = "solaris";
+       // Even on 64-bit platform, solaris uname -m prints i86pc.
+       run(&b, nil, 0, "isainfo", "-n", nil);
+       if(contains(bstr(&b), "amd64"))
+               gohostarch = "amd64";
+       if(contains(bstr(&b), "i386"))
+               gohostarch = "386";
 #else
        fatal("unknown operating system");
 #endif
index 3db33c76ef8d04bf02546d817251c1b1c7aafe26..1acaefed87535f16b807ae4b2e0f8abd225610e6 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly freebsd linux netbsd openbsd
+// +build darwin dragonfly freebsd linux netbsd openbsd solaris
 
 #include <u.h>
 #include <errno.h>
index 3ce87751b2faed3a47c6c67ff5d612fa903df596..269d53823320d20424ad9d2a4f4fc09f423100e9 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin dragonfly freebsd linux netbsd openbsd
+// +build darwin dragonfly freebsd linux netbsd openbsd solaris
 
 #include <u.h>
 #include <dirent.h>
diff --git a/src/libmach/solaris.c b/src/libmach/solaris.c
new file mode 100644 (file)
index 0000000..ea49c2f
--- /dev/null
@@ -0,0 +1,56 @@
+// This is stubbed out for the moment. Will revisit when the time comes.
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+#include <mach.h>
+
+int
+ctlproc(int pid, char *msg)
+{
+       USED(pid);
+       USED(msg);
+       sysfatal("ctlproc unimplemented in Solaris");
+       return -1;
+}
+
+char*
+proctextfile(int pid)
+{
+       USED(pid);
+       sysfatal("proctextfile unimplemented in Solaris");
+       return nil;
+}
+
+char*
+procstatus(int pid)
+{
+       USED(pid);
+       sysfatal("procstatus unimplemented in Solaris");
+       return nil;
+}
+
+Map*
+attachproc(int pid, Fhdr *fp)
+{
+       USED(pid);
+       USED(fp);
+       sysfatal("attachproc unimplemented in Solaris");
+       return nil;
+}
+
+void
+detachproc(Map *m)
+{
+       USED(m);
+       sysfatal("detachproc unimplemented in Solaris");
+}
+
+int
+procthreadpids(int pid, int *p, int np)
+{
+       USED(pid);
+       USED(p);
+       USED(np);
+       sysfatal("procthreadpids unimplemented in Solaris");
+       return -1;
+}
index dd162c7db7ff11057ff9a7daa94a16ca4a4803eb..77b841fb1968c2ee2e5d4fc2cd5414c1106908b2 100644 (file)
@@ -359,7 +359,7 @@ func allowed(pkg string) map[string]bool {
 }
 
 var bools = []bool{false, true}
-var geese = []string{"darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "plan9", "windows"}
+var geese = []string{"darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "plan9", "solaris", "windows"}
 var goarches = []string{"386", "amd64", "arm"}
 
 type osPkg struct {
index e1fbf6330b19ae3c7f75057299788e11a4888fde..f4702d0dc401552d891b24e28db6fc40a82094ba 100644 (file)
@@ -4,5 +4,5 @@
 
 package build
 
-const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows "
+const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 solaris windows "
 const goarchList = "386 amd64 arm "