[ECOS] More than 40 files open - eCos doesn't run properly?

Gary Thomas gary@mlbassoc.com
Tue Dec 16 14:49:00 GMT 2003

On Mon, 2003-12-15 at 13:11, Ernie Biancarelli wrote:
> Gary Thomas wrote:
> > On Mon, 2003-12-15 at 12:52, Ernie Biancarelli wrote:
> >   
> > > I am using the A&M Rattler power pc 8250 based target. I'm working with 
> > > the eCos source from ~September.
> > > 
> > > I have a configuration question regarding the POSIX File IO 
> > > Compatibility Layer package. I want to configure and run eCos with 110 
> > > file descriptors and 100 open files. Configuring the source and creating 
> > > an eCos library is no problem.  I am able to build the two threads 
> > > example as well, however, when I start the program via GDB, GDB hangs 
> > > and I don't see any output from the target.
> > > 
> > > I have determined through trial and error that 40 is the magic number of 
> > > open files that I can configure eCos with and still run the two threads 
> > > example. Any more than that, and the GDB/target hangs.
> > > 
> > > Can someone else with a Rattler verify this for me? Can anyone offer 
> > > help in getting past the 40 open file limit I see?
> > >     
> > 
> > How did you configure the system (template, what changes, etc)?  You can
> > provide this information best by using 
> >   % ecosconfig export my.cfg
> > This will generate an .ecm fragment, which can then be used by others 
> > (like me) to recreate your setup.
> > 
> > Also, what are you trying to open the file handles to?
> > 
> >   
> I've attached my config as you requested.
> I want to create file descriptors for ~30 HDLC channels and have some
> growing space for future expansion.  In addition to those FDs, we also
> will want to open several sockets...

What you have run into are two problems, with one masking the other.

Firstly, the problem with more than 40 open files is that the network
stack defaults to supporting as many sockets as files.  Sockets
are allocated from static buffers used by only the network stack.  This
memory pool is not adequate for so many sockets, so you ran out of 
memory during system initialization.  In fact, it _tried_ to print
this message (on the system console):
  PANIC: zinit: Out of memory

That brings up the second problem - there was a bug in the diagnostic
I/O support (only on this platform - MPC8xxx variants).  The problem was
that if you are using the interrupt driven serial I/O driver, then the
'diag_printf()' functions were not reliable.  I have just checked in
a change to fix this.  In order to use it, you'll have to rebuild and
update your RedBoot.

As for the first issue (out of memory), adjust the value of

Both of these are now fixed in the public CVS

Gary Thomas <gary@mlbassoc.com>
MLB Associates

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

More information about the Ecos-discuss mailing list