Comment by schemescape

2 years ago

What’s the minimum kernel version required? (No need for an exact answer, I just want to know if it’s “in the last 3 years” vs “in the last 10 years” etc.)

And is it possible to resolve network names or do anything network related? (Or is it planned?)

I’m always looking for some way to create portable Linux binaries, and I happen to like Lisps. Right now, my best bets are Janet compiled against musl libc or maybe ECL… or just use Python (distributed as source)…

Edit to add: I love the idea. Great work!

> What’s the minimum kernel version required?

In order to build lone, any version after the Linux UAPI headers split should do.

https://lwn.net/Articles/507794/

https://stackoverflow.com/q/18858190/512904

https://github.com/torvalds/linux/tree/master/include/uapi

These are the only headers that lone currently requires. When lone is built, a script will read all the system calls defined in those headers and create a table mapping symbols to system call numbers. This is so that you can write symbolic code such as:

  (system-call 'write fd buffer length)

Instead of:

  (system-call 1 fd buffer length); write is system call 1 on x86_64

Once compiled, however, it should work with literally any version of Linux. The system call primitive can issue any system call given its number and its parameters. If an unsupported system call is made, Linux will simply return -ENOSYS which can be handled at runtime and should not crash the program.

> I’m always looking for some way to create portable Linux binaries, and I happen to like Lisps.

I have this vision in my mind: embedding lone modules into sections of the lone ELF and shipping it out. Zero dependencies, self-contained.

Linux passes processes a pointer to their own ELF header via the auxiliary vector. Lone already grabs this data and puts it into a nice lisp object. Now I just need to code that feature in somehow: parse the header, find the sections, read them into a lone module and evaluate...

SBCL lets you drop core images which if you setup your system properly can be made executable by usesing sbcl as the interpreter, like /bin/sh and shell scripts.