Hi Ian,

>>> the patch broke Solaris bootstrap:
>>>
>>> /vol/gcc/src/hg/trunk/local/libgo/go/syscall/exec_unix.go:240:11: error: 
>>> reference to undefined name 'forkExecPipe'
>>>   if err = forkExecPipe(p[:]); err != nil {
>>>            ^
>>>
>>> libgo/go/syscall/forkpipe_bsd.go is needed on Solaris, too.
>>>
>>> /vol/gcc/src/hg/trunk/local/libgo/go/golang_org/x/net/lif/link.go:73:10: 
>>> error: use of undefined type 'lifnum'
>>>   lifn := lifnum{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | 
>>> sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
>>>           ^
>>> make[8]: *** [Makefile:3349: golang_org/x/net/lif.lo] Error 1
>>>
>>> The Go 1.9 upgrade patch has
>>>
>>> @@ -70,7 +70,7 @@ func Links(af int, name string) ([]Link,
>>>
>>>  func links(eps []endpoint, name string) ([]Link, error) {
>>>         var lls []Link
>>> -       lifn := sysLifnum{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | 
>>> sysLIFC_AL
>>> LZONES | sysLIFC_UNDER_IPMP}
>>> +       lifn := lifnum{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | 
>>> sysLIFC_ALLZO
>>> NES | sysLIFC_UNDER_IPMP}
>>>
>>> Reverting that allows link.go to compile.
>>>
>>> /vol/gcc/src/hg/trunk/local/libgo/go/internal/poll/fd_unix.go:366:21: 
>>> error: reference to undefined identifier 'syscall.ReadDirent'
>>>    n, err := syscall.ReadDirent(fd.Sysfd, buf)
>>>                      ^
>>>
>>> I don't yet see where this comes from on non-Linux systems...
>>
>> It's in forkpipe_bsd.go.  Does this patch fix the problem?
>
> that's true for forkExecPipe and I had this change in the patch I'd
> attached.  But what about syscall.ReadDirent?  I couldn't find that
> one...

I've had success with this patch on sparc-sun-solaris2.11 and
i386-pc-solaris2.11.

I've no idea what's behind upstream's src/syscall/syscall_solaris.go:

func ReadDirent(fd int, buf []byte) (n int, err error) {
        // Final argument is (basep *uintptr) and the syscall doesn't take nil.
        // TODO(rsc): Can we use a single global basep for all calls?
        return Getdents(fd, buf, new(uintptr))
}

I could find no hint that getdents(2) has an additional basep arg,
neither in OpenSolaris sources nor in Illumos, so I've ignored this
weirdness.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


# HG changeset patch
# Parent  7757f79801cbabf35852c59a0a056f48150cb0b6
Fix Solaris libgo build after Go 1.9 import

diff --git a/libgo/go/golang_org/x/net/lif/link.go b/libgo/go/golang_org/x/net/lif/link.go
--- a/libgo/go/golang_org/x/net/lif/link.go
+++ b/libgo/go/golang_org/x/net/lif/link.go
@@ -70,7 +70,7 @@ func Links(af int, name string) ([]Link,
 
 func links(eps []endpoint, name string) ([]Link, error) {
 	var lls []Link
-	lifn := lifnum{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
+	lifn := sysLifnum{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
 	lifc := lifconf{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
 	for _, ep := range eps {
 		lifn.Family = uint16(ep.af)
diff --git a/libgo/go/syscall/forkpipe_bsd.go b/libgo/go/syscall/forkpipe_bsd.go
--- a/libgo/go/syscall/forkpipe_bsd.go
+++ b/libgo/go/syscall/forkpipe_bsd.go
@@ -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 netbsd openbsd
+// +build darwin dragonfly netbsd openbsd solaris
 
 package syscall
 
diff --git a/libgo/go/syscall/libcall_solaris.go b/libgo/go/syscall/libcall_solaris.go
new file mode 100644
--- /dev/null
+++ b/libgo/go/syscall/libcall_solaris.go
@@ -0,0 +1,12 @@
+// Copyright 2017 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.
+
+package syscall
+
+//sys Getdents(fd int, buf []byte) (n int, err error)
+//getdents(fd _C_int, buf *byte, nbyte Size_t) _C_int
+
+func ReadDirent(fd int, buf []byte) (n int, err error) {
+	return Getdents(fd, buf)
+}

Reply via email to