1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:54:44 -07:00

cmd/link: implement Msync for Windows using FlushViewOfFile

CL 196846 implemented memory mapped output files but forgot to provide
an implementation for Msync. This rectifies that with a simple call to
FlushViewOfFile.

Change-Id: I5aebef9baf3a2a6ad54ceda096952a5d7d660bfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/198418
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Jason A. Donenfeld 2019-10-02 11:25:24 +02:00
parent 148ec3e3bc
commit 274f4cef93

View File

@ -42,6 +42,8 @@ func (out *OutBuf) Munmap() {
}
func (out *OutBuf) Msync() error {
// does nothing on windows
return nil
if out.buf == nil {
return nil
}
return syscall.FlushViewOfFile(uintptr(unsafe.Pointer(&out.buf[0])), 0)
}