Re: Lack of Documentation about SA_RESTART...

Paolo Ornati
2005-07-13T07:46:53Z

On Tue, 12 Jul 2005 14:16:35 -0400
Theodore Ts'o <tytso@mit.edu> wrote:

> Yes, do look at that. From the latest 2.6 sources:
>
> timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
>
> if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
> /* Error code is set above */
> if (!timeo || !inet_wait_for_connect(sk, timeo))
> goto out;
>
> err = sock_intr_errno(timeo);
> if (signal_pending(current))
> goto out;
> }
>
> If the socket is non-blocking, then we don't call
> inet_wiat_for_connect(), yes. But sock_intr_errno() will set the
> error code to -EINTR if the socket is set to non-nonblocking (see
> include/net/sock.h), and if a signal is pending, return it.

No.

With non-blocking socket "timeo" is set to 0. So the instruction:

if (!timeo || !inet_wait_for_connect(sk, timeo))
goto out;

jumps directly to "out" label. "sock_intr_errno()" isn't called.

--
Paolo Ornati
Linux 2.6.12.2 on x86_64