Граф коммитов

76 Коммитов

Автор SHA1 Сообщение Дата
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
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
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
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
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
Matt Layher 43c01164e9 unix: implement AF_TIPC sockets on Linux
Adds initial constants and types to use with SockaddrTIPC. For more
information on TIPC, see: http://tipc.sourceforge.net/.

Because the C struct sockaddr_tipc makes use of a union for its addr
field, I have created a wrapping layer in SockaddrTIPC that uses
an interface to determine which variant is in use.

Tests accompany this change due to the complexity of this code. There
is currently little test coverage in the Sockaddr-related code, but
perhaps this is something that could be picked up as a relatively
straightforward task for a new contributor.

Change-Id: I5033a0685cb7128d4b1a23d18aca71c202d0c0aa
Reviewed-on: https://go-review.googlesource.com/c/sys/+/187960
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-04 00:50:37 +00:00
Kir Kolyshkin 9109b7679e unix: add IoctlRetInt for Linux
Add IoctlRetInt() for ioctls that use syscall's return value
as an output parameter. Add a unit test for Linux, and the
NS_GET_ defines that it requires (see ioctl_ns(2)).

Motivation:

Currently, x/sys/unix provides a few functions to deal with ioctls.
In particular, IoctlGetInt(), which "performs an ioctl operation
which gets an integer value". It does that by passing a pointer
to an integer to a syscall and returning that integer. The value
returned from syscall is treated as success/failure flag
(0 means success, -1 means failure, and in such case errno
is used to figure out the underlying error).

It appears that there are a few ioctls in Linux and at least one
in Solaris, which do not use the above way to return an int, instead
they use the syscall's return value (in case it's not negative).

As Linux ioctl(2) man page says,

> RETURN VALUE
> Usually, on success zero is returned. A few ioctl() requests
> use the return value as an output parameter and return
> a nonnegative value on success. On error, -1 is returned,
> and errno is set appropriately.

Currently I am aware of at least 6 Linux ioctls that do that
(return the value directly):

* LOOP_CTL_* ioctls on /dev/loop-control (all 3 of them). Source: loop(4)
* NS_* ioctls (3 out of 4) on /proc/PID/ns/*. Source: ioctl_ns(2)

And one in Solaris:

* I_FIND ioctl, source: streamio(7i).

There might be some more ioctls like the ones above, but since
ioctls are scarcely documented, it is hard to say how many more.

Obviously, using IoctlGetInt() for such ioctls would be a big
mistake, as 0 will always be returned. For example, there was
a bug in Docker's pkg/loopback (moby/moby#39801).

[v6: make it linux-specific for now]

Fixes golang/go#33966

Change-Id: Ie64f72fd84101b955ba14519a357e06a66d685d0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/192780
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-02 13:37:55 +00:00
Tobias Klauser fde4db37ae unix/linux: update Dockerfile to glibc 2.30
Change-Id: I4fd358388c46b4c2e8a4081640315db2313e585f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/189438
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2019-08-13 06:44:41 +00:00
Tobias Klauser fae7ac547c unix: add constants and types to work with Linux loop devices
Change-Id: I0996df39a561b50822a6e42e770d96421d6b4965
Reviewed-on: https://go-review.googlesource.com/c/sys/+/185498
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-12 06:29:09 +00:00
Tobias Klauser 6ec70d6a55 unix: update Dockerfile to Linux 5.2 and Go 1.13beta1
Change-Id: I1a63f6ae5fe6b8b6fb4f493837b12dbe3c2860d4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/185497
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-10 14:34:15 +00:00
Tobias Klauser 943d5127bd unix: add support to get/set Linux capabilities
Add wrappers for Getcap/Setcap on Linux as well as some related types
and consts.

Change-Id: I07764c2e64717214850ea3cbdc238e313d1e38c4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/183218
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-06-21 15:33:39 +00:00
Tobias Klauser abf6ff7781 unix: add MCAST_* constants on linux
This will also add two BPF_* consts which weren't added as part of
CL 174978 because they were generated before the Linux version update
in CL 175158.

Change-Id: I5dfecbecb9d94b56d01490a5f17f2250ad5b30d4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/178658
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-05-24 12:25:48 +00:00
Lehner Florian 12bbe5a7a5 unix: add BPF constants on Linux
Change-Id: Ie43daa8ba56ad1e57ddbb8ddd47f83b363fe75b4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174978
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-05-08 10:04:23 +00:00
Tobias Klauser 2953c62de4 unix: update Dockerfile to Linux 5.1
Also add KexecFileLoad on linux/arm now that is has SYS_KEXEC_FILE_LOAD.

Change-Id: I519bc2f611b511af994e1c7bbaa07f68cd615ef4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175158
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-07 05:39:17 +00:00
Matt Layher 18eb32c0e2 unix: add Linux crypto configuration API constants and types
Change-Id: I447150cb60b5580cee77d23c0dae2244803e92ef
Reviewed-on: https://go-review.googlesource.com/c/sys/+/173660
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-24 17:57:32 +00:00
Tobias Klauser e844e0132e unix: update Dockerfile to Go 1.12 and Linux 5.0
Also enable KexecFileLoad on linux/{arm64,riscv64} now that they have
SYS_KEXEC_FILE_LOAD.

Change-Id: I1c52d09a1a617794f2df697e4966c4c24a166611
Reviewed-on: https://go-review.googlesource.com/c/sys/+/164997
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-04 15:46:30 +00:00
Dominik Honnef c2f5717e61 unix: add fanotify API on Linux
This teaches unix/mksyscall.go about mapping uint64 to syscall
arguments, similar to existing handling of int64.

Change-Id: I536b4b09bbf6a8e3016565a4a04d2b9d32cbc624
Reviewed-on: https://go-review.googlesource.com/c/164664
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-03-03 19:25:50 +00:00
Tobias Klauser 41f3e65849 unix/linux: update Dockerfile to glibc 2.29 and Go 1.12beta2
Drop the manually defined *_XDP constants which were added to glibc.
Install python3 instead of python because glibc's confugure script now
requires at least 3.4.

Change-Id: Ic19ff4d8aa4dbadeb5438e331ccafeafc2cc9925
Reviewed-on: https://go-review.googlesource.com/c/160957
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-04 20:37:06 +00:00
Tobias Klauser afcc84fd75 unix: add RND* ioctl consts on Linux
Change-Id: I79c721d0f4fe097daf096dc7404675aa3048bf6a
Reviewed-on: https://go-review.googlesource.com/c/160757
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-01 15:26:29 +00:00
Tobias Klauser 054c452bb7 unix: add socket error queue constants and types from linux/errqueue.h
Also add additional packet timestamping constants and types defined
in the same header.

Change-Id: I4280f925b46e229f4c3a83a7fee4612592314016
Reviewed-on: https://go-review.googlesource.com/c/158761
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-22 07:17:31 +00:00
Tobias Klauser a457fd0364 unix: add Signalfd on linux
Also add the SFD_* constants and SignalfdSiginfo type.

Change-Id: I3415c212b85c9d5a940ba2bf70f43739a2630d78
Reviewed-on: https://go-review.googlesource.com/c/157897
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-15 15:29:22 +00:00
Sebastian Schmidt 2be5172556 unix: add ClockNanosleep and TIMER_ABSTIME
This adds the ClockNanosleep syscall and the TIMER_* constants;
currently only TIMER_ABSTIME for specifying an absolute timestamp.

Change-Id: Ic8d857eb92818529aadab569cd8646a19bb9c055
Reviewed-on: https://go-review.googlesource.com/c/157658
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-01-14 13:03:36 +00:00
Tobias Klauser 82a175fd15 unix/linux: update Dockerfile to Linux Kernel 4.20
Change-Id: Iadc92b5afd18a5c1df0bc42b0d6f52f0b768b47a
Reviewed-on: https://go-review.googlesource.com/c/155979
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-02 15:56:01 +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
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
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
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
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 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
Tobias Klauser ebe1bf3edb unix: add SYNC_FILE_RANGE_* constants on Linux
These are usefule to specify SyncFileRange's flags argument.

Change-Id: I1726c3adf55aaebac61beed09d39a48a8e040a93
Reviewed-on: https://go-review.googlesource.com/133475
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-05 08:04:54 +00:00
Tobias Klauser 4910a1d54f unix: add UBI ioctl constants on Linux
Change-Id: Icde91c6504cd45d78208c6041bf6dc097d2d8334
Reviewed-on: https://go-review.googlesource.com/131235
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-24 14:33:01 +00:00
Tobias Klauser 4e1fef5609 unix: update Dockerfile to Linux 4.18, glibc 2.28 and Go 1.11beta3
Including linux/stat.h in mkerrors.sh is no longer necessary because the
statx types and constants were added to the glibc headers.

Change-Id: I643c35fd2da76dd2c15015556658d7fa862249c4
Reviewed-on: https://go-review.googlesource.com/129100
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-14 07:20:32 +00:00
Tobias Klauser 2be389f392 unix: add Renameat2 on Linux
Renameat2 is Linux-specific and allows to pass an additional flags
argument to the renameat syscall. Also add the corresponding RENAME_*
flag mask values.

Change-Id: Ib4baa46fdd0b07ccd0988ac624862ce69d5c3ad5
Reviewed-on: https://go-review.googlesource.com/127763
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-06 19:25:00 +00:00
Casey Callendrello 3dc4335d56 unix: add Linux network namespace constants
This adds the NETNSA constants from net_namespace.h, used for creating
and querying network namespace IDs.

Fixes golang/go#26330
Change-Id: I786c4c4771be3eddc4fdb830a52e128aa1a2b9fd
Reviewed-on: https://go-review.googlesource.com/124436
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-01 22:11:39 +00:00
Tobias Klauser 9e6071e1da unix: follow convention for generated code comment
Follow the convertion (https://golang.org/s/generatedcode) for generated
code.

Change-Id: I27899b24366d5c0d2c5574b5eaf3d7e0babc8909
Reviewed-on: https://go-review.googlesource.com/118820
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 13:37:17 +00:00
Michael Stapelberg 56ede360ec unix: add rtc defines and types
Change-Id: I280fc3b2cd3402c40f2840d152bac2fa288f48a0
Reviewed-on: https://go-review.googlesource.com/118661
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 17:11:35 +00:00
Matt Layher a9e25c09b9 unix: update Dockerfile to Ubuntu 18.04, Linux 4.17, and Go 1.10.3
The code has been regenerated using the updated software versions.

Change-Id: Ic2af968d4d8cbf3ab31e5bca1d6640642eb7115a
Reviewed-on: https://go-review.googlesource.com/118255
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2018-06-12 14:22:14 +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 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
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
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
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
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
Tobias Klauser c1138c84af unix: update to Linux 4.15, glibc 2.27 and Go 1.10
Also use the Ubuntu 17.10 docker image and additionally install bison
which is needed by the glibc build.

The resulting change only consists of a few additional constants.
Exclude the X86_CR3_PCID_NOFLUSH constant on 386 and amd64, though.

Change-Id: I0a9b8959146273ff3b259c17bb616625a9ac8278
Reviewed-on: https://go-review.googlesource.com/96255
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-02-22 21:03:05 +00:00
Tobias Klauser fff93fa7cd unix: add Statx on Linux
statx(2) allows to get enhanced file status information (not currently
available through the existing stat syscalls), lightweight stat,
heavyweight stat. The Statx_t type used by Statx has consistent field
sizes on all arches (with year-2038-capable timestamps) and is closer to
the BSD implementation of Stat_t.

See http://man7.org/linux/man-pages/man2/statx.2.html for details. The
syscall was added in Linux kernel 4.11.

See https://github.com/tklauser/statx for an example of how this
function and types can be used to report stat(1)-like file status
information.

Change-Id: I9e9642b5b42a393f94fd532453888ce9ba4f0003
Reviewed-on: https://go-review.googlesource.com/87555
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-15 08:58:44 +00:00
Tobias Klauser a22539bf85 unix: add vmsockets ioctl constant on Linux
To be used e.g. in github.com/mdlayher/vsock

Change-Id: I52148a6e6c53c022c07e2cc8bf7348a96445c17b
Reviewed-on: https://go-review.googlesource.com/76193
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2017-11-07 15:03:14 +00:00
Tobias Klauser 52c393dd0c unix: update Dockerfile to go 1.9.2
Update go to 1.9.2 in the Dockerfile used to generate the Linux go files.

The update also changes some zerror definitions: RLIM_INFINITY is
assigned to Rlimit.{Cur,Max} which are both uint64 on all architectures.
PR_SET_PTRACER_ANY is used with Prctl which expects an uintptr.

With the current version, an "constant -1 overflows uint64" error would
result if these constants were used directly without type conversion.

Change-Id: Iefd23a44e983b4fcf210121776531df225014112
Reviewed-on: https://go-review.googlesource.com/73873
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-27 13:58:47 +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