Commit Graph

284 Commits

Author SHA1 Message Date
Kevin Burke
314a259e30 README: add better links, Markdown
Move the README to README.md so Gerrit can render it; currently
Gerrit only renders files named exactly "README.md" (for example at
https://go.googlesource.com/go).

Add more links to the README explaining how to file issues,
how to submit code changes, where to download the code to and
how to get it. Hopefully this should help people who go to
https://go.googlesource.com/sys or https://github.com/golang/sys
figure out how to get started with development.

Change-Id: I2b3b9cb1021292c3cb4b5eb3a84b5c17eb8429da
Reviewed-on: https://go-review.googlesource.com/49911
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-09-27 05:46:21 +00:00
Carlos Eduardo Seo
429f518978 unix: update Select to use newselect on ppc64x
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>
2017-09-22 12:34:23 +00:00
Tobias Klauser
2320a9c158 unix: fix TestMmap crash on openbsd/386
When adding Mprotect to TestMmap in CL 56172, PROT_WRITE was implicitly
assumed to also include PROT_READ. This is not necessarily true on all
OSes and makes TestMmap crash on openbsd/386.

As suggested my Mikio Hara fix it by also setting PROT_READ on the
memory mapping.

Fixes golang/go#21962

Change-Id: Ia789ab8b31f8dec0c3db23cc950ccdd4aab3db05
Reviewed-on: https://go-review.googlesource.com/65230
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-21 19:16:43 +00:00
Tobias Klauser
b6e1ae2164 unix: remove _SC_PAGESIZE on Solaris
CL 62111 removed the _SC_PAGESIZE definition from the types_*.go files
but did not re-generate ztypes_solaris_amd64.go. Do so now to get rid of
_SC_PAGESIZE there as well.

Change-Id: Icde4366f4b7a92e8a89170ad00ff2b807e7655e1
Reviewed-on: https://go-review.googlesource.com/64350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-19 00:13:38 +00:00
Tobias Klauser
1f337fdb7f unix: add Major, Minor and Mkdev functions on Solaris
Add Major, Minor and Mkdev functions for converting device numbers to
their major/minor components and vice versa.

Use the respective functions provided by the Solaris libc instead of
reimplementing them.

Test the conversion function with some well-known static device numbers
for devices which should be present on any Solaris system.

Re-generated files on OpenIndiana Hipster 2017.04 (SunOS 5.11) which
also added some previously missing error constants.

Change-Id: Ief9ea973d91c24956571eb8fafc8a4525b0f5b90
Reviewed-on: https://go-review.googlesource.com/64390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-18 21:40:44 +00:00
Tobias Klauser
b8ca6dd53d unix: add Msync function on Solaris
Add the Msync function on solaris/amd64.

Change-Id: Idde0f9e693f924fef471acb42afb84e83c4cee76
Reviewed-on: https://go-review.googlesource.com/64370
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-18 21:34:02 +00:00
Jeet Parekh
062cd7e4e6 windows: fix NewCallback function
It has been suggested to migrate from syscall to golang.org/x/sys
The NewCallback function works in syscall. But the golang.org/x/sys/windows NewCallback function did not work.

Since golang.org/x/sys/windows already imports syscall, the NewCallback function now calls syscall.NewCallback.

Fixes golang/go#21831

Change-Id: I5cabd8540777b398a288308a66ae20896ed4a1db
Reviewed-on: https://go-review.googlesource.com/63250
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-09-12 23:54:04 +00:00
Tobias Klauser
033028a6b4 unix: add Major, Minor and Mkdev functions on OpenBSD
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of the macros defined in OpenBSD's
sys/types.h header. However, the parameter and return types are changed
to match the existing implementations of these functions.

Test the conversion macros with some well-known device numbers.

Updates golang/go#8106

Change-Id: Ia50b7ccab18ff7c7e9dd77ddc7e4aa6cf5c79963
Reviewed-on: https://go-review.googlesource.com/63070
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-12 22:26:33 +00:00
Tobias Klauser
804a9fee62 unix: convert major/minor to uint64 before shifting in Mkdev on Darwin/*BSD
Follow CL 63090 and change the Makedev function on Darwin and *BSD to
convert to uint64 before shifting/masking. This avoids a potential
overflow.

Change-Id: I5b566329695cc5edcf82f0ff2366033011b0625b
Reviewed-on: https://go-review.googlesource.com/63112
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-12 19:57:40 +00:00
Tobias Klauser
7a85bfad8b unix: fix potential overflow in Mkdev on Linux
Daniel Swarbrick reports the following go vet warning after CL 50550:

  .../dev_linux.go:38: (major & 0xfffff000) (32 bits) too small for shift of 32

Fix it by converting major and minor to uint64 before the bitwise-and.

Change-Id: If37540be81f2c78a58fd5e5dcce7b770ce7b8afe
Reviewed-on: https://go-review.googlesource.com/63090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-12 14:41:02 +00:00
Tobias Klauser
a5054c7c13 unix: add Major, Minor and Mkdev functions on FreeBSD
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of the macros defined in FreeBSD's
sys/types.h header. However, the parameter and return types are changed
to match the existing implementations of these functions.

Because FreeBSD dynamically allocates major/minor device numbers through
devfs at runtime, testing the conversion macros against well-known
device numbers is not possible.

Updates golang/go#8106

Change-Id: I9874e63f388cfc5c0d5cc47d4d0f6ccc489b28f2
Reviewed-on: https://go-review.googlesource.com/61631
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-09 06:31:39 +00:00
Tobias Klauser
5513e650ab unix: add Major, Minor and Mkdev functions on Dragonfly
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of the macros defined in DragonFlyBSD's
sys/types.h header. However, the parameter and return types are changed
to match the existing implementations of these functions.

Test the conversion macros with some well-known device numbers.

Updates golang/go#8106

Change-Id: I84c128dff3108821caaa75dcec620cf5bdb1f32d
Reviewed-on: https://go-review.googlesource.com/61630
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-08 13:26:36 +00:00
Joe Richey joerichey@google.com
a45f55524b unix: defer Getpagesize() to runtime
In general, page size is not a function of the archetecture. This was
addressed in the Go standard library here:
https://go-review.googlesource.com/25051

This change simply defers to the standard library "syscall" package,
which in turn defers to the runtime. This helps in addressing golang/go#10180 and
also fixes a bug on ppc64.

Currently, we return 65536 as the page size on ppc64, but the kernel
supports 4k and 64k sizes, see here:
http://elixir.free-electrons.com/linux/v4.13/source/arch/powerpc/include/asm/page.h#L24

Now that various page size calculations are not needed, various
components are now dead code and can also be removed. This CL reverts:
https://go-review.googlesource.com/14483
and part of:
https://go-review.googlesource.com/30755

Change-Id: I9d7a2d96359054e0dca9c985b026c8072b2eeaf3
Reviewed-on: https://go-review.googlesource.com/62111
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-07 22:11:50 +00:00
Joe Richey joerichey@google.com
31e1fafe95 unix: update Linux to v4.13 kernel and v2.26 glibc
This change updates the Linux symbols to correspond to v4.13 of the
kernel and v2.26 of glibc. To get everything building correctly, newer
versions of the build tools are required. Instead of trying to get an
Ubuntu 17.10 docker image working, we just add Artful sources to
/etc/apt/sources.list to get a similar effect.

Now that the kernel UAPI is updated, FS_MAX_KEY_SIZE and fscrypt_key no
longer need to be manually declared, as they are now in the proper
kernel headers.

Change-Id: I5f14c99fd70b43dbb8b44e05f53e4e9f09c9a345
Reviewed-on: https://go-review.googlesource.com/61771
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-07 22:07:22 +00:00
Joe Richey joerichey@google.com
9aade4d3a3 unix: Fix mkerrors.sh to do comparison correctly
Bash should use "=" not "-eq" for equality comparison.

Some incorrect comparison operators were missed in:
https://go-review.googlesource.com/c/sys/+/41832

Change-Id: I110968287b7370870301b2fdd2a4ec188f623a39
Reviewed-on: https://go-review.googlesource.com/61770
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-09-06 00:00:21 +00:00
Joe Richey joerichey@google.com
568757c03f unix: Properly generate files for Linux
Change https://go-review.googlesource.com/c/sys/+/56172 did not run
./mkall.sh after modifying syscall_linux.go. This change simply runs
./mkall.sh to correctly generate the modified files.

Note that the previous change simply reordered a few functions, so the
functions are simply reordered in the generated files.

Change-Id: I2d819f9ca4ae0e59e67e42d04bb6e6513b3c6c45
Reviewed-on: https://go-review.googlesource.com/61750
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-05 23:59:36 +00:00
Tobias Klauser
7ddbeae9ae unix: add Major, Minor and Mkdev functions on NetBSD
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of the macros defined in NetBSD's
sys/types.h header. However, the parameter and return types are changed
to match the existing implementations of these functions.

Test the conversion macros with some well-known device numbers.

Updates golang/go#8106

Change-Id: I536d6d2622f6fe9be3c1ed3beb266745fe4bfb6e
Reviewed-on: https://go-review.googlesource.com/60970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-01 18:12:14 +00:00
Tobias Klauser
a07a691ac8 unix: add Major, Minor and Mkdev functions on Darwin
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of the macros defined in Darwin's
sys/types.h header. However, the parameter and return types are changed
to match the respective Linux implementation of these functions.

Test the conversion macros with some well-known static device numbers
for devices which should be present on any Darwin system.

Updates golang/go#8106

Change-Id: I1862be64684cc1b5a53e15a883819571e368cb2b
Reviewed-on: https://go-review.googlesource.com/60610
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-01 00:32:39 +00:00
Luca Bruno
bb24a47a89 unix: drop dummy byte for oob in unixgram SendmsgN
This commit relaxes SendmsgN behavior of introducing a dummy 1-byte
payload when sending ancillary-only messages.
The fake payload is not needed for SOCK_DGRAM type sockets, and actually
breaks interoperability with other fd-passing software (journald is one
known example). This introduces an additional check to avoid injecting
dummy payload in such case.

Backport of https://go.googlesource.com/go/+/93da0b6e66f24c4c307e0df37ceb102a33306174
Full reference at https:/golang.org/issue/6476#issue-51285243

Change-Id: I7cf00a1c7cde75fe62e00b98ccba6ac8469b0493
Reviewed-on: https://go-review.googlesource.com/60190
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-30 13:42:02 +00:00
Matt Layher
ab9e364efd unix: add generic netlink types and constants on Linux
Generic netlink is a generalized netlink family which enables a series
of different communication channels to be multiplexed on a single
netlink family.

For more information, please see: https://lwn.net/Articles/208755/.

Fixes golang/go#21682.

Change-Id: I2095150e06471f4a0e1322fba669573aa8f0a9b1
Reviewed-on: https://go-review.googlesource.com/59931
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 18:59:17 +00:00
Matt Layher
2d6f6f883a unix: add taskstats enum values
I falsely assumed that enum values would be generated automatically,
but now realize that the previous values I added were actually generated
from preprocessor define statements.

This change adds some missing values I intended to add in CL 59050.

Fixes golang/go#21623.

Change-Id: I3c40c8454ee1d323e1e4e014febe0874e859a378
Reviewed-on: https://go-review.googlesource.com/59090
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-25 19:46:20 +00:00
Matt Layher
22e23b7432 unix: add taskstats type and constants on Linux
Taskstats is a netlink-based interface for sending per-task and
per-process statistics from the kernel to userspace.

For more information, please see:
https://www.kernel.org/doc/Documentation/accounting/taskstats.txt.

Fixes golang/go#21616.

Change-Id: I7d4b8035aa8e993074d61911d9a8c3a3e61c9b2e
Reviewed-on: https://go-review.googlesource.com/59050
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-25 17:12:00 +00:00
Tobias Klauser
07c182904d windows: add missing event functions
Add CreateEventEx, OpenEvent, ResetEvent and PulseEvent.

Also change eventAttrs to use the local definition of the
SecurityAttributes type, not the one from syscall.

GetConsoleScreenBufferInfo is also changed by re-running 'go generate'
to pass a pointer to ConsoleScreenBufferInfo (instead of a pointer to
pointer).

Change-Id: I08dff4360186b04c55fd0362e31920f38206157b
Reviewed-on: https://go-review.googlesource.com/56110
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-21 09:33:53 +00:00
Tobias Klauser
43e60d72a8 unix: unify memory functions on BSD
Make Madvice, Mlock, Mlockall, Mprotect, Msync, Munlock and Munlockall
available equally on all BSD flavors. NetBSD was previously lacking
SYS_MSYNC, so add it.

Reorder the //sys function prototype alphabetically and clean up already
implemented syscalls everywhere.

Also add tests for Mprotect, Msync and Madvice - now that they're
available on all unix platforms.

Fixes golang/go#18513

Change-Id: I0eb502d72c7e991f191fb96225ef04e8297d8b8d
Reviewed-on: https://go-review.googlesource.com/56172
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-17 23:46:08 +00:00
Tobias Klauser
9f7170bcd8 unix: fix definition of AT_FDCWD on dragonfly
Follow CL golang.org/cl/55690 (which did the same for syscall) and fix
the definition of AT_FDCWD on dragonfly/amd64.

Change-Id: I2c44a0f84308697d3dbac9b78c4a3dce973f88ba
Reviewed-on: https://go-review.googlesource.com/55691
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-15 13:50:41 +00:00
Tobias Klauser
2d3e384235 unix: add utimensat and use it for UtimesNano on BSD
Follow golang.org/cl/55130 and add the utimensat syscall on *BSD. Use it
in UtimesNano and UtimesNanoAt (which is added on *BSD, akin to the
already existing implementation on Linux and Solaris).

Also add AT_FDCWD and AT_SYMLINK_NOFOLLOW where they are missing. These
might be used with UtimesNanoAt.

In order to be able to generate the syscalls, also add two missing
$GOOS_$GOARCH patterns to mkall.sh. As a side effect, some additional
syscalls are added for openbsd/arm.

Change-Id: I85351098002209f8454ec328cef0cfe9d12c5214
Reviewed-on: https://go-review.googlesource.com/55071
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 19:17:52 +00:00
Sean Chittenden
c84c1ab9fd unix: add flock(3C) support on Solaris
Fixes: golang/go#21410

Change-Id: Ie1971f7d6e0cfe405603e94c538a15dd5f467392
Reviewed-on: https://go-review.googlesource.com/55230
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-14 04:45:13 +00:00
Yuval Pavel Zholkover
e42485b6e2 unix: use vm.swap_total for FreeBSD TestSysctlUint64
Fixes golang/go#21375

Change-Id: Ibb33df9d71eb3a935a1f8f9f0ad1f180211e8ce4
Reviewed-on: https://go-review.googlesource.com/54390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-09 19:06:05 +00:00
Tobias Klauser
89d4068c4f unix: add *at functions (POSIX.1-2008) on darwin/{arm,arm64}
Follow golang.org/cl/50450 and add the Faccessat, Fchmodat, Fchownat,
Linkat, Mkdirat, Openat, Readlinkat, Renameat, Symlinkat and Unlinkat
functions (to conform to POSIX.1-2008) for darwin/arm and darwin/amd64.
Also add the missing AT_* constants.

Generated on Mac OS 10.11 (Darwin 15.6.0). This also regenerates the
syscall numbers for arm and arm64 akin to golang.org/cl/14151

Also fix the mksysnum call in mkall.sh to work for darwin/arm.

Fixes golang/go#14457

Change-Id: Ia3c36dbca9e6f1e4873afdfafcc4f7d8050644f9
Reviewed-on: https://go-review.googlesource.com/54271
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-09 14:56:55 +00:00
Tobias Klauser
f1e7f7a8ac unix: add MNT_* constants on Darwin
Add the MNT_* constants used for the Mount and Umount functions on
Darwin.

Generated on Mac OS 10.11 (Darwin 15.6.0). This also brings
zerrors_darwin_{arm,arm64} up to date with constants which are already
present for 386 and amd64.

Fixes golang/go#9891

Change-Id: Id77847a2fb805a759aa0f5b36e8954b764e699a5
Reviewed-on: https://go-review.googlesource.com/54210
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-09 13:30:23 +00:00
Brad Fitzpatrick
b0e0dd7297 unix: add openbsd/arm support (in theory)
This copies over some files from the main repo to make the
GOOS=openbsd GOARCH=arm go install and go test -c work.

No clue whether it actually works or not, though. We don't have
builders anymore for this port.

But once this compiles, we'll at least be able to use constants from
the x/sys/unix package from x/net without regressing x/net's support
for openbsd/arm. (If anybody uses openbsd/arm)

Fixes golang/go#10826

Change-Id: Id821e2011bcd2d3720652be44ac09e4ce4d2a3a3
Reviewed-on: https://go-review.googlesource.com/54053
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2017-08-09 03:45:07 +00:00
Yuval Pavel Zholkover
47bdb838cc unix: fix freebsd/arm build, fix freebsd/{386,arm} tests
Re-run mkall.sh on FreeBSD-11.1-RELEASE armv6 for Capsicum consts and
POSIX.1-2008 path relative *at() syscalls.

Add errors_freebsd_arm.go generated semi-automatically using:
https://gist.github.com/paulzhol/c6d54dc2baf2a6bd204b343a15459661
Similar to https://golang.org/cl/51570. In order to handle C enum based
constants that mkerrors.sh missed.

Use fix from https://golang.org/cl/53639 to run Capsicum tests only on amd64.

Fixes golang/go#21136

Change-Id: I9681b033531090e6b1c5e2446a442deb39cf3066
Reviewed-on: https://go-review.googlesource.com/53691
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-08 15:06:51 +00:00
Tobias Klauser
d8f5ea21b9 windows: rename ztypes_* to types_*
The ztypes_* file names indicate that these are auto-generated while in
fact they aren't. Rename them to types_* to avoid this confusion.

Noticed by Brad Fitzpatrick in https://golang.org/cl/52670.

Change-Id: I75c8d0f4116dfb3a24ae9444509daf31524c35d6
Reviewed-on: https://go-review.googlesource.com/52950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-03 14:03:59 +00:00
Tobias Klauser
d6c3f2be45 windows: add SetConsoleMode and GetConsoleScreenBufferInfo
Add the SetConsoleMode and GetConsoleScreenBufferInfo functions, as well
as the corresponding types and constants. For details see:

  https://docs.microsoft.com/en-us/windows/console/setconsolemode
  https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo
  https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str

Change-Id: I17dcd62ffde12b5c94e1245b6836d067aea3dc6e
Reviewed-on: https://go-review.googlesource.com/52670
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-08-03 08:12:02 +00:00
Tobias Klauser
e312636bda unix: add ioctl functions on FreeBSD
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on FreeBSD. These are similar to the
already existing implementations on Linux, Darwin and Solaris.

Generated on FreeBSD 10.11-RELEASE.

Change-Id: I79b273032cfeb719ec5550ac15635fd9f3231469
Reviewed-on: https://go-review.googlesource.com/52710
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-02 14:19:12 +00:00
Tobias Klauser
396c9fc8fb unix: add ioctl functions on Darwin
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on Darwin. These are similar to the
already existing implementations on Linux and Solaris.

Generated on Mac OS 10.11 (Darwin 15.6.0).

Change-Id: I2d4cc957c840836fcc2ccb71c67631420f4a2eb1
Reviewed-on: https://go-review.googlesource.com/52410
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-01 17:37:36 +00:00
Tobias Klauser
b892924b68 unix: add *at functions (POSIX.1-2008) on FreeBSD
Add the Faccessat, Fchmodat, Fchownat, Linkat, Mkdirat, Readlinkat,
Renameat, Symlinkat and Unlinkat functions (to conform to POSIX.1-2008)
and also add the missing AT_* constants.

Generated on FreeBSD 10.11-RELEASE for freebsd/amd64 and freebsd/386.

Change-Id: I1aea155d5375cfd6b38662018ccb5b834151b982
Reviewed-on: https://go-review.googlesource.com/52070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-01 02:10:45 +00:00
Tobias Klauser
0f826bdd13 unix: re-enable Capsicum on FreeBSD 386
Capsicum support was added by https://golang.org/cl/47290, but only for
amd64. This broke the freebsd/386 build which was subsequently fixed by
http://golang.org/cl/51270. However, even with this fix the tests still
fail to build due to the missing Capsicum functions and types.

Fix the build/test on freebsd/386 for real by re-running mkall.sh on
FreeBSD 11.1-RELEASE (inside VirtualBox) to get all the Capsicum
functions and types.

Some zerrors constants were removed or converted to enums in the FreeBSD
headers. Manually move them to a dedicated file. Do the same for amd64,
where these constants were removed by accident in
https://golang.org/cl/47290.

Updates golang/go#21136

Change-Id: I54fe2c4567674b07dedad677756369a43a1f0ef6
Reviewed-on: https://go-review.googlesource.com/51570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-28 17:44:21 +00:00
Matt Layher
7716a567fb unix: add PacketMreq on Linux
The packet_mreq structure is used on Linux to modify the behavior
of packet sockets using setsockopt.  See 'man 7 packet' for more
details.

Change-Id: I34e5b99a6b6eb1f23d49a9c9f25ce7b77121c8f0
Reviewed-on: https://go-review.googlesource.com/51710
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-28 16:07:29 +00:00
Tobias Klauser
515fc15b65 unix: add missing SizeofIovec constant on Linux
Add the SizeofIovec constant corresponding to type Iovec.

Change-Id: Icde241b8cac3bc89806f0081a4021598bf0ef7cf
Reviewed-on: https://go-review.googlesource.com/51730
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-28 15:34:37 +00:00
Kirill Smelkov
35ef4487ce unix: add Syncfs function on Linux
Syncfs is Linux-specific system call to synchronize to disk one
filesystem specified by fd to any of its files.

See http://man7.org/linux/man-pages/man2/syncfs.2.html for details.

Change-Id: Ia2ad6208c3fa0e9c40d5112ce938edd5d374131d
Reviewed-on: https://go-review.googlesource.com/51510
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-27 13:53:23 +00:00
Brad Fitzpatrick
02a66801d9 unix: fix FreeBSD 386 build
It was broken by https://golang.org/cl/47290

Fixes golang/go#21136

Change-Id: I2a08869fd44a9776f0dc7d461814e1df4e606b5d
Reviewed-on: https://go-review.googlesource.com/51270
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-07-26 18:25:55 +00:00
Tobias Klauser
14ac33bf84 unix: remove duplicate build tag
Remove a duplicate build tag in unix/flock.go. Keep the alphabetically
sorted version below the copyright header.

Change-Id: Ie3a6e5e01e5e4114960fdf63111a68d3b2b8de47
Reviewed-on: https://go-review.googlesource.com/51051
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-25 16:04:15 +00:00
Tobias Klauser
85d1495063 unix: add Major, Minor and Mkdev functions on Linux
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of glibc's corresponding macros. Also
add an explanatory comment about the device number format, so the magic
numbers make more sense.

Test the conversion macros with some well-known device numbers for
devices which should be present on any Linux system.

Fixes golang/go#8106

Change-Id: Id336317985d6ac85ee83bc54e5f23703257c9121
Reviewed-on: https://go-review.googlesource.com/50550
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-07-25 14:02:08 +00:00
Tobias Klauser
a7f1d9efe6 unix: add Msync function on Darwin
Add the Msync function on darwin/amd64 and darwin/386.

Fixes golang/go#8245

Change-Id: I1d234bb97731934c36d926ed2332c93b35b2f641
Reviewed-on: https://go-review.googlesource.com/50892
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-25 13:53:46 +00:00
Tobias Klauser
d6d53c0e54 unix: add Msync function on Linux
Add the Msync function on Linux. See
http://man7.org/linux/man-pages/man2/msync.2.html

Updates golang/go#8245

Change-Id: I964259bafc8d4fbca09961443f21c4278bf56706
Reviewed-on: https://go-review.googlesource.com/50891
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-25 13:53:26 +00:00
Tobias Klauser
c4489faa6e unix: add *at functions (POSIX.1-2008) on Darwin
Add the Faccessat, Fchownat, Linkat, Mkdirat, Openat, Readlinkat,
Renameat, Symlinkat and Unlinkat functions (to conform to POSIX.1-2008)
and make Fchmodat available on all architectures, not just amd64. Also
add the missing AT_* constants.

Generated on Mac OS 10.11 (Darwin 15.6.0) for darwin/amd64 and
darwin/386 only.

Fixes golang/go#14458

Change-Id: I6d9258864383ea77f9cad058ee8ba2c728213b40
Reviewed-on: https://go-review.googlesource.com/50450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-21 16:35:17 +00:00
Ben Laurie
7a4fde3fda unix: add some FreeBSD Capsicum support.
Change-Id: Ibb1426ebd18d27ee9f144af0fd8c94b08c06f7d7
Reviewed-on: https://go-review.googlesource.com/47290
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-19 20:48:12 +00:00
Tobias Klauser
cd2c276457 unix: add ioctl functions to get/set terminal window size on Linux
Add IoctlGetWinsize and IoctlSetWinsize to retreive and manipulate
Winsize structures on Linux, akin to the already existing implementation
on Solaris.

Also remove the named result parameter for IoctlSetInt and
IoctlSetTermios, as they add no additional use.

Change-Id: Id349d1d6a21d5c9a05943f4dcc3a275613ccf7b8
Reviewed-on: https://go-review.googlesource.com/49231
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-18 16:13:35 +00:00
Tobias Klauser
4cd6d1a821 unix: add Mkfifoat function on Linux
Add the Mkfifoat function on Linux, akin to the existing Mkfifo function
but taking an additional dirfd parameter. See
http://man7.org/linux/man-pages/man3/mkfifo.3.html

Originally requested in golang/go#14216

Also remove the named result parameter for Mkfifo, as they add no
additional use (suggested by Brad Fitzpatrick).

Change-Id: I7b759752abf3e1469d7f883a7f13313e3062aeb4
Reviewed-on: https://go-review.googlesource.com/48530
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-14 16:04:39 +00:00