Re: ptrace/select/signal errno weirdness

Brian Wellington (bwelling@xbill.org)
Thu, 15 Aug 2002 21:15:59 -0700 (PDT)


On 15 Aug 2002, Linus Torvalds wrote:

> In article <Pine.LNX.4.44.0208151508060.21876-100000@spratly.nominum.com>,
> Brian Wellington <bwelling@xbill.org> wrote:
> >When sending a SIGINT to a ptraced process (run under gdb), an interrupted
> >select() call returns with errno==514. linux/include/linux/errno.h says:
> >
> >/* Should never be seen by user programs */
> >#define ERESTARTSYS 512
> >#define ERESTARTNOINTR 513
> >#define ERESTARTNOHAND 514 /* restart if no handler.. */
> >#define ENOIOCTLCMD 515 /* No ioctl command */
> >
> >As gdb is a user program, and the printf is printing it, there's something
> >wrong.
>
> No, there's nothing wrong.
>
> The process _itself_ never sees these magic error numbers, because they
> are internal to the kernel, and the only time they are seen is by a
> tracer that sees them - at the same time as the kernel backed up the
> instruction pointer so that the traced process will not actually return
> from the system call, it will re-do the system call.

If that's the case, then how does
fprintf(stderr, "select: %s\n", strerror(errno));
print
select: Unknown error 514
?

That's the traced process printing the error, not the tracing process.

Brian

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/