Commit Graph

566 Commits

Author SHA1 Message Date
David Anderson
0cf1ed9e52 unix: add IoctlSetPointerInt
IoctlSetPointerInt is necessary for interacting with the PPP kernel
driver, which wants it passed as a pointer to int, rather than the
more conventional int cast as a pointer.

We can technically do this already with
IoctlSetInt(int(uintptr(unsafe.Pointer(&foo)))), but that's just
masking the operation we're trying to execute in the first place,
and relying on the internals of IoctlSetInt to do the right
inverse transformation.

Change-Id: I1e6a1dd6190c11f06c6f5393cd2cae453939878a
GitHub-Last-Rev: a88f56073d
GitHub-Pull-Request: golang/sys#25
Reviewed-on: https://go-review.googlesource.com/c/150321
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-21 00:28:34 +00:00
David Anderson
ec83556a53 unix: add ioctl definitions for PPP interfaces.
Change-Id: I76b53563e3f029d1fbaad39acd5af73df278343e
GitHub-Last-Rev: b0aff54248
GitHub-Pull-Request: golang/sys#24
Reviewed-on: https://go-review.googlesource.com/c/150317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-19 19:55:03 +00:00
David Anderson
93218def8b unix: add sockaddr and defines for PPPoE sockets.
`sockaddr_pppox` is a packed struct, which godefs doesn't understand.
So, I had to do the byte packing by hand instead.

Change-Id: Ib92cf43f8ae0729a0af043c4241063911c95e6bf
GitHub-Last-Rev: 8982dec099
GitHub-Pull-Request: golang/sys#23
Reviewed-on: https://go-review.googlesource.com/c/149757
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-11-16 16:16:06 +00:00
Tobias Klauser
5ac8a444bd unix: export FdSet bits field on freebsd
After CL 136816 the bits member of the FdSet struct is no longer
exported. Make sure to retain it in mkpost.go and rename it to Bits
as on all other systems.

Change-Id: I860b307a80c7e29b4a75d9d916d879ee0a31c014
Reviewed-on: https://go-review.googlesource.com/c/149897
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-16 15:22:17 +00:00
Tobias Klauser
66b7b1311a unix: add IoctlGetPtmget on netbsd
This ioctl is used to implement ptsname on netbsd.

Change-Id: Ic87f1bf7d15c6fbef0c2226a06a4983a504c3f30
Reviewed-on: https://go-review.googlesource.com/c/148097
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-07 16:59:24 +00:00
Tobias Klauser
3a76605856 unix: test UtimesNanoAt on darwin
Change-Id: I18354d29db909227ae75df1c8b1ab7888375f8db
Reviewed-on: https://go-review.googlesource.com/c/147740
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-06 13:59:30 +00:00
Tobias Klauser
3a27cdcbcf unix: don't use deprecated sys/capability.h header on FreeBSD
sys/capability.h is deprecated, use sys/capsicum.h instead.

Change-Id: I05a3b8ff28d4df6536a3f10e0da7381b48329738
Reviewed-on: https://go-review.googlesource.com/c/147737
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-06 13:43:33 +00:00
Lynn Boger
7155702f2d unix: fix errors in syscalls when using -linkshared on ppc64x
When using -linkshared, the external linker on ppc64x cannot
always handle the direct branch to syscall.Syscall and similar
similar functions when the offset is too far. Instead it should
be done as a BL which can then be called through a procedure
linkage table entry.

This change removes functions Syscall, Syscall6,
RawSyscall, RawSyscall6 from asm_linux_ppc64x.s and instead
creates Go functions which call their corresponding
functions in the syscall package. As Go functions, they can be
inlined with the help of CL 147361.

Fixes golang/go#16662

Change-Id: Ibd2b6ec15b0781c3d7db25e249a3ffc9e1c2884b
Reviewed-on: https://go-review.googlesource.com/c/146518
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-11-06 07:38:32 +00:00
Tobias Klauser
9b800f95db unix: avoid index out of range in *setxattr on BSD
Passing an empty data []byte to Fsetxattr/Setxattr/Lsetxattr leads
to an index out of range panic. Fix this by passing an nil
unsafe.Pointer to the underlying syscall in this case.

Change-Id: I5ef3983c6304c5317ed5b49afc4ed19791864dbb
Reviewed-on: https://go-review.googlesource.com/c/146198
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-31 14:35:58 +00:00
Tobias Klauser
7e31e0c00f unix: add remaining *at functions on dragonfly
Add Faccessat, Fchownat, Linkat, Mkdirat, Mknodat, Symlinkat and
Unlinkat.

Change-Id: I9a2758ea2ca31aa59c57ead01838c08cbab2bbe1
Reviewed-on: https://go-review.googlesource.com/c/145819
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-30 15:01:19 +00:00
Tobias Klauser
f7626d0b15 unix: add remaining *at functions on netbsd
Add Fchownat, Linkat, Mkdirat, Mkfifoat, Mknodat, Openat, Readlinkat,
Renameat, Symlinkat and Unlinkat.

Change-Id: Id498b2f1a99f281599bc226a0c50a13172e36e4f
Reviewed-on: https://go-review.googlesource.com/c/145818
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-30 14:20:55 +00:00
Tobias Klauser
c8e336422f unix: add remaining *at functions on openbsd
Add Fchownat, Linkat, Mkdirat, Mkfifoat, Mknodat, Renameat, Symlinkat
and Unlinkat.

Change-Id: I023214f3b65e3b7d620fa7e1ce12f1c35a765cd9
Reviewed-on: https://go-review.googlesource.com/c/145817
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-30 13:39:55 +00:00
Tobias Klauser
d69651ed34 unix: add Readlinkat on openbsd
Change-Id: I1069c327a5ce01ca2bfa37a889d3c6fd72b7859d
Reviewed-on: https://go-review.googlesource.com/c/145517
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-29 17:45:26 +00:00
Tobias Klauser
95b1ffbd15 unix: add Openat on dragonfly
Change-Id: I1bf134301e5e81e6d6524bf63532975166694db6
Reviewed-on: https://go-review.googlesource.com/c/144978
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-26 20:36:30 +00:00
Tobias Klauser
9ff3f177ec unix: add Openat on netbsd
Change-Id: Ie37958307e8bf6d5fd47caa7ab5b1c209d0cca00
Reviewed-on: https://go-review.googlesource.com/c/144977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-26 20:36:11 +00:00
s7onith
2772b66316 unix: allow to pass a NULL pointer to the pledge syscall
Added PledgePromises and PledgeExecpromises functions
Added the pledgeAvailable helper function to check for pledge(2)
availability

Change-Id: Ib40e7eb481f70e4c02219db0ad445dfaa92aba2b
Reviewed-on: https://go-review.googlesource.com/c/142898
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-26 14:45:32 +00:00
Tobias Klauser
731415f00d unix: add kernel module load/unload syscalls on Linux
InitModule loads a kernel module from an ELF image. FinitModule loads a
kernel module from a file descriptor. DeleteModule unloads a kernel
module.

These syscalls require the CAP_SYS_MODULE capability.

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

Also drop deprecated syscalls related to kernel modules from the list
of unimplemented syscalls.

Change-Id: I131e17f02c5617640f5f4073982d2b27a6d78bbf
Reviewed-on: https://go-review.googlesource.com/c/144173
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-26 06:49:43 +00:00
Ivan Markin
d989b31c87 unix: add support for OpenBSD unveil(2)
Now as `SYS_UNVEIL` has landed in `x/sys`, it's time to have a convenient handle for it too.

Change-Id: I61db9cc23fa9f2e10bac601959002319ea9c854b
GitHub-Last-Rev: eb9487242e
GitHub-Pull-Request: golang/sys#19
Reviewed-on: https://go-review.googlesource.com/c/142317
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-25 06:32:00 +00:00
Tobias Klauser
5cd93ef61a unix: use ppoll to implement Pause on linux/{arm64,riscv64}
Use ppoll instead of re-implementing it using Syscall6(SYS_PPOLL, ...)

Change-Id: I7b3baa00df32dc1fe7ee80755843a492a884938c
Reviewed-on: https://go-review.googlesource.com/c/144171
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-24 14:56:15 +00:00
Tobias Klauser
22bddfe262 unix: add Openat on openbsd
Change-Id: I0c9d97d7db72e74cfd5d7ba77c46726ec38b821b
Reviewed-on: https://go-review.googlesource.com/c/144172
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-24 14:55:22 +00:00
Tobias Klauser
44b849a8bc unix: add Ppoll on openbsd
Change-Id: I3a13730e219e6f6df28829cf0d1e193c62073ac8
Reviewed-on: https://go-review.googlesource.com/c/144057
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-23 15:21:57 +00:00
Tobias Klauser
8a28ead16f unix: update Dockerfile to Linux 4.19
Change-Id: I58c2cfb11ddd5ce731a880c0c63790092052f130
Reviewed-on: https://go-review.googlesource.com/c/143697
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-22 13:44:30 +00:00
Ivan Markin
8b8824e799 unix: don't use local syscall number in Pledge()
Change-Id: Ifecafeedd733d4b33ef082a8f505165de9bac20a
GitHub-Last-Rev: 44c40b0424
GitHub-Pull-Request: golang/sys#20
Reviewed-on: https://go-review.googlesource.com/c/142318
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-22 07:43:55 +00:00
Yuval Pavel Zholkover
5535b4e6bf unix: FreeBSD 12 ino64 support
Background:
The 64-bit inode project was merged into the upcoming FreeBSD 12 release.
It changes the ABI for structs holding inodes: stat, statfs, dirent.
New system call numbers were introduced which accept the new struct layouts,
the old ones were marked as COMPAT11.
Their equivalent libc wrappers are using ELF symbol versioning.
The new wrappers have moved from @FBSD_1.0 to @FBSD_1.5.

Backward and forward compatability is achieved by always using the new struct
layouts while converting the old struct instance to the new layout on old kernels.
https://svnweb.freebsd.org/base?view=revision&revision=318736
https://svnweb.freebsd.org/base?view=revision&revision=320278

The same approach is used for Go:
The new Stat_t, Statfs_t and Dirent types hold 64-bit inodes and additional ABI
changes, they are generated from their C definitions in FreeBSD-12 using cgo -godefs.
Each type has an unexported *_freebsd11 counterpart generated the same way.
Previous directly exposed syscalls like Fstat have now a wrapper in place calling
either fstat or fstat_freebsd12 zsyscall wrapper based on the kern.osreldate.
If an old syscall needs to be used, then the returned *_freebsd11 result is converted
to the new layout before returning from the wrapper.

Introduce supportsABI() call to check the kern.osreldate sysctl for the ABI version.
Drop the old struct stat8 definition in favour of the <sys/stat.h> version.
Run the mktypes part of GOOS=freebsd GOARCH={386,amd64,arm} ./mkall.sh
on FreeBSD-12.0-ALPHA6 (r338675), updating all types except Kevent.

Expose Mknodat, both COMPAT11 version (currently missing) and the FreeBSD 12 one.
Some COMPAT11 syscalls have no direct FreeBSD 12 counterpart, in those cases
an *at(AT_FDCWD, ...) is used instead.

Updates golang/go#22448

Change-Id: I87940b88ae358db88103cdcd06f9cafbf4694cfc
Reviewed-on: https://go-review.googlesource.com/c/136816
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-10-22 06:42:59 +00:00
Ivan Markin
eda9bb28ed unix: update syscall numbers to OpenBSD 6.4
For all supported platforms (386, amd64, arm).

Note that this doesn't update whole `unix` package for these platforms.

Change-Id: I0a66f8403f704c6328000ffc9f238989c22936d2
GitHub-Last-Rev: 14fd451964
GitHub-Pull-Request: golang/sys#21
Reviewed-on: https://go-review.googlesource.com/c/143542
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>
2018-10-21 15:56:30 +00:00
Tobias Klauser
8e24a49d80 unix: add SOF_TIMESTAMPING_* flags on Linux
Add the SOF_TIMESTAMPING_* flags used to request different types of
timestamping operations. In

  err := unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_TIMESTAMPING, val)

val is a mask of SOF_TIMESTAMPING_* values.

See https://www.kernel.org/doc/Documentation/networking/timestamping.txt
for more information.

Fixes golang/go#28173

Change-Id: I26e964d607606f2b3cb24f66f071d11765b9696e
Reviewed-on: https://go-review.googlesource.com/c/143337
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-19 16:01:39 +00:00
chigotc
8f1d3d21f8 unix: add support for aix/ppc64, gc implementation
This commit ports unix package for aix/ppc64 with gc implementation.

In order to merge as much as possible gc and gccgo implementation, the
mksyscall_aix_ppc64.pl creates three files.

zsyscall_aix_ppc64.go is common for both implementation. It has the main
syscall function and handles the pointer creations, type conversions
and the error if needed. It calls a function "call..." which is
available for each implementation.

zsyscall_aix_ppc64_gc.go is the gc part. It implements "call..."
functions using //go:cgo_import_dynamic and //go:linkname. It is
based on syscall.syscall6 function.

zsyscall_aix_ppc64_gccgo.go is the gccgo part. It implements "call..."
functions using cgo and C functions.

Some unavailable syscalls were also removed from the previous
implementation.

For aix/ppc, the script is left unchanged as aix/ppc won't be
implemented inside gc.

Change-Id: I3701095df31517c66f95874ba8e682967993090b
Reviewed-on: https://go-review.googlesource.com/c/143117
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-10-19 08:45:34 +00:00
Tobias Klauser
fa43e7bc11 unix: add marker comments to zsyscall_solaris_amd64.go
These marker comments are in every other zsyscall_*.go file generated by
mksyscall.pl and mksyscall_aix.pl. Also add them to the file generated
by mksyscall_solaris.pl.

Change-Id: Ic0ad5f28dd0a0934aa768f58ccc390b613a36abb
Reviewed-on: https://go-review.googlesource.com/c/141557
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 15:26:04 +00:00
Tobias Klauser
4497e2df6f unix: convert errorList and signalList to new format for linux/sparc64
This wasn't converted during CL 110875

Updates golang/go#25134

Change-Id: Iaa579e0c173d3e27cf9f7e20072752277089beb1
Reviewed-on: https://go-review.googlesource.com/c/139977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-05 13:31:03 +00:00
Tobias Klauser
f81de40a84 unix: add KexecFileLoad on linux/{amd64,ppc64x,s390x}
Add a wrapper for the kexec_file_load syscall on the architectures that
implement it (amd64, ppc64x, s390x). See
http://man7.org/linux/man-pages/man2/kexec_file_load.2.html

Change-Id: Ie29f871902176610a6ba7ed0a7bcc95c10eb172b
Reviewed-on: https://go-review.googlesource.com/c/140037
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-05 13:07:39 +00:00
Tobias Klauser
8469e31483 unix: export sizeof consts
Export the sizeof(Ptr|Short|Int|Long|LongLong) consts. This allows users
to get this information (e.g. for alignment purposes) without using cgo
or generating these constants themselves.

Change-Id: I8640482bf67b89c2f2b6e9a116ba7bc268f8135a
Reviewed-on: https://go-review.googlesource.com/c/139617
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-04 14:53:25 +00:00
Tobias Klauser
af653ce8b7 unix: use correctly aligned result buffer in SysctlClockinfo
It's not guaranteed that the []byte buffer will be aligned as
required for Clockinfo. Use a Clockinfo var for the sysctl call
instead.

This came up during the review for SysctlUvmexp on OpenBSD in CL
139278. Thanks to Ian Lance Taylor for pointing this out.

Change-Id: Idc7a624922da7249c6e7d5ce0236a431b58ebe5f
Reviewed-on: https://go-review.googlesource.com/c/139279
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-03 14:59:44 +00:00
Tobias Klauser
679a27dec1 unix: add SysctlUvmexp on OpenBSD
OpenBSD uses sysctl with struct uvmexp to get information from the
virtual memory system of the kernel. Add type Uvmexp and the
SysctlUvmexp function to query this information.

This will be used in github.com/tklauser/go-sysconf to get
_SC_AVPHYS_PAGES on OpenBSD.

Change-Id: I96ded2d1be37e5307bab55e79b13234cc93d21e6
Reviewed-on: https://go-review.googlesource.com/c/139278
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-03 14:57:07 +00:00
Tobias Klauser
219bb53033 unix: re-add vm.* sysctl strings on openbsd/amd64
These sysctl strings were lost in CL 114075 which updated openbsd/amd64
to OpenBSD 6.3. Re-add them by adding uvm/uvmexp.h to mksysctl_openbsd.pl.
The defines for the VM_* constants were moved to this header in
OpenBSD 6.3.

Change-Id: If4291380d6d8235485d91c4442076dd03485bc2c
Reviewed-on: https://go-review.googlesource.com/c/139277
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-03 12:56:02 +00:00
Matt Layher
e4b3c5e906 unix: add NCSI generic netlink constants
Change-Id: I458f69e01fb64ff66f0b518c547d9eca3e8625cb
Reviewed-on: https://go-review.googlesource.com/138375
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-28 13:38:29 +00:00
Tobias Klauser
dad3d9fb7b unix: add ClockGetres on Linux
Change-Id: Id60c9310bad85e02ec81b04e7f304f058b680822
Reviewed-on: https://go-review.googlesource.com/138116
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-27 15:05:00 +00:00
Tobias Klauser
8ccfc68037 unix: add SysctlClockinfo on NetBSD
NetBSD uses sysctl with struct clockinfo to get clock rate information
from the kernel. Add type Clockinfo and the SysctlClockinfo function
to query this information.

This will be used in github.com/tklauser/go-sysconf to get _SC_CLK_TCK
on NetBSD.

Change-Id: I9e67d766f491ec3b460f26cb243b3595f0ba4d69
Reviewed-on: https://go-review.googlesource.com/138035
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-27 15:03:35 +00:00
Lynn Boger
c2ed4eda69 unix: fix TestSchedSetaffinity for smt settings
If a system has the ability to disable some cores, as on
ppc64 with the ppc64_cpu command, then TestSchedSetaffinity will
fail if the CPUset passed to Setaffinity includes one that has
been disabled.

This adds a check to use values from the oldMask, which are the valid
cores returned from Getaffinity, to pass to Setaffinity.

Fixes golang/go#27875

Change-Id: I9656f41867afc18e0eaedc4bdef5f75e137a1fcd
Reviewed-on: https://go-review.googlesource.com/137675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-26 16:07:41 +00:00
Tobias Klauser
2f1df4e56c unix: add additional rlimit resource constants on NetBSD
CL 45052 added them to mkerrors.sh but they weren't generated on NetBSD. Do so now.

Change-Id: I314b0b7b203aba910a5733f9fbb63b1a0e6ccecf
Reviewed-on: https://go-review.googlesource.com/137595
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-26 14:17:14 +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
Jordan Rhee
90868a75fe windows: add support for windows/arm
Updates golang/go#26148

Change-Id: I0425244bfb0c8f600a6f02d9d7b228e175a720a4
Reviewed-on: https://go-review.googlesource.com/127665
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-24 17:59:46 +00:00
Tobias Klauser
f02c79500a unix: add MNT_* flags on DragonflyBSD
Change-Id: I0326a7bfcf3cd794eb1158055a8ee98a396d3b47
Reviewed-on: https://go-review.googlesource.com/136818
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-24 17:12:10 +00:00
Tobias Klauser
c01370cb5c unix: add MNT_* flags on NetBSD
Change-Id: Ifc720a583a830883908e83bfe0e2d74c2bfa013f
Reviewed-on: https://go-review.googlesource.com/136817
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-24 14:20:50 +00:00
Matt Layher
d47a0f3392 unix: implement Linux AF_XDP sockets
Provides access to the Linux AF_XDP socket family.  For more
information on AF_XDP, see:
https://www.kernel.org/doc/html/latest/networking/af_xdp.html.

Change-Id: I7efb82c4a67da3e15932e3c0d882f0bad7ba16ef
Reviewed-on: https://go-review.googlesource.com/136695
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-09-21 16:39:48 +00:00
Tobias Klauser
d641721ec2 unix: add more RTA_* constants on Linux
Now all non-deprecated RTA_* constants as of Linux v4.18 are present.

Change-Id: Ib04e233015f381ceb7c7e06b3d808f3c7948f5b4
Reviewed-on: https://go-review.googlesource.com/136456
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-09-20 11:09:15 +00:00
Tony Reix
1561086e64 unix: add Termio, Winsize, Statfs_t, TC[GS]ET, Mkdir and Mknod for AIX
These changes add Termio/Winsize/Statfs_t for AIX, constants TC[GS]ET and the syscalls Mkdir and Mknod.
It also changes the comments for AIX which still were talking about Linux and glibc.

Change-Id: I64325330328d6e16cff540f103fdfa533b7d8f5b
Reviewed-on: https://go-review.googlesource.com/136295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-09-19 16:26:11 +00:00
Tobias Klauser
1061eb656b unix: change MemfdCreate flags parameter to int for all GOARCHes
For some reason I didn't completely re-generate the zsyscall_linux_*
files for all GOARCHes during review of CL 135915. Do so now such that
the flags parameter is of type int on all GOARCHes.

Change-Id: Ifc4afacfbedb70f3818b23ed3ea468745bbdb455
Reviewed-on: https://go-review.googlesource.com/136296
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-19 16:13:05 +00:00
Tobias Klauser
ee1b12c67a unix: add MemfdCreate on Linux
Add a wrapper for the memfd_create syscall on Linux. See
http://man7.org/linux/man-pages/man2/memfd_create.2.html for more
information.

Also add the corresponding MFD_* constants to be used in the flags
argument.

Change-Id: Ib30a007e15575a38ecf204601ffede9c913799b6
Reviewed-on: https://go-review.googlesource.com/135915
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-18 15:37:33 +00:00
Leigh McCulloch
d0be0721c3 unix: correct misspelling in test output
The TestRlimitAs function has fatal output that uses the word 'suceeded'
that is a misspelling of 'succeeded'.

Change-Id: Id235c9e38338e09c5c06c4ed4a0037afc8f6f2bd
GitHub-Last-Rev: 84d6abe576
GitHub-Pull-Request: golang/sys#17
Reviewed-on: https://go-review.googlesource.com/134220
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-09 12:40:46 +00:00
Leigh McCulloch
4526dd3c8b windows: correct misspelling in comment
The comment for ConsoleScreenBufferInfo uses the word 'retreive' that
is a misspelling of 'retrieve'.

Change-Id: Idd9fb0c5082b6a2b10badbbb162e312710bfe68b
GitHub-Last-Rev: 08d62a57df
GitHub-Pull-Request: golang/sys#18
Reviewed-on: https://go-review.googlesource.com/134221
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-09 07:10:14 +00:00