Commit Graph

297 Commits

Author SHA1 Message Date
Tobias Klauser
9e4fff1f4d all: single space after period
Follow CL 20022 and consistently use single space after a period in
documentation.

Generated with:

$ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

Change-Id: Ia29ad823668f060e81293e848a79fc4b4857d94b
Reviewed-on: https://go-review.googlesource.com/73530
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-25 20:39:07 +00:00
Tobias Klauser
607525c0eb unix: add Poll function on Dragonfly
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I03f4396be2e190770abb219c1c5324ca55bcfa27
Reviewed-on: https://go-review.googlesource.com/73430
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 19:14:39 +00:00
Tobias Klauser
92ac112afc unix: add Poll function on FreeBSD
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I56ee0124a04c64e3ea51a1653901f2f4277983e6
Reviewed-on: https://go-review.googlesource.com/73370
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 15:18:35 +00:00
Tobias Klauser
f0d39a4bd5 unix: add Poll function on Darwin
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: Ia57e3a92e6a50cb22edde8a31e1c4e70d894dc4c
Reviewed-on: https://go-review.googlesource.com/73310
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-10-25 12:55:06 +00:00
Tobias Klauser
e825973668 unix: unify NsecToTime{spec,val}, fix for times < 1970
All the implementations of NsecToTimespec and NsecToTimeval were the
same other than types. Write a single version that uses
GOARCH/GOOS-specific setTimespec and setTimeval functions to handle the
types.

The logic in NsecToTimespec and NsecToTimeval caused times before 1970
to have a negative usec/nsec. The Linux kernel requires that usec
contain a positive number; for consistency, we do this for both
NsecToTimespec and NsecToTimeval.

Follow CL 30826 which did the same for syscall.

Change-Id: Id6c6f4fef8450251447d1a5b01f35c2a36b5aeb1
Reviewed-on: https://go-review.googlesource.com/73170
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 08:56:33 +00:00
Tobias Klauser
bb1b7fe501 unix: add test for UtimesNanoAt on Linux
Add a test for UtimesNanoAt which makes sure the timestamp of a symlink
is updated.

Change-Id: I819e43db1d390fb37f011b34e58ff9d3d06595f1
Reviewed-on: https://go-review.googlesource.com/72377
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 08:55:50 +00:00
Tobias Klauser
a1a1f1746d unix: unify TimespecToNsec and TimevalToNsec
All implementations of these functions are identical.

Follow CL 30819 which did the same for syscall.

Change-Id: I3c78f05ea12251306f3e100a006d266154a5238e
Reviewed-on: https://go-review.googlesource.com/72378
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-23 17:51:51 +00:00
Michael Stapelberg
a57a2b53a1 unix: add watchdog constants on Linux
To be used e.g. in
2e60d5b8c8

Change-Id: If79ffec9021dc79375c861a0ddd9dd443adb4692
Reviewed-on: https://go-review.googlesource.com/72375
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-23 17:49:30 +00:00
Tobias Klauser
ff8cd6cb4f unix: add UTIME_* constants on Linux
They might be used as special values in struct Timespec. See
http://man7.org/linux/man-pages/man2/utimensat.2.html for details.

Change-Id: I1c2d6d7731ca7f077d033e51ee6421a4f2cfbb89
Reviewed-on: https://go-review.googlesource.com/72376
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-23 17:48:59 +00:00
Hilko Bengen
8dbc5d05d6 windows: add GetProcAddressByOrdinal
The current GetProcAddress implementation only resolves functions in
DLLs by name. Add GetProcAddressByOrdinal that allows resolving
functions by ordinal number, using the same GetProcAddress call from
kernel32.dll in the background.

This is particularly useful for some functions (e.g. IsOS from
shlwapi.dll in some older versions of Windows) that cannot be found by
name.

Fixes golang/go#16507

Change-Id: Ib5fba7568c365a0aa2491c1261876b3a3929ec3d
Reviewed-on: https://go-review.googlesource.com/70690
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-17 06:39:10 +00:00
Tobias Klauser
686000749e unix: correct type for timeout argument to Select on linux/{arm64,mips64x}
Follow CL 70590 which did the same for syscall.

unix.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. It also makes Pselect
generaly available on linux.

Updates golang/go#22246

Change-Id: I69f8821a40c59ee469b8a986d784a4db8727ee9a
Reviewed-on: https://go-review.googlesource.com/70610
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-13 13:55:06 +00:00
Tobias Klauser
43eea11bc9 unix: add MNT_* flags on FreeBSD
Add the MNT_* flags to be used e.g. with Getfsstat on FreeBSD.

Change-Id: I1afb50f715f447f85b4ece3d3fead8b9ce79c4f6
Reviewed-on: https://go-review.googlesource.com/70250
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-12 16:43:49 +00:00
Tobias Klauser
ebfc5b4631 unix: generate GOARCH specific zsysctl files on OpenBSD
Since CL 10087 build tags for GOOS and GOARCH are emitted by
mksysctl_openbsd.go but the generated file is always written to
zsysctl_openbsd.go.

Adjust mkall.sh to write to GOOS/GOARCH specific files and create a
zsysctl_openbsd_${GOARCH}.go file for each GOARCH supported on openbsd.

Change-Id: Id2a7b2815081f024de0ca87ba870a672bab32d24
Reviewed-on: https://go-review.googlesource.com/68870
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-06 17:50:12 +00:00
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