[ale] Circular Buffers

Christopher Fowler cfowler at outpostsentinel.com
Fri Nov 2 18:16:57 EST 2001


Maybe some people on the list have some good insight to a design issue that
I'm working out.


Problem:

Embedded devices have very little storage space.  Log files tend to grow in
size
over time and potential can fill memory until unit crashes.

I have a daemon that creates a log file in /var/log.  It *reads* and
*writes* to this file.  For
every instance of that daemon there is another log file.  I have a potential
to run over 50 instances of the daemon at any given time.  The unit I'm
experimenting with has 128meg of SDRAM and 8mb is a devoted ramfs mounted as
/var/log.  I can not control the reboots of the machine so it the log files
fill up the 8mb storage then I will have a problem.  I do not want to have
to modify the program.


Proposed Solution:

Write a daemon that manages a shared memory segment for each instance of the
above mentioned server
program.  Since pipes do not go both ways, created a read pipe and a write
pipe in /var/log for each instance of the server.  Modify it so it at least
knows to read and write from 2 different files.
The management daemon will create a shared memory segment at roughly 128k
for each instance of the server.  It will read stuff from
/var/log/file.$$.read and write stuff to /var/log/file.$$.write and
the server will get the logs from those locations.

This may be a dirty way to provide a solution.  There are many Linux
embedded development kits on the market but don't they all treat it as a
downsized version of "RedHat"?  The main development in any
embedded system is in configurations and logging.  I'm using syslogd from
BusyBox http://oss.lineo.com
It supports a circular buffer and has no log files in the fs.  I have a 3rd
party program that needs to come over but I can not let it fill up the FS
with log files.  I was hoping someone here has ran into this problem and has
a solution that will work with many programs.

Thanks,
Chris


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list