diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-01-18 03:37:52 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-01-18 03:37:52 +0000 |
commit | 49947b33ff2fc3982e6e5e0815d0daf3e46188eb (patch) | |
tree | 6eee4082ac9050dde854deba503306e29e078b66 | |
parent | 4cc0208ac8f44e826c983ec89c6ffbc4f4facc7a (diff) | |
download | gcc-49947b33ff2fc3982e6e5e0815d0daf3e46188eb.zip gcc-49947b33ff2fc3982e6e5e0815d0daf3e46188eb.tar.gz gcc-49947b33ff2fc3982e6e5e0815d0daf3e46188eb.tar.bz2 |
syscall, golang_org/x/net/lif: fixes for gccgo on Solaris
Reviewed-on: https://go-review.googlesource.com/35390
From-SVN: r244563
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/go/golang_org/x/net/lif/link.go | 2 | ||||
-rw-r--r-- | libgo/go/golang_org/x/net/lif/syscall.go | 19 | ||||
-rw-r--r-- | libgo/go/golang_org/x/net/lif/zsys_solaris.go (renamed from libgo/go/golang_org/x/net/lif/zsys_solaris_amd64.go) | 11 | ||||
-rw-r--r-- | libgo/go/syscall/syscall_solaris.go | 17 |
5 files changed, 26 insertions, 25 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 375ce17..f989752 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -223cba75b947afc1ee5a13a60c15c66f6ff355c1 +2b3d389f961b8461b3fdf42318a628f68b56f8b1 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/golang_org/x/net/lif/link.go b/libgo/go/golang_org/x/net/lif/link.go index 76fa6c6..6a77a8f 100644 --- a/libgo/go/golang_org/x/net/lif/link.go +++ b/libgo/go/golang_org/x/net/lif/link.go @@ -84,7 +84,7 @@ func links(eps []endpoint, name string) ([]Link, error) { b := make([]byte, lifn.Count*sizeofLifreq) lifc.Family = uint16(ep.af) lifc.Len = lifn.Count * sizeofLifreq - littleEndian.PutUint64(lifc.Lifcu[:], uint64(uintptr(unsafe.Pointer(&b[0])))) + lifc.Lifcu = unsafe.Pointer(&b[0]) ioc = int64(sysSIOCGLIFCONF) if err := ioctl(ep.s, uintptr(ioc), unsafe.Pointer(&lifc)); err != nil { continue diff --git a/libgo/go/golang_org/x/net/lif/syscall.go b/libgo/go/golang_org/x/net/lif/syscall.go index 5fe0736..ea75414 100644 --- a/libgo/go/golang_org/x/net/lif/syscall.go +++ b/libgo/go/golang_org/x/net/lif/syscall.go @@ -11,23 +11,12 @@ import ( "unsafe" ) -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - -//go:linkname procIoctl libc_ioctl - -var procIoctl uintptr - -func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno) - -// TODO: replace with runtime.KeepAlive when available -//go:noescape -func keepAlive(p unsafe.Pointer) +//extern __go_ioctl_ptr +func libc_ioctl(int32, int32, unsafe.Pointer) int32 func ioctl(s, ioc uintptr, arg unsafe.Pointer) error { - _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procIoctl)), 3, s, ioc, uintptr(arg), 0, 0, 0) - keepAlive(arg) - if errno != 0 { - return error(errno) + if libc_ioctl(int32(s), int32(ioc), arg) < 0 { + return syscall.GetErrno() } return nil } diff --git a/libgo/go/golang_org/x/net/lif/zsys_solaris_amd64.go b/libgo/go/golang_org/x/net/lif/zsys_solaris.go index 94231c4..6452dd8 100644 --- a/libgo/go/golang_org/x/net/lif/zsys_solaris_amd64.go +++ b/libgo/go/golang_org/x/net/lif/zsys_solaris.go @@ -3,6 +3,8 @@ package lif +import "unsafe" + const ( sysAF_UNSPEC = 0x0 sysAF_INET = 0x2 @@ -59,15 +61,11 @@ const ( ) const ( - sizeofLifnum = 0xc sizeofLifreq = 0x178 - sizeofLifconf = 0x18 - sizeofLifIfinfoReq = 0x10 ) type sysLifnum struct { Family uint16 - Pad_cgo_0 [2]byte Flags int32 Count int32 } @@ -81,16 +79,13 @@ type lifreq struct { type lifconf struct { Family uint16 - Pad_cgo_0 [2]byte Flags int32 Len int32 - Pad_cgo_1 [4]byte - Lifcu [8]byte + Lifcu unsafe.Pointer } type lifIfinfoReq struct { Maxhops uint8 - Pad_cgo_0 [3]byte Reachtime uint32 Reachretrans uint32 Maxmtu uint32 diff --git a/libgo/go/syscall/syscall_solaris.go b/libgo/go/syscall/syscall_solaris.go index 0b2d748..673ba82 100644 --- a/libgo/go/syscall/syscall_solaris.go +++ b/libgo/go/syscall/syscall_solaris.go @@ -29,3 +29,20 @@ func direntNamlen(buf []byte) (uint64, bool) { } return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true } + +//sysnb getexecname() (execname unsafe.Pointer, err error) +//getexecname() *byte + +func Getexecname() (path string, err error) { + ptr, err := getexecname() + if err != nil { + return "", err + } + bytes := (*[1 << 29]byte)(ptr)[:] + for i, b := range bytes { + if b == 0 { + return string(bytes[:i]), nil + } + } + panic("unreachable") +} |