public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Possible problem in timeout.c
@ 2003-04-03 13:32 Niels Beier (NB)
  2003-04-08  0:47 ` Jonathan Larmour
  0 siblings, 1 reply; 2+ messages in thread
From: Niels Beier (NB) @ 2003-04-03 13:32 UTC (permalink / raw)
  To: 'ecos-discuss@sources.redhat.com'

I think I have found a bug in /net/bsd_tcpip/current/src/ecos/timeout.c -
Trunk 2.0 version - last CVS update 25 marts-2003
(I have discovered the problem as tcp_slowtimo in bsd_tcpip is never called)

It seems only to be possible to create a single callout.

In the timeout() function the following code may have a problem:

    stamp = 0;  // Assume no slots available
    for (e = _timeouts;  e;  e = e->next) {
        if ((e->flags & CALLOUT_PENDING) == 0) {
            // Free entry
            callout_init(e);
            e->flags = CALLOUT_LOCAL;
            callout_reset(e, delta, fun, arg);
            stamp = (cyg_uint32)e;
            break;
        }
    }
When the first callot is inserted, the callout_reset() functions sets
the "next" field in the first element of the _timeouts array to zero (as 
timeous is initially equal to zero) and
the second call to timeout() will fail.


The "for loop" should be changed to something like this:
    for (i = 0; i < NTIMEOUTS; i++) {
        e = &_timeouts[i];
        if ((e->flags & CALLOUT_PENDING) == 0) {
            // Free entry
            callout_init(e);
            e->flags = CALLOUT_LOCAL;
            callout_reset(e, delta, fun, arg);
            stamp = (cyg_uint32)e;
            break;
        }
    }    

Is there something, that I have misses?

Best regards
Niels Beier
Thrane&Thrane A/S

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] Possible problem in timeout.c
  2003-04-03 13:32 [ECOS] Possible problem in timeout.c Niels Beier (NB)
@ 2003-04-08  0:47 ` Jonathan Larmour
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Larmour @ 2003-04-08  0:47 UTC (permalink / raw)
  To: Niels Beier (NB); +Cc: 'ecos-discuss@sources.redhat.com'

Niels Beier (NB) wrote:
> I think I have found a bug in /net/bsd_tcpip/current/src/ecos/timeout.c -
> Trunk 2.0 version - last CVS update 25 marts-2003
> (I have discovered the problem as tcp_slowtimo in bsd_tcpip is never called)
> 
> It seems only to be possible to create a single callout.
[snip]

Since it looks like this needs a closer looker than be given quickly on 
the mailing lists, can you submit to bugzilla as per 
http://sources.redhat.com/ecos/problemreport.html hopefully with a 
testcase that would expose the problem?

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-08  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-03 13:32 [ECOS] Possible problem in timeout.c Niels Beier (NB)
2003-04-08  0:47 ` Jonathan Larmour

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