Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golang/sys
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ca59eda
Choose a base ref
...
head repository: golang/sys
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 55b11dc
Choose a head ref
  • 11 commits
  • 31 files changed
  • 9 contributors

Commits on May 4, 2023

  1. 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>
    Bryan C. Mills authored and gopherbot committed May 4, 2023
    Copy the full SHA
    1911637 View commit details

Commits on May 16, 2023

  1. 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>
    tklauser authored and gopherbot committed May 16, 2023
    Copy the full SHA
    c43fe1e View commit details
  2. 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>
    tklauser authored and gopherbot committed May 16, 2023
    Copy the full SHA
    352d833 View commit details

Commits on May 19, 2023

  1. 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>
    roman-mazur authored and qmuntal committed May 19, 2023
    Copy the full SHA
    c8ea6b0 View commit details

Commits on May 23, 2023

  1. 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>
    florianl authored and gopherbot committed May 23, 2023
    Copy the full SHA
    b5c7a09 View commit details

Commits on May 31, 2023

  1. unix: add Getresuid, Getresgid for linux

    Fixes golang/go#60483
    
    Change-Id: Id4c1bf8367066485a16bedeea337c384a3555942
    GitHub-Last-Rev: 61f0fe6
    GitHub-Pull-Request: #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>
    mateusz834 authored and gopherbot committed May 31, 2023
    Copy the full SHA
    b52f544 View commit details

Commits on Jun 4, 2023

  1. 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: ff9227d
    GitHub-Pull-Request: #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>
    oxzi authored and gopherbot committed Jun 4, 2023
    Copy the full SHA
    ff98eae View commit details

Commits on Jun 5, 2023

  1. 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: cff1170
    GitHub-Pull-Request: #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>
    oxzi authored and gopherbot committed Jun 5, 2023
    Copy the full SHA
    81c8a6c View commit details

Commits on Jun 6, 2023

  1. 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: a43b6fb
    GitHub-Pull-Request: #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>
    jrick authored and gopherbot committed Jun 6, 2023
    Copy the full SHA
    304f187 View commit details

Commits on Jun 9, 2023

  1. 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>
    abner-chenc authored and gopherbot committed Jun 9, 2023
    Copy the full SHA
    5059a07 View commit details

Commits on Jun 12, 2023

  1. 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>
    bradfitz authored and gopherbot committed Jun 12, 2023
    Copy the full SHA
    55b11dc View commit details
4 changes: 2 additions & 2 deletions cpu/endian_little.go
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm
// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh wasm

package cpu

21 changes: 21 additions & 0 deletions cpu/endian_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cpu_test

import (
"testing"
"unsafe"

"golang.org/x/sys/cpu"
)

func TestIsBigEndian(t *testing.T) {
b := uint16(0xff00)
want := *(*byte)(unsafe.Pointer(&b)) == 0xff
if cpu.IsBigEndian != want {
t.Errorf("IsBigEndian = %t, want %t",
cpu.IsBigEndian, want)
}
}
46 changes: 46 additions & 0 deletions unix/linux/types.go
Original file line number Diff line number Diff line change
@@ -2543,6 +2543,11 @@ const (
BPF_REG_8 = C.BPF_REG_8
BPF_REG_9 = C.BPF_REG_9
BPF_REG_10 = C.BPF_REG_10
BPF_CGROUP_ITER_ORDER_UNSPEC = C.BPF_CGROUP_ITER_ORDER_UNSPEC
BPF_CGROUP_ITER_SELF_ONLY = C.BPF_CGROUP_ITER_SELF_ONLY
BPF_CGROUP_ITER_DESCENDANTS_PRE = C.BPF_CGROUP_ITER_DESCENDANTS_PRE
BPF_CGROUP_ITER_DESCENDANTS_POST = C.BPF_CGROUP_ITER_DESCENDANTS_POST
BPF_CGROUP_ITER_ANCESTORS_UP = C.BPF_CGROUP_ITER_ANCESTORS_UP
BPF_MAP_CREATE = C.BPF_MAP_CREATE
BPF_MAP_LOOKUP_ELEM = C.BPF_MAP_LOOKUP_ELEM
BPF_MAP_UPDATE_ELEM = C.BPF_MAP_UPDATE_ELEM
@@ -2554,6 +2559,7 @@ const (
BPF_PROG_ATTACH = C.BPF_PROG_ATTACH
BPF_PROG_DETACH = C.BPF_PROG_DETACH
BPF_PROG_TEST_RUN = C.BPF_PROG_TEST_RUN
BPF_PROG_RUN = C.BPF_PROG_RUN
BPF_PROG_GET_NEXT_ID = C.BPF_PROG_GET_NEXT_ID
BPF_MAP_GET_NEXT_ID = C.BPF_MAP_GET_NEXT_ID
BPF_PROG_GET_FD_BY_ID = C.BPF_PROG_GET_FD_BY_ID
@@ -2598,6 +2604,7 @@ const (
BPF_MAP_TYPE_CPUMAP = C.BPF_MAP_TYPE_CPUMAP
BPF_MAP_TYPE_XSKMAP = C.BPF_MAP_TYPE_XSKMAP
BPF_MAP_TYPE_SOCKHASH = C.BPF_MAP_TYPE_SOCKHASH
BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED = C.BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED
BPF_MAP_TYPE_CGROUP_STORAGE = C.BPF_MAP_TYPE_CGROUP_STORAGE
BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = C.BPF_MAP_TYPE_REUSEPORT_SOCKARRAY
BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = C.BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE
@@ -2608,6 +2615,10 @@ const (
BPF_MAP_TYPE_STRUCT_OPS = C.BPF_MAP_TYPE_STRUCT_OPS
BPF_MAP_TYPE_RINGBUF = C.BPF_MAP_TYPE_RINGBUF
BPF_MAP_TYPE_INODE_STORAGE = C.BPF_MAP_TYPE_INODE_STORAGE
BPF_MAP_TYPE_TASK_STORAGE = C.BPF_MAP_TYPE_TASK_STORAGE
BPF_MAP_TYPE_BLOOM_FILTER = C.BPF_MAP_TYPE_BLOOM_FILTER
BPF_MAP_TYPE_USER_RINGBUF = C.BPF_MAP_TYPE_USER_RINGBUF
BPF_MAP_TYPE_CGRP_STORAGE = C.BPF_MAP_TYPE_CGRP_STORAGE
BPF_PROG_TYPE_UNSPEC = C.BPF_PROG_TYPE_UNSPEC
BPF_PROG_TYPE_SOCKET_FILTER = C.BPF_PROG_TYPE_SOCKET_FILTER
BPF_PROG_TYPE_KPROBE = C.BPF_PROG_TYPE_KPROBE
@@ -2639,6 +2650,7 @@ const (
BPF_PROG_TYPE_EXT = C.BPF_PROG_TYPE_EXT
BPF_PROG_TYPE_LSM = C.BPF_PROG_TYPE_LSM
BPF_PROG_TYPE_SK_LOOKUP = C.BPF_PROG_TYPE_SK_LOOKUP
BPF_PROG_TYPE_SYSCALL = C.BPF_PROG_TYPE_SYSCALL
BPF_CGROUP_INET_INGRESS = C.BPF_CGROUP_INET_INGRESS
BPF_CGROUP_INET_EGRESS = C.BPF_CGROUP_INET_EGRESS
BPF_CGROUP_INET_SOCK_CREATE = C.BPF_CGROUP_INET_SOCK_CREATE
@@ -2677,13 +2689,22 @@ const (
BPF_XDP_CPUMAP = C.BPF_XDP_CPUMAP
BPF_SK_LOOKUP = C.BPF_SK_LOOKUP
BPF_XDP = C.BPF_XDP
BPF_SK_SKB_VERDICT = C.BPF_SK_SKB_VERDICT
BPF_SK_REUSEPORT_SELECT = C.BPF_SK_REUSEPORT_SELECT
BPF_SK_REUSEPORT_SELECT_OR_MIGRATE = C.BPF_SK_REUSEPORT_SELECT_OR_MIGRATE
BPF_PERF_EVENT = C.BPF_PERF_EVENT
BPF_TRACE_KPROBE_MULTI = C.BPF_TRACE_KPROBE_MULTI
BPF_LSM_CGROUP = C.BPF_LSM_CGROUP
BPF_LINK_TYPE_UNSPEC = C.BPF_LINK_TYPE_UNSPEC
BPF_LINK_TYPE_RAW_TRACEPOINT = C.BPF_LINK_TYPE_RAW_TRACEPOINT
BPF_LINK_TYPE_TRACING = C.BPF_LINK_TYPE_TRACING
BPF_LINK_TYPE_CGROUP = C.BPF_LINK_TYPE_CGROUP
BPF_LINK_TYPE_ITER = C.BPF_LINK_TYPE_ITER
BPF_LINK_TYPE_NETNS = C.BPF_LINK_TYPE_NETNS
BPF_LINK_TYPE_XDP = C.BPF_LINK_TYPE_XDP
BPF_LINK_TYPE_PERF_EVENT = C.BPF_LINK_TYPE_PERF_EVENT
BPF_LINK_TYPE_KPROBE_MULTI = C.BPF_LINK_TYPE_KPROBE_MULTI
BPF_LINK_TYPE_STRUCT_OPS = C.BPF_LINK_TYPE_STRUCT_OPS
BPF_ANY = C.BPF_ANY
BPF_NOEXIST = C.BPF_NOEXIST
BPF_EXIST = C.BPF_EXIST
@@ -2721,6 +2742,7 @@ const (
BPF_F_ZERO_CSUM_TX = C.BPF_F_ZERO_CSUM_TX
BPF_F_DONT_FRAGMENT = C.BPF_F_DONT_FRAGMENT
BPF_F_SEQ_NUMBER = C.BPF_F_SEQ_NUMBER
BPF_F_TUNINFO_FLAGS = C.BPF_F_TUNINFO_FLAGS
BPF_F_INDEX_MASK = C.BPF_F_INDEX_MASK
BPF_F_CURRENT_CPU = C.BPF_F_CURRENT_CPU
BPF_F_CTXLEN_MASK = C.BPF_F_CTXLEN_MASK
@@ -2735,6 +2757,7 @@ const (
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = C.BPF_F_ADJ_ROOM_ENCAP_L4_GRE
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = C.BPF_F_ADJ_ROOM_ENCAP_L4_UDP
BPF_F_ADJ_ROOM_NO_CSUM_RESET = C.BPF_F_ADJ_ROOM_NO_CSUM_RESET
BPF_F_ADJ_ROOM_ENCAP_L2_ETH = C.BPF_F_ADJ_ROOM_ENCAP_L2_ETH
BPF_ADJ_ROOM_ENCAP_L2_MASK = C.BPF_ADJ_ROOM_ENCAP_L2_MASK
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = C.BPF_ADJ_ROOM_ENCAP_L2_SHIFT
BPF_F_SYSCTL_BASE_NAME = C.BPF_F_SYSCTL_BASE_NAME
@@ -2759,10 +2782,16 @@ const (
BPF_LWT_ENCAP_SEG6 = C.BPF_LWT_ENCAP_SEG6
BPF_LWT_ENCAP_SEG6_INLINE = C.BPF_LWT_ENCAP_SEG6_INLINE
BPF_LWT_ENCAP_IP = C.BPF_LWT_ENCAP_IP
BPF_F_BPRM_SECUREEXEC = C.BPF_F_BPRM_SECUREEXEC
BPF_F_BROADCAST = C.BPF_F_BROADCAST
BPF_F_EXCLUDE_INGRESS = C.BPF_F_EXCLUDE_INGRESS
BPF_SKB_TSTAMP_UNSPEC = C.BPF_SKB_TSTAMP_UNSPEC
BPF_SKB_TSTAMP_DELIVERY_MONO = C.BPF_SKB_TSTAMP_DELIVERY_MONO
BPF_OK = C.BPF_OK
BPF_DROP = C.BPF_DROP
BPF_REDIRECT = C.BPF_REDIRECT
BPF_LWT_REROUTE = C.BPF_LWT_REROUTE
BPF_FLOW_DISSECTOR_CONTINUE = C.BPF_FLOW_DISSECTOR_CONTINUE
BPF_SOCK_OPS_RTO_CB_FLAG = C.BPF_SOCK_OPS_RTO_CB_FLAG
BPF_SOCK_OPS_RETRANS_CB_FLAG = C.BPF_SOCK_OPS_RETRANS_CB_FLAG
BPF_SOCK_OPS_STATE_CB_FLAG = C.BPF_SOCK_OPS_STATE_CB_FLAG
@@ -2826,6 +2855,10 @@ const (
BPF_FIB_LKUP_RET_UNSUPP_LWT = C.BPF_FIB_LKUP_RET_UNSUPP_LWT
BPF_FIB_LKUP_RET_NO_NEIGH = C.BPF_FIB_LKUP_RET_NO_NEIGH
BPF_FIB_LKUP_RET_FRAG_NEEDED = C.BPF_FIB_LKUP_RET_FRAG_NEEDED
BPF_MTU_CHK_SEGS = C.BPF_MTU_CHK_SEGS
BPF_MTU_CHK_RET_SUCCESS = C.BPF_MTU_CHK_RET_SUCCESS
BPF_MTU_CHK_RET_FRAG_NEEDED = C.BPF_MTU_CHK_RET_FRAG_NEEDED
BPF_MTU_CHK_RET_SEGS_TOOBIG = C.BPF_MTU_CHK_RET_SEGS_TOOBIG
BPF_FD_TYPE_RAW_TRACEPOINT = C.BPF_FD_TYPE_RAW_TRACEPOINT
BPF_FD_TYPE_TRACEPOINT = C.BPF_FD_TYPE_TRACEPOINT
BPF_FD_TYPE_KPROBE = C.BPF_FD_TYPE_KPROBE
@@ -2835,6 +2868,19 @@ const (
BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = C.BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG
BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = C.BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL
BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = C.BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP
BPF_CORE_FIELD_BYTE_OFFSET = C.BPF_CORE_FIELD_BYTE_OFFSET
BPF_CORE_FIELD_BYTE_SIZE = C.BPF_CORE_FIELD_BYTE_SIZE
BPF_CORE_FIELD_EXISTS = C.BPF_CORE_FIELD_EXISTS
BPF_CORE_FIELD_SIGNED = C.BPF_CORE_FIELD_SIGNED
BPF_CORE_FIELD_LSHIFT_U64 = C.BPF_CORE_FIELD_LSHIFT_U64
BPF_CORE_FIELD_RSHIFT_U64 = C.BPF_CORE_FIELD_RSHIFT_U64
BPF_CORE_TYPE_ID_LOCAL = C.BPF_CORE_TYPE_ID_LOCAL
BPF_CORE_TYPE_ID_TARGET = C.BPF_CORE_TYPE_ID_TARGET
BPF_CORE_TYPE_EXISTS = C.BPF_CORE_TYPE_EXISTS
BPF_CORE_TYPE_SIZE = C.BPF_CORE_TYPE_SIZE
BPF_CORE_ENUMVAL_EXISTS = C.BPF_CORE_ENUMVAL_EXISTS
BPF_CORE_ENUMVAL_VALUE = C.BPF_CORE_ENUMVAL_VALUE
BPF_CORE_TYPE_MATCHES = C.BPF_CORE_TYPE_MATCHES
)

// generated by:
2 changes: 1 addition & 1 deletion unix/mkall.sh
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then
# Use the Docker-based build system
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
$cmd docker build --tag generate:$GOOS $GOOS
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS
exit
fi

6 changes: 4 additions & 2 deletions unix/mkerrors.sh
Original file line number Diff line number Diff line change
@@ -741,7 +741,8 @@ main(void)
e = errors[i].num;
if(i > 0 && errors[i-1].num == e)
continue;
strcpy(buf, strerror(e));
strncpy(buf, strerror(e), sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
buf[0] += a - A;
@@ -760,7 +761,8 @@ main(void)
e = signals[i].num;
if(i > 0 && signals[i-1].num == e)
continue;
strcpy(buf, strsignal(e));
strncpy(buf, strsignal(e), sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
buf[0] += a - A;
30 changes: 28 additions & 2 deletions unix/syscall_linux.go
Original file line number Diff line number Diff line change
@@ -1699,12 +1699,23 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
}

// elfNT_PRSTATUS is a copy of the debug/elf.NT_PRSTATUS constant so
// x/sys/unix doesn't need to depend on debug/elf and thus
// compress/zlib, debug/dwarf, and other packages.
const elfNT_PRSTATUS = 1

func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
var iov Iovec
iov.Base = (*byte)(unsafe.Pointer(regsout))
iov.SetLen(int(unsafe.Sizeof(*regsout)))
return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
}

func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
var iov Iovec
iov.Base = (*byte)(unsafe.Pointer(regs))
iov.SetLen(int(unsafe.Sizeof(*regs)))
return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
}

func PtraceSetOptions(pid int, options int) (err error) {
@@ -2420,6 +2431,21 @@ func PthreadSigmask(how int, set, oldset *Sigset_t) error {
return rtSigprocmask(how, set, oldset, _C__NSIG/8)
}

//sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int)
//sysnb getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int)

func Getresuid() (ruid, euid, suid int) {
var r, e, s _C_int
getresuid(&r, &e, &s)
return int(r), int(e), int(s)
}

func Getresgid() (rgid, egid, sgid int) {
var r, e, s _C_int
getresgid(&r, &e, &s)
return int(r), int(e), int(s)
}

/*
* Unimplemented
*/
17 changes: 15 additions & 2 deletions unix/syscall_openbsd.go
Original file line number Diff line number Diff line change
@@ -151,6 +151,21 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
return
}

//sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int)
//sysnb getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int)

func Getresuid() (ruid, euid, suid int) {
var r, e, s _C_int
getresuid(&r, &e, &s)
return int(r), int(e), int(s)
}

func Getresgid() (rgid, egid, sgid int) {
var r, e, s _C_int
getresgid(&r, &e, &s)
return int(r), int(e), int(s)
}

//sys ioctl(fd int, req uint, arg uintptr) (err error)
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL

@@ -338,8 +353,6 @@ func Uname(uname *Utsname) error {
// getgid
// getitimer
// getlogin
// getresgid
// getresuid
// getthrid
// ktrace
// lfs_bmapv
48 changes: 48 additions & 0 deletions unix/zerrors_linux_sparc64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions unix/zsyscall_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions unix/zsyscall_openbsd_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions unix/zsyscall_openbsd_386.s
Original file line number Diff line number Diff line change
@@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $4
DATA ·libc_getcwd_trampoline_addr(SB)/4, $libc_getcwd_trampoline<>(SB)

TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getresuid(SB)
GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $4
DATA ·libc_getresuid_trampoline_addr(SB)/4, $libc_getresuid_trampoline<>(SB)

TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getresgid(SB)
GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $4
DATA ·libc_getresgid_trampoline_addr(SB)/4, $libc_getresgid_trampoline<>(SB)

TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $4
Loading