Re: ERESTARTSYS question.

Bjorn Wesen (bjorn@sparta.lu.se)
Thu, 5 Apr 2001 17:02:42 +0200 (MET DST)


On Thu, 5 Apr 2001, Jani Monoses wrote:
> On Thu, 5 Apr 2001, Bjorn Wesen wrote:
> > ERESTARTSYS is a part of the api between the driver and the
> > signal-handling code in the kernel. It does not reach user-space (provided
> > of course that it's used appropriately in the drivers :)
>
> As an example sound/via82cxxx_audio.c returns ERESTARTSYS from
> via_dsp_open() .I suppose this _does_ reach userland right?

No; system calls do not exit directly to userland, they exit through the
magic in entry.S (confusingly so :). If a signal is pending (which it is,
if down_interruptible fails) the return is made through do_signal, which
rewrites the return value and does the proper restarting.

(down_interruptible means it can be interrupted by a signal, btw - bad
drivers do sleep and semaphoring without _interruptible so if your HW is
bad the process can get stuck irrecoverably in the kernel)

/Bjorn

-
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/