Re:Should you be scared of Unix signals?
by gpderetta on Tuesday June 14, 2016 @12:13PM
(#11902995)
Duh! You are right, losing the results of partial read/writes is not acceptable. I guess on x86, completely unportably, you could check whether the current ip is pointing to a syscall/int instruction.
[ Parent
| on HN ]
You probably want to jump if you're "just before" the syscall, too, though. So you end up with basically this:
syscall wrappers: https://github.com/scottlamb/sigsafe/blob/master/src/x86_64-... (probably could do something better with that thread local; and as I mentioned this isn't using vsyscall)
signal handler: https://github.com/scottlamb/sigsafe/blob/master/src/x86_64-... (although it bugs me now that I iterate the whole array if the instruction pointer's not in any of the syscalls)
and just to be sure, a race checker: https://github.com/scottlamb/sigsafe/blob/master/tests/race_...