Re: 2.0.30 serial.c, ppp.c and pppd-2.2 questions

Theodore Y. Ts'o (tytso@MIT.EDU)
Tue, 22 Jul 1997 22:32:23 -0400


Date: Sun, 20 Jul 1997 00:56:46 -0600 (MDT)
From: Rob Riggs <rriggs@tesser.com>

On 20-Jul-97 Rob Riggs wrote:
>> You're right that setting an overflow error is the most appropriate
>> thing to do; however, reporting an overrun error itself requires a space
>> in the flip buffer, which we won't have if the flip buffer is full.....
>
>It would be easy to make sure that we have at least one
>byte available in the flip buffer to report overruns.

Yes, I know. Following up on my own message. Almost as bad as
talking to oneself in public...

There is an easier way to handle this. The following patch
deals with this in a slightly better fashion.

The patch you submitted doesn't work, because it uses a static variable,
flip_overflow. If you have multiple serial ports active, they will all
try to reference same flip_overflow variable while the interrupt routine
is executing, with really bad results.

(Insert standard claim about why I think threads are a bad idea for most
application programs; there are plenty of kernel programmers have a hard
time writing thread-safe kernel code --- and we expect *application*
programmers to be able to get this stuff right? It's like handing a
loaded .45 to a chimpanzee and hoping he won't shoot himself or others
while he's playing with it. :-)

(Yes, I know sometimes you need threads for performance reasons; but you
better have someone who really knows what they are doing, and the times
when you need threads are much rarer than you think.)

BTW, the basic idea in your patch was a good one; you just have to put
the flip_overflow flag in the info structure.

- Ted