1
0
mirror of https://github.com/golang/go synced 2024-11-23 21:30:08 -07:00

lib9, libmach, cmd/dist, go/build: add support for GOOS=solaris

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
This commit is contained in:
Aram Hăvărneanu 2014-01-07 23:12:12 +11:00 committed by Joel Sing
parent 8f9844348f
commit 901e7bfe53
7 changed files with 70 additions and 4 deletions

View File

@ -52,6 +52,7 @@ static char *okgoos[] = {
"darwin", "darwin",
"dragonfly", "dragonfly",
"linux", "linux",
"solaris",
"freebsd", "freebsd",
"netbsd", "netbsd",
"openbsd", "openbsd",

9
src/cmd/dist/unix.c vendored
View File

@ -24,6 +24,7 @@
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <setjmp.h> #include <setjmp.h>
#include <signal.h>
// bprintf replaces the buffer with the result of the printf formatting // bprintf replaces the buffer with the result of the printf formatting
// and returns a pointer to the NUL-terminated buffer contents. // and returns a pointer to the NUL-terminated buffer contents.
@ -686,6 +687,14 @@ main(int argc, char **argv)
gohostos = "openbsd"; gohostos = "openbsd";
#elif defined(__NetBSD__) #elif defined(__NetBSD__)
gohostos = "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 #else
fatal("unknown operating system"); fatal("unknown operating system");
#endif #endif

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // 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 <u.h>
#include <errno.h> #include <errno.h>

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // 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 <u.h>
#include <dirent.h> #include <dirent.h>

56
src/libmach/solaris.c Normal file
View File

@ -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;
}

View File

@ -359,7 +359,7 @@ func allowed(pkg string) map[string]bool {
} }
var bools = []bool{false, true} 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"} var goarches = []string{"386", "amd64", "arm"}
type osPkg struct { type osPkg struct {

View File

@ -4,5 +4,5 @@
package build 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 " const goarchList = "386 amd64 arm "