title: Offset for mmap() must be page aligned
body: <p>I was going through the manual of the mmap function and came across this line: </p>
  
  <pre><code>pa_offset = offset &amp; ~(sysconf(_SC_PAGE_SIZE) - 1);
  /* offset for mmap() must be page aligned */
  </code></pre>
  
  <p>I think I understand what this line does. It gets the page size and makes sure that pa_offset is either zero or a multiple of the page size (4096 here). But I do not understand how. I know what the bitwise operators do, but is it possible to explain how exactly this is being achieved? </p>