Re: Changes in the sockets: SIGIO handling

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Mon Mar 06 2000 - 12:36:36 EST


Dean Gaudet wrote:
> > If you use poll, and you fail to read all the data which is available,
> > then next time you poll you'll find the fd still active. If you rely on
> > signals, then it is up to you to make sure that you do all of the work
> > specified by the signal, and that absolutely requires that you keep
> > reading until there is no more data on the fd.
>
> hmm. i think you only need to loop around and continue read()ing if
> the first read() returned a full buffer. this should save a bunch
> of extra read() == -1/EWOULDBLOCK returns. i.e. if you asked for 4096
> and got 1400 then you don't need to read() again -- 'cause the next
> packet will queue up another signal.

True. A fine reason to read() one byte more than the MRU payload.

Hopefully there isn't a race condition: if you read 1400 bytes and a
packet arrives _during_ the read, a signal must be queued.

-- Jamie

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



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:20 EST