Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall, x/sys/unix: Select is not implemented on ppc64le #21946

Closed
zhsj opened this issue Sep 20, 2017 · 7 comments
Closed

syscall, x/sys/unix: Select is not implemented on ppc64le #21946

zhsj opened this issue Sep 20, 2017 · 7 comments

Comments

@zhsj
Copy link

@zhsj zhsj commented Sep 20, 2017

What version of Go are you using (go version)?

go version go1.9 linux/ppc64le

Does this issue reproduce with the latest release?

yes, with go1.9

What operating system and processor architecture are you using (go env)?

GOARCH="ppc64le"
GOBIN=""
GOEXE=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/debian/go"
GORACE=""
GOROOT="/usr/lib/go-1.9"
GOTOOLDIR="/usr/lib/go-1.9/pkg/tool/linux_ppc64le"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build188776017=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

package main

import (
        "fmt"
        "syscall"
        "unsafe"
)

var nFdBits = uint(8 * unsafe.Sizeof(syscall.FdSet{}.Bits[0]))

func main() {
        fd := 11
        fs := &syscall.FdSet{}
        fs.Bits[uint(fd)/nFdBits] &= ^(1 << (uint(fd) % nFdBits))
        _, e := syscall.Select(fd+1, fs, nil, nil, &syscall.Timeval{Usec: 1})
        fmt.Println(e)
}

What did you expect to see?

I hope it print <nil> which is the result on amd64.

What did you see instead?

it prints function not implemented

BTW, gccgo works fine.

@mundaym
Copy link
Member

@mundaym mundaym commented Sep 20, 2017

/cc @laboger

It looks like syscall.Select should be using the newselect system call. The runtime package appears to have been modified to work around this, but not the syscall package.

runtime:

#define SYS_select               82     // always return -ENOSYS
#define SYS_newselect           142
@mundaym
Copy link
Member

@mundaym mundaym commented Sep 20, 2017

The x/sys/unix package looks like it is affected as well.

@mundaym mundaym added the NeedsFix label Sep 20, 2017
@mundaym mundaym changed the title syscall.Select is not implemented on ppc64le syscall, x/sys/unix: Select is not implemented on ppc64le Sep 20, 2017
@mundaym mundaym added this to the Go1.10 milestone Sep 20, 2017
@laboger
Copy link
Contributor

@laboger laboger commented Sep 20, 2017

@ceseo
Copy link
Contributor

@ceseo ceseo commented Sep 20, 2017

I'll have a fix for this shortly.

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 20, 2017

Change https://golang.org/cl/65090 mentions this issue: syscall: Update syscall.Select to use newselect

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 20, 2017

Change https://golang.org/cl/65091 mentions this issue: unix: update Select to use newselect on ppc64x

gopherbot pushed a commit to golang/sys that referenced this issue Sep 22, 2017
Analog to the runtime package, Select should be using newselect
instead of select. This change addresses this problem and regenerates
zsyscall_linux_* for ppc64 and ppc64le.

Updates golang/go#21946

Change-Id: I7ed5c2490ba2ce556f143f8e8377572ab345f7b8
Reviewed-on: https://go-review.googlesource.com/65091
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
gopherbot pushed a commit that referenced this issue Sep 22, 2017
Analog to the runtime package, syscall.Select should be using
newselect instead of select. This change addresses this problem and
regenerates zsyscall_linux_* for ppc64 and ppc64le.

Updates #21946

Change-Id: I5dc3bf9e7f0b1172d6cce30ddf3bb1e3c95ec8e9
Reviewed-on: https://go-review.googlesource.com/65090
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
@zhsj
Copy link
Author

@zhsj zhsj commented Sep 24, 2017

So I think the fix is merged and we can close this issue now

@zhsj zhsj closed this Sep 24, 2017
@golang golang locked and limited conversation to collaborators Sep 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.