Commit 274f4cef authored by Jason A. Donenfeld's avatar Jason A. Donenfeld

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: default avatarAlex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 148ec3e3
...@@ -42,6 +42,8 @@ func (out *OutBuf) Munmap() { ...@@ -42,6 +42,8 @@ func (out *OutBuf) Munmap() {
} }
func (out *OutBuf) Msync() error { func (out *OutBuf) Msync() error {
// does nothing on windows if out.buf == nil {
return nil return nil
}
return syscall.FlushViewOfFile(uintptr(unsafe.Pointer(&out.buf[0])), 0)
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment