The official homepage of the snailit project


snailit is an init(8) replacement designed to use very little memory or resources yet still provide most of the services of larger inits. snailit was written for poly-p-ux by me, poly-p man.

snailit is not quite a standard init system - it provides many services (perhaps too many) in the code itself, calling scripts for a small portion of the system loading process. The part of snailit which is most deviant from standard init systems is the built-in reboot and shutdown implementations - including killing all processes - which are triggered only by signals.

Programmers may be interested in this code (the c portions especially - everything else is just little scripts) for a few reasons. First of all, this was what I did for the summer of '08... you get a chance to see how I think. On a technical level, this contains some decent low-level stuff that I learned from the o'reilly book Linux System Programming by Robert Love - a book well worth the ORA tax, assuming you're interested in this kind of stuff (or are working on a project for which it would be useful - like me :P ). The most interesting reasons for programmers to read this code, however, are the two calls of which I am most proud - and which took me the longest to write and debug.

mysystem and readfile

If I had access to just these two functions over the summer, I would have had a much easier time. Mysystem is a system() type function with many improvements. The first thing someone using the code will notice is that it takes many options - command, terminal (which terminal to output to, or current), newgroup (whether or not to make a new process group), and wait (whether or not to wait() for the process to complete) - instead of system()'s single option, command. The real reson I wrote my own system(), however, was not the fancy options. Since this is written for very old, slow, and low-memory systems, system's approach to pass command as argument 3 to "/bin/sh -c <command>" was not good - three processes per process is too many - my approach brings it down to two, where it should be.

readfile is slightly less useful, but still could provide a bit of convenience. this function takes the file to read as its only argument, and returns a char * (malloc()'d, so you must free() it) which is full of the contents of that file. This was a convenience function for myself, because I needed it in two different functions. The reading is done in such a way to prevent short reads, and it also reads a block at a time from the filesystem to provide performance.

conclusion

I am rather proud of this software... have fun with it under the gpl. Please email me for any tips you have about this software (email address available from the main page).

Current version is 0.02, adding a modules.autoload feature not present in the unreleased 0.01, and also spotting a few nasty hidden bugs. Should compile with a few warnings but no errors.

Download snailit: snailit-0.02.tar.gz

poly-p-ux main site | poly-p-ux projects main page