tomOSii – The User-Space Programs

tomOSii includes a small, yet growing, set of user-space tools/executables. They are on the hand required for testing and developing new kernel features. On the other hand, these executables provide stripped-down reimplementations of the functionality of tools typically found on a POSIX system. The reimplementation is part of the learning path towards understanding the core concepts. Despite of that it is required, since tomOSii is not yet in a shape that porting available tools would seem reasonable.

Currently, the executables run in kernel mode, though they are loaded into and execute within a new, isolated user address space. This creates the illusion of a user-space environment, even though the underlying execution is still taking place within the kernel. This approach is a temporary measure. A formal user space and associated system features will be developed.

Currently, the following tools/executables are available:

  • /bin/echo – Just echo the arguments passed after the command’s name.

  • /bin/login – Just execute the shell – no login verification at all.

  • /bin/sh – A very minimal shell.

  • /sbin/getty – Open the first three file descriptors for stdin, stdout, stderr; prompt for a username; execute /bin/login

  • /sbin/init – Forked and executed by the kernel. Fork and execute /sbin/getty; rinse and repeat.

  • /sbin/reboot – Reboot the system.

  • /sbin/shutdown – Shut the system down.

  • /usr/bin/cat – Concatenate files to standard output.

  • /usr/bin/dmesg – Print (paged) the content of the kernel ring buffer.

  • /usr/sbin/fdisk – Partition a block device with MBR partitions.

  • /usr/sbin/mke2fs – Create an minimal ext4 filesystem in a partition. – Pretty much hardcoded.

Additionally some custom executables are provided, mainly for testing purposes:

  • /opt/bin/print_zeros – Print the specified number of zeros. In order to do so, read the data to be printed from /dev/zero.

  • /opt/bin/read_vda – Reads and prints (some) partition info from /dev/vda.

  • /opt/bin/to_lower – Read lines from stdin, convert them to lowercase, print to stdout.

  • /opt/bin/to_upper – Read lines from stdin, convert them to uppercase, print to stdout.

  • /opt/gip1/hello – Print Hello world! to stdout.

Executables are added/updated whenever they are required for implementing/testing/demonstrating new kernel functionality. Their file system paths are still somewhat arbitrary. We will spend more thought on that in the future.