title: C write/read detection on memory block
body: <p>i like to ask if someone have any idea how to detect a write on alloc memory address.</p>
  
  <p>At first i used mprotect along with sigaction to force a segmentation fault when was made a write/read operation. </p>
  
  <p>Two negative factor with this approach among several:</p>
  
  <ul>
  <li>is the difficult to pass through a segmentation fault</li>
  <li>the memory address pass in mprotect must be aligned to a page boundary i.e its not possible to handle this memory address with a simple malloc.</li>
  </ul>
  
  <p>To clarify the problematic:</p>
  
  <p>I construct a app in C for cluster environment. In some point I allocate memory that i call  buffer in a local host and assign some data. This buffer will be sent to a remote node  and have the same procedure. At same point this buffer will be write/read in remote node but i don't know when(it will be used DMA to write/read buffer), the local host must be notified about buffer modification. Like i said above i already used some mechanisms but none of them 
  its capable to handle it with some ability. For now i just want some idea.</p>
  
  <p>Every different idea here its welcome.</p>
  
  <p>Thanks </p>