public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Select problem found (I think) with GoAhead
@ 2000-11-30  9:33 Colin Ford
  0 siblings, 0 replies; only message in thread
From: Colin Ford @ 2000-11-30  9:33 UTC (permalink / raw)
  To: Ecos Mailing List

Hello All,

I've been having trouble with eCos and the GoAhead web
server with blocks of memory becoming invalidated.

I found that in the GoAhead web server code there is a function
called socketSelect which has the calculation of

nwords = (socketHighestFd + NFDBITS) / NFDBITS;

This seems to calculate nwords to be 1 and then it has
the calculation:

len = nwords * sizeof(int);

which happends to be 4 it seems in my case. Then the
fd_masks are malloced using the len ie:

readFds = balloc(B_L, len);

so we have 4 bytes for readFds. Now latter on a select call
happends like:

   nEvents = select(socketHighestFd + 1, (fd_set *) readFds,
      (fd_set *) writeFds, (fd_set *) exceptFds, &tv);

the select call maps down to the call:

cyg_select(int nfd, fd_set *in, fd_set *out, fd_set *ex,
                    struct timeval *tv, cyg_bool_t abortable)

which defines:

fd_set in_res, out_res, ex_res;  // Result sets

unfortunatly later on if it finds something it does:

 memcpy(in, &in_res, sizeof(in_res));

the size of in_res being 32. which blats over the memory in
the readFds.

This is using the latest eCos cvs with the latest tcp stack from cvs and

the latest 2.1 GoAhead server.

To get GoAhead to compiler with eCos I had to add:

#define     NFDBITS        __NFDBITS

So which bit should I change the calculation? The fd_mask to
an fd_set? The NFDBITS definition or is there something that
I'm missing here? Why does the socketSelect function not
use FD_SET, FD_ISSET etc?

Many thanks,
Col.

--
===========================================
Colin Ford               PipingHot Networks
Software Engineer        +44 (0)1364 655510



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-11-30  9:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-30  9:33 [ECOS] Select problem found (I think) with GoAhead Colin Ford

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).