unix: use epoll_pwait rather than epoll_wait

This extends a pattern implemented on arm64 by CL 21971
to all arches.

This is safe to do because epoll_pwait was added in Linux 2.6.19
and x/sys's go.mod file sets go 1.25.0 which has a minimum Linux
version of 3.2.

epoll_wait is a legacy syscall that is being left behind
- some newer arches (like arm64) do not implement it
- libc implementations never call it
- seccomp allow lists do not include it

epoll_pwait is a complete superset of epoll_wait: it adds a new
sigmask argument, but according to the docs:

  The sigmask argument may be specified as NULL, in which
  case epoll_pwait() is equivalent to epoll_wait().

This might have the inverse downside where someone wrote a seccomp
filter allowing epoll_wait but not epoll_pwait, but given that the
rest of the ecosystem (libcs, ...) uses epoll_pwait this seems
unlikely.

Fixes golang/go#80080

Change-Id: Ief3b7799e35c61cec328c328422155a29fc02ae4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/792700
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
29 files changed
tree: 05e9b991a6188e524eb988d3a2f0bab7330980a5
  1. cpu/
  2. execabs/
  3. plan9/
  4. unix/
  5. windows/
  6. .gitattributes
  7. .gitignore
  8. codereview.cfg
  9. CONTRIBUTING.md
  10. go.mod
  11. LICENSE
  12. PATENTS
  13. README.md
README.md

sys

Go Reference

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

Report Issues / Send Patches

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

The git repository is https://go.googlesource.com/sys.

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