diff options
| author | qmuntal <quimmuntal@gmail.com> | 2025-04-10 17:45:47 +0200 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2025-04-24 06:51:09 -0700 |
| commit | 8a8f506516e1210c9ca3a352d76bd1d570c407fd (patch) | |
| tree | ac3815d0347d06b817638779e7c2eb3dac61a5ee /src/internal/syscall | |
| parent | c1fc209c41c18806b7cef1cf114f1ca9b3731eb9 (diff) | |
| download | go-8a8f506516e1210c9ca3a352d76bd1d570c407fd.tar.xz | |
os,internal/poll: disassociate handle from IOCP in File.Fd
Go 1.25 will gain support for overlapped IO on handles passed to
os.NewFile thanks to CL 662236. It was previously not possible to add
an overlapped handle to the Go runtime's IO completion port (IOCP),
and now happens on the first call the an IO method.
This means that there is code that relies on the fact that File.Fd
returns a handle that can always be associated with a custom IOCP.
That wouldn't be the case anymore, as a handle can only be associated
with one IOCP at a time and it must be explicitly disassociated.
To fix this breaking change, File.Fd will disassociate the handle
from the Go runtime IOCP before returning it. It is then not necessary
to defer the association until the first IO method is called, which
was recently added in CL 661955 to support this same use case, but
in a more complex and unreliable way.
Updates #19098.
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race,gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: Id8a7e04d35057047c61d1733bad5bf45494b2c28
Reviewed-on: https://go-review.googlesource.com/c/go/+/664455
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal/syscall')
| -rw-r--r-- | src/internal/syscall/windows/syscall_windows.go | 2 | ||||
| -rw-r--r-- | src/internal/syscall/windows/types_windows.go | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/internal/syscall/windows/syscall_windows.go b/src/internal/syscall/windows/syscall_windows.go index b6859a5432..b6692166cc 100644 --- a/src/internal/syscall/windows/syscall_windows.go +++ b/src/internal/syscall/windows/syscall_windows.go @@ -32,6 +32,7 @@ func UTF16PtrToString(p *uint16) string { } const ( + ERROR_INVALID_HANDLE syscall.Errno = 6 ERROR_BAD_LENGTH syscall.Errno = 24 ERROR_SHARING_VIOLATION syscall.Errno = 32 ERROR_LOCK_VIOLATION syscall.Errno = 33 @@ -39,6 +40,7 @@ const ( ERROR_CALL_NOT_IMPLEMENTED syscall.Errno = 120 ERROR_INVALID_NAME syscall.Errno = 123 ERROR_LOCK_FAILED syscall.Errno = 167 + ERROR_IO_INCOMPLETE syscall.Errno = 996 ERROR_NO_TOKEN syscall.Errno = 1008 ERROR_NO_UNICODE_TRANSLATION syscall.Errno = 1113 ERROR_CANT_ACCESS_FILE syscall.Errno = 1920 diff --git a/src/internal/syscall/windows/types_windows.go b/src/internal/syscall/windows/types_windows.go index 6c81754e1a..9f8f61f6d9 100644 --- a/src/internal/syscall/windows/types_windows.go +++ b/src/internal/syscall/windows/types_windows.go @@ -248,3 +248,11 @@ type FILE_LINK_INFORMATION struct { FileNameLength uint32 FileName [syscall.MAX_PATH]uint16 } + +const FileReplaceCompletionInformation = 61 + +// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_completion_information +type FILE_COMPLETION_INFORMATION struct { + Port syscall.Handle + Key uintptr +} |
