From 4cafe5c66f05b714f48b5a4731ead72874dbf29f Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Sun, 7 Nov 2021 04:47:54 +0900 Subject: [PATCH 01/13] unix: implements RenamexNp and RenameatxNp for darwin Fixes golang/go#48425 Change-Id: Ib3619863e238eadf09da479bd2e1e47d9ab6f274 Reviewed-on: https://go-review.googlesource.com/c/sys/+/361958 Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI --- unix/darwin_amd64_test.go | 2 ++ unix/darwin_arm64_test.go | 2 ++ unix/mkerrors.sh | 1 + unix/syscall_darwin.go | 12 +++++++++ unix/zerrors_darwin_amd64.go | 5 ++++ unix/zerrors_darwin_arm64.go | 5 ++++ unix/zsyscall_darwin_amd64.go | 48 +++++++++++++++++++++++++++++++++++ unix/zsyscall_darwin_amd64.s | 10 ++++++++ unix/zsyscall_darwin_arm64.go | 48 +++++++++++++++++++++++++++++++++++ unix/zsyscall_darwin_arm64.s | 10 ++++++++ 10 files changed, 143 insertions(+) diff --git a/unix/darwin_amd64_test.go b/unix/darwin_amd64_test.go index ed56acca38..b6dac524c4 100644 --- a/unix/darwin_amd64_test.go +++ b/unix/darwin_amd64_test.go @@ -114,6 +114,8 @@ var darwinTests = [...]darwinTest{ {"removexattr", libc_removexattr_trampoline_addr}, {"rename", libc_rename_trampoline_addr}, {"renameat", libc_renameat_trampoline_addr}, + {"renameatx_np", libc_renameatx_np_trampoline_addr}, + {"renamex_np", libc_renamex_np_trampoline_addr}, {"revoke", libc_revoke_trampoline_addr}, {"rmdir", libc_rmdir_trampoline_addr}, {"select", libc_select_trampoline_addr}, diff --git a/unix/darwin_arm64_test.go b/unix/darwin_arm64_test.go index 3e0fb7d163..5a310de020 100644 --- a/unix/darwin_arm64_test.go +++ b/unix/darwin_arm64_test.go @@ -114,6 +114,8 @@ var darwinTests = [...]darwinTest{ {"removexattr", libc_removexattr_trampoline_addr}, {"rename", libc_rename_trampoline_addr}, {"renameat", libc_renameat_trampoline_addr}, + {"renameatx_np", libc_renameatx_np_trampoline_addr}, + {"renamex_np", libc_renamex_np_trampoline_addr}, {"revoke", libc_revoke_trampoline_addr}, {"rmdir", libc_rmdir_trampoline_addr}, {"select", libc_select_trampoline_addr}, diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh index 4ed2e488b6..d07dd09eb5 100755 --- a/unix/mkerrors.sh +++ b/unix/mkerrors.sh @@ -58,6 +58,7 @@ includes_Darwin=' #define _DARWIN_USE_64_BIT_INODE #define __APPLE_USE_RFC_3542 #include +#include #include #include #include diff --git a/unix/syscall_darwin.go b/unix/syscall_darwin.go index 4cc7b00596..2d15200adb 100644 --- a/unix/syscall_darwin.go +++ b/unix/syscall_darwin.go @@ -402,6 +402,18 @@ func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq)) } +//sys renamexNp(from string, to string, flag uint32) (err error) + +func RenamexNp(from string, to string, flag uint32) (err error) { + return renamexNp(from, to, flag) +} + +//sys renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) + +func RenameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + return renameatxNp(fromfd, from, tofd, to, flag) +} + //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL func Uname(uname *Utsname) error { diff --git a/unix/zerrors_darwin_amd64.go b/unix/zerrors_darwin_amd64.go index e40fa85245..4308ac1772 100644 --- a/unix/zerrors_darwin_amd64.go +++ b/unix/zerrors_darwin_amd64.go @@ -1169,6 +1169,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 diff --git a/unix/zerrors_darwin_arm64.go b/unix/zerrors_darwin_arm64.go index bb02aa6c05..c8068a7a16 100644 --- a/unix/zerrors_darwin_arm64.go +++ b/unix/zerrors_darwin_arm64.go @@ -1169,6 +1169,11 @@ const ( PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 + RENAME_EXCL = 0x4 + RENAME_NOFOLLOW_ANY = 0x10 + RENAME_RESERVED1 = 0x8 + RENAME_SECLUDE = 0x1 + RENAME_SWAP = 0x2 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 diff --git a/unix/zsyscall_darwin_amd64.go b/unix/zsyscall_darwin_amd64.go index 07642c308d..b622533ef2 100644 --- a/unix/zsyscall_darwin_amd64.go +++ b/unix/zsyscall_darwin_amd64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { diff --git a/unix/zsyscall_darwin_amd64.s b/unix/zsyscall_darwin_amd64.s index 923e08cb79..cfe6646baf 100644 --- a/unix/zsyscall_darwin_amd64.s +++ b/unix/zsyscall_darwin_amd64.s @@ -223,6 +223,16 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 diff --git a/unix/zsyscall_darwin_arm64.go b/unix/zsyscall_darwin_arm64.go index 7d73dda647..13f624f69f 100644 --- a/unix/zsyscall_darwin_arm64.go +++ b/unix/zsyscall_darwin_arm64.go @@ -740,6 +740,54 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func renamexNp(from string, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_renamex_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renamex_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renamex_np renamex_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameatx_np_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), uintptr(flag), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameatx_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameatx_np renameatx_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { diff --git a/unix/zsyscall_darwin_arm64.s b/unix/zsyscall_darwin_arm64.s index 057700111e..fe222b75df 100644 --- a/unix/zsyscall_darwin_arm64.s +++ b/unix/zsyscall_darwin_arm64.s @@ -223,6 +223,16 @@ TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) +TEXT libc_renamex_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renamex_np(SB) +GLOBL ·libc_renamex_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renamex_np_trampoline_addr(SB)/8, $libc_renamex_np_trampoline<>(SB) + +TEXT libc_renameatx_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameatx_np(SB) +GLOBL ·libc_renameatx_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameatx_np_trampoline_addr(SB)/8, $libc_renameatx_np_trampoline<>(SB) + TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 From 47fe91694258cf5e2eb195795793b7774a135c9f Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Wed, 10 Jul 2024 17:53:02 -0500 Subject: [PATCH 02/13] cpu: add support for DIT detection Change-Id: I9f0991da9684ebd297e40a754e34130c418c34d0 Reviewed-on: https://go-review.googlesource.com/c/sys/+/597377 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI --- cpu/cpu.go | 1 + cpu/cpu_arm64.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cpu/cpu.go b/cpu/cpu.go index 8fa707aa4b..11a0abc1db 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -105,6 +105,7 @@ var ARM64 struct { HasSVE bool // Scalable Vector Extensions HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 + HasDIT bool // Data Independent Timing support _ CacheLinePad } diff --git a/cpu/cpu_arm64.go b/cpu/cpu_arm64.go index 0e27a21e1f..98956a5b5d 100644 --- a/cpu/cpu_arm64.go +++ b/cpu/cpu_arm64.go @@ -168,6 +168,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { parseARM64SVERegister(getzfr0()) } + + switch extractBits(pfr0, 48, 51) { + case 1: + ARM64.HasDIT = true + } } func parseARM64SVERegister(zfr0 uint64) { From ee0e6279584905810760a1a02774a659e06b24b1 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 10 Jul 2024 10:50:10 -0700 Subject: [PATCH 03/13] unix: skip TestIoctlFileDedupeRange on EOPNOTSUPP error Fixes golang/go#68372 Change-Id: Id3b8fb920b1458e39e7370195591183ee7e450ff Reviewed-on: https://go-review.googlesource.com/c/sys/+/597555 Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Commit-Queue: Ian Lance Taylor --- unix/syscall_linux_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/syscall_linux_test.go b/unix/syscall_linux_test.go index 69c42b5ddc..53e64458c4 100644 --- a/unix/syscall_linux_test.go +++ b/unix/syscall_linux_test.go @@ -1087,7 +1087,7 @@ func TestIoctlFileDedupeRange(t *testing.T) { // The first Info should be equal if dedupe.Info[0].Status < 0 { errno := unix.Errno(-dedupe.Info[0].Status) - if errno == unix.EINVAL { + if errno == unix.EINVAL || errno == unix.EOPNOTSUPP { t.Skip("deduplication not supported on this filesystem") } t.Errorf("Unexpected error in FileDedupeRange: %s", unix.ErrnoName(errno)) @@ -1102,7 +1102,7 @@ func TestIoctlFileDedupeRange(t *testing.T) { // The second Info should be different if dedupe.Info[1].Status < 0 { errno := unix.Errno(-dedupe.Info[1].Status) - if errno == unix.EINVAL { + if errno == unix.EINVAL || errno == unix.EOPNOTSUPP { t.Skip("deduplication not supported on this filesystem") } t.Errorf("Unexpected error in FileDedupeRange: %s", unix.ErrnoName(errno)) From dce4e64e6654a3553efaf67a1acbdd5865f621ba Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 16 Jul 2024 11:35:24 -0400 Subject: [PATCH 04/13] LICENSE: update per Google Legal Very minor tweaks: - Remove (c) pseudosymbol. - Remove "All Rights Reserved." - Change "Google Inc." (no longer exists) to "Google LLC". [git-generate] echo ' ,s/\(c\) // ,s/ All rights reserved.// ,s/Google Inc./Google LLC/ w q ' | sam -d LICENSE Change-Id: I9373310143631467badd0131416d741b02c9bd10 Reviewed-on: https://go-review.googlesource.com/c/sys/+/598528 LUCI-TryBot-Result: Go LUCI Auto-Submit: Russ Cox Reviewed-by: Ian Lance Taylor --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 6a66aea5ea..2a7cf70da6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. From 0c18c88c715857ea966c4fcc1a5d23841443feb2 Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Tue, 16 Jul 2024 16:38:00 -0700 Subject: [PATCH 05/13] cpu: add DIT option and hwcap DIT support Follow-up to https://go.dev/cl/597377, add a option for DIT so it can be set via GODEBUG, and add hwcap support for Linux. Change-Id: Ib094b520edea9c099d37f121b09d02b31644a433 Reviewed-on: https://go-review.googlesource.com/c/sys/+/598719 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor --- cpu/cpu_arm64.go | 1 + cpu/cpu_linux_arm64.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cpu/cpu_arm64.go b/cpu/cpu_arm64.go index 98956a5b5d..8bde6f1b93 100644 --- a/cpu/cpu_arm64.go +++ b/cpu/cpu_arm64.go @@ -38,6 +38,7 @@ func initOptions() { {Name: "dcpop", Feature: &ARM64.HasDCPOP}, {Name: "asimddp", Feature: &ARM64.HasASIMDDP}, {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM}, + {Name: "dit", Feature: &ARM64.HasDIT}, } } diff --git a/cpu/cpu_linux_arm64.go b/cpu/cpu_linux_arm64.go index 3d386d0fc2..bc61b1909f 100644 --- a/cpu/cpu_linux_arm64.go +++ b/cpu/cpu_linux_arm64.go @@ -35,6 +35,7 @@ const ( hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 + hwcap_DIT = 1 << 24 hwcap2_SVE2 = 1 << 1 ) @@ -106,6 +107,8 @@ func doinit() { ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) ARM64.HasSVE = isSet(hwCap, hwcap_SVE) ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) + ARM64.HasDIT = isSet(hwCap, hwcap_DIT) + // HWCAP2 feature bits ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) From 0eac9b5475d551041d06679d16b0f4fb0514dc94 Mon Sep 17 00:00:00 2001 From: database64128 Date: Fri, 12 Jul 2024 06:50:57 +0000 Subject: [PATCH 06/13] windows: add flags for GetAdaptersAddresses This commit adds all missing flags for GetAdaptersAddresses. Change-Id: I874623b6ac77af4ced49205493258e118a4f1b26 GitHub-Last-Rev: 384c92a2808112d156e93c41ef092871efd77354 GitHub-Pull-Request: golang/sys#203 Reviewed-on: https://go-review.googlesource.com/c/sys/+/597915 Reviewed-by: Alex Brainman LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Than McIntosh --- windows/types_windows.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/windows/types_windows.go b/windows/types_windows.go index d8cb71db0a..b8d93f307d 100644 --- a/windows/types_windows.go +++ b/windows/types_windows.go @@ -2003,7 +2003,21 @@ const ( MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 ) -const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 +// Flags for GetAdaptersAddresses, see +// https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses. +const ( + GAA_FLAG_SKIP_UNICAST = 0x1 + GAA_FLAG_SKIP_ANYCAST = 0x2 + GAA_FLAG_SKIP_MULTICAST = 0x4 + GAA_FLAG_SKIP_DNS_SERVER = 0x8 + GAA_FLAG_INCLUDE_PREFIX = 0x10 + GAA_FLAG_SKIP_FRIENDLY_NAME = 0x20 + GAA_FLAG_INCLUDE_WINS_INFO = 0x40 + GAA_FLAG_INCLUDE_GATEWAYS = 0x80 + GAA_FLAG_INCLUDE_ALL_INTERFACES = 0x100 + GAA_FLAG_INCLUDE_ALL_COMPARTMENTS = 0x200 + GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER = 0x400 +) const ( IF_TYPE_OTHER = 1 From bce4cf76d859904eacef4ad1c5fe647d794b0331 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Sat, 13 Jul 2024 22:34:16 +0000 Subject: [PATCH 07/13] windows: add GetKeyboardLayout & ToUnicodeEx These are used along with GetForegroundWindow and GetWindowThreadProcessId to determine the current user layout and translate the base key the user has pressed. Change-Id: Ib833ba7ab54213d83e889ff74c5bc0ace5edbe95 GitHub-Last-Rev: 2afe9976a2d1f6a8dda9bd74cf07b207246bfcc6 GitHub-Pull-Request: golang/sys#188 Reviewed-on: https://go-review.googlesource.com/c/sys/+/574755 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Than McIntosh Reviewed-by: Alex Brainman Reviewed-by: Ayman Bagabas --- windows/syscall_windows.go | 12 +++++++-- windows/syscall_windows_test.go | 47 +++++++++++++++++++++++++++++++++ windows/types_windows.go | 11 ++++++++ windows/zsyscall_windows.go | 33 +++++++++++++++++++++++ 4 files changed, 101 insertions(+), 2 deletions(-) diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go index 6525c62f3c..1fa34fd17c 100644 --- a/windows/syscall_windows.go +++ b/windows/syscall_windows.go @@ -17,8 +17,10 @@ import ( "unsafe" ) -type Handle uintptr -type HWND uintptr +type ( + Handle uintptr + HWND uintptr +) const ( InvalidHandle = ^Handle(0) @@ -211,6 +213,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW //sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId +//sys LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) [failretval==0] = user32.LoadKeyboardLayoutW +//sys UnloadKeyboardLayout(hkl Handle) (err error) = user32.UnloadKeyboardLayout +//sys GetKeyboardLayout(tid uint32) (hkl Handle) = user32.GetKeyboardLayout +//sys ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) = user32.ToUnicodeEx //sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow //sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW //sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx @@ -1368,9 +1374,11 @@ func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) } + func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) } + func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } diff --git a/windows/syscall_windows_test.go b/windows/syscall_windows_test.go index 7708154115..ca8a70d2a4 100644 --- a/windows/syscall_windows_test.go +++ b/windows/syscall_windows_test.go @@ -1437,3 +1437,50 @@ uintptr_t beep(void) { t.Fatal("LoadLibraryEx unexpectedly found beep.dll") } } + +func TestGetKeyboardLayout(t *testing.T) { + fg := windows.GetForegroundWindow() + tid, err := windows.GetWindowThreadProcessId(fg, nil) + if err != nil { + t.Fatalf("GetWindowThreadProcessId failed: %v", err) + } + + // We don't care about the result, just that it doesn't crash. + _ = windows.GetKeyboardLayout(tid) +} + +func TestToUnicodeEx(t *testing.T) { + var utf16Buf [16]uint16 + + // Arabic (101) Keyboard Identifier + // See https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-language-pack-default-values + ara, err := windows.UTF16PtrFromString("00000401") + if err != nil { + t.Fatalf("UTF16PtrFromString failed: %v", err) + } + araLayout, err := windows.LoadKeyboardLayout(ara, windows.KLF_ACTIVATE) + if err != nil { + t.Fatalf("LoadKeyboardLayout failed: %v", err) + } + + var keyState [256]byte + ret := windows.ToUnicodeEx( + 0x41, // 'A' vkCode + 0x1e, // 'A' scanCode + &keyState[0], + &utf16Buf[0], + int32(len(utf16Buf)), + 0x4, // don't change keyboard state + araLayout, + ) + + if ret != 1 { + t.Errorf("ToUnicodeEx failed, wanted 1, got %d", ret) + } + if utf16Buf[0] != 'ش' { + t.Errorf("ToUnicodeEx failed, wanted 'ش', got %q", utf16Buf[0]) + } + if err := windows.UnloadKeyboardLayout(araLayout); err != nil { + t.Errorf("UnloadKeyboardLayout failed: %v", err) + } +} diff --git a/windows/types_windows.go b/windows/types_windows.go index b8d93f307d..4d0c15745f 100644 --- a/windows/types_windows.go +++ b/windows/types_windows.go @@ -3418,3 +3418,14 @@ type DCB struct { EvtChar byte wReserved1 uint16 } + +// Keyboard Layout Flags. +// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadkeyboardlayoutw +const ( + KLF_ACTIVATE = 0x00000001 + KLF_SUBSTITUTE_OK = 0x00000002 + KLF_REORDER = 0x00000008 + KLF_REPLACELANG = 0x00000010 + KLF_NOTELLSHELL = 0x00000080 + KLF_SETFORPROCESS = 0x00000100 +) diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index eba761018a..92e3cf31c6 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -478,12 +478,16 @@ var ( procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow") procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow") procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo") + procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout") procGetShellWindow = moduser32.NewProc("GetShellWindow") procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") procIsWindow = moduser32.NewProc("IsWindow") procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode") procIsWindowVisible = moduser32.NewProc("IsWindowVisible") + procLoadKeyboardLayoutW = moduser32.NewProc("LoadKeyboardLayoutW") procMessageBoxW = moduser32.NewProc("MessageBoxW") + procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") + procUnloadKeyboardLayout = moduser32.NewProc("UnloadKeyboardLayout") procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") @@ -4082,6 +4086,12 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { return } +func GetKeyboardLayout(tid uint32) (hkl Handle) { + r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) + hkl = Handle(r0) + return +} + func GetShellWindow() (shellWindow HWND) { r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) shellWindow = HWND(r0) @@ -4115,6 +4125,15 @@ func IsWindowVisible(hwnd HWND) (isVisible bool) { return } +func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) + hkl = Handle(r0) + if hkl == 0 { + err = errnoErr(e1) + } + return +} + func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) ret = int32(r0) @@ -4124,6 +4143,20 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i return } +func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { + r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) + ret = int32(r0) + return +} + +func UnloadKeyboardLayout(hkl Handle) (err error) { + r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { var _p0 uint32 if inheritExisting { From 7bb0bf703bd313f37f48995aa1cb6788e592050d Mon Sep 17 00:00:00 2001 From: Hernan Martinez Date: Sat, 29 Jun 2024 05:37:15 -0600 Subject: [PATCH 08/13] cpu: add Int8 matrix multiplication instructions CPU feature flag for ARM64 References: https://github.com/torvalds/linux/blob/5bbd9b249880dba032bffa002dd9cd12cd5af09c/arch/arm64/include/uapi/asm/hwcap.h#L75C9-L75C31 https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Registers/ID-AA64ISAR1-EL1--AArch64-Instruction-Set-Attribute-Register-1 Change-Id: Ic4e1cf2c23097c7e8695453b6d0b335756d474bc Reviewed-on: https://go-review.googlesource.com/c/sys/+/595678 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor Reviewed-by: Cherry Mui --- cpu/cpu.go | 1 + cpu/cpu_arm64.go | 6 ++++++ cpu/cpu_linux_arm64.go | 2 ++ 3 files changed, 9 insertions(+) diff --git a/cpu/cpu.go b/cpu/cpu.go index 11a0abc1db..ec07aab057 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -106,6 +106,7 @@ var ARM64 struct { HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 HasDIT bool // Data Independent Timing support + HasI8MM bool // Advanced SIMD Int8 matrix multiplication instructions _ CacheLinePad } diff --git a/cpu/cpu_arm64.go b/cpu/cpu_arm64.go index 8bde6f1b93..af2aa99f9f 100644 --- a/cpu/cpu_arm64.go +++ b/cpu/cpu_arm64.go @@ -39,6 +39,7 @@ func initOptions() { {Name: "asimddp", Feature: &ARM64.HasASIMDDP}, {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM}, {Name: "dit", Feature: &ARM64.HasDIT}, + {Name: "i8mm", Feature: &ARM64.HasI8MM}, } } @@ -146,6 +147,11 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { ARM64.HasLRCPC = true } + switch extractBits(isar1, 52, 55) { + case 1: + ARM64.HasI8MM = true + } + // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: diff --git a/cpu/cpu_linux_arm64.go b/cpu/cpu_linux_arm64.go index bc61b1909f..08f35ea177 100644 --- a/cpu/cpu_linux_arm64.go +++ b/cpu/cpu_linux_arm64.go @@ -38,6 +38,7 @@ const ( hwcap_DIT = 1 << 24 hwcap2_SVE2 = 1 << 1 + hwcap2_I8MM = 1 << 13 ) // linuxKernelCanEmulateCPUID reports whether we're running @@ -112,6 +113,7 @@ func doinit() { // HWCAP2 feature bits ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) + ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM) } func isSet(hwc uint, value uint) bool { From beb594982ddbfbf4b2df2c4a1a214b75fc0fbff8 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 22 Jul 2024 20:49:42 +0000 Subject: [PATCH 09/13] windows: correctly generate GetAce syscall GetAce expects a failretval==0, and we shouldn't call GetLastError on error. For golang/go#66850 Change-Id: I812d71b066d56e8285324e70b8b5b5fb42b5ce35 GitHub-Last-Rev: 40cf7508de5e2b26d245ac12cc5057282303fe5a GitHub-Pull-Request: golang/sys#205 Reviewed-on: https://go-review.googlesource.com/c/sys/+/599295 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Reviewed-by: Alex Brainman Auto-Submit: Dmitri Shuralyov --- windows/security_windows.go | 2 +- windows/zsyscall_windows.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/windows/security_windows.go b/windows/security_windows.go index 97651b5bd0..b6e1ab76f8 100644 --- a/windows/security_windows.go +++ b/windows/security_windows.go @@ -1179,7 +1179,7 @@ type OBJECTS_AND_NAME struct { //sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD //sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW -//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) = advapi32.GetAce +//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) = advapi32.GetAce // Control returns the security descriptor control bits. func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index 92e3cf31c6..9bb979a3e4 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -793,6 +793,14 @@ func FreeSid(sid *SID) (err error) { return } +func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { + r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetLengthSid(sid *SID) (len uint32) { r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) len = uint32(r0) @@ -1229,14 +1237,6 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE return } -func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) { - r0, _, _ := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) - if r0 == 0 { - ret = GetLastError() - } - return -} - func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { From d03a807229bc212694753d74c81119a9b4adb711 Mon Sep 17 00:00:00 2001 From: Mauri de Souza Meneguzzo Date: Tue, 23 Jul 2024 23:35:50 +0000 Subject: [PATCH 10/13] unix: update glibc to 2.40 Change-Id: I691cc18fe046600a6192c492cf573c8223aa573e GitHub-Last-Rev: 7a25e88e86a1c473013851a546ef2ebc89e62354 GitHub-Pull-Request: golang/sys#208 Reviewed-on: https://go-review.googlesource.com/c/sys/+/600517 Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov --- unix/linux/Dockerfile | 4 ++-- unix/zerrors_linux.go | 14 ++++++++++++++ unix/zerrors_linux_386.go | 2 ++ unix/zerrors_linux_amd64.go | 2 ++ unix/zerrors_linux_arm.go | 2 ++ unix/zerrors_linux_arm64.go | 2 ++ unix/zerrors_linux_loong64.go | 2 ++ unix/zerrors_linux_mips.go | 2 ++ unix/zerrors_linux_mips64.go | 2 ++ unix/zerrors_linux_mips64le.go | 2 ++ unix/zerrors_linux_mipsle.go | 2 ++ unix/zerrors_linux_ppc.go | 2 ++ unix/zerrors_linux_ppc64.go | 2 ++ unix/zerrors_linux_ppc64le.go | 2 ++ unix/zerrors_linux_riscv64.go | 2 ++ unix/zerrors_linux_s390x.go | 2 ++ unix/zerrors_linux_sparc64.go | 2 ++ 17 files changed, 46 insertions(+), 2 deletions(-) diff --git a/unix/linux/Dockerfile b/unix/linux/Dockerfile index 24114d54f9..625e60b55c 100644 --- a/unix/linux/Dockerfile +++ b/unix/linux/Dockerfile @@ -17,8 +17,8 @@ WORKDIR /git RUN git config --global advice.detachedHead false # Linux Kernel: Released 12 May 2024 RUN git clone --branch v6.9 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux -# GNU C library: Released 31 Jan 2024 -RUN git clone --branch release/2.39/master --depth 1 https://sourceware.org/git/glibc.git +# GNU C library: Released 21 July 2024 +RUN git clone --branch release/2.40/master --depth 1 https://sourceware.org/git/glibc.git # Get Go ENV GOLANG_VERSION 1.21.0 diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index 877a62b479..ac6efff3d1 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -928,6 +928,7 @@ const ( EPOLL_CTL_ADD = 0x1 EPOLL_CTL_DEL = 0x2 EPOLL_CTL_MOD = 0x3 + EPOLL_IOC_TYPE = 0x8a EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 ESP_V4_FLOW = 0xa ESP_V6_FLOW = 0xc @@ -1861,6 +1862,19 @@ const ( MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_FIXED_NOREPLACE = 0x100000 + MAP_HUGE_16GB = 0x88000000 + MAP_HUGE_16KB = 0x38000000 + MAP_HUGE_16MB = 0x60000000 + MAP_HUGE_1GB = 0x78000000 + MAP_HUGE_1MB = 0x50000000 + MAP_HUGE_256MB = 0x70000000 + MAP_HUGE_2GB = 0x7c000000 + MAP_HUGE_2MB = 0x54000000 + MAP_HUGE_32MB = 0x64000000 + MAP_HUGE_512KB = 0x4c000000 + MAP_HUGE_512MB = 0x74000000 + MAP_HUGE_64KB = 0x40000000 + MAP_HUGE_8MB = 0x5c000000 MAP_HUGE_MASK = 0x3f MAP_HUGE_SHIFT = 0x1a MAP_PRIVATE = 0x2 diff --git a/unix/zerrors_linux_386.go b/unix/zerrors_linux_386.go index e4bc0bd57c..684a5168da 100644 --- a/unix/zerrors_linux_386.go +++ b/unix/zerrors_linux_386.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_amd64.go b/unix/zerrors_linux_amd64.go index 689317afdb..61d74b592d 100644 --- a/unix/zerrors_linux_amd64.go +++ b/unix/zerrors_linux_amd64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_arm.go b/unix/zerrors_linux_arm.go index 5cca668ac3..a28c9e3e89 100644 --- a/unix/zerrors_linux_arm.go +++ b/unix/zerrors_linux_arm.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_arm64.go b/unix/zerrors_linux_arm64.go index 14270508b0..ab5d1fe8ea 100644 --- a/unix/zerrors_linux_arm64.go +++ b/unix/zerrors_linux_arm64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 ESR_MAGIC = 0x45535201 EXTPROC = 0x10000 diff --git a/unix/zerrors_linux_loong64.go b/unix/zerrors_linux_loong64.go index 28e39afdcb..c523090e7c 100644 --- a/unix/zerrors_linux_loong64.go +++ b/unix/zerrors_linux_loong64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_mips.go b/unix/zerrors_linux_mips.go index cd66e92cb4..01e6ea7804 100644 --- a/unix/zerrors_linux_mips.go +++ b/unix/zerrors_linux_mips.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_mips64.go b/unix/zerrors_linux_mips64.go index c1595eba78..7aa610b1e7 100644 --- a/unix/zerrors_linux_mips64.go +++ b/unix/zerrors_linux_mips64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_mips64le.go b/unix/zerrors_linux_mips64le.go index ee9456b0da..92af771b44 100644 --- a/unix/zerrors_linux_mips64le.go +++ b/unix/zerrors_linux_mips64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_mipsle.go b/unix/zerrors_linux_mipsle.go index 8cfca81e1b..b27ef5e6f1 100644 --- a/unix/zerrors_linux_mipsle.go +++ b/unix/zerrors_linux_mipsle.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x80 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_ppc.go b/unix/zerrors_linux_ppc.go index 60b0deb3af..237a2cefb3 100644 --- a/unix/zerrors_linux_ppc.go +++ b/unix/zerrors_linux_ppc.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/unix/zerrors_linux_ppc64.go b/unix/zerrors_linux_ppc64.go index f90aa7281b..4a5c555a36 100644 --- a/unix/zerrors_linux_ppc64.go +++ b/unix/zerrors_linux_ppc64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/unix/zerrors_linux_ppc64le.go b/unix/zerrors_linux_ppc64le.go index ba9e015033..a02fb49a5f 100644 --- a/unix/zerrors_linux_ppc64le.go +++ b/unix/zerrors_linux_ppc64le.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x20 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000000 FF1 = 0x4000 diff --git a/unix/zerrors_linux_riscv64.go b/unix/zerrors_linux_riscv64.go index 07cdfd6e9f..e26a7c61b2 100644 --- a/unix/zerrors_linux_riscv64.go +++ b/unix/zerrors_linux_riscv64.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_s390x.go b/unix/zerrors_linux_s390x.go index 2f1dd214a7..c48f7c2103 100644 --- a/unix/zerrors_linux_s390x.go +++ b/unix/zerrors_linux_s390x.go @@ -78,6 +78,8 @@ const ( ECHOPRT = 0x400 EFD_CLOEXEC = 0x80000 EFD_NONBLOCK = 0x800 + EPIOCGPARAMS = 0x80088a02 + EPIOCSPARAMS = 0x40088a01 EPOLL_CLOEXEC = 0x80000 EXTPROC = 0x10000 FF1 = 0x8000 diff --git a/unix/zerrors_linux_sparc64.go b/unix/zerrors_linux_sparc64.go index f40519d901..ad4b9aace7 100644 --- a/unix/zerrors_linux_sparc64.go +++ b/unix/zerrors_linux_sparc64.go @@ -82,6 +82,8 @@ const ( EFD_CLOEXEC = 0x400000 EFD_NONBLOCK = 0x4000 EMT_TAGOVF = 0x1 + EPIOCGPARAMS = 0x40088a02 + EPIOCSPARAMS = 0x80088a01 EPOLL_CLOEXEC = 0x400000 EXTPROC = 0x10000 FF1 = 0x8000 From 31ef9e726f987c593d73c3c35ca1c7477cf0e480 Mon Sep 17 00:00:00 2001 From: Mauri de Souza Meneguzzo Date: Wed, 24 Jul 2024 16:22:22 +0000 Subject: [PATCH 11/13] unix: update to Linux kernel 6.10 Change-Id: I87cac997e5fad645ae04b8a808063389fc468e5a GitHub-Last-Rev: 3104aafba8f6dc0a29780ca03b5ee00dad95ee8b GitHub-Pull-Request: golang/sys#207 Reviewed-on: https://go-review.googlesource.com/c/sys/+/600516 LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov Reviewed-by: Ian Lance Taylor --- unix/linux/Dockerfile | 4 ++-- unix/zerrors_linux.go | 24 +++++++++++++++++++++--- unix/zsysnum_linux_386.go | 1 + unix/zsysnum_linux_amd64.go | 1 + unix/zsysnum_linux_arm.go | 1 + unix/zsysnum_linux_arm64.go | 1 + unix/zsysnum_linux_loong64.go | 1 + unix/zsysnum_linux_mips.go | 1 + unix/zsysnum_linux_mips64.go | 1 + unix/zsysnum_linux_mips64le.go | 1 + unix/zsysnum_linux_mipsle.go | 1 + unix/zsysnum_linux_ppc.go | 1 + unix/zsysnum_linux_ppc64.go | 1 + unix/zsysnum_linux_ppc64le.go | 1 + unix/zsysnum_linux_riscv64.go | 1 + unix/zsysnum_linux_s390x.go | 1 + unix/zsysnum_linux_sparc64.go | 1 + unix/ztypes_linux.go | 7 ++++--- 18 files changed, 42 insertions(+), 8 deletions(-) diff --git a/unix/linux/Dockerfile b/unix/linux/Dockerfile index 625e60b55c..51b66ccba9 100644 --- a/unix/linux/Dockerfile +++ b/unix/linux/Dockerfile @@ -15,8 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Get the git sources. If not cached, this takes O(5 minutes). WORKDIR /git RUN git config --global advice.detachedHead false -# Linux Kernel: Released 12 May 2024 -RUN git clone --branch v6.9 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux +# Linux Kernel: Released 14 July 2024 +RUN git clone --branch v6.10 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux # GNU C library: Released 21 July 2024 RUN git clone --branch release/2.40/master --depth 1 https://sourceware.org/git/glibc.git diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index ac6efff3d1..01a70b2463 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -457,6 +457,7 @@ const ( B600 = 0x8 B75 = 0x2 B9600 = 0xd + BCACHEFS_SUPER_MAGIC = 0xca451a4e BDEVFS_MAGIC = 0x62646576 BINDERFS_SUPER_MAGIC = 0x6c6f6f70 BINFMTFS_MAGIC = 0x42494e4d @@ -942,9 +943,6 @@ const ( ETHTOOL_FEC_OFF = 0x4 ETHTOOL_FEC_RS = 0x8 ETHTOOL_FLAG_ALL = 0x7 - ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 - ETHTOOL_FLAG_OMIT_REPLY = 0x2 - ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_FLASHDEV = 0x33 ETHTOOL_FLASH_MAX_FILENAME = 0x80 ETHTOOL_FWVERS_LEN = 0x20 @@ -1706,6 +1704,7 @@ const ( KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 + KEXEC_CRASH_HOTPLUG_SUPPORT = 0x8 KEXEC_FILE_DEBUG = 0x8 KEXEC_FILE_NO_INITRAMFS = 0x4 KEXEC_FILE_ON_CRASH = 0x2 @@ -1781,6 +1780,7 @@ const ( KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_IOCTL_DEV = 0x8000 LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 @@ -2512,6 +2512,23 @@ const ( PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_PPC_DEXCR_CTRL_CLEAR = 0x4 + PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC = 0x10 + PR_PPC_DEXCR_CTRL_EDITABLE = 0x1 + PR_PPC_DEXCR_CTRL_MASK = 0x1f + PR_PPC_DEXCR_CTRL_SET = 0x2 + PR_PPC_DEXCR_CTRL_SET_ONEXEC = 0x8 + PR_PPC_DEXCR_IBRTPD = 0x1 + PR_PPC_DEXCR_NPHIE = 0x3 + PR_PPC_DEXCR_SBHE = 0x0 + PR_PPC_DEXCR_SRAPD = 0x2 + PR_PPC_GET_DEXCR = 0x48 + PR_PPC_SET_DEXCR = 0x49 + PR_RISCV_CTX_SW_FENCEI_OFF = 0x1 + PR_RISCV_CTX_SW_FENCEI_ON = 0x0 + PR_RISCV_SCOPE_PER_PROCESS = 0x0 + PR_RISCV_SCOPE_PER_THREAD = 0x1 + PR_RISCV_SET_ICACHE_FLUSH_CTX = 0x47 PR_RISCV_V_GET_CONTROL = 0x46 PR_RISCV_V_SET_CONTROL = 0x45 PR_RISCV_V_VSTATE_CTRL_CUR_MASK = 0x3 @@ -3206,6 +3223,7 @@ const ( STATX_MTIME = 0x40 STATX_NLINK = 0x4 STATX_SIZE = 0x200 + STATX_SUBVOL = 0x8000 STATX_TYPE = 0x1 STATX_UID = 0x8 STATX__RESERVED = 0x80000000 diff --git a/unix/zsysnum_linux_386.go b/unix/zsysnum_linux_386.go index 53aef5dc58..524b0820cb 100644 --- a/unix/zsysnum_linux_386.go +++ b/unix/zsysnum_linux_386.go @@ -457,4 +457,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_amd64.go b/unix/zsysnum_linux_amd64.go index 71d524763d..d3e38f681a 100644 --- a/unix/zsysnum_linux_amd64.go +++ b/unix/zsysnum_linux_amd64.go @@ -379,4 +379,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_arm.go b/unix/zsysnum_linux_arm.go index c747706131..70b35bf3b0 100644 --- a/unix/zsysnum_linux_arm.go +++ b/unix/zsysnum_linux_arm.go @@ -421,4 +421,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_arm64.go b/unix/zsysnum_linux_arm64.go index f96e214f6d..6c778c2327 100644 --- a/unix/zsysnum_linux_arm64.go +++ b/unix/zsysnum_linux_arm64.go @@ -324,4 +324,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_loong64.go b/unix/zsysnum_linux_loong64.go index 28425346cf..37281cf51a 100644 --- a/unix/zsysnum_linux_loong64.go +++ b/unix/zsysnum_linux_loong64.go @@ -318,4 +318,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_mips.go b/unix/zsysnum_linux_mips.go index d0953018da..7e567f1eff 100644 --- a/unix/zsysnum_linux_mips.go +++ b/unix/zsysnum_linux_mips.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/unix/zsysnum_linux_mips64.go b/unix/zsysnum_linux_mips64.go index 295c7f4b81..38ae55e5ef 100644 --- a/unix/zsysnum_linux_mips64.go +++ b/unix/zsysnum_linux_mips64.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/unix/zsysnum_linux_mips64le.go b/unix/zsysnum_linux_mips64le.go index d1a9eaca7a..55e92e60a8 100644 --- a/unix/zsysnum_linux_mips64le.go +++ b/unix/zsysnum_linux_mips64le.go @@ -371,4 +371,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 5459 SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_LIST_MODULES = 5461 + SYS_MSEAL = 5462 ) diff --git a/unix/zsysnum_linux_mipsle.go b/unix/zsysnum_linux_mipsle.go index bec157c39f..60658d6a02 100644 --- a/unix/zsysnum_linux_mipsle.go +++ b/unix/zsysnum_linux_mipsle.go @@ -441,4 +441,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 4459 SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_LIST_MODULES = 4461 + SYS_MSEAL = 4462 ) diff --git a/unix/zsysnum_linux_ppc.go b/unix/zsysnum_linux_ppc.go index 7ee7bdc435..e203e8a7ed 100644 --- a/unix/zsysnum_linux_ppc.go +++ b/unix/zsysnum_linux_ppc.go @@ -448,4 +448,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_ppc64.go b/unix/zsysnum_linux_ppc64.go index fad1f25b44..5944b97d54 100644 --- a/unix/zsysnum_linux_ppc64.go +++ b/unix/zsysnum_linux_ppc64.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_ppc64le.go b/unix/zsysnum_linux_ppc64le.go index 7d3e16357d..c66d416dad 100644 --- a/unix/zsysnum_linux_ppc64le.go +++ b/unix/zsysnum_linux_ppc64le.go @@ -420,4 +420,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_riscv64.go b/unix/zsysnum_linux_riscv64.go index 0ed53ad9f7..9889f6a559 100644 --- a/unix/zsysnum_linux_riscv64.go +++ b/unix/zsysnum_linux_riscv64.go @@ -325,4 +325,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_s390x.go b/unix/zsysnum_linux_s390x.go index 2fba04ad50..01d86825bb 100644 --- a/unix/zsysnum_linux_s390x.go +++ b/unix/zsysnum_linux_s390x.go @@ -386,4 +386,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/zsysnum_linux_sparc64.go b/unix/zsysnum_linux_sparc64.go index 621d00d741..7b703e77cd 100644 --- a/unix/zsysnum_linux_sparc64.go +++ b/unix/zsysnum_linux_sparc64.go @@ -399,4 +399,5 @@ const ( SYS_LSM_GET_SELF_ATTR = 459 SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_LIST_MODULES = 461 + SYS_MSEAL = 462 ) diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index 4740b83485..b102b95a0a 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -110,7 +110,8 @@ type Statx_t struct { Mnt_id uint64 Dio_mem_align uint32 Dio_offset_align uint32 - _ [12]uint64 + Subvol uint64 + _ [11]uint64 } type Fsid struct { @@ -3473,7 +3474,7 @@ const ( DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 DEVLINK_PORT_FN_ATTR_CAPS = 0x4 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x6 ) type FsverityDigest struct { @@ -3975,7 +3976,7 @@ const ( ETHTOOL_A_TSINFO_TX_TYPES = 0x3 ETHTOOL_A_TSINFO_RX_FILTERS = 0x4 ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 - ETHTOOL_A_TSINFO_MAX = 0x5 + ETHTOOL_A_TSINFO_MAX = 0x6 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1 From cde4660eb9c519b4373bebe3d42deebc744368f2 Mon Sep 17 00:00:00 2001 From: Mauri de Souza Meneguzzo Date: Sat, 27 Jul 2024 09:20:42 +0000 Subject: [PATCH 12/13] unix: add linux mseal system call The mseal system call was added in Linux 6.10. See https://lwn.net/Articles/954936. Change-Id: Ic812a5d784effbc1f362045ffeb6f7e50ee5f8bb GitHub-Last-Rev: de3924e954b1182e974c008b41e07fd21f283c30 GitHub-Pull-Request: golang/sys#209 Reviewed-on: https://go-review.googlesource.com/c/sys/+/600518 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor Reviewed-by: Michael Knyszek --- unix/syscall_linux.go | 1 + unix/zsyscall_linux.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index 5682e2628a..3f1d3d4cb2 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go @@ -2592,3 +2592,4 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { } //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) +//sys Mseal(b []byte, flags uint) (err error) diff --git a/unix/zsyscall_linux.go b/unix/zsyscall_linux.go index 87d8612a1d..1bc1a5adb2 100644 --- a/unix/zsyscall_linux.go +++ b/unix/zsyscall_linux.go @@ -2229,3 +2229,19 @@ func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mseal(b []byte, flags uint) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSEAL, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} From aa1c4c8554e2f3f54247c309e897cd42c9bfc374 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Fri, 28 Jun 2024 22:51:24 +1000 Subject: [PATCH 13/13] unix: provide Mount on openbsd Note that Mount is already provided for both darwin and linux, with differing signatures. Change-Id: Iaddae1769e436aad5125b78e31b2d62d22e45b16 Reviewed-on: https://go-review.googlesource.com/c/sys/+/595735 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek --- unix/syscall_openbsd.go | 1 + unix/zsyscall_openbsd_386.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_386.s | 5 +++++ unix/zsyscall_openbsd_amd64.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_amd64.s | 5 +++++ unix/zsyscall_openbsd_arm.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_arm.s | 5 +++++ unix/zsyscall_openbsd_arm64.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_arm64.s | 5 +++++ unix/zsyscall_openbsd_mips64.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_mips64.s | 5 +++++ unix/zsyscall_openbsd_ppc64.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_ppc64.s | 6 ++++++ unix/zsyscall_openbsd_riscv64.go | 24 ++++++++++++++++++++++++ unix/zsyscall_openbsd_riscv64.s | 5 +++++ 15 files changed, 205 insertions(+) diff --git a/unix/syscall_openbsd.go b/unix/syscall_openbsd.go index b25343c71a..b86ded549c 100644 --- a/unix/syscall_openbsd.go +++ b/unix/syscall_openbsd.go @@ -293,6 +293,7 @@ func Uname(uname *Utsname) error { //sys Mkfifoat(dirfd int, path string, mode uint32) (err error) //sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) +//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) diff --git a/unix/zsyscall_openbsd_386.go b/unix/zsyscall_openbsd_386.go index 9dc42410b7..1851df14e8 100644 --- a/unix/zsyscall_openbsd_386.go +++ b/unix/zsyscall_openbsd_386.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_386.s b/unix/zsyscall_openbsd_386.s index 41b5617316..0b43c69365 100644 --- a/unix/zsyscall_openbsd_386.s +++ b/unix/zsyscall_openbsd_386.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/unix/zsyscall_openbsd_amd64.go b/unix/zsyscall_openbsd_amd64.go index 0d3a0751cd..e1ec0dbe4e 100644 --- a/unix/zsyscall_openbsd_amd64.go +++ b/unix/zsyscall_openbsd_amd64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_amd64.s b/unix/zsyscall_openbsd_amd64.s index 4019a656f6..880c6d6e31 100644 --- a/unix/zsyscall_openbsd_amd64.s +++ b/unix/zsyscall_openbsd_amd64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/unix/zsyscall_openbsd_arm.go b/unix/zsyscall_openbsd_arm.go index c39f7776db..7c8452a63e 100644 --- a/unix/zsyscall_openbsd_arm.go +++ b/unix/zsyscall_openbsd_arm.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_arm.s b/unix/zsyscall_openbsd_arm.s index ac4af24f90..b8ef95b0fa 100644 --- a/unix/zsyscall_openbsd_arm.s +++ b/unix/zsyscall_openbsd_arm.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mount_trampoline_addr(SB)/4, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 diff --git a/unix/zsyscall_openbsd_arm64.go b/unix/zsyscall_openbsd_arm64.go index 57571d072f..2ffdf861f7 100644 --- a/unix/zsyscall_openbsd_arm64.go +++ b/unix/zsyscall_openbsd_arm64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_arm64.s b/unix/zsyscall_openbsd_arm64.s index f77d532121..2af3b5c762 100644 --- a/unix/zsyscall_openbsd_arm64.s +++ b/unix/zsyscall_openbsd_arm64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/unix/zsyscall_openbsd_mips64.go b/unix/zsyscall_openbsd_mips64.go index e62963e67e..1da08d5267 100644 --- a/unix/zsyscall_openbsd_mips64.go +++ b/unix/zsyscall_openbsd_mips64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_mips64.s b/unix/zsyscall_openbsd_mips64.s index fae140b62c..b7a251353b 100644 --- a/unix/zsyscall_openbsd_mips64.s +++ b/unix/zsyscall_openbsd_mips64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 diff --git a/unix/zsyscall_openbsd_ppc64.go b/unix/zsyscall_openbsd_ppc64.go index 00831354c8..6e85b0aac9 100644 --- a/unix/zsyscall_openbsd_ppc64.go +++ b/unix/zsyscall_openbsd_ppc64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_ppc64.s b/unix/zsyscall_openbsd_ppc64.s index 9d1e0ff06d..f15dadf055 100644 --- a/unix/zsyscall_openbsd_ppc64.s +++ b/unix/zsyscall_openbsd_ppc64.s @@ -555,6 +555,12 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mount(SB) + RET +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_nanosleep(SB) RET diff --git a/unix/zsyscall_openbsd_riscv64.go b/unix/zsyscall_openbsd_riscv64.go index 79029ed584..28b487df25 100644 --- a/unix/zsyscall_openbsd_riscv64.go +++ b/unix/zsyscall_openbsd_riscv64.go @@ -1493,6 +1493,30 @@ var libc_mknodat_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(fsType) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dir) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mount mount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { diff --git a/unix/zsyscall_openbsd_riscv64.s b/unix/zsyscall_openbsd_riscv64.s index da115f9a4b..1e7f321e43 100644 --- a/unix/zsyscall_openbsd_riscv64.s +++ b/unix/zsyscall_openbsd_riscv64.s @@ -463,6 +463,11 @@ TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) +TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mount(SB) +GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) + TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8