Commit Graph

1523 Commits

Author SHA1 Message Date
Kir Kolyshkin
fc717d344a unix: remove usage of ioutil.TempFile in tests
Mostly change that to os.Create(filepath.Join(t.TempDir(), "filename"))
so that the cleanup is done automatically (and, because this is a new
directory, we do not need to have a "create unique temp file name"
logic).

While at it, fix some log/error messages -- if an error is coming from
e.g. os package, it is already wrapped, so there's no need to add more
context.

Change-Id: I62f13679f256b94095be5ca1e77a3fa302f01b97
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526298
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
2023-09-12 16:41:25 +00:00
Kir Kolyshkin
cb4ecd9fe9 unix: use filepath in tests where appropriate
Change-Id: I0b80cdf4fcf48b80139bf4439f4c78954c972382
Reviewed-on: https://go-review.googlesource.com/c/sys/+/527155
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-09-12 16:41:14 +00:00
qmuntal
4848eb0479 windows,windows\svc,windows\svc\mgr: use unsafe.Slice instead of unsafeheader.Slice
unsafe.Slice is available since Go 1.17, which is already the minimum
version supported by this package.

This change removes the dependency on the internal unsafeheader package,
which can be removed from the module.

Change-Id: I6c34cb152f2336ea04c5f9c7e88797ed8914f9cc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526635
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-09-08 18:06:11 +00:00
Kir Kolyshkin
0e97d69659 all: use t.TempDir in tests
This removes all usage of ioutil.TempDir in tests (and a few cases of
os.TempDir as well, while we're at it), which simplifies test cleanup a
lot.

Compile tested (go test -c) for most platforms (except zos).

Change-Id: I9178f5ec615c0a6cfef36e8de78c6b72e055b7cb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526297
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-09-08 15:25:11 +00:00
Kir Kolyshkin
0514fecd90 unix: rm unused zos test helper functions
These functions are not used anywhere in zos tests.

Checked with:

	git grep -wE 'mktmpfifo|touch|chtmpdir' \
		$(git grep -lw zos | grep _test.go; ls *_zos_test.go)

Change-Id: Ie8b25640578e1c607dd4e4f0fe4e7869f8e3f5d3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526296
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dustin Ward <wardddustin@gmail.com>
2023-09-07 23:38:50 +00:00
Tobias Klauser
bfd1ebb2bc unix: remove unused ptracePtr on darwin
ptracePtr was introduced in CL 469835 for darwin but it's not used on
this platform. Also, the argument types for addr and data were swapped
in the generated ptrace1Ptr (probably because the change was not
generated but done manually).

This change also includes generated changes moving some definitions in
zsyscall_darwin_*.go and removing some empty lines in
zsyscall_darwin_*.s. These changes result from running ./mkall on
darwin/amd64 and darwin/arm64.

For golang/go#58387

Change-Id: I90bba3be7fbc8c77815450d0b666a2948b63fab0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526455
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-07 20:52:23 +00:00
Dmitri Shuralyov
81cb935067 unix, windows: use ^TestName$ regular pattern for invoking a single test
For reasons motivated in the commit message of CL 524948.

Change-Id: I0085411f30a77634962239ee36d15e7b6ef893ef
Reviewed-on: https://go-review.googlesource.com/c/sys/+/525618
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-09-06 00:53:53 +00:00
chenguoqi
51546915a6 unix/linux: update to gcc 13.2.0, qemu 8.0.3 for loong64 and and Go 1.21.0 for all
Running `GOOS=linux GOARCH={amd64,arm64,loong64,mips64le,riscv64} ./mkall.sh`
produces no changes, as expected.

Update Loong64's cross toolchain to support for the ELF psABI v2.0 relocs [1].

Updates #58784.

[1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html

Change-Id: I676893b934d8cfc30b9f3702fc92a5ab82f7f116
Reviewed-on: https://go-review.googlesource.com/c/sys/+/483455
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
v0.12.0
2023-08-25 20:53:44 +00:00
Tobias Klauser
e8190d9965 windows: don't check non-existent return code in GetStartupInfo
Same as CL 520275 did in package syscall.

For golang/go#31316

Change-Id: Ie9d8fed7f40b9e562534d5e91488b4ba1ac44f34
Reviewed-on: https://go-review.googlesource.com/c/sys/+/520295
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2023-08-17 16:34:40 +00:00
Mauri de Souza Meneguzzo
ad02017442 windows: use SyscallN in mkwinsyscall
The mkwinsyscall command has a hard limit of 15 on the
number of syscall arguments. Windows has several system
calls with more than 15 arguments, for example CreateFontPackage
has 18 arguments.

If the number of arguments is higher than 15 we use SyscallN.

Fixes golang/go#57914

Change-Id: I4205e779a960ae10c0778de7876154e0d7ec00a1
GitHub-Last-Rev: 1f1e96fab7
GitHub-Pull-Request: golang/sys#171
Reviewed-on: https://go-review.googlesource.com/c/sys/+/518995
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2023-08-17 16:18:12 +00:00
cui fliter
70233675ae cpu: remove repetitive word
Change-Id: I6dbed409b549ab2cfc862094f19373816b7c0859
Reviewed-on: https://go-review.googlesource.com/c/sys/+/519076
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-08-16 01:58:07 +00:00
Anton Kuklin
eabbd5c036 cpu: add support for amx detection
Added detection for x86 AMX,
including AMX-Tile, AMX-INT8 and AMX-BF16
instruction sets.

Change-Id: Ib3d663430b64d46b46b22bdd05d40f1992e37ee0
GitHub-Last-Rev: 7986ed6d4f
GitHub-Pull-Request: golang/sys#170
Reviewed-on: https://go-review.googlesource.com/c/sys/+/516815
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-08-14 16:42:18 +00:00
Andy Pan
552c4e8192 unix: avoid setting O_NONBLOCK needlessly by checking flags beforehand
Change-Id: I227118221df469a677f3ff140ca7b94acb7f9571
Reviewed-on: https://go-review.googlesource.com/c/sys/+/517576
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-08-10 14:36:31 +00:00
Kir Kolyshkin
ee578879d8 unix: add SchedSetAttr and SchedGetAttr for Linux
Add wrappers for sched_getattr(2) and sched_setattr(2), as well as
various SCHED_ values usable for these.

The kludge in linux/types.go is needed so we can include both
linux/sched/types.h (for struct sched_attr) and sched.h (for a few
defines from include/bits/cpu-set.h).

Unfortunately, they both define struct sched_param, thus the need to
mask one of the definitions.

Change-Id: I3e13cf49ccef7ae81a75d33826d18de84a52106d
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/sys/+/516756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-08-09 15:08:02 +00:00
qmuntal
60ecf13377 windows: add TimeBeginPeriod and TimeEndPeriod syscalls
Updates golang/go#44343
Fixes golang/go#61723

Change-Id: I920f2fad6b3a2a9ba67ff2fafea4319644a0bc8c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/515915
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-07 06:21:27 +00:00
Mark Ryan
104d4017fa unix: add riscv_hwprobe for riscv64
The riscv_hwprobe system call was introduced in Linux 6.4 and allows
the caller to determine a number of interesting pieces of information
about the underlying RISC-V CPUs, e.g., which extensions they support
and whether they allow fast unaligned memory accesses.  For more information
please see:

https://docs.kernel.org/riscv/hwprobe.html

We also update linux/mksysnum.go to ensure that the generated syscall constants
written to the zsysnum_linux_*.go files are always sorted by their syscall numbers
in ascending order.

Updates golang/go#61416

Change-Id: Iedb0a86adb65faac9061b9a5969ffa09eb5b303a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/510795
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
v0.11.0
2023-07-26 11:14:25 +00:00
Ed Schouten
70f4e408de unix: retry fetching of lists through sysctl if the size changes
On macOS, the SysctlKinfoProcSlice() function may be used to fetch the contents of the process table. As the process table may grow between the first and second call to sysctl(), the second call may fail with ENOMEM. In that case we simply need to retry.

Change-Id: I40229653ed383603c33762f37b0dc2e7de47bcb6
GitHub-Last-Rev: b63b6b8471
GitHub-Pull-Request: golang/sys#169
Reviewed-on: https://go-review.googlesource.com/c/sys/+/513036
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-07-26 11:12:51 +00:00
Lorenz Brun
ad7130c58d unix: add more block device ioctl numbers
This adds a few additional ioctl numbers for performing various block
device operations.

Change-Id: I1dc836f4017bbc175b2dee759fece728f1caa010
Reviewed-on: https://go-review.googlesource.com/c/sys/+/511597
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-20 23:00:54 +00:00
cui fliter
c406141231 all: fix some typos
Change-Id: Id4bf4ce8aee8b98baa2f1a9c62a72a9554f7d557
Reviewed-on: https://go-review.googlesource.com/c/sys/+/510595
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-07-19 19:13:37 +00:00
Mauri de Souza Meneguzzo
25d0004552 unix: fix last argument of pselect6 on linux
On Linux, the last argument of pselect6 system call is **not** a
sigseg_t * pointer, but instead it is a structure of the form:

    struct {
        const sigset_t *ss;     /* Pointer to signal set */
        size_t          ss_len; /* Size (in bytes) of object pointed
    };

See man 2 pselect6.

Fixes #61251

Change-Id: Id0aa122a77796713bc6d624dc395d396fbc0c5e2
GitHub-Last-Rev: cb3c6d7da9
GitHub-Pull-Request: golang/sys#167
Reviewed-on: https://go-review.googlesource.com/c/sys/+/510195
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-07-19 00:01:56 +00:00
cui fliter
706fa9866a windows: remove repetitive words
Change-Id: I9c944eca6117b1039f0c5287706cb447b75c8cbd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/509835
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-07-17 14:37:11 +00:00
Tobias Klauser
3fead03e7d unix: add Mremap for netbsd
Fixes golang/go#60409

Change-Id: I2d872a1a6fb63c27ab3753deff370e1c2f752bdd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/508397
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-07-13 05:43:33 +00:00
Tobias Klauser
a1a9c4b846 unix/linux: update to Linux kernel 6.4 and Go 1.21rc2
Also fix the glibc 2.37 release date in a comment.

Change-Id: Ibd972a2846f0085bacf67c847ce4726bf130d5ba
Reviewed-on: https://go-review.googlesource.com/c/sys/+/506017
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
v0.10.0
2023-06-27 17:19:37 +00:00
Heschi Kreinick
0a92922092 windows: make TestSystemModuleVersions more tolerant
One file can't be read on LUCI's Windows image:

    syscall_windows_test.go:892: CimFS.SYS: The specified resource type cannot be found in the image file.

That doesn't seem like a good enough reason to fail the test. Skip the
file if this error is encountered.

Change-Id: Id9a65b3ff748bbf7ef7fac37d3741c16e001a4b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/505220
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2023-06-27 15:54:37 +00:00
Jordan Whited
d1abdad3a4 unix/linux: update TUN flags and virtio_net_hdr constants
TUN_F_USO{4,6} and VIRTIO_NET_HDR_GSO_UDP_L4 are new in Linux v6.2.

Change-Id: I7e3dc34118d1c03afeb87fb8699d8167a6e49b7f
GitHub-Last-Rev: c658b9bf0f
GitHub-Pull-Request: golang/sys#165
Reviewed-on: https://go-review.googlesource.com/c/sys/+/506455
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-06-27 15:33:31 +00:00
Craig Davison
2b751ddc66 windows/svc/mgr: add Service.RecoveryActionsOnNonCrashFailures
Fixes golang/go#59016

Change-Id: I5e16f61ea2fc384052565342c6517687562260a1
GitHub-Last-Rev: 3626b01fcf
GitHub-Pull-Request: golang/sys#157
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484896
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-24 00:31:25 +00:00
Anton Kuklin
e0c3b6e6ae unix: add Mremap for linux
For golang/go#60409

Change-Id: I75a9732ee996f0aeb91599d80803f96ada468c27
GitHub-Last-Rev: c348b6194d
GitHub-Pull-Request: golang/sys#164
Reviewed-on: https://go-review.googlesource.com/c/sys/+/502715
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-06-16 19:37:35 +00:00
Tobias Klauser
ca096e46e8 unix: add missing IFLA_* consts on linux
Change-Id: Ib221d98f8d7e5aac7ff2db207cdd92145fe1dc60
Reviewed-on: https://go-review.googlesource.com/c/sys/+/503715
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-06-16 18:27:27 +00:00
Tobias Klauser
df9fef2097 unix/linux: update to Linux kernel 6.3 and Go 1.20.5
Change-Id: I347341ae0e45e73477e9a310a3749d37bafa8da7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/503255
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-16 18:27:25 +00:00
Brad Fitzpatrick
55b11dcdae unix: remove recently introduced debug/elf dependency
CL 501795 added a dependency on debug/elf (and thus compress/gzip,
debug/dwarf, hash/adler32)

Add a copy of the const instead.

Change-Id: I2c86094ef7de61b8dd0bdd727f6e547ac7f58527
Reviewed-on: https://go-review.googlesource.com/c/sys/+/502356
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
v0.9.0
2023-06-12 14:18:21 +00:00
Guoqi Chen
5059a07aa4 unix: implement Ptrace{Set,Get}Regs using PTRACE_{GET,SET}REGSET for Linux
The same change was already done in CL 501756.

Fixes #60679.

Change-Id: I5d1f4ad89cabb0ac120b3d72876944fb3283ec6f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/501795
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-09 14:43:47 +00:00
Josh Rickmar
304f187cdb unix: replace use of strcpy in mkerrors.sh
On OpenBSD-current, clang emits a warning message to standard output for the use of strcpy, e.g.:

_errors.c(/tmp/_errors-673190.o:(main)): warning: strcpy() is almost always misused, please use strlcpy()

This message makes it into the Go source being created, causing gofmt to error on the invalid syntax, and leaving the zerrors file empty.

Using strlcpy would be preferred here, but strncpy is enough to silence this message, and is more portable.

Change-Id: I16404d74c4406dadda87f211fc0ba062de0d11ac
GitHub-Last-Rev: a43b6fbc1b
GitHub-Pull-Request: golang/sys#147
Reviewed-on: https://go-review.googlesource.com/c/sys/+/468399
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2023-06-06 21:43:30 +00:00
Alvar Penning
81c8a6c06d unix: add Getresuid and Getresgid for OpenBSD
Addresses golang/go#60483 for OpenBSD.

This change was successfully tested on amd64 and adjusted accordingly for the other architectures.

Change-Id: Id63cca342d81d2cc5854eb2923ca7e66bfaa91bf
GitHub-Last-Rev: cff1170143
GitHub-Pull-Request: golang/sys#160
Reviewed-on: https://go-review.googlesource.com/c/sys/+/500655
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-05 16:39:39 +00:00
Alvar Penning
ff98eae2a0 unix: remove absolute path of pwd from mkall.sh
The pwd command does not always reside under /bin for all Linux
distributions. As a $PATH is otherwise always assumed, here too.

Change-Id: I8a9b65fedc0bdd6b963f30e69d5c98b1550326cd
GitHub-Last-Rev: ff9227dbe6
GitHub-Pull-Request: golang/sys#161
Reviewed-on: https://go-review.googlesource.com/c/sys/+/500656
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-04 15:21:17 +00:00
Mateusz Poliwczak
b52f5441ce unix: add Getresuid, Getresgid for linux
Fixes golang/go#60483

Change-Id: Id4c1bf8367066485a16bedeea337c384a3555942
GitHub-Last-Rev: 61f0fe6f6a
GitHub-Pull-Request: golang/sys#159
Reviewed-on: https://go-review.googlesource.com/c/sys/+/499055
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-05-31 15:03:40 +00:00
Florian Lehner
b5c7a0975d unix: update BPF constants with Linux kernel 6.2
Change-Id: Iaa92ec9e8ff6e337457ea4f57b4c046221128d43
Reviewed-on: https://go-review.googlesource.com/c/sys/+/496675
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-05-23 19:43:07 +00:00
Roman Mazur
c8ea6b0cbc windows: fix EnumProcesses to pass the correct array size
Implementation generated directly with mkwinsyscall has a wrong
assumption about the expected value for PIDs buffer size.

This change adds some small manual code that converts the input
slice length to the number of bytes of the array backing the slice.

A test is also added. It fails with the previous implementation.

Fixes golang/go#60223

Change-Id: I5e2414acb29c6c949e5e6acd328043f8a8883887
Reviewed-on: https://go-review.googlesource.com/c/sys/+/495995
Commit-Queue: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-05-19 20:19:27 +00:00
Tobias Klauser
352d8339e8 cpu: add test for IsBigEndian
For golang/go#57237

Change-Id: I11d1c954f942ebd836c4deb9c710c40778dc5599
Reviewed-on: https://go-review.googlesource.com/c/sys/+/494858
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-16 16:00:41 +00:00
Tobias Klauser
c43fe1e1f5 cpu: define IsBigEndian on wasm
For golang/go#57237

Change-Id: Ia2aa943e93c8df51cd08003535fa026d2bb8003e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/494856
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-05-16 16:00:40 +00:00
Bryan C. Mills
1911637744 windows/svc: use separate (and more descriptive) service names in tests
Notably, the DisplayName field was set to the same thing in both
sys.TestExample and mrg.TestMyService, which may explain the collision
reported in golang/go#59298.

Moreover, the adjective ”my” conveys no information whatsoever — we
shouldn't use it in tests or examples.

Also skip the tests that install services if GO_BUILDER_NAME is not
set, to reduce the likelihood of 'go test all' in a user's working
directory being mistaken for a malicious or compromised program.

Fixes golang/go#59298.

Change-Id: Ib00bf7400bfaa34e1a1d49125c43b97019b53c82
Reviewed-on: https://go-review.googlesource.com/c/sys/+/481015
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-05-04 17:52:42 +00:00
Bryan C. Mills
ca59edaa5a windows: use unsafe.Add instead of pointer arithmetic on a uintptr
The existing uintptr arithmetic is arguably valid because the
environment block is not located within the Go heap
(see golang/go#58625).

However, unsafe.Add (added in Go 1.17) expresses the same logic with
fewer conversions, and in addition avoids triggering the unsafeptr
vet check.

For golang/go#41205.

Change-Id: Ifc509279a13fd707be570908ec779d8518b4f75b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/492415
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
v0.8.0
2023-05-03 21:21:24 +00:00
Alex Brainman
6c5289959c windows: return error if DecomposeCommandLine parameter contains NUL
DecomposeCommandLine is documented to use CommandLineToArgv, and the
CommandLineToArgvW system call inherently does not support strings with
internal NUL bytes. This CL changes DecomposeCommandLine to reject those
strings with an error instead of panicking.

Fixes golang/go#58817

Change-Id: I22a026bf2e69344a21f04849c50ba19b6e7b2007
Reviewed-on: https://go-review.googlesource.com/c/sys/+/487695
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2023-04-25 08:07:06 +00:00
Craig Davison
9524d496ef windows/svc/mgr: Service.Control: populate Status when returning certain errors
Fixes golang/go#59015

Change-Id: I45f22049f3a05f807f78d20c9ed67c6c79e3d3c1
GitHub-Last-Rev: 929aeb4acb
GitHub-Pull-Request: golang/sys#156
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484895
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-25 08:02:03 +00:00
Tobias Klauser
2a33a30b79 execabs: let hasExec return false on wasip1
Wasm cannot execute processes. Follow CL 479622 and update hasExec to
match internal/testenv.HasExec.

Updates golang/go#58141

Change-Id: Ie44dc356ee589784c44906694fda387fb1448ad5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/485655
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-04-18 17:08:16 +00:00
Tobias Klauser
39c2d6a01d unix: add UDP socket option constants on linux
Change-Id: I4c947319f98754a5135b306d8ff042a986ab5440
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484637
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2023-04-14 20:11:08 +00:00
Tobias Klauser
1fb6828e5b unix: convert Iovec.Base to *byte in mkpost.go on solaris
Instead of defining a dedicated type goIovec with the correct *byte type
for its Base field like CL 412496 did, modify the Base field of the
original type Iovec (generated from struct iovec) in mkpost.go. This is
akin to how we already change []int8 to []byte for several other types.

Fixes golang/go#55997

Change-Id: If30799bb2bfe6d17678370b45348ff0b7c5de2e9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484635
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-04-14 16:57:27 +00:00
Tobias Klauser
3125361ba6 unix: allow overriding GOOS using GOOS_TARGET in mkpost.go
mkpost.go is platform independent and can in principle be run on a GOOS
other than the one we're generating the syscall wrappers for. Allow
overriding GOOS by setting GOOS_TARGET, similar to other generator
programs in the repo. This e.g. allows testing mkpost.go changes on a
different GOOS.

Follows CL 256278 which did the same for mksyscall.go

Change-Id: Ib99aa5cd266f7d27543cf9433cfb028f367eef63
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484636
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2023-04-14 16:29:20 +00:00
Sebastian Soto
dbd8f99a5e windows: add Service.ListDependentServices
This method allows a user to list all Windows services which are
dependent upon a given service.

This commit makes use of the EnumDependentServices Windows API call.
Without this, a user would have to iterate through each service on the
system, and check if the given service is listed in each service's
dependencies list.

The implementation of ListDependentServices is mostly the same as
Mgr.ListServices, as the API calls behave in the same way.

Fixes golang/go#56766

Change-Id: I9ec18c97afd02f48deef691ccdd5c26d6501add1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/451363
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2023-04-14 09:16:30 +00:00
masshash
f25ff604a2 windows: add JobObjectInformationClass consts for QueryInformationJobObject
Reference:
https://learn.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi2-queryinformationjobobject#parameters

Change-Id: I0d10895ffc18b345f371cc7e0cbf8362fd67f71a
GitHub-Last-Rev: 28163917a0
GitHub-Pull-Request: golang/sys#154
Reviewed-on: https://go-review.googlesource.com/c/sys/+/481455
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-10 20:17:12 +00:00
Ed Schouten
64840c112d unix: add bindings for setattrlist() on macOS
The setattrlist() function can be used to mutate the attributes of files through a single call. For example, one can perform a chmod(), chown(), chflags(), [...] all at once.

This change also adds bindings for the UF_* and SF_* flags that are accepted by chflags(). This makes it possible to use setattrlist() to perform the equivalent of lchflags(), for which we currently have no binding.

Change-Id: Ib5a604503a984b95a02b65ad1a437246cd170584
GitHub-Last-Rev: 45dd9d475a
GitHub-Pull-Request: golang/sys#155
Reviewed-on: https://go-review.googlesource.com/c/sys/+/481815
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
v0.7.0
2023-04-04 14:21:21 +00:00