mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 07:07:33 -04:00
unix: add Select syscall on AIX
As select is a keyword of Go, C.select cannot be used on gccgo files. Therefore, select call is transformed into c_select. Change-Id: Ic68a7ffa03dc5a5d70514876b5f6afb565691a4a Reviewed-on: https://go-review.googlesource.com/c/sys/+/172739 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Ian Lance Taylor
parent
d20716ef9d
commit
f0ce4c0180
@@ -123,6 +123,26 @@ func TestUtimesNanoAt(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelect(t *testing.T) {
|
||||
_, err := unix.Select(0, nil, nil, nil, &unix.Timeval{Sec: 0, Usec: 0})
|
||||
if err != nil {
|
||||
t.Fatalf("Select: %v", err)
|
||||
}
|
||||
|
||||
dur := 150 * time.Millisecond
|
||||
tv := unix.NsecToTimeval(int64(dur))
|
||||
start := time.Now()
|
||||
_, err = unix.Select(0, nil, nil, nil, &tv)
|
||||
took := time.Since(start)
|
||||
if err != nil {
|
||||
t.Fatalf("Select: %v", err)
|
||||
}
|
||||
|
||||
if took < dur {
|
||||
t.Errorf("Select: timeout should have been at least %v, got %v", dur, took)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPselect(t *testing.T) {
|
||||
if runtime.GOARCH == "ppc64" {
|
||||
t.Skip("pselect issue with structure timespec on AIX 7.2 tl0, skipping test")
|
||||
|
||||
Reference in New Issue
Block a user