Commit Graph

455 Commits

Author SHA1 Message Date
Alex Vaghin
bc2ef10f1b cpu: add gccgo implementation
It uses __get_cpuid_count, provided by cpuid.h.
The xgetbv is implemented after its counterpart in cpu_x86.s.

Change-Id: I97624d7da67ab4ec3c9a53b0bfc4dfcdf7d12c87
Reviewed-on: https://go-review.googlesource.com/116155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-06 16:53:29 +00:00
Tobias Klauser
538ab54ba9 cpu: introduce and export type CacheLinePad
Add a CacheLinePad struct type that has a size of cacheLineSize.
This can be used for padding structs in order to avoid false sharing.

Fixes golang/go#25203

Change-Id: I6b6daf91ea0e9c50428ffa053035429c3921b461
Reviewed-on: https://go-review.googlesource.com/111775
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-06 11:15:58 +00:00
Tobias Klauser
c11f84a56e unix: don't check atime in TestStatx
On some builders TestStatx occassionally fails when comparing atime
between Statx and Stat/Lstat.

--- FAIL: TestStatx (0.00s)
	syscall_linux_test.go:365: Statx: returned stat atime does not match Lstat

Fix it by dropping the atime comparison, it's enough to verify Statx
working correctly by comparing ctime and mtime. Also, not all
filesystems support atime.

Change-Id: I7da68bd20b9b21274c4993aa2c4241395d2c933a
Reviewed-on: https://go-review.googlesource.com/114616
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-25 14:28:21 +00:00
Tobias Klauser
d4cedef346 unix: make Nfgenmsg a type definition
CL 114518 introduced Nfgenmsg as a type alias which breaks the build on
Go <= 1.9. Fix it by making Nfgenmsg a type like all others in
x/sys/unix

Updates golang/go#25561
Fixes golang/go#25563

Change-Id: I9950be857e34e7e3ca79c71fced9663a0cac9b63
Reviewed-on: https://go-review.googlesource.com/114596
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-25 12:34:33 +00:00
Michael Stapelberg
31355384c8 unix: add nftables defines and types
Change-Id: I55efe06ec81e891ec3872405ba75c7eb9ce4e635
Reviewed-on: https://go-review.googlesource.com/114518
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-05-25 06:20:15 +00:00
Tobias Klauser
b269ba27ed unix: fix TestXattr on android
Like on linux, lsetxattr on symlinks returns EPERM.

Change-Id: I6dfc59484e1826872af54579dd6ec02705c816da
Reviewed-on: https://go-review.googlesource.com/114535
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-24 22:17:17 +00:00
Tobias Klauser
04b83988a0 unix: fix or skip failing tests on android and iOS
The mkfifo syscall is disallowed on android and iOS. sched_setaffinity
is disallowed on android. Skip all tests which use them.

/usr/bin does not exist on android. Use /system/bin in TestGetwd
instead, like TestChdirAndGetwd in the os package.

Like linux, android does not support Fchmodat with flags != 0. Adjust
TestFchmodat accordingly.

TestDevices might stat some device files which are not accessible, skip
those.

iOS cannot exec subprocesses, thus skip TestPassFD.

Fixes golang/go#25535

Change-Id: Ic764b9152f0a7b703ad4f47fdb1a9a5e94718154
Reviewed-on: https://go-review.googlesource.com/114395
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-24 13:58:53 +00:00
Tobias Klauser
e2c7578ad1 unix: delete TestDevices for *BSD and Darwin
Instead, add a small test verify Major, Minor and Mkdev using arbitrary
numbers.

Leave TestDevices on Linux as its major/minor numbers are guaranteed
stable.

Updates golang/go#25528
Updates golang/go#25535

Change-Id: Ic105211660d80f9b3508ca9d518e9fac3b7e3beb
Reviewed-on: https://go-review.googlesource.com/114396
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-24 12:53:35 +00:00
pytimer
56ad15cc21 windows: add QueryServiceStatusEx function
Fixes golang/go#25485

Change-Id: Ic00df1f86591c00fa88cddcb03c7ced0c6bdb0c1
Reviewed-on: https://go-review.googlesource.com/114215
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-05-24 10:43:36 +00:00
Tobias Klauser
77b0e43150 unix: add symlink-safe *xattr functions on darwin
Updates golang/go#14456

Change-Id: I04632ef1d302e938a2cc373eb90f600f01404380
Reviewed-on: https://go-review.googlesource.com/114198
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-23 21:11:48 +00:00
Hana Kim
f3b0f5faf5 unix: skip TestStatx if the operation is not permitted
Fixes golang/go#25529

Change-Id: Ifb7060106608fab0c87ce4596c9f16c14bde6205
Reviewed-on: https://go-review.googlesource.com/114093
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-23 20:51:00 +00:00
Hana Kim
028bb33fd0 unix: delete TestDevices test for Solaris
The test uses hardcoded numbers specific to one Solaris variant or
version. It's not guaranteed that they are stable over time or
across variants.

Fixes golang/go#25528

Change-Id: I148bd4d8264b802f07a2e886b99e76a40824af35
Reviewed-on: https://go-review.googlesource.com/114092
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-23 20:44:46 +00:00
Tobias Klauser
88eb85aaee unix: add tests for *xattr functions
Based on the tests in github.com/pkg/xattr

Change-Id: I3af73ad538877da042602708248063c218260a2e
Reviewed-on: https://go-review.googlesource.com/114135
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-22 22:42:04 +00:00
Hana Kim
dc67e5b82c windows: address error reported by vet
https://storage.googleapis.com/go-build-log/489a6b5c/misc-vet-vetall_c1e51035.log
cmd/vendor/golang.org/x/sys/windows/asm_windows_amd64.s:12: [amd64] loadlibrary: wrong argument size 8; expected $...-24

Change-Id: I02e7c53216e2c55d0d062e50f72984228c214e23
Reviewed-on: https://go-review.googlesource.com/114082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-22 22:16:54 +00:00
irfan sharif
0b6bef9960 unix: add {get,set,remove,list}xattr on darwin
It's only when dest is set to NULL that the OS X implementations of
getxattr() and listxattr() return the current sizes of the named
attributes. An empty byte array is not sufficient. To maintain the same
behaviour as the linux implementation, we wrap around the system calls
and pass in NULL when dest is empty.

The parameters for the OS X implementation of setxattr() vary slightly
compared to the linux system call, specifically the 'position'
parameter:

 linux:
     int setxattr(
         const char *path,
         const char *name,
         const void *value,
         size_t size,
         int flags
     );

 darwin:
     int setxattr(
         const char *path,
         const char *name,
         void *value,
         size_t size,
         u_int32_t position,
         int options
     );

'position' specifies the offset within the extended attribute. In the
current implementation, only the resource fork extended attribute makes
use of this argument. For all others, position is reserved.  We simply
default to setting it to zero.  If that's needed by the package user, a
function with a different name needs to be implemented instead.

Similarly for removexattr(), we wrap around and explicitly zero out the
options provided. We do so for interoperability with the linux variant.
If options are needed by the package user, a function with a different
name needs to be implemented instead.

Fixes golang/go#14456

Change-Id: I2581e1fa8dc9324bced7fda7f8ada10fe2ede3f5
Reviewed-on: https://go-review.googlesource.com/113995
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-22 21:16:09 +00:00
Filippo Valsorda
7f59abf37b unix: update openbsd/amd64 to OpenBSD 6.3
Change-Id: I0a16c77437e4ed68cc19eda41bb9b64ab4376fd0
Reviewed-on: https://go-review.googlesource.com/114075
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-05-22 14:59:51 +00:00
Tobias Klauser
89da893103 unix: exclude AUDIT_RECORD_MAGIC constant on darwin
CL 112696 changed mkerrors.sh to add filesystem magic constants on
linux. This leads to the unrelated AUDIT_RECORD_MAGIC constant being
added on darwin. Avoid this by explicity excluding it in mkerrors.sh.

Change-Id: I5a73797e5e9a1a92cb39f96f360fdb48982a7741
Reviewed-on: https://go-review.googlesource.com/114095
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-22 13:13:21 +00:00
Tobias Klauser
7c87d13f8e unix: add tpacket types and constants on Linux
Change-Id: I4f2fd8a7c899403f545d8dc73fec2ebbb0b322c0
Reviewed-on: https://go-review.googlesource.com/113035
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-14 14:36:08 +00:00
Brad Fitzpatrick
d0faeb5398 unix: fix TestSCMCredentials to not fail when root
Fixes golang/go#25354

Change-Id: Ic74005ed26792a78354ffe76f567e9a009eabe9a
Reviewed-on: https://go-review.googlesource.com/112738
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-05-11 16:50:53 +00:00
Tobias Klauser
9950ad118b unix: add statfs and filesystem magic constants on Linux
Fixes golang/go#25341

Change-Id: I79cb4c77b771e005eb27d4e495ac6a7491e2e66e
Reviewed-on: https://go-review.googlesource.com/112696
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-11 13:39:06 +00:00
Hana (Hyang-Ah) Kim
7dfd1290c7 windows: address vet reports
Found in https://storage.googleapis.com/go-build-log/300ed876/misc-vet-vetall_dd96a388.log

cmd/vendor/golang.org/x/sys/windows/asm_windows_386.s:9: [386] getprocaddress: wrong argument size 8; expected $...-16
cmd/vendor/golang.org/x/sys/windows/asm_windows_386.s:12: [386] loadlibrary: wrong argument size 4; expected $...-12
cmd/vendor/golang.org/x/sys/windows/svc/service.go:337: cmd/vendor/golang.org/x/sys/windows.SERVICE_TABLE_ENTRY composite literal uses unkeyed fields
cmd/vendor/golang.org/x/sys/windows/svc/service.go:338: cmd/vendor/golang.org/x/sys/windows.SERVICE_TABLE_ENTRY composite literal uses unkeyed fields
cmd/vendor/golang.org/x/sys/windows/svc/debug/service.go:34: cmd/vendor/golang.org/x/sys/windows/svc.ChangeRequest composite literal uses unkeyed fields
cmd/vendor/golang.org/x/sys/windows/svc/mgr/config.go:124: cmd/vendor/golang.org/x/sys/windows.SERVICE_DESCRIPTION composite literal uses unkeyed fields

Change-Id: Ic08cfcc802aac89cfa1eb98661ec556c844e8013
Reviewed-on: https://go-review.googlesource.com/112557
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-10 03:28:50 +00:00
Hana (Hyang-Ah) Kim
64746a42f3 unix: address vet's finding of wrong argument size
From https://storage.googleapis.com/go-build-log/ebe363d0/misc-vet-vetall_b459ec91.log

cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:16: [amd64] Syscall: wrong argument size 64; expected $...-56
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:19: [amd64] Syscall6: wrong argument size 88; expected $...-80
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:22: [amd64] Syscall9: wrong argument size 112; expected $...-104
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:25: [amd64] RawSyscall: wrong argument size 64; expected $...-56
cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s:28: [amd64] RawSyscall6: wrong argument size 88; expected $...-80

Change-Id: I5c2264154e819a124aade5d18d261b7934b0090a
Reviewed-on: https://go-review.googlesource.com/112556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-09 20:58:23 +00:00
Tobias Klauser
7db1c3b1a9 cpu: use t.Fatal instead of t.Fatalf
The messages contain no format string, so there is no need to use
t.Fatalf.

Change-Id: I29098c04797f919784b732af84a63fbaed671558
Reviewed-on: https://go-review.googlesource.com/111776
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-07 13:57:25 +00:00
Tobias Klauser
6f686a352d unix: add ErrnoName and SignalName
Add ErrnoName and SignalName to get errno and signal name strings from
syscall.Errno and syscall.Signal values, respectively.

This repurposes the errors and signals vars (because they are not used
within x/sys/unix currently) and turns them into slices of struct,
containing errno/signal number, name and description. ErrnoName and
SignalName can then be trivially implemented using sort.Search.

Renaming errors to errorList additionaly allows to avoid package aliases
for the errors package.

Fixes golang/go#25134

Change-Id: Ie195872793f44c437f0f175ccfaa13a2546338c5
Reviewed-on: https://go-review.googlesource.com/110875
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-05-04 06:42:12 +00:00
Alex Brainman
78d5f264b4 windows/svc: correct MOVL instruction in sys_amd64.s
Second argument of servicemain is a pointer. See

https://msdn.microsoft.com/en-us/library/windows/desktop/ms685138(v=vs.85).aspx

So amd64 assembler code should use MOVQ to read that value.
I probably copied 386 assembler code into amd64 and did not
adjust the code.

Broken code was used to pass parameters to the service, so
add some tests to verify that parameter passing works.

Fixes golang/go#24575

Change-Id: I89f8cad026ea13f8a5d78ff3e24b7236e27fc91f
Reviewed-on: https://go-review.googlesource.com/110160
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-01 09:27:40 +00:00
Andreas Auernhammer
4adea008a5 cpu: new package
This CL introduces a new cpu package for CPU/platform feature detection.
The cpu package is basically a copy of `internal/cpu` of the standard library.
Revision: bf86aec25972f3a100c3aa58a6abcbcc35bdea49

This CL does not export ARM64 and PPC64 feature detection since at the moment
ARM64/PPC64 requires standard library support.

Updates golang/go#24843

Change-Id: I11bc1ca60b116e902c941b5887c00870dbb1f899
Reviewed-on: https://go-review.googlesource.com/107015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30 17:35:09 +00:00
Tobias Klauser
f67ecc163a unix: use Fstatat for Stat on linux/amd64
The stat syscall is disallowed by Android's seccomp policy on
linux/amd64. Use the fstatat syscall with AT_FDCWD and zero flags to
achieve the same behavior.

CL 109835 did the same for package syscall.

Change-Id: Iaa7d0dbf17ade4803f59b4361973ce627bcb65b4
Reviewed-on: https://go-review.googlesource.com/110061
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30 07:01:21 +00:00
Jason A. Donenfeld
cbbc999da3 unix: use pselect on amd64 to satisfy Android
This is yet another syscall that needs to be changed around for
Android's seccomp. We already do this in MIPS64 and ARM64, but
apparently forgot about AMD64.

Change-Id: I42c8a4653a55d4714dacfaf7add14012f428c992
Reviewed-on: https://go-review.googlesource.com/109835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-27 15:18:31 +00:00
Ian Lance Taylor
bb9c189858 unix: 32-bit MIPS splice system call returns int, not int64
Change-Id: If795a53b8532c35731f18b9a94ca8c53a4bc23c2
Reviewed-on: https://go-review.googlesource.com/109357
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-25 19:48:35 +00:00
Matt Layher
79b0c68887 unix: add Linux block device ioctl types and constants
These types and constants are taken from hdreg.h, and will enable
querying and manipulation of block devices on Linux.

Fixes golang/go#24971

Change-Id: Iafe8f81ba7ab9f1e127743dab6a9fb1912874a5c
Reviewed-on: https://go-review.googlesource.com/108455
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-04-20 14:53:19 +00:00
Jason A. Donenfeld
a2a45943ae unix: avoid extra syscall on send/recvmsg on Linux
By simply rearranging the logic, we avoid the overhead of a superfluous
call to getsockopt. For, if p is already non empty, there's no point
in having to check if we need to attach dummy payload. This has
performance benefits when using send/recvmsg for high speed
communications.

Change-Id: If47ab5322464aad8e6d2603a369e95327223211f
Reviewed-on: https://go-review.googlesource.com/108337
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-19 22:20:23 +00:00
Matt Layher
3ccc7e5779 unix: fix typos in linux/types.go.
Change-Id: I0cd02100844d7565f6fc18278ff52a8cceaacec5
Reviewed-on: https://go-review.googlesource.com/107938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-18 21:24:19 +00:00
Matt Layher
9b00609908 unix: add tcp_md5sig on Linux
This structure is used with setsockopt in BGP speaker implementations.

For more information, please see:
https://criticalindirection.com/2015/05/12/tcp_md5sig/.

Fixes golang/go#24830

Change-Id: Ic2137e843ad502dbe9a4227362b63164789c5877
Reviewed-on: https://go-review.googlesource.com/106656
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-18 18:02:25 +00:00
Tobias Klauser
b126b21c05 unix: re-export Fsid and Sigset_t Val member on Linux
As spotted by Brad Fitzpatrick, CL 106838 unexported the value field of
Fsid and Sigset_t, but these types would be useless without any exported
fields. Re-export them via an exception in mkpost.go

Change-Id: I30d3c3b81c8c1b6377f8aa55cad816e3486a4395
Reviewed-on: https://go-review.googlesource.com/107415
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>
2018-04-17 08:01:22 +00:00
Ivan Markin
ecfd8b563e unix: implement getrtable/setrtable syscalls on OpenBSD
Change-Id: I9f0ca3c2c1cd79f0c996ebbc7f79a42f740e0d2c
GitHub-Last-Rev: ebd0046a4f
GitHub-Pull-Request: golang/sys#10
Reviewed-on: https://go-review.googlesource.com/107302
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-16 21:11:45 +00:00
Adam Sindelar
2f57af4873 unix: add wrapper around perf_event_open on Linux
This adds a wrapper around perf_event_open, exported constants and
two structs:
 - perf_event_attr, used to configure the syscall
 - perf_event_mmap_page to coordinate the kernel's mmap ring buffer

Change-Id: Ife7ded8344de9e3eb74441bd51ab9a04c81b4965
Reviewed-on: https://go-review.googlesource.com/105756
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-16 11:22:24 +00:00
Tobias Klauser
2281fa97ef unix: don't export any padding/alignment fields on all platforms
On linux/s390x these fields are already hidden. Don't export them on any
other platform either.

Preparatory CL for https://golang.org/cl/106656

Change-Id: I421a0ba41ff46081e2576be212e246a4dd982a67
Reviewed-on: https://go-review.googlesource.com/106838
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-04-14 09:28:25 +00:00
Adam Sindelar
f6f352972f unix: add a step to mkall.go that generates ABI headers to be referenced from types.go
Change-Id: I3ecf7802c152b82c0d40f8b1bebcb25feda7fb13
Reviewed-on: https://go-review.googlesource.com/106315
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: Tobias Klauser <tobias.klauser@gmail.com>
2018-04-13 14:08:54 +00:00
Tobias Klauser
3b87a42e50 unix: update Dockerfile to Linux 4.16 and Go 1.10.1
Also avoid installing recommended packages if possible to silightly
reduce the Docker image size.

Change-Id: I7a3ea33f6501cf063b1aa0324b5928f96241d048
Reviewed-on: https://go-review.googlesource.com/105077
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-06 13:57:29 +00:00
Philip Brown
1d206c9fa8 unix: add FcntlInt
Fixes golang/go#24649
Fixes golang/go#24677

Change-Id: I3faa74ab68e093a097c3f2a8ec7c054431bdfb3f
Reviewed-on: https://go-review.googlesource.com/104736
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-04 20:37:33 +00:00
Tobias Klauser
fcb792cfc2 unix: unify Getsockopt*
Move the common Getsockopt* implementations to syscall_unix.go instead
of duplicating them in syscall_bsd.go and syscall_linux.go. This also
makes all of them available on Solaris and adds GetsockoptByte on Linux.

Change-Id: Ibf49b27be46be579e63e3b3e2ebc1504e5228d5f
Reviewed-on: https://go-review.googlesource.com/104695
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-04 15:47:05 +00:00
Chris Koch
f67933eaf9 unix: solicit EPERM via wrong PID in creds test.
In a Linux user namespace that doesn't have UID 0 mapped, WriteMsgUnix
will return an EINVAL as the uid-valid-in-uns check comes first in the kernel.

Even if in a user and PID namespace, using the wrong PID in Ucred will
always give EPERM.

Change-Id: Ia7452bbf2911c3b9a2aa5d7df1572e8b0790ff38
GitHub-Last-Rev: 341d3f0cba
GitHub-Pull-Request: golang/sys#7
Reviewed-on: https://go-review.googlesource.com/103857
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-04-04 07:11:08 +00:00
Tobias Klauser
378d26f466 unix: add CRTSCTS on netbsd and openbsd
Fixes golang/go#8760

Change-Id: Iacb5802ce6256fc5fb61b558f2d0bc0dcf593c96
Reviewed-on: https://go-review.googlesource.com/103355
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29 13:18:31 +00:00
Tobias Klauser
2de2067aa5 unix: add sendfile support on Solaris
Same was done in CL 7940 for the syscall package.

Fixes golang/go#10838

Change-Id: I98efa99f57f21bdcdbfb117af66f673e37767fec
Reviewed-on: https://go-review.googlesource.com/103335
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29 13:14:28 +00:00
Cholerae Hu
13d03a9a82 unix: add GetsockoptLinger and GetsockoptTimeval
Fixes golang/go#24515

Change-Id: Icac78e8f2937668c2ce2fd6a695ce44bb702b8f1
Reviewed-on: https://go-review.googlesource.com/102515
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-03-26 15:43:31 +00:00
Tobias Klauser
91ee8cde43 unix: use strings.IndexByte instead of for loops
Change-Id: I8d91f4f959b03f71a8f2effdf7f1c6d1308f2217
Reviewed-on: https://go-review.googlesource.com/102135
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-22 16:54:03 +00:00
Tobias Klauser
1e3c7779a7 unix: don't export padding fields on Darwin
Re-run ./mkall.sh to avoid exporting Pad_cgo* fields on Darwin.

Updates golang/go#18632

Change-Id: Id9d264293d0b1f1c5581aff289c6e826d63e71ef
Reviewed-on: https://go-review.googlesource.com/102075
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2018-03-22 15:36:57 +00:00
Tobias Klauser
c488ab1dd8 unix: add Fadvise on linux/{arm64,mipsx.mips64x,ppx64x,sparc64}
Change-Id: I3b32b6343e9bc0bb6a205ada9941b4bb9ef91a23
Reviewed-on: https://go-review.googlesource.com/101895
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-21 18:38:24 +00:00
Tobias Klauser
ee8db001f5 unix: add Fadvise on NetBSD
Change-Id: I7b32bbbfc73e8e05898bd640e9e92a183c72b92b
Reviewed-on: https://go-review.googlesource.com/101935
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-21 18:38:08 +00:00
Tobias Klauser
bb729a5782 unix: fix TestFchmodat on Illumos
On Illumos, TestFchmodat fails with:

--- FAIL: TestFchmodat (0.00s)
        syscall_unix_test.go:502: Fchmodat: unexpected error: operation not supported on transport endpoint

Like Linux, Illumos doesn't support flags != 0 in Fchmodat, see
https://illumos.org/man/2/chmod

Adjust TestFchmodat accordingly to handle EOPNOTSUPP on Illumos.

Change-Id: Icd4564497a41c4aa962cd76604b5ca2c7575d96c
Reviewed-on: https://go-review.googlesource.com/101775
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-21 13:56:09 +00:00