]> Cypherpunks repositories - gostls13.git/commitdiff
internal/runtime/syscall: rename to internal/runtime/syscall/linux
authorqmuntal <quimmuntal@gmail.com>
Mon, 21 Jul 2025 08:39:28 +0000 (10:39 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Thu, 24 Jul 2025 20:30:14 +0000 (13:30 -0700)
All code in internal/runtime/syscall is Linux-specific, so better
move it to a new linux sub-directory. This way it will be easier
to factor out runtime syscall code from other platforms, e.g.
Windows.

Updates #51087.

Change-Id: Idd2a52444b33bf3ad576b47fd232e990cdc8ae75
Reviewed-on: https://go-review.googlesource.com/c/go/+/689155
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

33 files changed:
src/cmd/internal/objabi/pkgspecial.go
src/go/build/deps_test.go
src/internal/coverage/pkid.go
src/internal/runtime/cgroup/cgroup_linux.go
src/internal/runtime/cgroup/line_reader.go
src/internal/runtime/syscall/linux/asm_linux_386.s [moved from src/internal/runtime/syscall/asm_linux_386.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_amd64.s [moved from src/internal/runtime/syscall/asm_linux_amd64.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_arm.s [moved from src/internal/runtime/syscall/asm_linux_arm.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_arm64.s [moved from src/internal/runtime/syscall/asm_linux_arm64.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_loong64.s [moved from src/internal/runtime/syscall/asm_linux_loong64.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_mips64x.s [moved from src/internal/runtime/syscall/asm_linux_mips64x.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_mipsx.s [moved from src/internal/runtime/syscall/asm_linux_mipsx.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_ppc64x.s [moved from src/internal/runtime/syscall/asm_linux_ppc64x.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_riscv64.s [moved from src/internal/runtime/syscall/asm_linux_riscv64.s with 100% similarity]
src/internal/runtime/syscall/linux/asm_linux_s390x.s [moved from src/internal/runtime/syscall/asm_linux_s390x.s with 100% similarity]
src/internal/runtime/syscall/linux/defs_linux.go [moved from src/internal/runtime/syscall/defs_linux.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_386.go [moved from src/internal/runtime/syscall/defs_linux_386.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_amd64.go [moved from src/internal/runtime/syscall/defs_linux_amd64.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_arm.go [moved from src/internal/runtime/syscall/defs_linux_arm.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_arm64.go [moved from src/internal/runtime/syscall/defs_linux_arm64.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_loong64.go [moved from src/internal/runtime/syscall/defs_linux_loong64.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_mips64x.go [moved from src/internal/runtime/syscall/defs_linux_mips64x.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_mipsx.go [moved from src/internal/runtime/syscall/defs_linux_mipsx.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_ppc64x.go [moved from src/internal/runtime/syscall/defs_linux_ppc64x.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_riscv64.go [moved from src/internal/runtime/syscall/defs_linux_riscv64.go with 97% similarity]
src/internal/runtime/syscall/linux/defs_linux_s390x.go [moved from src/internal/runtime/syscall/defs_linux_s390x.go with 97% similarity]
src/internal/runtime/syscall/linux/syscall_linux.go [moved from src/internal/runtime/syscall/syscall_linux.go with 92% similarity]
src/internal/runtime/syscall/linux/syscall_linux_test.go [moved from src/internal/runtime/syscall/syscall_linux_test.go with 74% similarity]
src/runtime/netpoll_epoll.go
src/runtime/os_linux.go
src/runtime/os_linux_riscv64.go
src/runtime/set_vma_name_linux.go
src/syscall/syscall_linux.go

index e09aeadbc21c8294e7e2c6dffa004419449eaf7d..522337f583aa17f235e048068a349d6677c76f61 100644 (file)
@@ -56,7 +56,7 @@ var runtimePkgs = []string{
        "internal/runtime/math",
        "internal/runtime/strconv",
        "internal/runtime/sys",
-       "internal/runtime/syscall",
+       "internal/runtime/syscall/linux",
 
        "internal/abi",
        "internal/bytealg",
@@ -94,7 +94,7 @@ var allowAsmABIPkgs = []string{
        "syscall",
        "internal/bytealg",
        "internal/chacha8rand",
-       "internal/runtime/syscall",
+       "internal/runtime/syscall/linux",
        "internal/runtime/startlinetest",
 }
 
index 6d92542e31b6526a5c9797f2d51bfb9f6a7c9ae2..b3d8f66bc761eeee1374d7b2161ebc7409e344a0 100644 (file)
@@ -91,7 +91,7 @@ var depsRules = `
        < internal/msan
        < internal/asan
        < internal/runtime/sys
-       < internal/runtime/syscall
+       < internal/runtime/syscall/linux
        < internal/runtime/atomic
        < internal/runtime/exithook
        < internal/runtime/gc
index 30b5ad49aceac2bbc1079daeb3c813e74f3e6854..c9bcce2b6c1850a6c4bf31e730a314cb5ceb1154 100644 (file)
@@ -31,7 +31,7 @@ package coverage
 //    slot: 6 path='internal/runtime/math'  hard-coded id: 6
 //    slot: 7 path='internal/bytealg'  hard-coded id: 7
 //    slot: 8 path='internal/goexperiment'
-//    slot: 9 path='internal/runtime/syscall'  hard-coded id: 8
+//    slot: 9 path='internal/runtime/syscall/linux'  hard-coded id: 8
 //    slot: 10 path='runtime'  hard-coded id: 9
 //    fatal error: runtime.addCovMeta
 //
@@ -66,7 +66,7 @@ var rtPkgs = [...]string{
        "internal/runtime/strconv",
        "internal/runtime/sys",
        "internal/runtime/maps",
-       "internal/runtime/syscall",
+       "internal/runtime/syscall/linux",
        "internal/runtime/cgroup",
        "internal/stringslite",
        "runtime",
index 2fc3b225c527ee0dc72c9ccda22d5af07f159f14..91815b4a1d0df88dcee191c10f29ab092182ba01 100644 (file)
@@ -7,7 +7,7 @@ package cgroup
 import (
        "internal/bytealg"
        "internal/runtime/strconv"
-       "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
 )
 
 var (
@@ -77,10 +77,10 @@ type CPU struct {
 func (c CPU) Close() {
        switch c.version {
        case V1:
-               syscall.Close(c.quotaFD)
-               syscall.Close(c.periodFD)
+               linux.Close(c.quotaFD)
+               linux.Close(c.periodFD)
        case V2:
-               syscall.Close(c.quotaFD)
+               linux.Close(c.quotaFD)
        default:
                throw("impossible cgroup version")
        }
@@ -112,7 +112,7 @@ func OpenCPU(scratch []byte) (CPU, error) {
        case 1:
                n2 := copy(base[n:], v1QuotaFile)
                path := base[:n+n2]
-               quotaFD, errno := syscall.Open(&path[0], syscall.O_RDONLY|syscall.O_CLOEXEC, 0)
+               quotaFD, errno := linux.Open(&path[0], linux.O_RDONLY|linux.O_CLOEXEC, 0)
                if errno != 0 {
                        // This may fail if this process was migrated out of
                        // the cgroup found by FindCPU and that cgroup has been
@@ -122,7 +122,7 @@ func OpenCPU(scratch []byte) (CPU, error) {
 
                n2 = copy(base[n:], v1PeriodFile)
                path = base[:n+n2]
-               periodFD, errno := syscall.Open(&path[0], syscall.O_RDONLY|syscall.O_CLOEXEC, 0)
+               periodFD, errno := linux.Open(&path[0], linux.O_RDONLY|linux.O_CLOEXEC, 0)
                if errno != 0 {
                        // This may fail if this process was migrated out of
                        // the cgroup found by FindCPU and that cgroup has been
@@ -139,7 +139,7 @@ func OpenCPU(scratch []byte) (CPU, error) {
        case 2:
                n2 := copy(base[n:], v2MaxFile)
                path := base[:n+n2]
-               maxFD, errno := syscall.Open(&path[0], syscall.O_RDONLY|syscall.O_CLOEXEC, 0)
+               maxFD, errno := linux.Open(&path[0], linux.O_RDONLY|linux.O_CLOEXEC, 0)
                if errno != 0 {
                        // This may fail if this process was migrated out of
                        // the cgroup found by FindCPU and that cgroup has been
@@ -200,7 +200,7 @@ func readV1Number(fd int) (int64, error) {
        //
        // Always read from the beginning of the file to get a fresh value.
        var b [64]byte
-       n, errno := syscall.Pread(fd, b[:], 0)
+       n, errno := linux.Pread(fd, b[:], 0)
        if errno != 0 {
                return 0, errSyscallFailed
        }
@@ -248,7 +248,7 @@ func readV2Limit(fd int) (float64, bool, error) {
        //
        // Always read from the beginning of the file to get a fresh value.
        var b [64]byte
-       n, errno := syscall.Pread(fd, b[:], 0)
+       n, errno := linux.Pread(fd, b[:], 0)
        if errno != 0 {
                return 0, false, errSyscallFailed
        }
@@ -345,8 +345,8 @@ func FindCPU(out []byte, scratch []byte) (int, Version, error) {
 // Returns ErrNoCgroup if the process is not in a CPU cgroup.
 func FindCPURelativePath(out []byte, scratch []byte) (int, Version, error) {
        path := []byte("/proc/self/cgroup\x00")
-       fd, errno := syscall.Open(&path[0], syscall.O_RDONLY|syscall.O_CLOEXEC, 0)
-       if errno == syscall.ENOENT {
+       fd, errno := linux.Open(&path[0], linux.O_RDONLY|linux.O_CLOEXEC, 0)
+       if errno == linux.ENOENT {
                return 0, 0, ErrNoCgroup
        } else if errno != 0 {
                return 0, 0, errSyscallFailed
@@ -354,13 +354,13 @@ func FindCPURelativePath(out []byte, scratch []byte) (int, Version, error) {
 
        // The relative path always starts with /, so we can directly append it
        // to the mount point.
-       n, version, err := parseCPURelativePath(fd, syscall.Read, out[:], scratch)
+       n, version, err := parseCPURelativePath(fd, linux.Read, out[:], scratch)
        if err != nil {
-               syscall.Close(fd)
+               linux.Close(fd)
                return 0, 0, err
        }
 
-       syscall.Close(fd)
+       linux.Close(fd)
        return n, version, nil
 }
 
@@ -489,19 +489,19 @@ func FindCPUMountPoint(out []byte, scratch []byte) (int, error) {
        checkBufferSize(scratch, ParseSize)
 
        path := []byte("/proc/self/mountinfo\x00")
-       fd, errno := syscall.Open(&path[0], syscall.O_RDONLY|syscall.O_CLOEXEC, 0)
-       if errno == syscall.ENOENT {
+       fd, errno := linux.Open(&path[0], linux.O_RDONLY|linux.O_CLOEXEC, 0)
+       if errno == linux.ENOENT {
                return 0, ErrNoCgroup
        } else if errno != 0 {
                return 0, errSyscallFailed
        }
 
-       n, err := parseCPUMount(fd, syscall.Read, out, scratch)
+       n, err := parseCPUMount(fd, linux.Read, out, scratch)
        if err != nil {
-               syscall.Close(fd)
+               linux.Close(fd)
                return 0, err
        }
-       syscall.Close(fd)
+       linux.Close(fd)
 
        return n, nil
 }
index 382cfd70d1c836cd2baea46ec74416972af89730..9a7213327c04ecd253989c0653413580b6409c6c 100644 (file)
@@ -55,7 +55,7 @@ type lineReader struct {
 // remainder of the line skipped. See next for more details.
 //
 // read is the function used to read more bytes from fd. This is usually
-// internal/runtime/syscall.Read. Note that this follows syscall semantics (not
+// internal/runtime/syscall/linux.Read. Note that this follows syscall semantics (not
 // io.Reader), so EOF is indicated with n=0, errno=0.
 func newLineReader(fd int, scratch []byte, read func(fd int, b []byte) (n int, errno uintptr)) *lineReader {
        return &lineReader{
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux.go
rename to src/internal/runtime/syscall/linux/defs_linux.go
index 4c131e23cfe81cacf4c55b791634b2370808d2a3..1ca3c352386b46daf56c3f0def2abb9a914b8efa 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        AT_FDCWD = -0x64
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_386.go
rename to src/internal/runtime/syscall/linux/defs_linux_386.go
index 6f05fd73065694545701c3c7b42ad7e088ac3ea1..7fdf5d3f8062fa4d3891fa107dcc054493f3e839 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 6
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_amd64.go
rename to src/internal/runtime/syscall/linux/defs_linux_amd64.go
index 6c6281810082824d03ae9a8f762d2faacd43e006..2c8676e6e9b4d92b6a85d60c49f79785129a7399 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 3
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_arm.go
rename to src/internal/runtime/syscall/linux/defs_linux_arm.go
index 2b6005a3daeedd56819f8ae7360f1a7e00e4d524..a0b395d67627344a7d4e6198210f49ab4f716b64 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 6
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_arm64.go
rename to src/internal/runtime/syscall/linux/defs_linux_arm64.go
index 05922fbf7a6c6f799bf2aecf549fcfbd5c70e2b5..223dce0c5b428171441e1e77c7a0433722f8d9a5 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 57
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_loong64.go
rename to src/internal/runtime/syscall/linux/defs_linux_loong64.go
index 2501434cebd7162d9334c3913a61bda7dc2e2173..8aa61c391dcdcb790bcce08b0eaa707e95053566 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 57
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_mips64x.go
rename to src/internal/runtime/syscall/linux/defs_linux_mips64x.go
index 92ba3f7398fbd26586fcecbf4265e7df9fe09b46..84b760dc1b5545a39047a494d9659757ca4a8325 100644 (file)
@@ -4,7 +4,7 @@
 
 //go:build linux && (mips64 || mips64le)
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 5003
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_mipsx.go
rename to src/internal/runtime/syscall/linux/defs_linux_mipsx.go
index 7b4dee08af04137ee2ebca8eefdfb50c25353348..a9be21414c26f9baa930fbae7a484dc457276ff2 100644 (file)
@@ -4,7 +4,7 @@
 
 //go:build linux && (mips || mipsle)
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 4006
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_ppc64x.go
rename to src/internal/runtime/syscall/linux/defs_linux_ppc64x.go
index 4656517628534d83d85b65633217282f85d3a290..63f4e5d7864de45606222fdb1c2f72002012345d 100644 (file)
@@ -4,7 +4,7 @@
 
 //go:build linux && (ppc64 || ppc64le)
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 6
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_riscv64.go
rename to src/internal/runtime/syscall/linux/defs_linux_riscv64.go
index 2501434cebd7162d9334c3913a61bda7dc2e2173..8aa61c391dcdcb790bcce08b0eaa707e95053566 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 57
similarity index 97%
rename from src/internal/runtime/syscall/defs_linux_s390x.go
rename to src/internal/runtime/syscall/linux/defs_linux_s390x.go
index 8005890e45365fa9d5f5cebcb8026b0ea0b8ef1f..52945db0e5b72faf9055f6e310c0d6b8e2d2c868 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall
+package linux
 
 const (
        SYS_CLOSE         = 6
similarity index 92%
rename from src/internal/runtime/syscall/syscall_linux.go
rename to src/internal/runtime/syscall/linux/syscall_linux.go
index 49e5f8de2cb10545ae3a37cfac42a506956cb213..8201e7d1907444a54bf079d2742d822b703cb31d 100644 (file)
@@ -2,16 +2,15 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Package syscall provides the syscall primitives required for the runtime.
-package syscall
+// Package linux provides the syscall primitives required for the runtime.
+package linux
 
 import (
        "internal/goarch"
        "unsafe"
 )
 
-// TODO(https://go.dev/issue/51087): This package is incomplete and currently
-// only contains very minimal support for Linux.
+// TODO(https://go.dev/issue/51087): Move remaining syscalls to this package.
 
 // Syscall6 calls system call number 'num' with arguments a1-6.
 func Syscall6(num, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr)
similarity index 74%
rename from src/internal/runtime/syscall/syscall_linux_test.go
rename to src/internal/runtime/syscall/linux/syscall_linux_test.go
index 14bb31c4b8c9b87a51d679bf32e2a321c683b520..10eb2d56bfe66eda9f40a659bd15a1f48bd97688 100644 (file)
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package syscall_test
+package linux_test
 
 import (
-       "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
        "testing"
 )
 
 func TestEpollctlErrorSign(t *testing.T) {
-       v := syscall.EpollCtl(-1, 1, -1, &syscall.EpollEvent{})
+       v := linux.EpollCtl(-1, 1, -1, &linux.EpollEvent{})
 
        const EBADF = 0x09
        if v != EBADF {
index c43bab08821559c48a66b7ca35fc22fcf2b0c6a2..48c03d119ffdd97525dd8f912db84de8c8e5edbd 100644 (file)
@@ -8,7 +8,7 @@ package runtime
 
 import (
        "internal/runtime/atomic"
-       "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
        "unsafe"
 )
 
@@ -20,21 +20,21 @@ var (
 
 func netpollinit() {
        var errno uintptr
-       epfd, errno = syscall.EpollCreate1(syscall.EPOLL_CLOEXEC)
+       epfd, errno = linux.EpollCreate1(linux.EPOLL_CLOEXEC)
        if errno != 0 {
                println("runtime: epollcreate failed with", errno)
                throw("runtime: netpollinit failed")
        }
-       efd, errno := syscall.Eventfd(0, syscall.EFD_CLOEXEC|syscall.EFD_NONBLOCK)
+       efd, errno := linux.Eventfd(0, linux.EFD_CLOEXEC|linux.EFD_NONBLOCK)
        if errno != 0 {
                println("runtime: eventfd failed with", -errno)
                throw("runtime: eventfd failed")
        }
-       ev := syscall.EpollEvent{
-               Events: syscall.EPOLLIN,
+       ev := linux.EpollEvent{
+               Events: linux.EPOLLIN,
        }
        *(**uintptr)(unsafe.Pointer(&ev.Data)) = &netpollEventFd
-       errno = syscall.EpollCtl(epfd, syscall.EPOLL_CTL_ADD, efd, &ev)
+       errno = linux.EpollCtl(epfd, linux.EPOLL_CTL_ADD, efd, &ev)
        if errno != 0 {
                println("runtime: epollctl failed with", errno)
                throw("runtime: epollctl failed")
@@ -47,16 +47,16 @@ func netpollIsPollDescriptor(fd uintptr) bool {
 }
 
 func netpollopen(fd uintptr, pd *pollDesc) uintptr {
-       var ev syscall.EpollEvent
-       ev.Events = syscall.EPOLLIN | syscall.EPOLLOUT | syscall.EPOLLRDHUP | syscall.EPOLLET
+       var ev linux.EpollEvent
+       ev.Events = linux.EPOLLIN | linux.EPOLLOUT | linux.EPOLLRDHUP | linux.EPOLLET
        tp := taggedPointerPack(unsafe.Pointer(pd), pd.fdseq.Load())
        *(*taggedPointer)(unsafe.Pointer(&ev.Data)) = tp
-       return syscall.EpollCtl(epfd, syscall.EPOLL_CTL_ADD, int32(fd), &ev)
+       return linux.EpollCtl(epfd, linux.EPOLL_CTL_ADD, int32(fd), &ev)
 }
 
 func netpollclose(fd uintptr) uintptr {
-       var ev syscall.EpollEvent
-       return syscall.EpollCtl(epfd, syscall.EPOLL_CTL_DEL, int32(fd), &ev)
+       var ev linux.EpollEvent
+       return linux.EpollCtl(epfd, linux.EPOLL_CTL_DEL, int32(fd), &ev)
 }
 
 func netpollarm(pd *pollDesc, mode int) {
@@ -114,9 +114,9 @@ func netpoll(delay int64) (gList, int32) {
                // 1e9 ms == ~11.5 days.
                waitms = 1e9
        }
-       var events [128]syscall.EpollEvent
+       var events [128]linux.EpollEvent
 retry:
-       n, errno := syscall.EpollWait(epfd, events[:], int32(len(events)), waitms)
+       n, errno := linux.EpollWait(epfd, events[:], int32(len(events)), waitms)
        if errno != 0 {
                if errno != _EINTR {
                        println("runtime: epollwait on fd", epfd, "failed with", errno)
@@ -138,7 +138,7 @@ retry:
                }
 
                if *(**uintptr)(unsafe.Pointer(&ev.Data)) == &netpollEventFd {
-                       if ev.Events != syscall.EPOLLIN {
+                       if ev.Events != linux.EPOLLIN {
                                println("runtime: netpoll: eventfd ready for", ev.Events)
                                throw("runtime: netpoll: eventfd ready for something unexpected")
                        }
@@ -156,10 +156,10 @@ retry:
                }
 
                var mode int32
-               if ev.Events&(syscall.EPOLLIN|syscall.EPOLLRDHUP|syscall.EPOLLHUP|syscall.EPOLLERR) != 0 {
+               if ev.Events&(linux.EPOLLIN|linux.EPOLLRDHUP|linux.EPOLLHUP|linux.EPOLLERR) != 0 {
                        mode += 'r'
                }
-               if ev.Events&(syscall.EPOLLOUT|syscall.EPOLLHUP|syscall.EPOLLERR) != 0 {
+               if ev.Events&(linux.EPOLLOUT|linux.EPOLLHUP|linux.EPOLLERR) != 0 {
                        mode += 'w'
                }
                if mode != 0 {
@@ -167,7 +167,7 @@ retry:
                        pd := (*pollDesc)(tp.pointer())
                        tag := tp.tag()
                        if pd.fdseq.Load() == tag {
-                               pd.setEventErr(ev.Events == syscall.EPOLLERR, tag)
+                               pd.setEventErr(ev.Events == linux.EPOLLERR, tag)
                                delta += netpollready(&toRun, pd, mode)
                        }
                }
index fd560ddf5a4e43a16bf5503b3ba6f64d2a4332a3..0ec5e43007353dce9ec45635546a4e4b6d7afc5e 100644 (file)
@@ -9,7 +9,7 @@ import (
        "internal/goarch"
        "internal/runtime/atomic"
        "internal/runtime/strconv"
-       "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
        "unsafe"
 )
 
@@ -470,7 +470,7 @@ func pipe2(flags int32) (r, w int32, errno int32)
 
 //go:nosplit
 func fcntl(fd, cmd, arg int32) (ret int32, errno int32) {
-       r, _, err := syscall.Syscall6(syscall.SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0)
+       r, _, err := linux.Syscall6(linux.SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0)
        return int32(r), int32(err)
 }
 
@@ -773,7 +773,7 @@ func syscall_runtime_doAllThreadsSyscall(trap, a1, a2, a3, a4, a5, a6 uintptr) (
        // ensuring all threads execute system calls from multiple calls in the
        // same order.
 
-       r1, r2, errno := syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6)
+       r1, r2, errno := linux.Syscall6(trap, a1, a2, a3, a4, a5, a6)
        if GOARCH == "ppc64" || GOARCH == "ppc64le" {
                // TODO(https://go.dev/issue/51192 ): ppc64 doesn't use r2.
                r2 = 0
@@ -884,7 +884,7 @@ func runPerThreadSyscall() {
        }
 
        args := perThreadSyscall
-       r1, r2, errno := syscall.Syscall6(args.trap, args.a1, args.a2, args.a3, args.a4, args.a5, args.a6)
+       r1, r2, errno := linux.Syscall6(args.trap, args.a1, args.a2, args.a3, args.a4, args.a5, args.a6)
        if GOARCH == "ppc64" || GOARCH == "ppc64le" {
                // TODO(https://go.dev/issue/51192 ): ppc64 doesn't use r2.
                r2 = 0
@@ -923,6 +923,6 @@ func (c *sigctxt) sigFromSeccomp() bool {
 
 //go:nosplit
 func mprotect(addr unsafe.Pointer, n uintptr, prot int32) (ret int32, errno int32) {
-       r, _, err := syscall.Syscall6(syscall.SYS_MPROTECT, uintptr(addr), n, uintptr(prot), 0, 0, 0)
+       r, _, err := linux.Syscall6(linux.SYS_MPROTECT, uintptr(addr), n, uintptr(prot), 0, 0, 0)
        return int32(r), int32(err)
 }
index c4a4d4e50d45061c227a38656e0a94cedbb2382d..65fa601a29962e0c78ecdc1976fbeed8a25d69ec 100644 (file)
@@ -5,7 +5,7 @@
 package runtime
 
 import (
-       "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
        "unsafe"
 )
 
@@ -32,6 +32,6 @@ func internal_cpu_riscvHWProbe(pairs []riscvHWProbePairs, flags uint) bool {
        }
        // Passing in a cpuCount of 0 and a cpu of nil ensures that only extensions supported by all the
        // cores are returned, which is the behaviour we want in internal/cpu.
-       _, _, e1 := syscall.Syscall6(sys_RISCV_HWPROBE, uintptr(unsafe.Pointer(&pairs[0])), uintptr(len(pairs)), uintptr(0), uintptr(unsafe.Pointer(nil)), uintptr(flags), 0)
+       _, _, e1 := linux.Syscall6(sys_RISCV_HWPROBE, uintptr(unsafe.Pointer(&pairs[0])), uintptr(len(pairs)), uintptr(0), uintptr(unsafe.Pointer(nil)), uintptr(flags), 0)
        return e1 == 0
 }
index 100c2bfecac60c90c089c91eb2adabcc723927fc..9b6654f33299a04936b6fb52e5038fba6da1373e 100644 (file)
@@ -8,7 +8,7 @@ package runtime
 
 import (
        "internal/runtime/atomic"
-       "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
        "unsafe"
 )
 
@@ -24,7 +24,7 @@ func setVMAName(start unsafe.Pointer, length uintptr, name string) {
        n := copy(sysName[:], " Go: ")
        copy(sysName[n:79], name) // leave final byte zero
 
-       _, _, err := syscall.Syscall6(syscall.SYS_PRCTL, syscall.PR_SET_VMA, syscall.PR_SET_VMA_ANON_NAME, uintptr(start), length, uintptr(unsafe.Pointer(&sysName[0])), 0)
+       _, _, err := linux.Syscall6(linux.SYS_PRCTL, linux.PR_SET_VMA, linux.PR_SET_VMA_ANON_NAME, uintptr(start), length, uintptr(unsafe.Pointer(&sysName[0])), 0)
        if err == _EINVAL {
                prSetVMAUnsupported.Store(true)
        }
index d733ca9bf9230f92eb4d440cbe9eed0adc6cc718..ec9f771daad93ee136af650a99695749f3a981d8 100644 (file)
@@ -13,7 +13,7 @@ package syscall
 
 import (
        "internal/itoa"
-       runtimesyscall "internal/runtime/syscall"
+       "internal/runtime/syscall/linux"
        "runtime"
        "slices"
        "unsafe"
@@ -62,7 +62,7 @@ func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
 //go:linkname RawSyscall6
 func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
        var errno uintptr
-       r1, r2, errno = runtimesyscall.Syscall6(trap, a1, a2, a3, a4, a5, a6)
+       r1, r2, errno = linux.Syscall6(trap, a1, a2, a3, a4, a5, a6)
        err = Errno(errno)
        return
 }