This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: [patch] redboot networking
- From: Wolfgang Köbler <wk-list at koebler dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 14 Mar 2006 14:19:57 +0100 (CET)
- Subject: Re: [ECOS] [patch] redboot networking
Huh ? What killed the rest of my mail ? So second try:
Hi,
In ecos/packages/redboot/current/src/net/tcp.c there are the two functions
__tcp_write and __tcp_write_block . Both have the same interface and do the
same thing, but the second is the blocking version of the first. Both
return an integer. __tcp_write returns the number of bytes that are (going to
be) send. So __tcp_write_block could return the number of bytes that have been
sent. But it always returns 0 (or -1 as error code). In __tcp_write_block,
there is a variable called "total" that is initialized to zero and returned
(in case of no error). But this variable is never increased.
I think it is not meant to be this way. I think this variable (and hence the
return value) should contain the total number of bytes sent during this
function call. Changing this can be done with the patch below.
The patch below is a very small change. It probably increases the memory
footprint by a few single bytes. In current (2006-03-09) ecos CVS
references to __tcp_write_block can be found in:
/ecos/packages/redboot/current/include/net/net.h
/ecos/packages/redboot/current/src/net/http_client.c
/ecos/packages/redboot/current/src/net/net_io.c
/ecos/packages/redboot/current/src/net/tcp.c
(via "find -exec grep -il __tcp_write_block {} \;")
net.h
should not be affected by this patch as it only includes the declaration
http_client.c
should not be affected by this patch as it does not check the return
value.
net_io.c
should not be affected by this patch. It includes code that uses
__tcp_write_block as if the patch was already applied. But this has no
effect (the assigned vars are overwritten or never used afterwards).
tcp.c
is the file changed by the patch. It includes no additional references to
__tcp_write_block, only the function definition.
Bye,
Wolfgang
--- ecos-orig-2006-03-09/ecos/packages/redboot/current/src/net/tcp.c
2004-09-24 14:51:22.000000000 +0200
+++ ecos/packages/redboot/current/src/net/tcp.c 2005-12-15 01:46:53.000000000
+0100
@@ -868,6 +868,7 @@
if (n > 0) {
len -= n;
buf += n;
+ total += n;
}
__tcp_poll();
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss