]> Cypherpunks repositories - gostls13.git/commit
os: support overlapped IO with NewFile
authorqmuntal <quimmuntal@gmail.com>
Wed, 2 Apr 2025 10:47:32 +0000 (12:47 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 4 Apr 2025 21:00:21 +0000 (14:00 -0700)
commit7e60bdd7aada492c2f4a492d92439040974af2c5
treedab09b4dde299811fc57dcf640eb9c202762064c
parent5fc596ebe7c34b9f68c33da5ffc4f3645c38ef72
os: support overlapped IO with NewFile

The runtime/poll package has just gained support for overlapped IO,
see CL 660595 and CL 661955. The only remaining piece was making it
visible to user code via os.NewFile.

Some of the poll.FD.Init responsibility has been moved to os.NewFile
to avoid unnecessary syscalls for the common case of using os.Open,
os.Create, os.OpenFile, and os.Pipe, where we know that the file
is not opened for overlapped IO.

Some internal/poll tests have been moved to the os package to exercise
public APIs rather than internal ones.

The os.NewFile function definition has been moved into an OS-agnostic
file to avoid having duplicated documentation and ensure that the
caller is aware of its behavior across all platforms.

Closes #19098.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race,gotip-windows-arm64
Change-Id: If043f8b34d588cd4b481777203107ed92d660fd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/662236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
doc/next/6-stdlib/99-minor/os/15388.md
src/internal/poll/fd_windows.go
src/internal/poll/fd_windows_test.go
src/os/file.go
src/os/file_plan9.go
src/os/file_unix.go
src/os/file_windows.go
src/os/os_windows_test.go
src/os/removeall_windows.go
src/os/root_windows.go