C write / read detection in memory block

I like to ask if anyone has an idea how to detect a write to the address memory address.

First I used mprotect along with sigaction to cause a segmentation error when a write / read operation was done.

Two negative factors with this approach between several:

  • hard to get through a segmentation error
  • The memory address passed to mprotect must be aligned on the page border, that is, it is impossible to process this memory address with simple malloc.

To clarify the problem:

I am creating an application in C for a cluster environment. At some point, I allocate memory so that I call the buffer on the local node and assign some data. This buffer will be sent to the remote node and will have the same procedure. At the same point, this buffer will write / read to the remote node, but I do not know when (it will be used by DMA to write / read the buffer), the local host should be notified of the buffer modification. As I said, I have already used some mechanisms, but not one of them is able to deal with it with some abilities. Right now I just need an idea.

Every other idea is welcome here.

thank

+3
source share
1 answer

. , , . , , , , "".

x86 , (. http://en.wikipedia.org/wiki/X86_debug_register).

, GDB . "" GDB, .

, mprotect() - , , , ( , , ). , , : http://catb.org/esr/faqs/smart-questions.html#goal

+1

All Articles