Unlocking the Interpreter

After successfully running a few programs with my interpreter, I started up the window manager to get the satisfaction of running something in the wm/sh graphical shell. This blocked itself and stopped the entire environment from running. I closed the emulator and investigated what went wrong.

The answer, of course, is that I forgot to put release() and acquire() function calls around my calls to kernel functions. With that corrected, the test program could be run again:


Running a simple program in the interpreter.

With that working, it seemed like time to look at extending the interfaces to the underlying system.

A digression about cat

One of the strange things you might encounter when using Inferno is the way that the cat utility handles directories. On Linux, running cat on a directory results in something like this:

$ cat n
cat: n: Is a directory
$

In the Inferno environment, this is the sort of thing you see:

; cat /prog/1
=�U������u��e5by�����m���c��eu��e����������disk��david��david��=�U������u��e7by�
����m���c��eu��e����������dump��david��david��?�U������>��e�`y�����m���c��e>��e�
���������client��david��david��>�U������u��e;by�����m���c��eu��e����������local�
�david��david��;�U������u��e4by�����m���c��eu��e����������cd��david��david��A�U�
�����u��e=by�����m���c��eu��e����������registry��david��david��<�U������u��e:by�
����m���c��eu��e����������kfs��david��david��<�U������u��e8by�����m���c��eu��e��
��������ftp��david��david��=�U������u��e6by�����m���c��eu��e����������dist��davi
d��david��?�U������u��e>by�����m���c��eu��e����������remote��david��david��=�U��
����u��e<by�����m���c��eu��e����������rdbg��david��david��?�U������u��e9by�����m
���c��eu��e����������gridfs��david��david��;

You can see that there's a directory listing of sorts in the mixture of text and binary data, and that's because cat is reading and returning a sequence of Rstat messages from the underlying file system.

This seemingly unhelpful behaviour turns out to be useful when implementing some of the library features that the Limbo Sys module contains. To get information about the contents of a directory, we can just read the directory and decode the entries, like this:

; cat /prog/1 | winter /tmp/out.w
name=ctl length (low)=0 length (high)=0 mode=00000080 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=dbgctl length (low)=0 length (high)=0 mode=000001A4 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=heap length (low)=0 length (high)=0 mode=000001A4 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=ns length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=nsgrp length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=pgrp length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=stack length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=status length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=text length (low)=0 length (high)=0 mode=00000000 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=wait length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=fd length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david
name=exception length (low)=0 length (high)=0 mode=00000124 mtime=1707005916 atime=1707083434 uid=david gid=david muid=david

So we can start to build up some of the support that programs need if they are going to access file systems.


David Boddie
4 February 2024