Commit Graph

645 Commits

Author SHA1 Message Date
Tobias Klauser
5a3cf8467b unix: compare Stat_t members in TestFstatat
TestFstatat occasionally fails on some builders due to mismatching
Stat_t info returned by the calls to Fstatat (most likely due to Atime
changing). Fix the test by just comparing some well known members.

Change-Id: I862957ad9d3632173a97d93692a6c672779ac508
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212417
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-23 22:42:16 +00:00
Tobias Klauser
abf886d6f5 unix: unify definition of func fcntl
For linux and *bsd, implement func fcntl in fcntl.go instead of
generating it. Implement it using fcntl64Syscall, so SYS_FCNTL64 is used
on 32-bit linux.

For aix, darwin and solaris continue generate func fcntl as before.

Change-Id: I3750b88d1ee5573daaee2b75c369f723fde8834a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212337
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-23 22:40:30 +00:00
Ian Lance Taylor
0732a99047 unix: use correct file name in comment
Change-Id: Ib05fbd6f1dca630a3ac596f88373756797d8c27e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212298
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-20 22:00:14 +00:00
Axel Wagner
d4481acd18 unix: add Readv/Writev family of syscalls for linux
Fixes golang/go#36201

Change-Id: Ie3b197e18bc5d59fd222f3fa0100e1e0a3d11866
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212157
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-20 14:29:24 +00:00
Umang Parmar
4a24b40652 unix: add PrctlRetInt, a Prctl variant that returns (int, error)
Fixes golang/go#35978

Change-Id: I396f0c2c6443e000bcecc9081841cd55145c050b
GitHub-Last-Rev: d461448006
GitHub-Pull-Request: golang/sys#48
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209969
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-18 08:49:08 +00:00
erifan01
ac6580df44 unix: move functions Ptrace{Get|Set}RegSetArm64 to a separate file
CL 204418 adds functions PtraceGetRegSetArm64 and PtraceSetRegSetArm64 to file
zptrace_armnn_linux.go, both of which depend on type Iovec. The definitions of type
Iovec on linux arm and arm64 are different, but file zptrace_armnn_linux.go is
shared by them. So these two functions cause compilation errors on linux arm. This
patch fixes this error by moving these two functions into a separate file.

Fixes golang/go#36032

Change-Id: Ia380bd863895900599c09d4631ed26f204955112
Reviewed-on: https://go-review.googlesource.com/c/sys/+/210322
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-10 02:34:23 +00:00
Umang Parmar
eeba5f6aab unix: replace readlink in mkall.sh with portable shell commands
Fixes golang/go#35997

Change-Id: I1c489a126646a0ff4abf9e8b7ba357ff62cb66ac
GitHub-Last-Rev: e01b1c0e8b
GitHub-Pull-Request: golang/sys#49
Reviewed-on: https://go-review.googlesource.com/c/sys/+/210157
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 22:06:18 +00:00
erifan01
bc7efcf3b8 unix: add functions PtraceGetRegSetArm64 and PtraceSetRegSetArm64
Since arm64 GNU/Linux version 2.6.34, PTRACE_GETREGS was replaced by PTRACE_GETREGSET,
in order to get or set the general purpose and floating-point register values,
PTRACE_GETREGSET/PTRACE_SETREGSET request type and a proper "NT_XXX" constant values
should be used. For the sake of not breaking the existing API, we added two functions
PtraceGetRegSetArm64 and PtraceSetRegSetArm64, they take an additional argument "addr",
and use PTRACE_GETREGSET and PTRACE_SETREGSET request types respectively.

Change-Id: I14c55733e15cea4b7d775187b1018fcb2880d6a9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/204418
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 21:42:22 +00:00
Tobias Klauser
ce4227a45e unix: add Statvfs and Fstatvfs on NetBSD
NetBSD replaced statfs with statvfs in NetBSD 3.0. statfs is derived
from BSD4.4, while NetBSD (and Solaris) implement statvfs from POSIX
instead.

Generated and tested on NetBSD 8.0 (amd64). Also tested on NetBSD 7.0 (amd64).

Change-Id: I53738b77815d04c7774a6455b4a31cd4e9571f7b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209637
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-12-04 07:23:24 +00:00
Eric Biggers
63cb32ae39 unix: add new fscrypt declarations from Linux v5.4
Create Go bindings for the updated fscrypt UAPI from Linux v5.4:

- Various new ioctls.  We use the regex FS_IOC_.*ENCRYPTION to match
  both the new and existing fscrypt ioctls.

- Various new structures for passing to the ioctls

- Various new constants named like FSCRYPT_*

- FscryptPolicy was renamed to FscryptPolicyV1.  (But the old name is
  still available for source compatibility.)

- The existing fscrypt-related constants named like FS_* (besides the
  ioctls) were renamed to FSCRYPT_*.  (But the old names are still
  available for source compatibility.)

For reference, see fscrypt.h:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fscrypt.h?h=v5.4

Fixes golang/go#35856

Change-Id: I48ddd37cfa7c1e0e7eb227baa6f220c848ddc880
Reviewed-on: https://go-review.googlesource.com/c/sys/+/208898
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-27 02:17:46 +00:00
Matt Layher
8a8471f7e5 unix/linux: bump Linux and Go versions to latest stable releases
Attempting to upgrade to the Ubuntu 19.10 Docker image results in
failures due to Ubuntu/Debian removing the mips{,64}{,le} cross
compilers, so we stick with 19.04 for now.

Change-Id: Ie75057447889ea1648d638a410e1c35c047b579a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/208737
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-11-26 13:16:56 +00:00
Tobias Klauser
bd437916bb unix: check number of ready file descriptors in TestPselect
Like in TestSelect, check the number of ready file descriptors returned
by Pselect.

Change-Id: I4a64720092132c5ba432d6d1274df8c68bb5b6bf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207862
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-20 15:59:48 +00:00
Tobias Klauser
76d669a226 unix: don't fail TestSelect on EINTR from Select
Change-Id: Ie162966c830ffd86947cf4f04532a7f6741a5587
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207861
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-20 15:59:35 +00:00
Tobias Klauser
f068ffe820 unix: use same TestSelect on all Unices
Also change t.Error messages to use "got foo, expected bar" notation.

Change-Id: Ia0b452f96b08cbb69a0b64cc2a467b5cf94e72da
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207858
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-19 19:55:28 +00:00
Tobias Klauser
e882bf8e40 unix: fix EINTR check in TestPselect
err == EINTR needs to be checked before err != nil for the interrupted
syscall to be retried properly.

Follow-up for CL 207284

Updates golang/go#35555

Change-Id: I76d569058b7985ec51f07909d86807a8b4911772
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207292
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-19 06:07:38 +00:00
Clément Chigot
cf1e2d5771 unix: regenerate zerrors for AIX
Add "sys/select.h" in order to have NFDBITS on AIX and regenerate
zerrors_aix_ppc.go and zerrors_aix_ppc64.go at the same time.

Fixes: golang/go#35635

Change-Id: Iaad62ea1faf50f4b08364f288b3c63013ac4bc6e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207657
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-11-18 13:31:27 +00:00
Tobias Klauser
2f86c98f34 unix: don't fail TestPselect on EINTR from Pselect
Updates golang/go#35555

Change-Id: I3efb010c8edf92a75941c6b7ec749665235020d8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207284
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-18 07:38:50 +00:00
Tobias Klauser
6254a7c3ca unix: fix EINTR check in TestClockNanosleep
err == EINTR needs to be checked before err != nil for the interrupted
syscall to be retried properly.

Follow-up for CL 207285

Updates golang/go#35622

Change-Id: I0f8c1a75eb96e11aaba284eb75716db044257cbd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207290
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-18 01:35:47 +00:00
Tobias Klauser
81af7394a2 unix: don't fail TestClockNanosleep on EINTR from ClockNanosleep
Continue the test and log the time slept in case of EINTR.

Fixes golang/go#35622

Change-Id: I4444b2500a5ae492aad27f3bcbc5f77ef3944447
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207285
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>
2019-11-17 21:15:29 +00:00
Tobias Klauser
52ab431487 unix: fix EpollEvent padding on mips64{,le}
Like on other 64-bit GOARCHes, EpollEvent needs padding before Fd for
mips64 and mips64le.

Change-Id: I934368ba22ef7bf3a25949649613c2a03928bf83
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207278
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-15 15:19:21 +00:00
Tobias Klauser
4c7a9d0fe0 unix: check correct CPU for being enabled in old mask in TestSchedSetaffinity
When checking the old affinity mask with the fix introduced in CL
137675, the wrong CPU (5 instead of 1) is checked. Correct this and also
move the call to SchedGetaffinity closer to the SchedSetaffinity call in
order to reduce the time window for CPUs to go offline.

Updates golang/go#27875
Fixes golang/go#35184

Change-Id: Ie50320c82d1334aa26764281253dc9dde066a730
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206863
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-11-13 16:50:36 +00:00
Tobias Klauser
fee6b63275 unix: accept time.Now()±1 as valid in TestTime
Fixes golang/go#33200

Change-Id: I7e6e62f09174f0b214e7d021a31f1ad2166f9db5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206861
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-13 15:49:46 +00:00
Tobias Klauser
8ad3422571 unix: skip TestPselect on EINTR
Some slow builders occassionally seem to fail with:

    syscall_linux_test.go:301: Pselect: interrupted system call

Just skip the test in these cases for now.

Fixes golang/go#35555

Change-Id: I8850634fc4000bf9d0d6cce27834febc53d3fcd6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206862
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-13 15:03:13 +00:00
Tobias Klauser
59a1497f0c unix: test returned fd in TestEpoll
Check the fd returned in EpollEvent to detect potential padding issues.

Also, fail the test if the number of events mismatches.

Updates golang/go#35479

Change-Id: I39f856ca2c336e849876a33acffb70b82aa83c3f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206858
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-12 21:41:54 +00:00
Tobias Klauser
c1f44814a5 unix: add TestEpoll on linux
This tests the epoll functionality on linux and should hopefully help
catch GOARCHes where additional padding of EpollEvent is needed (see
e.g.  CL 189877).

Change-Id: Icd19746a60a63016a5d46535a2cc557ca7a0d474
Reviewed-on: https://go-review.googlesource.com/c/sys/+/205398
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-05 23:10:09 +00:00
Tobias Klauser
ac3223d801 unix: add methods to manipulate *FdSet
Add Set, Clear, IsSet and Zero methods to manipulate an *FdSet. These
implement the same functionality as the FD_SET, FD_CLR, FD_ISSET and
FD_ZERO macros in <sys/select.h>.

Change-Id: I6b7bccb98e58ee5e719096ed5743f6edcd232840
Reviewed-on: https://go-review.googlesource.com/c/sys/+/205397
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-05 14:28:33 +00:00
Matt Layher
195ce5e7f9 unix: add devlink Linux generic netlink API constants
For more information on devlink, see: https://lwn.net/Articles/674867/.

Change-Id: I68815c94160864f4a3d2bb78b2e5d06949d27acf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203878
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-28 16:43:58 +00:00
Alexander Menzhinsky
b67d8b46d2 unix: add missing HCI_CHANNEL_LOGGING constant
For more information see: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git/commit/?id=ac71494934c475e3f51e5e3e64a12f57618d82a4

Change-Id: If67f020c5a4ed64726d6ef35ba03d5ed100cedc4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203610
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-28 14:51:28 +00:00
Tobias Klauser
33540a1f60 unix: don't use non-existing uint128 type on freebsd/arm64
CL 179099 introduced type FpReg on freebsd, on freebsd/arm64 using a
type uint128. This type doesn't exist in Go.

Change-Id: Ie7f065f38f2cc2c163abdfa7dddad886b8edbe3b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203419
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-26 07:03:38 +00:00
Tobias Klauser
6c3a3bfe00 unix: make convertFromDirents11 checkptr safe
Follow CL 202878 which did the same for package syscall.

Updates golang/go#35092

Change-Id: Id53d2cde0333581c98d13b096a48f2a602b2425f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202959
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-25 02:14:31 +00:00
Cuong Manh Le
b4ff53e7a1 unix: remove un-used ptrSize
Same as CL 202881.

Change-Id: Idc85bd23574c437c711b40155b49621e35ef571b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203237
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-24 17:25:28 +00:00
Tobias Klauser
e66fe6eb8e unix: regenerate darwin libc trampolines after CL 202837
CL 202837 forgot to properly re-generate
zsyscall_darwin_{386,amd64,arm64}.s with the correct trampoline name.

Updates golang/go#35103
Updates golang/go#34133
Updates golang/go#35101

Change-Id: I98805988f97c7ff51da858fdc36c436aa680c8c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202958
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-24 07:30:52 +00:00
Jason A. Donenfeld
f89234f9a2 unix: __sysctl is sysctl on darwin
While the other BSDs use __sysctl as the name, Darwin now uses sysctl,
without the leading underscores, and considers __sysctl to be "private".
Using __sysctl leads to App Store rejections, and Go's syscall package
already uses the proper syscall. So this commit changes Darwin's syscall
to use it too here, while reverting a recent commit that removed it all
together on arm and arm64.

This reverts CL 194097.

Fixes golang/go#35103
Updates golang/go#34133
Updates golang/go#35101

Change-Id: Ic72d5e7a435b99fe62c533b77b2c3790590f4c9e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202837
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-23 15:13:26 +00:00
Matt Layher
b69606af41 unix: comply with -d=checkptr in Test_anyToSockaddr
Rather than directly casting between types of different sizes, use an
explicit copy in a helper function.

Fixes golang/go#35106

Change-Id: I2293eb38fa53205ce069e2e5405262294c9ad412
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202820
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-23 14:50:28 +00:00
Tobias Klauser
3e7259c5e7 unix: don't use 32-bit aligned access for cmsgAlignOf on dragonfly after ABI change
Use 32-bit alignment for versions before the September 2019 ABI changes
http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html

Follows CL 201977 which did the same for package syscall.

Updates golang/go#34958

Change-Id: I0e13fccf6563e4d34dd4aa7410be044881f220aa
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202179
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-20 21:24:54 +00:00
Tobias Klauser
9984515f05 windows, unix: fix wrong unsafe.Pointer alignment in syscall
Same as CL 201877 did for package syscall.

Updates golang/go#34972

Change-Id: I3929841ab32378516edafb1f02a84b1bdcc77bbd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202177
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-20 15:20:52 +00:00
Tobias Klauser
727590c500 unix: avoid "just past the end" pointers in UnixRights
Same as CL 201617 did for package syscall.

Caught with -d=checkptr

Updates golang/go#22218

Change-Id: I8208f8e6d9bd62376bf9e0458dc18956daabd785
Reviewed-on: https://go-review.googlesource.com/c/sys/+/201937
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-10-18 09:52:05 +00:00
Lehner Florian
06d7bd2c5f unix: update rtnetlink constants
Change-Id: I21551672b5d8dd3e56c49da69f66dc19b07a5299
Reviewed-on: https://go-review.googlesource.com/c/sys/+/199757
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-09 17:02:03 +00:00
Paulo Gomes
543471e840 unix: add new func PtraceInterrupt on Linux
Add to the unix package a new func to allow ptrace using PTRACE_INTERRUPT.

Fixes golang/go#34755

Change-Id: Ie50ae14c6eb5b3005dda2f8eefee57dd5bd6f360
GitHub-Last-Rev: 7e93ff4d87
GitHub-Pull-Request: golang/sys#45
Reviewed-on: https://go-review.googlesource.com/c/sys/+/199504
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-08 10:56:21 +00:00
Paulo Gomes
4ac5d0cebf unix: add new func PtraceSeize on Linux
Add to the unix package a new func to allow ptrace using PTRACE_SEIZE.

Fixes golang/go#34717

Change-Id: I6518868b99311a4608f21d249fe670990bfec555
GitHub-Last-Rev: 8a694c4f23
GitHub-Pull-Request: golang/sys#44
Reviewed-on: https://go-review.googlesource.com/c/sys/+/199497
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-07 08:45:22 +00:00
Srinidhi Kaushik
aed5e4c7ec unix: add Klogset and related SYSLOG_ACTION_ constants
Adds a new function: Klogset which wraps sys_syslog for
cases where the `bufp` argument is not required and the
argument that follows needs to be passed to the function.

Fixes golang/go#34672

Change-Id: Idf026791ea9265aaca33e78a34fcd490edb8d326
Reviewed-on: https://go-review.googlesource.com/c/sys/+/199278
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-05 20:08:04 +00:00
Tobias Klauser
3421d5a6bb unix: avoid __getdirentries64 on darwin
Getdirentries is implemented with the __getdirentries64 function
in libSystem.dylib on darwin/{386,amd64}. That function can't be used in
an app store application.

Implement Getdirentries using the underlying
fdopendir/readdir_r/closedir for Go 1.13. The simulation isn't faithful,
and could be slow, but it should handle common cases.

For Go 1.12, fall back to raw syscalls since syscall.syscallPtr needed
to use fdopendir from libSystem.dylib is not available.

Follow CL 168479 and CL 170892 which did the same for syscall in the
stdlib.

Tested on darwin/amd64 with Go 1.11, Go 1.12 and Go 1.13

Fixes golang/go#34400

Change-Id: I631382aaea9ee7e0c4ed09e06ad5427efc620769
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196478
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-02 06:39:06 +00:00
Tobias Klauser
34b0ac8f0d unix: update openbsd/{386,amd64.arm} MAP_* consts
Update the MAP_* consts for openbsd/{386,amd64.arm} on OpenBSD 6.5.
openbsd/arm64 was already generated on OpenBSD 6.5 for CL 173678.

Fixes golang/go#34589

Change-Id: Ie06bdc28ddd39a8c8e4f61137cb060f74c59e1eb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/198157
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-10-02 06:38:49 +00:00
Tobias Klauser
2837fb4f24 unix: add NFDBITS const on Linux, update TestSelect
Adjust TestSelect on Linux to match the Darwin/*BSD changes in CL
196802.

Updates golang/go#34458

Change-Id: Ia17fdadf7091001ea785391da23aaf9d3ec4ac5e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196806
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 15:45:21 +00:00
Tobias Klauser
e2fefa8ec2 unix: fix Select to return number of ready fds on Solaris
Make Select's signature on Solaris match the one on Linux and return the number
of ready file descriptors.

Updates golang/go#34458

Change-Id: I118c4c35cbc83dba015ef357ce9bef44c9165ec1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196807
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 15:45:09 +00:00
Tobias Klauser
2f72d4f062 unix: re-generate Select on dragonfly
CL 196802 did not properly re-generate the definition of Select after
changing the //sys comment.

Updates golang/go#34458

Change-Id: I035468487163f48393fc777dde691737fce41aa8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196805
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 13:54:25 +00:00
Tobias Klauser
2aa67d56cd unix: fix Select to return number of ready fds on Darwin and *BSD
Make Select's signature on Darwin and the BSDs match the one on Linux
and return the number of ready file descriptors.

Fixes golang/go#34458

Change-Id: Ia618ce34ff754f2b731d7f913cab840d7948579c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196802
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 06:27:00 +00:00
Eric Chiang
ef0ce17483 unix: add KEYCTL_RESTRICT_KEYRING capabilities
Asymmetric keyrings can require key payloads to be X.509 certificates
signed by a key in a different keyring. This can be helpful for rotating
keys on a live machines for subsystems like IMA while preventing local
tampering.

Tested locally by applying the "key_or_keyring:<id>" restriction to a
keyring.

Change-Id: Ia8dcb343abc5f405d374c357d5cac3d5181d7159
Reviewed-on: https://go-review.googlesource.com/c/sys/+/178400
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-09-20 19:08:10 +00:00
Matt Layher
b4ddaad3f8 unix: redefine TIPC_WAIT_FOREVER as a uint32 value
The code generator produces -0x1 for (~0) from the tipc.h C header, but this
value is unusable in Go as a uint32. Undefine and replace this value with
the appropriate constant for TIPC_WAIT_FOREVER.

Fixes golang/go#34310

Change-Id: Ic6ab0ddd14394e15868085e2123a9a97a841bc6d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/195757
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-16 20:23:48 +00:00
Tobias Klauser
1a3b71a79e unix: update Dockerfile to Linux 5.3 and use ubuntu 19.04 base image
rsync needs to be explicitly installed for 'make headers_install' to
work.

Change-Id: Icd3d6b3f004a7684b5ae32b4b7cab8d50631900d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/195258
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>
2019-09-16 14:18:54 +00:00