unix: align the getdents buffer

getdents64 stores a 64-bit d_ino at the start of every entry, so the entries
are aligned only if the buffer is. Go promises no alignment for a []byte, and
sparc64 faults on the misaligned store rather than fixing it up, returning
EFAULT.

Buffers from make are already 8-aligned, so this is a no-op unless the caller
passes a sub-slice.

Updates golang/go#55000

Change-Id: I3724af7c4ef7debc4bdd9d0b1c3130c312094957
GitHub-Last-Rev: 2d416d91ae1f7ad56c32636521af5b2c61a567b2
GitHub-Pull-Request: golang/sys#291
Reviewed-on: https://go-review.googlesource.com/c/sys/+/822906
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2 files changed
tree: 6059db0fc544bfed08eddde71c6290a21deed473
  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.