EINTR vs. ERESTART - Unix

This is a discussion on EINTR vs. ERESTART - Unix ; Hi, I have a program, which starts child processes and therefore has to execute wait(3c) from time to time. This should be done in a timely manner. The problem is that I'm also opening up a named pipe from time ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: EINTR vs. ERESTART

  1. EINTR vs. ERESTART

    Hi,

    I have a program, which starts child processes and therefore has to
    execute wait(3c) from time to time. This should be done in a timely
    manner. The problem is that I'm also opening up a named pipe from time
    to time, which can block infinitely. So I set up a signal handler for
    SIGCHLD, to unblock open if a child terminates, so I can execute wait(3c).

    Unfortunately, Linux and Cygwin exit the system call open with ERESTART,
    instead of EINTR and restart the system call. I had expected open(2) to
    return EINTR by reading the standard and also observed this behavior on
    Solaris. 1003.1 doesn't even know about ERESTART...

    So, does anybody know how to tell Linux and Cygwin to return EINTR, when
    a syscall gets interrupted and not ERESTART which breaks standard semantics?

    Any info would be highly appreciated...

    TIA,
    Thomas

  2. Re: EINTR vs. ERESTART

    Thomas Maier-Komor writes:
    > I have a program, which starts child processes and therefore has to
    > execute wait(3c) from time to time. This should be done in a timely
    > manner. The problem is that I'm also opening up a named pipe from time
    > to time, which can block infinitely. So I set up a signal handler for
    > SIGCHLD, to unblock open if a child terminates, so I can execute
    > wait(3c).
    >
    > Unfortunately, Linux and Cygwin exit the system call open with
    > ERESTART, instead of EINTR and restart the system call. I had expected
    > open(2) to return EINTR by reading the standard and also observed this
    > behavior on Solaris. 1003.1 doesn't even know about ERESTART...
    >
    > So, does anybody know how to tell Linux and Cygwin to return EINTR,
    > when a syscall gets interrupted and not ERESTART which breaks standard
    > semantics?


    The solution to this problem is most likely to not assume that signal
    has traditional SysV-semantics everywhere, but use sigaction instead
    (not specifiying SA_RESTART for sa_flags_.


  3. Re: EINTR vs. ERESTART

    Rainer Weikusat schrieb:
    > Thomas Maier-Komor writes:
    >> I have a program, which starts child processes and therefore has to
    >> execute wait(3c) from time to time. This should be done in a timely
    >> manner. The problem is that I'm also opening up a named pipe from time
    >> to time, which can block infinitely. So I set up a signal handler for
    >> SIGCHLD, to unblock open if a child terminates, so I can execute
    >> wait(3c).
    >>
    >> Unfortunately, Linux and Cygwin exit the system call open with
    >> ERESTART, instead of EINTR and restart the system call. I had expected
    >> open(2) to return EINTR by reading the standard and also observed this
    >> behavior on Solaris. 1003.1 doesn't even know about ERESTART...
    >>
    >> So, does anybody know how to tell Linux and Cygwin to return EINTR,
    >> when a syscall gets interrupted and not ERESTART which breaks standard
    >> semantics?

    >
    > The solution to this problem is most likely to not assume that signal
    > has traditional SysV-semantics everywhere, but use sigaction instead
    > (not specifiying SA_RESTART for sa_flags_.
    >


    Rainer,

    thank you for the hint - that was it.

    - Thomas

+ Reply to Thread