lkml.org 
[lkml]   [1996]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: -ERESTARTSYS and /dev/ttyS1



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)

Linus


\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.035 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site