3 ms·
This sounds interesting. Do you know of an example that does this? So if I have multiple threads reading the same mmap'd file, I use si_addr in the signal hand
by planteen 7y ago
This sounds interesting. Do you know of an example that does this?
So if I have multiple threads reading the same mmap'd file, I use si_addr in the signal handler to know which page to call MAP_FIXED on?
- klodolph 7y agoI don’t know an open-source example off the top of my head. But that’s the gist of it… you keep an array somewhere with all the address ranges mapped. If you get SIGBUS, find the corresponding map, replace it with zeroes, and mark it as having an error. If there is no corresponding map, uninstall the signal handler and return—the thread will SIGBUS immediately after return and the default action will kill the process.