This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Fix internal error in wait_lwp (interrupted system call)
On Thu, May 12, 2005 at 11:02:55PM +0200, Ulrich Weigand wrote:
> Daniel Jacobowitz wrote:
>
> > On the one hand, this is very clever. On the other hand, it's not very
> > robust. This is not the only signal that could arrive. Shouldn't
> > wait_lwp be looping on EINTR anyway, probably by using my_waitpid
> > (which is a recent addition)?
>
> Well, this isn't very robust either as waitpid isn't the only system
> call that could be interrupted -- it just typically has the biggest
> race window as it tends to sleep ...
>
> Using SA_RESTART has the advantage that it handles *all* (well,
> nearly all) system calls automatically, without having to add
> EINTR loops all over the place.
>
> If other signals are in fact a problem, too, I'd rather install
> them with SA_RESTART too. (However, I haven't ever seen the
> problem with any other signal.)
I think that's because GDB mostly uses signal(). That automatically
has SA_RESTART behavior, right? I'm just worried that this will
require non-local fixes; the SIGCHLD handler was in the same file, but
arbitrary other signal handlers could be at arbitrary places in GDB.
Not handling EINTR from a library call which is allowed to return EINTR
is, pedantically, always a bug.
Perhaps we should make both changes.
--
Daniel Jacobowitz
CodeSourcery, LLC