On 23 January 2011 21:35, Mike Frysinger <vap...@gentoo.org> wrote: > On Sun, Jan 23, 2011 at 16:25, Peter Maydell wrote: >> This looks wrong -- ppoll() is supposed to be atomic, but >> your implementation isn't. Why can't we just implement this >> by calling the host ppoll? (might need a configure test, but >> that's straightforward.) > > it's atomic from the apps' point of view, so what does it matter ?
It's not atomic because signals can arrive in the gaps between your calls to sigaction and poll (even if qemu doesn't deliver them to the guest until we're done). ppoll() is supposed to return EINTR if interrupted by a signal, but if a signal arrives before you call poll() then you won't notice it so you won't return, and the app might hang. Looks like this same issue came up with a proposed pselect patch last year: http://www.mail-archive.com/qemu-devel@nongnu.org/msg28339.html (together with some remarks about it being better not to trust buggy libcs and go straight for the host syscall.) -- PMM