This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nonblocking read call (dev_fo_read)


Roland Caßebohm <roland.cassebohm@visionsystems.de> writes:

> Does anybody know if this is the right change to make this work?
> 

Yep, that looks like a bug. It also needs changing in
dev_fo_write(). I've applied the following patch to our repository:


Index: ChangeLog
===================================================================
RCS file: /home/cvs/ecc/ecc/io/fileio/current/ChangeLog,v
retrieving revision 1.45
diff -u -5 -r1.45 ChangeLog
--- ChangeLog	2002/03/07 16:19:27	1.45
+++ ChangeLog	2002/04/05 12:17:43
@@ -1,5 +1,10 @@
+2002-04-05  Nick Garnett  <nickg@redhat.com>
+
+	* src/devfs.cxx: Changed test for EAGAIN in dev_fo_read() and
+	dev_fo_write() to negate value first. 
+
 2002-03-07  Nick Garnett  <nickg@redhat.com>
 
 	* doc/fileio.sgml: Added this file to contain documentation on
 	this package.
 
Index: src/devfs.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/io/fileio/current/src/devfs.cxx,v
retrieving revision 1.7
diff -u -5 -r1.7 devfs.cxx
--- src/devfs.cxx	2002/01/23 15:35:13	1.7
+++ src/devfs.cxx	2002/04/05 12:17:43
@@ -341,11 +341,11 @@
         else
             err = cyg_io_read( (cyg_io_handle_t)t,
                                iov->iov_base,
                                &len);
 
-        if( EAGAIN == err ) // must be in non-blocking mode
+        if( -EAGAIN == err ) // must be in non-blocking mode
         {
             uio->uio_resid -= len;
             return ENOERR;
         }
         if( err < 0 ) break;
@@ -378,11 +378,11 @@
         else
             err = cyg_io_write( (cyg_io_handle_t)t,
                                 iov->iov_base,
                                 &len);
 
-        if( EAGAIN == err ) // must be in non-blocking mode
+        if( -EAGAIN == err ) // must be in non-blocking mode
         {
             uio->uio_resid -= len;
             return ENOERR;
         }
         if( err < 0 ) break;



-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]