From 29298aaa6a49af9eb63e0c3e6932893034b93051 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Thu, 1 Aug 2024 18:02:11 +1000 Subject: [PATCH 1/3] windows: delete TestGetKeyboardLayout According to https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow GetForegroundWindow can return nil in some circumstances. So GetForegroundWindow cannot be used in the TestGetKeyboardLayout. Just delete the test for now. Fixes golang/go#68671 Change-Id: I7e05ac2f19b1a6310a3f7f690c6d02b0d1f5571e Reviewed-on: https://go-review.googlesource.com/c/sys/+/602335 Reviewed-by: Cherry Mui Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI Reviewed-by: Ayman Bagabas --- windows/syscall_windows_test.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/windows/syscall_windows_test.go b/windows/syscall_windows_test.go index ca8a70d2a4..b7703dfe15 100644 --- a/windows/syscall_windows_test.go +++ b/windows/syscall_windows_test.go @@ -1438,17 +1438,6 @@ uintptr_t beep(void) { } } -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 From 4c7077ec60eeb233fdff4640ef2286500c7689a7 Mon Sep 17 00:00:00 2001 From: database64128 Date: Mon, 29 Jul 2024 06:53:55 +0000 Subject: [PATCH 2/3] windows: add enums for IpAdapterUnicastAddress These are for the enum fields in IpAdapterUnicastAddress. Change-Id: Ibcb6ce674ab41a94dbe46d394f035208a94b6dae GitHub-Last-Rev: 1837ff9c32357fe7eb64257001b9bf42485b1c8c GitHub-Pull-Request: golang/sys#204 Reviewed-on: https://go-review.googlesource.com/c/sys/+/598895 LUCI-TryBot-Result: Go LUCI Reviewed-by: Alex Brainman Reviewed-by: Michael Knyszek Reviewed-by: David Chase --- windows/types_windows.go | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/windows/types_windows.go b/windows/types_windows.go index 4d0c15745f..3f03b3d57c 100644 --- a/windows/types_windows.go +++ b/windows/types_windows.go @@ -2031,6 +2031,50 @@ const ( IF_TYPE_IEEE1394 = 144 ) +// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin +const ( + IpPrefixOriginOther = 0 + IpPrefixOriginManual = 1 + IpPrefixOriginWellKnown = 2 + IpPrefixOriginDhcp = 3 + IpPrefixOriginRouterAdvertisement = 4 + IpPrefixOriginUnchanged = 1 << 4 +) + +// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin +const ( + NlsoOther = 0 + NlsoManual = 1 + NlsoWellKnown = 2 + NlsoDhcp = 3 + NlsoLinkLayerAddress = 4 + NlsoRandom = 5 + IpSuffixOriginOther = 0 + IpSuffixOriginManual = 1 + IpSuffixOriginWellKnown = 2 + IpSuffixOriginDhcp = 3 + IpSuffixOriginLinkLayerAddress = 4 + IpSuffixOriginRandom = 5 + IpSuffixOriginUnchanged = 1 << 4 +) + +// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state +const ( + NldsInvalid = 0 + NldsTentative = 1 + NldsDuplicate = 2 + NldsDeprecated = 3 + NldsPreferred = 4 + IpDadStateInvalid = 0 + IpDadStateTentative = 1 + IpDadStateDuplicate = 2 + IpDadStateDeprecated = 3 + IpDadStatePreferred = 4 +) + type SocketAddress struct { Sockaddr *syscall.RawSockaddrAny SockaddrLength int32 From 914deed708990c429d263121ee1ef42388e94ba4 Mon Sep 17 00:00:00 2001 From: Mauri de Souza Meneguzzo Date: Wed, 7 Aug 2024 20:55:24 +0000 Subject: [PATCH 3/3] unix: add missing ETHTOOL_FLAG_ constants Some constants were removed in CL 600516 that included changes for the Linux kernel 6.10. This kernel version moved C defines to an enum ethtool_header_flags that was not picked up by the mkall.sh script. For enums, there is a perl script that needs to be run manually, and the output must be added by hand to the list of constants in unix/linux/types.go. See https://elixir.bootlin.com/linux/v6.10.3/source/include/uapi/linux/ethtool_netlink.h#L120 Fixes golang/go#68761 Change-Id: Idb189886d257d0fe66a4e832757a469e17f86c34 GitHub-Last-Rev: 08b8ef571ddeed14640c0b84a846e9fe280aaddb GitHub-Pull-Request: golang/sys#212 Reviewed-on: https://go-review.googlesource.com/c/sys/+/604098 Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI --- unix/linux/types.go | 7 +++++-- unix/ztypes_linux.go | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/unix/linux/types.go b/unix/linux/types.go index a6f44f4bb1..27b56486c4 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -3551,8 +3551,8 @@ const ( // ethtool and its netlink interface, generated using: // -// perl -nlE '/^\s*(ETHTOOL_\w+)/ && say "$1 = C.$1"' ethtool.h -// perl -nlE '/^\s*(ETHTOOL_\w+)/ && say "$1 = C.$1"' ethtool_netlink.h +// perl -nlE '/^\s*(ETHTOOL_\w+)/ && say "$1 = C.$1"' /usr/include/linux/ethtool.h +// perl -nlE '/^\s*(ETHTOOL_\w+)/ && say "$1 = C.$1"' /usr/include/linux/ethtool_netlink.h // // Note that a couple of constants produced by this command will be duplicated // by mkerrors.sh, so some manual pruning was necessary. @@ -3787,6 +3787,9 @@ const ( ETHTOOL_MSG_PSE_GET_REPLY = C.ETHTOOL_MSG_PSE_GET_REPLY ETHTOOL_MSG_RSS_GET_REPLY = C.ETHTOOL_MSG_RSS_GET_REPLY ETHTOOL_MSG_KERNEL_MAX = C.ETHTOOL_MSG_KERNEL_MAX + ETHTOOL_FLAG_COMPACT_BITSETS = C.ETHTOOL_FLAG_COMPACT_BITSETS + ETHTOOL_FLAG_OMIT_REPLY = C.ETHTOOL_FLAG_OMIT_REPLY + ETHTOOL_FLAG_STATS = C.ETHTOOL_FLAG_STATS ETHTOOL_A_HEADER_UNSPEC = C.ETHTOOL_A_HEADER_UNSPEC ETHTOOL_A_HEADER_DEV_INDEX = C.ETHTOOL_A_HEADER_DEV_INDEX ETHTOOL_A_HEADER_DEV_NAME = C.ETHTOOL_A_HEADER_DEV_NAME diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index b102b95a0a..7f1961b907 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -3807,6 +3807,9 @@ const ( ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 ETHTOOL_MSG_KERNEL_MAX = 0x2b + ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 + ETHTOOL_FLAG_OMIT_REPLY = 0x2 + ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy