Skip to content

Commit

Permalink
cmd/link: implement Msync for Windows using FlushViewOfFile
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Alex Brainman <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
zx2c4 committed Oct 2, 2019
1 parent 148ec3e commit 274f4ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cmd/link/internal/ld/outbuf_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 274f4ce

Please sign in to comment.