Commit Graph

12 Commits

Author SHA1 Message Date
Tobias Klauser
ac3223d801 unix: add methods to manipulate *FdSet
Add Set, Clear, IsSet and Zero methods to manipulate an *FdSet. These
implement the same functionality as the FD_SET, FD_CLR, FD_ISSET and
FD_ZERO macros in <sys/select.h>.

Change-Id: I6b7bccb98e58ee5e719096ed5743f6edcd232840
Reviewed-on: https://go-review.googlesource.com/c/sys/+/205397
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-05 14:28:33 +00:00
Tobias Klauser
2aa67d56cd unix: fix Select to return number of ready fds on Darwin and *BSD
Make Select's signature on Darwin and the BSDs match the one on Linux
and return the number of ready file descriptors.

Fixes golang/go#34458

Change-Id: Ia618ce34ff754f2b731d7f913cab840d7948579c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196802
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 06:27:00 +00:00
Tobias Klauser
b09afc3d57 unix: add MNT_* flags on OpenBSD
Now that all BSDs define MNT_NOWAIT, use it in TestGetfsstat instead of
the locally defined copy.

Change-Id: Ib6cee08a6d3a034464c7b79591605b49889a46ae
Reviewed-on: https://go-review.googlesource.com/137195
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-25 11:27:36 +00:00
Tobias Klauser
df29b91272 unix: add TestSelect for *BSD
Change-Id: I9aa4ac170c361e56e36bded0cc13fb99346f70cf
Reviewed-on: https://go-review.googlesource.com/85275
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-12-22 14:35:20 +00:00
Tobias Klauser
bf42f188b9 unix: use sort.Search for sysctl lookup on OpenBSD
Use sort.Search to look up sysctl mib values from names instead of using
a hand-crafted binary search.

Also add a simple test to verify sysctl is still working after the
change.

Change-Id: I844840ac434a704b14c3166c3730daffabd2f347
Reviewed-on: https://go-review.googlesource.com/76930
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-14 16:20:44 +00:00
Brad Fitzpatrick
30de6d19a3 unix: fix TestGetfsstat the same way as CL 28550 in pkg syscall
Same as https://golang.org/cl/28550 but for x/sys/unix.

Updates golang/go#16937

Change-Id: Ie93df8ff1c40a7f2d98f1fb3ecf6110330bf1cbc
Reviewed-on: https://go-review.googlesource.com/28585
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-07 14:59:46 +00:00
Matthew Dempsky
50c6bc5e42 unix: skip broken test on OpenBSD
OpenBSD (and likely NetBSD, but it's not enabled for these tests
anyway) use a different sysctl API for fetching process information
than FreeBSD and its derivatives.

Change-Id: Id2ab10f170b788ba4d9bd45d3347f530555da23b
Reviewed-on: https://go-review.googlesource.com/19232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-02-04 22:58:17 +00:00
Steven Hartland
d9157a9621 unix: add custom Sysctl args and methods SysctlUint64, SysctlRaw
Add support for optional sysctl arguments which is required to support
sysctls that require more than the mib identifer args as returned from
nametomib such as kern.proc.pid.

Add SysctlUint64 which allows sysctls that return 64 bit ints to be
queried.

Add SysctlRaw which allows sysctls that return structs or other
unsupported types to be queried.

Change-Id: If0fa23935ee09496f2df210364d8988ccd0f3db6
Reviewed-on: https://go-review.googlesource.com/14955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-29 18:30:43 +00:00
Andrew Gerrand
dea3d764c2 go.sys: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/171050043
2014-11-10 08:56:17 +11:00
Rob Pike
279b3782ad go.sys: fix imports to cgc/p/go.sys, add build tags
Approach but probably not achieve a green build.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/126120043
2014-08-12 22:59:00 -07:00
Rob Pike
8442dd2c63 go.sys: update package names
Semi-automatic migration from package syscall to package {plan9,windows,unix}.
No builds attempted yet, but this gets a lot of noise behind us so subsequent
CLs will be more concise and easier to follow.
Subsequent CLs will have semantic content.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/121520043
2014-08-11 15:58:26 -07:00
Rob Pike
20acc5cf31 go.sys: copy files from syscall package to go.sys/{plan9,windows,unix}
This CL copies to each package of go.sys the files from syscall it will need.
Different directories have different files, but these:
        mkall.sh
        str.go
        syscall.go
        mksyscall.pl
        race.go
        race0.go
        syscall_test.go
are copied to all three.
No changes yet, these are just copies. They are not ready to use yet:
package names are wrong, for starters. But this clean copy will make
it easier to follow the changes as the packages are enabled.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/126960043
2014-08-11 14:48:46 -07:00