This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Only return EWOULDBLOCK if no data moved
- From: Roland Caßebohm <roland dot cassebohm at visionsystems dot de>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 27 Jan 2004 18:03:26 +0100
- Subject: [ECOS] Only return EWOULDBLOCK if no data moved
Hello,
both TCP/IP stacks could return EWOULDBLOCK even if there are data moved
in some cases.
My first solution was the attached patch, but maybe it is better to fix
the problem in the stacks it self?
I have seen there was a semilar problem in the serial driver:
2003-03-20 Gary Thomas <gary@mlbassoc.com>
* src/common/serial.c: Only return -EAGAIN if no data moved.
The attached patch would fix it for all possible places where something
like this could happen.
Any suggestions?
Roland
Index: io/fileio/current/src/io.cxx
===================================================================
RCS file: /home/cassebohm/net/USERS/CVSROOT/VSprojects/ecos/packages/io/fileio/current/src/io.cxx,v
retrieving revision 1.1.1.1.2.1
diff -u -5 -p -r1.1.1.1.2.1 io.cxx
--- io/fileio/current/src/io.cxx 12 Nov 2003 10:57:18 -0000 1.1.1.1.2.1
+++ io/fileio/current/src/io.cxx 27 Jan 2004 16:50:50 -0000
@@ -144,11 +144,16 @@ readwritev( int fd, const cyg_iovec *_io
cyg_fp_free( fp );
CYG_CANCELLATION_POINT;
if( ret != 0 )
- FILEIO_RETURN(ret);
+ {
+ if ((ret == EWOULDBLOCK || ret == EAGAIN) && cnt)
+ FILEIO_RETURN_VALUE(cnt);
+ else
+ FILEIO_RETURN(ret);
+ }
FILEIO_RETURN_VALUE(cnt);
}
//==========================================================================
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss