Schemix is a Scheme system, implemented as a patch to the Linux kernel. It aims to attain R5RS compliance while remaining small, fast and easy to understand. The intended use of Schemix is for exploration of the Linux kernel and for rapid, interactive prototyping of Linux drivers and other new kernel features. To achieve this, Schemix will attempt to make a large subset of the kernel functionality available to Scheme programs. Interactivity is via a character device: /dev/schemix which presents a REPL (Read, Eval, Print Loop) to anyone having access to the device.

$ cat /dev/schemix

$ echo "(display (+ 1 2 3))" > /dev/schemix
$ cat /dev/schemix
6
$ cat > /dev/schemix
(define foo (kernel-lambda (char*) printk))
(foo "Blah, blah, blah")

$ dmesg | tail -n 1
Blah, blah, blah
$ echo "(make-device foo ((a 1) (b 2)))" > /dev/schemix
$ ls -l /dev/foo
crw------- 1 root root 10, 1 Mar 31 14:09 /dev/foo
$ echo "(display a)" > /dev/foo
$ cat /dev/foo
1
$ echo "(display a)" > /dev/schemix
$ cat /dev/schemix
Error: eval: unbound variable: a
$ echo "(exit)" > /dev/foo
$ ls -l /dev/foo
ls: /dev/foo: No such file or directory
$ echo "(assert-type '(int) kernel::nr_threads)" > /dev/schemix
$ echo "(assert-type '(int) kernel::max_threads)" > /dev/schemix
$ echo "(display kernel::nr_threads)" > /dev/schemix
$ cat /dev/schemix
42
$ echo "(set! kernel::max_threads 42)" > /dev/schemix # Don't let any more processes start

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee


Reference:

  1. Schemix