[PR] Tweak shared memory mappings to fix Windows build
[PR] Tweak shared memory mappings to fix Windows build

Summary:
I broke the Windows build in a recent change to shared memory. The
recent change avoided the need to pass layout information out-of-band by
including it in the first page of the shared file, then mapping that
first page to get the layout before mapping the rest.

The solution I came up with involved creating separate mappings, each at
the appropriate offset. On Linux/Mac systems, the offset needs to be a
multiple of the page size, but Windows is a bit different. On Windows,
the offsets need to be a multiple of the "allocation granularity," which
is different from the page size.

Page sizes are generally 4k, while the allocation granularity is
actually 64k. I did a little digging and it seems like this is for
backwards compat reasons -- specifially, for Alpha! Throwback!

Anyway, this diff takes a different approach. We still create the
initial mapping of the first page to get the layout information, but
then we create just one more mapping of the full shared file. That is,
the second mapping starts at 0 (and overlaps with the first), so there's
no offset alignment to worry about.
Pull Request resolved: https://github.com/facebook/flow/pull/8291

Reviewed By: mroch

Differential Revision: D19841241

Pulled By: samwgoldman

fbshipit-source-id: d53a8847fcd4a651ceec0b944a3cf69ef77cc647

nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow