diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2017-10-13 13:51:23 +0200 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-10-13 14:01:17 +0000 |
| commit | bf237f534cc2a5ed23ae7ffa7deb38cbee64cae6 (patch) | |
| tree | 4e6f9598206acc34efdfda7f0df77c27a7527166 /src/syscall/syscall_linux_mips64x.go | |
| parent | 531e6c06c468badbb1ba180027a93b3f6c5b2615 (diff) | |
| download | go-bf237f534cc2a5ed23ae7ffa7deb38cbee64cae6.tar.xz | |
syscall: correct type for timeout argument to Select on linux/{arm64,mips64x}
syscall.Select uses SYS_PSELECT6 on arm64 and mipx64x, however this
syscall expects its 5th argument to be of type Timespec (with seconds
and nanoseconds) instead of type Timeval (with seconds and microseconds)
This leads to the timeout being too short by a factor of 1000.
This CL fixes this by adjusting the timeout argument accordingly,
similarly to how glibc does it for architectures where neither
SYS_SELECT nor SYS__NEWSELECT are available.
Fixes #22246
Change-Id: I33a183b0b87c2dae4a77a2d00f8615169fad48dd
Reviewed-on: https://go-review.googlesource.com/70590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall/syscall_linux_mips64x.go')
| -rw-r--r-- | src/syscall/syscall_linux_mips64x.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/syscall/syscall_linux_mips64x.go b/src/syscall/syscall_linux_mips64x.go index 671cfe6d8a..e4bc77530c 100644 --- a/src/syscall/syscall_linux_mips64x.go +++ b/src/syscall/syscall_linux_mips64x.go @@ -34,7 +34,6 @@ const ( //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK -//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6 //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys Setfsgid(gid int) (err error) //sys Setfsuid(uid int) (err error) @@ -66,6 +65,17 @@ const ( //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) +type sigset_t struct { + X__val [16]uint64 +} + +//sys pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_t) (n int, err error) = SYS_PSELECT6 + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} + return pselect(nfd, r, w, e, &ts, nil) +} + //sysnb Gettimeofday(tv *Timeval) (err error) func Time(t *Time_t) (tt Time_t, err error) { |
