Email List: Xaustin-group-lX
[All Lists]

Re: Stop signals and interruption of system calls on Linux

To: "Wojtek Lerch" <yyyyyy@xxxxxxx>, yyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Re: Stop signals and interruption of system calls on Linux
From: "Michael T Kerrisk" <yyyyyyyyy@xxxxxxx>
Date: Sat, 14 Feb 2004 11:57:19 +0100 (MET)
Hello Wojtek,

Thanks for your reply.

> Michael T Kerrisk wrote:
> > On Linux, the delivery of a stop signal (SIGTSTP, SIGSTOP, etc) 
> > plus subsequent SIGCONT can cause a certain blocking system calls 
> > (e.g., semop()) to return EINTR **even if the program is not 
> > catching the stop signal**.  
> 
> POSIX allows functions to fail for reasons not mentioned in the
> standard, and, unfortunately, does not forbid such failures to return
> EINTR.  Error codes are much less meaningful than most of us assume in
> everyday programming.
> 
> 
> "Implementations may support additional errors not included in this
> list, may generate errors included in this list under circumstances
>       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> other than those described here, or may contain extensions or
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> limitations that prevent some errors from occurring. The ERRORS section
> on each reference page specifies whether an error shall be returned, or
> whether it may be returned. Implementations shall not generate a
> different error number from the ones described here for error conditions
> described in this 1003.1-2001, but may generate additional errors
> Stdvolume of IEEE unless explicitly disallowed for a particular
> function."

I read this, and I thought -- bother!  And I thought an implementer would 
have to be getting pretty weaselly to try and use that interpretation.  Then

I remembered that Geoff Clare also pointed out to me the following text 
from Section 2.4.4:

    If the action of the signal is to stop the process, the 
    process shall stop until continued or terminated. Generation 
    of a SIGCONT signal for the process shall cause the process 
    to be continued, and the original function shall continue at 
    the point the process was stopped.

I think that saves my argument: Linux should not be returning 
EINTR at this point.  (And of course I'm still curious if any other 
implementation behaves like Linux.)

Cheers

Michael

-- 
Michael Kerrisk
yyyyyyyyy@xxxxxxx

GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++

<Prev in Thread] Current Thread [Next in Thread>