unix: add openat2 for linux

openat2 is a new syscall added to Linux 5.6. It provides a superset of
openat(2) functionality, extending it with flags telling the kernel how
to resolve the paths.

For more info, see https://lwn.net/Articles/803237/

NOTE that this is a second attempt to add the call; the previous one
(https://golang.org/cl/227280) was reverted
(https://golang.org/cl/227846) due to the test case failure on ARM
(https://golang.org/issue/38357).

This CL has the test case reworked to be less assumptive to the testing
environment. In particular, it first tries if the most simplistic
openat2() call succeeds, and skips the test otherwise. It is done that
way because CI can be under under different kernels and in various
envrionments -- in particular, Docker+seccomp can result in EPERM from a
system call (which is not expected otherwise).

For previous discussions about the test case, see
https://golang.org/cl/227865.

Change-Id: I4276cf13dc29ecbdbdc9c58da0f76270f585a67f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253057
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 files changed
tree: 544228e6bb9d7a9539253da89d2d13f50df0dd3c
  1. cpu/
  2. internal/
  3. plan9/
  4. unix/
  5. windows/
  6. .gitattributes
  7. .gitignore
  8. AUTHORS
  9. codereview.cfg
  10. CONTRIBUTING.md
  11. CONTRIBUTORS
  12. go.mod
  13. LICENSE
  14. PATENTS
  15. README.md
README.md

sys

This repository holds supplemental Go packages for low-level interactions with the operating system.

Download/Install

The easiest way to install is to run go get -u golang.org/x/sys. You can also manually git clone the repository to $GOPATH/src/golang.org/x/sys.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the sys repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/sys:” in the subject line, so it is easy to find.