Re: -ERESTARTSYS and /dev/ttyS1

Linus Torvalds (
Thu, 14 Nov 1996 18:39:01 +0200 (EET)

On Wed, 13 Nov 1996, Alan Cox wrote:
> > Follow the output of strace. Note the -ERESTARTSYS error. According with
> > /usr/include/linux/errno.h: /* Should never be seen by user programs */
> Thats what I'd expect. Libc handles -ERESTARTSYS, not the kernel.

No, the kernel handles -ERESTARTSYS, but when you _strace_ a process you
see it being done, because strace sees the system call restart (and if you
think about it, strace _has_ to see that the system call will be
restarted, otherwise you wouldn't be able to follow what happened).

> > alarm(2) = 0
> > open("/dev/ttyS1", O_RDWR|O_NOCTTY) = -1 ERESTARTSYS (errno 512)
> This blocks for carrier

And note that the user space process never sees the ERESTARTSYS at all,
because the system call will be restarted (duh!) after the signal handler
returns, so it will eventually return some other error..

(In this case, the process does an "exit()", so the system call never will
return, of course, but the fact that user space never sees the ERESTARTSYS
is still true. It can be a bit surprising if you aren't used to reading
the strace output)