Re: 2.4.0-test6 network socket problems

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Fri Oct 13 2000 - 17:37:29 EST


> I've found the problem. This type of loop does not work:
>
> do {
> alarm(t);
> read(fd);
> if (EINT)
> exception();
> else
> alarm(0);
> } while (data);
>
> There are some semantics here that differ from other *nix where this
> works. The read() won't come out when the alarm comes, and the socket
> will effectively become broken.

The restart or continue behaviour is undefined unless you use sigaction()
to control your signal behaviour (see POSIX.1 or SuS). Even then your code
is buggy on every OS I know

Suppose this happens..

        alarm(1)
        [sudden swap frenzy]
        alarm is delivered.. do nothing
        read

blocks forever. You need to make clever use of siglongjmp to avoid that one
occurring or use select/poll.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:26 EST