Re: Blocking read() from a USB->Serial adapter.
- From: Grant Edwards <grante@xxxxxxxx>
- Date: Mon, 27 Nov 2006 21:25:50 -0000
On 2006-11-27, jasen <jasen@xxxxxxxxxxx> wrote:
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?
AIUI EOF is not success.
Yes it is. EOF returns 0. Any value other than -1 is defined
as "success". Most people assume any negative value indicates
an error.
Fromm the read(2) man page:
RETURN VALUE
On success, the number of bytes read is returned (zero
indicates end of file). [...] On error, -1 is returned,
and errno is set appropriately.
a break symbol (or framing error etc...) on the seriai line
will also cause read to return.
Intesting -- I didn't know that either.
--
Grant Edwards grante Yow! Quick, sing me the
at BUDAPEST NATIONAL ANTHEM!!
visi.com
.
- References:
- Blocking read() from a USB->Serial adapter.
- From: Charles Sullivan
- Re: Blocking read() from a USB->Serial adapter.
- From: Floyd L. Davidson
- Re: Blocking read() from a USB->Serial adapter.
- From: Charles Sullivan
- Re: Blocking read() from a USB->Serial adapter.
- From: Grant Edwards
- Re: Blocking read() from a USB->Serial adapter.
- From: Floyd L. Davidson
- Re: Blocking read() from a USB->Serial adapter.
- From: Grant Edwards
- Re: Blocking read() from a USB->Serial adapter.
- From: jasen
- Blocking read() from a USB->Serial adapter.
- Prev by Date: Pthread ThreadPool
- Next by Date: Re: OT : emacs and ecb
- Previous by thread: Re: Blocking read() from a USB->Serial adapter.
- Next by thread: Re: Blocking read() from a USB->Serial adapter.
- Index(es):
Relevant Pages
|