Thursday, December 20, 2007

SharpOS Kernel + UNIX

For those of you who don't know me, my name is William Lahti. I am one of the original developers of the SharpOS project, and have contributed various odd parts of the kernel, mostly amounting to organization. At some inspired point I also wrote the foundations of a modern, network-transparent C# window system dubbed SharpWS.

Due to my inexperience with kernels and rather shoddy performance at programming one, I decided that I could help the project without doing too much design work on my own if I were to create a UNIX foundation (libraries and commands/utilities) that could be used natively on SharpOS (written in C#).

So, I started with the shell. I started the Nash shell, which by now has actually gotten quite workable, except for a few bugs in mono that are making things difficult. Currently, Nash supports variables (dynamically and statically typed for future interoperability with scripts), aliases, complete line editing and autocomplete, a set of builtin commands, support for interweaving script calls with Nash commands, the foundations of pipeline support, correct handling of most common special variables/environment variables, and more. It strives to be at least POSIX-compatible, if not BASH-compatible. Oh, and it runs programs alright too. It's still got it's issues, though. Currently, Console.Cursor[Top/Left] are not updated accordingly by Mono if other programs write to the terminal, but a workaround is in progress.

Now, what's the fun of having a managed UNIX shell if we don't have managed UNIX utilities? Sure, I could use Nash with my local GNU utilities, but that won't be the case when SharpOS is ready to run this bad boy. So, I started implementing UNIX utilities. So far I have started two packages of UNIX utilities. 'coreutils', like GNU coreutils, contains the most essential tools... I've implemented cat, cp, cut, date, dirname, hostname, kill, killall, ldd, less, ls, mkdir, pwd, rm, sleep, touch, tr, uname, and which.

The second is netutils, which so far only has one program, 'ping'. Unfortunately, Mono decided not to implement the System.Net.NetworkInformation.Ping class, because it would require super user powers. I disagree, but for now I can't test ping :-\.

I've started three libraries: SharpOS.Unix, SharpOS.Unix.Tar, and SharpOS.Unix.Curses. SharpOS.Unix implements common code for handling UNIX permissions, command-line options rules, timestamps, etc. SharpOS.Unix.Tar is a managed interface for reading and writing tar files. Yes, I am aware that SharpZipLib supports Tar, but I only discovered this fact after I finished the first commit of SharpOS.Unix.Tar, and SharpZipLib is not as powerful or accessible as this API is. Finally, SharpOS.Unix.Curses will be a managed terminal interaction API inspired by ncurses, and using terminfo terminal descriptions from Linux. Right now, only the terminfo code is completed, and the terminal code is not yet committed.

That just leaves ntar, which is a (quite-functional and compatible) implementation of tar, using the SharpOS.Unix.Tar library.

I've tentatively been referring to the whole set of tools as 'nunix' and/or SharpOS.Unix (the namespace of libraries and program classes).

Okay, this blog post got really long but I talked about all the new stuff I'm doing, so there! I'll try not to make my next ones so long :)

1 comment:

Unknown said...

does it have any capabilities to catch up any resources from the computer??