* [ECOS] NONBLOCK mode in serial.c
@ 2001-05-15 0:29 Boris V. Guzhov
0 siblings, 0 replies; only message in thread
From: Boris V. Guzhov @ 2001-05-15 0:29 UTC (permalink / raw)
To: ecos-discuss
There are some remarks to io/serial/current/src/common/serial.c file.
I think that in it the NONBLOCK mode is incorrectly implemented
(not like POSIX).
1) I the serial_write() function there is a code:
#ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
// Optionally return if configured for non-blocking
mode.
if (!cbuf->blocking) {
*len -= size; // number of characters actually
sent
cbuf->waiting = false;
res = -EAGAIN;
break;
}
#endif // CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
Probably it should assign res=-EAGAIN only if *len = 0, otherwise
it should assign res=ENOERR:
#ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
// Optionally return if configured for non-blocking
mode.
if (!cbuf->blocking) {
*len -= size; // number of characters actually
sent
cbuf->waiting = false;
res = *len ? ENOERR : -EAGAIN;
break;
}
#endif // CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
2) In the serial_read() function there is:
} else {
#ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
if (!cbuf->blocking) {
*len = size; // characters actually read
res = -EAGAIN;
break;
}
#endif // CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
Similarly: if size>0 it should assign res=ENOERR:
} else {
if (size) {
*len = size; // characters actually read
res = ENOERR;
break;
}
#ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
if (!cbuf->blocking) {
*len = 0;
res = -EAGAIN;
break;
}
#endif // CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
--
Boris Guzhov,
St.Petersburg, Russia
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-15 0:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15 0:29 [ECOS] NONBLOCK mode in serial.c Boris V. Guzhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).