Re: Blocking read() from a USB->Serial adapter.



Grant Edwards <grante@xxxxxxxx> wrote:
On 2006-11-25, Floyd L. Davidson <floyd@xxxxxxxxxx> wrote:
Grant Edwards <grante@xxxxxxxx> wrote:
On 2006-11-25, Charles Sullivan <cwsulliv@xxxxxxxxxxxx> wrote:

If that's the case, then that answers my questions. I thought
blocking meant blocking until the specified number of
characters is read, or until the read is interrupted.

Or until the driver decides to return for whatever reason it
chooses. On success, you're guaranteed a minimum of one byte.

Maybe. (Maybe not too!)

There's the case where the file is at EOF. Is there another
case where read() will return success with 0 bytes?

Any time there is no data available. With a file that will
indeed set the EOF flag, but with a serial port (or a pipe, or a
console) there is no such concept.

If the timer is enabled, and times out, read() will return 0.
Another possibility is if the number of bytes request was 0,
read() will return 0.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: Blocking read() from a USB->Serial adapter.
    ... blocking meant blocking until the specified number of ... characters is read, or until the read is interrupted. ... Or until the driver decides to return for whatever reason it ... On success, you're guaranteed a minimum of one byte. ...
    (comp.os.linux.development.apps)
  • Re: Blocking read() from a USB->Serial adapter.
    ... blocking meant blocking until the specified number of ... Or until the driver decides to return for whatever reason it ... On success, you're guaranteed a minimum of one byte. ...
    (comp.os.linux.development.apps)
  • Re: Why Formula One?
    ... a driver was penalized for blocking during a race, ... in the hands of the stewards IMO. ... It also means that (with a single change in direction) the driver must ...
    (rec.autos.sport.f1)
  • Re: Good job Stewart/Busch
    ... that mirror driving is more important ... EVERY driver you hear speak about the subject all say ... You spend more time looking in your mirror, and blocking in the closing ... It's stupid, and blocking should not be allowed. ...
    (rec.autos.sport.nascar)
  • Re: [PATCH -mmotm] fbmem: fix fb_info->lock and mm->mmap_sem circular locking dependency
    ... Circular locking dependecies occur calling the blocking ... Fix a circular locking dependency in the frame buffer console driver ...
    (Linux-Kernel)